Class ZeroconfJoramServer
- java.lang.Object
-
- org.objectweb.joram.client.jms.admin.server.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.
-
-
Field Summary
Fields Modifier and Type Field Description static StringA3_SERVERS_XMLstatic StringADMIN_HOST_NAMEstatic StringADMIN_PORTstatic StringBASE_DIR_PATHprivate static FilebaseDirprivate static StringbaseDirPathprivate static StringhostNamestatic StringJORAM_SERVER_DATAstatic StringROOT_USER_NAMEstatic StringROOT_USER_PWDstatic StringSERVER_IDprivate static StringserverName
-
Constructor Summary
Constructors Constructor Description ZeroconfJoramServer()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static voidadminConnect()static voiddestroy()Destroy the created server.private static voidinit()private static intloadServerId()Try to get a previously created configuration.static voidmain(String[] args)Starts a Joram server without any configuration.private static intnewServerId()Allocate a new identifier for the created server.private static voidsaveServerId(int sid)Save the unique identifier of the created server for future use.private static voidstartServer(int serverId)static voidstop()Stop the created server.
-
-
-
Field Detail
-
BASE_DIR_PATH
public static final String BASE_DIR_PATH
- See Also:
- Constant Field Values
-
ADMIN_HOST_NAME
public static final String ADMIN_HOST_NAME
- See Also:
- Constant Field Values
-
ADMIN_PORT
public static final String ADMIN_PORT
- See Also:
- Constant Field Values
-
ROOT_USER_NAME
public static final String ROOT_USER_NAME
- See Also:
- Constant Field Values
-
ROOT_USER_PWD
public static final String ROOT_USER_PWD
- See Also:
- Constant Field Values
-
SERVER_ID
public static final String SERVER_ID
- See Also:
- Constant Field Values
-
JORAM_SERVER_DATA
public static final String JORAM_SERVER_DATA
- See Also:
- Constant Field Values
-
A3_SERVERS_XML
public static final String A3_SERVERS_XML
- See Also:
- Constant Field Values
-
baseDirPath
private static String baseDirPath
-
baseDir
private static File baseDir
-
hostName
private static String hostName
-
serverName
private static String serverName
-
-
Method Detail
-
main
public static void main(String[] args) throws Exception
Starts a Joram server without any configuration.- Throws:
Exception
-
newServerId
private static int newServerId() throws ExceptionAllocate a new identifier for the created server.- Returns:
- The new identifier.
- Throws:
Exception
-
saveServerId
private static void saveServerId(int sid) throws IOExceptionSave 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 IOExceptionTry 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.
-
-