Class ZeroconfJoramServer


  • public class ZeroconfJoramServer
    extends Object
    This class starts a Joram server without almost any configuration. It just needs to know an existing Joram server (host, port) and the root login. The existing server is usually "s0" from the base configuration. These data are specified by 4 environment properties: ADMIN_HOST_NAME, ADMIN_PORT, ROOT_USER_NAME and ROOT_USER_PWD.

    This server uses the current directory to store some data. You can specify another directory with the property BASE_DIR_PATH.

    This new server is added into the first domain found in the Joram platform. If no domain exists, a first domain D0 is created. Notice that this bootstrap mechanism has been designed for a single domain platform. If you need to build more complex configuration with several domains you must use the raw Joram administration API.
    • Constructor Detail

      • ZeroconfJoramServer

        public ZeroconfJoramServer()
    • Method Detail

      • main

        public static void main​(String[] args)
                         throws Exception
        Starts a Joram server without any configuration.
        Throws:
        Exception
      • startServer

        private static void startServer​(int serverId)
                                 throws Exception
        Throws:
        Exception
      • newServerId

        private static int newServerId()
                                throws Exception
        Allocate a new identifier for the created server.
        Returns:
        The new identifier.
        Throws:
        Exception
      • saveServerId

        private static void saveServerId​(int sid)
                                  throws IOException
        Save the unique identifier of the created server for future use.
        Parameters:
        sid - The unique identifier of the created server.
        Throws:
        IOException - An error occurs during writing.
      • loadServerId

        private static int loadServerId()
                                 throws IOException
        Try to get a previously created configuration.
        Returns:
        The unique identifier of the server
        Throws:
        IOException - An error occurs during reading.
      • stop

        public static void stop()
        Stop the created server.
      • destroy

        public static void destroy()
                            throws Exception
        Destroy the created server. Remove it from the global configuration then clean the datas.
        Throws:
        Exception