Class AdminModule
- java.lang.Object
-
- org.objectweb.joram.client.jms.admin.AdminModule
-
public final class AdminModule extends Object
TheAdminModuleclass allows to set an administrator connection to a given JORAM server, and provides administration and monitoring methods at a server/platform level.The
AdminModuleclass uses a unique static connection to the Joram server, the connection is opened through connect method and closed by calling disconnect.- See Also:
AdminWrapper
-
-
Field Summary
Fields Modifier and Type Field Description static StringADM_NAME_PROPERTYprivate static ConnectioncnxThe connection used to link the administrator and the platform.static StringDEFAULT_ADM_NAMEprotected static StringlocalHostThe host name or IP address of the server the module is connected to.protected static intlocalPortThe port number of the client connection.private static ObjectlockLock object used to avoid multiple connections in case of concurrent connect.static org.objectweb.util.monolog.api.Loggerlogger(package private) static AdminWrapperwrapperThe administration wrapper needed to interact with the Joram server.
-
Constructor Summary
Constructors Constructor Description AdminModule()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static voidabortRequest()static StringaddAMQPBridgeConnection(int serverId, String urls)Adds an AMQP server and starts a live connection with it, accessible via the url provided.static voidaddDomain(String domain, int sid, int port)Adds a domain to the platform.static voidaddDomain(String domain, String network, int sid, int port)Adds a domain to the platform using a specific network component.static StringaddJMSBridgeConnection(int serverId, String urls)Adds a JMS server and starts a live connection with it, accessible via the url provided.static voidaddServer(int sid, String host, String domain, int port, String server)Adds a server to the platform.static voidaddServer(int sid, String host, String domain, int port, String server, String[] services, String[] args)Adds a server to the platform.static voidcollocatedConnect()Opens a connection with the collocated Joram server.static voidcollocatedConnect(String name, String password)Opens a connection with the collocated JORAM server.static voidcollocatedConnect(String name, String password, String identityClass)Deprecated.Next to Joram 5.2 use connect methods with ConnectionFactory.static voidconnect()Opens a TCP connection with the Joram server running on the default "localhost" host and listening to the default 16010 port.static voidconnect(String host, int port, String name, String password)Opens a TCP connection with the Joram server running on a given host and listening to a given port.static voidconnect(String host, int port, String name, String password, int cnxTimer)Deprecated.Next to Joram 5.2 use connect methods with ConnectionFactory.static voidconnect(String host, int port, String name, String password, int cnxTimer, String reliableClass)Deprecated.Next to Joram 5.2 use connect methods with ConnectionFactory.static voidconnect(String host, int port, String name, String password, int cnxTimer, String reliableClass, String identityClass)Deprecated.Next to Joram 5.2 use connect methods with ConnectionFactory.static voidconnect(String name, String password)Opens a TCP connection with the Joram server running on the default "localhost" host and listening to the default 16010 port.static voidconnect(String name, String password, int cnxTimer)Deprecated.Next to Joram 5.2 use connect methods with ConnectionFactory.static voidconnect(String name, String password, int cnxTimer, String reliableClass)Deprecated.Next to Joram 5.2 use connect methods with ConnectionFactory.static voidconnect(ConnectionFactory cf)Opens a connection dedicated to administering with the Joram server which parameters are wrapped by a givenConnectionFactory.static voidconnect(ConnectionFactory cf, String name, String password)Opens a connection dedicated to administering with the Joram server which parameters are wrapped by a givenConnectionFactory.static voidconnect(ConnectionFactory cf, String name, String password, String identityClass)Opens a connection dedicated to administering with the Joram server which parameters are wrapped by a givenConnectionFactory.static voidconnect(TopicConnectionFactory cf, String name, String password)Deprecated.No longer use TopicConnectionFactory next to Joram 5.2.static voidconnect(TopicConnectionFactory cf, String name, String password, String identityClass)Deprecated.No longer use TopicConnectionFactory next to Joram 5.2.static DestinationcreateQueue(int serverId, String name, String className, Properties prop)Creates or retrieves a queue destination on a given JORAM server.static DestinationcreateTopic(int serverId, String name, String className, Properties prop)Creates or retrieves a topic destination on a given JORAM server.static UsercreateUser(String name, String password, int serverId, String identityClassName)Admin method creating a user for a given server and instantiating the correspondingUserobject.static StringdeleteAMQPBridgeConnection(int serverId, String names)Removes the live connection to the specified AMQP server.static StringdeleteJMSBridgeConnection(int serverId, String names)Removes the live connection to the specified AMQP server.static StringdeleteJMSBridgeConnection(int serverId, String names, boolean async)Removes the live connection to the specified AMQP server.static StringdeleteJMSPBridgeConnection(int serverId, String names)Deprecated.static StringdeleteJMSPBridgeConnection(int serverId, String names, boolean async)Deprecated.static voiddisconnect()Closes the administration connection.static voiddoCollocatedConnect(String name, String password, String identityClass)Opens a connection with the collocated JORAM server.private static voiddoConnect(String host, int port, String name, String password, int cnxTimer, String reliableClass, String identityClass)Opens a TCP connection with the Joram server running on a given host and listening to a given port.private static voiddoConnect(AbstractConnectionFactory cf, String name, String password, String identityClass)Opens a connection dedicated to administering with the Joram server which parameters are wrapped by a givenConnectionFactory.static org.objectweb.joram.shared.admin.AdminReplydoRequest(org.objectweb.joram.shared.admin.AdminRequest request)Deprecated.static voidexecuteAdmin(Reader reader)static voidexecuteXMLAdmin(String path)This method execute the XML script file that the pathname is given in parameter.static voidexecuteXMLAdmin(String cfgDir, String cfgFileName)This method execute the XML script file that the location is given in parameter.static voidexportRepositoryToFile(String exportDir, String exportFilename)Export the repository content to an XML file - only the destinations objects are retrieved in this version - xml script format of the admin objects (joramAdmin.xml)static StringgetConfiguration()Returns the current servers configuration (a3servers.xml).static QueuegetDefaultDMQ()Returns the default dead message queue for the local server, null if not set.static QueuegetDefaultDMQ(int serverId)Returns the default dead message queue for a given server, null if not set.static StringgetDefaultDMQId()Returns the default dead message queue for the local server, null if not set.static StringgetDefaultDMQId(int serverId)Returns the default dead message queue for a given server, null if not set.static intgetDefaultThreshold()Returns the default threshold value for the local server, -1 if not set.static intgetDefaultThreshold(int serverId)Returns the default threshold value for a given server, -1 if not set.static Destination[]getDestinations()Returns the list of all destinations that exist on the local server, or null if none exist.static Destination[]getDestinations(int serverId)Returns the list of all destinations that exist on a given server, or null if none exist.static ListgetDestinationsList()Deprecated.No longer supported next to Joram 5.2static ListgetDestinationsList(int serverId)Deprecated.No longer supported next to Joram 5.2static String[]getDomainNames(int serverId)Returns the list of the domain names that contains the specified server.static HashtablegetJMXAttribute(int serverId, String attname)Returns JMX attribute value for the specified server.static HashtablegetJMXAttribute(String attname)Returns JMX attribute value for the local server.static StringgetLocalHost()Returns the host name of the server the module is connected to.static intgetLocalPort()Returns the port number of the server the module is connected to.static ServergetLocalServer()static intgetLocalServerId()Returns the identifier of the server the module is connected to.static Server[]getServers()static Server[]getServers(String domain)Returns the list of the servers' that belong to the specified domainstatic ListgetServersIds()Deprecated.No longer supported next to Joram 5.2static ListgetServersIds(String domain)Deprecated.No longer supported next to Joram 5.2static HashtablegetStatistics()Returns statistics for the local server.static HashtablegetStatistics(int serverId)Returns statistics for the the specified server.static longgetTimeOutToAbortRequest()Gets the timeout in ms before abortion of administration requests.static User[]getUsers()Returns the list of all users that exist on the local server, or null if none exist.static User[]getUsers(int serverId)Returns the list of all users that exist on a given server, or null if none exist.static ListgetUsersList()Deprecated.No longer supported next to Joram 5.2static ListgetUsersList(int serverId)Deprecated.No longer supported next to Joram 5.2static AdminWrappergetWrapper()Returns the administration wrapper.static StringinvokeStaticServerMethod(int serverId, String className, String methodName, Class<?>[] parameterTypes, Object[] args)Invokes the specified static method with the specified parameters on the chosen server.static StringinvokeStaticServerMethod(int serverId, String className, String methodName, Class<?>[] parameterTypes, Object[] args, boolean async)Invokes the specified static method with the specified parameters on the chosen server.static StringinvokeStaticServerMethod(String className, String methodName, Class<?>[] parameterTypes, Object[] args)Invokes the specified static method with the specified parameters on the local server.static StringinvokeStaticServerMethod(String className, String methodName, Class<?>[] parameterTypes, Object[] args, boolean async)Invokes the specified static method with the specified parameters on the local server.static voidmain(String[] args)This method execute the XML script file that the path is given in parameter.static org.objectweb.joram.shared.admin.AdminReplyprocessAdmin(String targetId, int command, Properties prop)The method send the admin JMS message on JORAM server (AdminTopic).static voidremoveDomain(String domain)Removes a domain from the platform.static voidremoveServer(int sid)Removes a server from the platform.static voidsetDefaultDMQ(int serverId, Queue dmq)Sets a given dead message queue as the default DMQ for a given server (nullfor unsetting previous DMQ).static voidsetDefaultDMQ(Queue dmq)Sets a given dead message queue as the default DMQ for the local server (nullfor unsetting previous DMQ).static voidsetDefaultDMQId(int serverId, String dmqId)Sets a given dead message queue as the default DMQ for a given server (nullfor unsetting previous DMQ).static voidsetDefaultDMQId(String dmqId)Sets a given dead message queue as the default DMQ for the local server (nullfor unsetting previous DMQ).static voidsetDefaultThreshold(int threshold)Sets a given value as the default threshold for the local server (-1 for unsetting previous value).static voidsetDefaultThreshold(int serverId, int threshold)Sets a given value as the default threshold for a given server (-1 for unsetting previous value).static voidsetTimeOutToAbortRequest(long timeOut)Sets the timeout in ms before abortion of administration requests.static voidstopServer()Stops the platform local server.static voidstopServer(int serverId)Stops a given server of the platform.
-
-
-
Field Detail
-
ADM_NAME_PROPERTY
public static final String ADM_NAME_PROPERTY
- See Also:
- Constant Field Values
-
DEFAULT_ADM_NAME
public static final String DEFAULT_ADM_NAME
- See Also:
- Constant Field Values
-
localHost
protected static String localHost
The host name or IP address of the server the module is connected to.
-
localPort
protected static int localPort
The port number of the client connection.
-
lock
private static Object lock
Lock object used to avoid multiple connections in case of concurrent connect.
-
cnx
private static Connection cnx
The connection used to link the administrator and the platform.
-
wrapper
static AdminWrapper wrapper
The administration wrapper needed to interact with the Joram server.
-
logger
public static org.objectweb.util.monolog.api.Logger logger
-
-
Method Detail
-
getWrapper
public static AdminWrapper getWrapper() throws ConnectException
Returns the administration wrapper.- Returns:
- The administration wrapper.
- Throws:
ConnectException- if no wrapper is defined.
-
main
public static void main(String[] args)
This method execute the XML script file that the path is given in parameter.- Since:
- 4.3.12
-
connect
public static void connect(ConnectionFactory cf) throws ConnectException, AdminException
Opens a connection dedicated to administering with the Joram server which parameters are wrapped by a givenConnectionFactory. Default administrator login name and password are used for connection as defined inAbstractConnectionFactory.getDefaultRootLogin()andAbstractConnectionFactory.getDefaultRootPassword().- Parameters:
cf- The Joram's ConnectionFactory to use for connecting.- Throws:
ConnectException- If connecting fails.AdminException- If the administrator identification is incorrect.ClassCastException- If the ConnectionFactory is not a Joram ConnectionFactory.
-
connect
public static void connect(ConnectionFactory cf, String name, String password) throws ConnectException, AdminException
Opens a connection dedicated to administering with the Joram server which parameters are wrapped by a givenConnectionFactory.- Parameters:
cf- The Joram's ConnectionFactory to use for connecting.name- Administrator's name.password- Administrator's password.- Throws:
ConnectException- If connecting fails.AdminException- If the administrator identification is incorrect.ClassCastException- If the ConnectionFactory is not a Joram ConnectionFactory.
-
connect
public static void connect(ConnectionFactory cf, String name, String password, String identityClass) throws ConnectException, AdminException
Opens a connection dedicated to administering with the Joram server which parameters are wrapped by a givenConnectionFactory.- Parameters:
cf- The Joram's ConnectionFactory to use for connecting.name- Administrator's name.password- Administrator's password.identityClass- identity class name.- Throws:
ConnectException- If connecting fails.AdminException- If the administrator identification is incorrect.ClassCastException- If the ConnectionFactory is not a Joram ConnectionFactory.
-
connect
public static void connect(TopicConnectionFactory cf, String name, String password) throws ConnectException, AdminException
Deprecated.No longer use TopicConnectionFactory next to Joram 5.2.Opens a connection dedicated to administering with the Joram server which parameters are wrapped by a givenTopicConnectionFactory.- Parameters:
cf- The TopicConnectionFactory to use for connecting.name- Administrator's name.password- Administrator's password.- Throws:
ConnectException- If connecting fails.AdminException- If the administrator identification is incorrect.ClassCastException- If the ConnectionFactory is not a Joram ConnectionFactory.
-
connect
public static void connect(TopicConnectionFactory cf, String name, String password, String identityClass) throws ConnectException, AdminException
Deprecated.No longer use TopicConnectionFactory next to Joram 5.2.Opens a connection dedicated to administering with the Joram server which parameters are wrapped by a givenTopicConnectionFactory.- Parameters:
cf- The TopicConnectionFactory to use for connecting.name- Administrator's name.password- Administrator's password.identityClass- identity class name.- Throws:
ConnectException- If connecting fails.AdminException- If the administrator identification is incorrect.ClassCastException- If the ConnectionFactory is not a Joram ConnectionFactory.
-
connect
public static void connect() throws UnknownHostException, ConnectException, AdminExceptionOpens a TCP connection with the Joram server running on the default "localhost" host and listening to the default 16010 port. Default administrator login name and password are used for connection as defined inAbstractConnectionFactory.getDefaultRootLogin()andAbstractConnectionFactory.getDefaultRootPassword().- Throws:
UnknownHostException- Never thrown.ConnectException- If connecting fails.AdminException- If the administrator identification is incorrect.
-
connect
public static void connect(String name, String password) throws UnknownHostException, ConnectException, AdminException
Opens a TCP connection with the Joram server running on the default "localhost" host and listening to the default 16010 port.- Parameters:
name- Administrator's name.password- Administrator's password.- Throws:
UnknownHostException- Never thrown.ConnectException- If connecting fails.AdminException- If the administrator identification is incorrect.
-
connect
public static void connect(String name, String password, int cnxTimer) throws UnknownHostException, ConnectException, AdminException
Deprecated.Next to Joram 5.2 use connect methods with ConnectionFactory.Opens a TCP connection with the Joram server running on the default "localhost" host and listening to the default 16010 port.- Parameters:
name- Administrator's name.password- Administrator's password.cnxTimer- Timer in seconds during which connecting to the server is attempted.- Throws:
UnknownHostException- Never thrown.ConnectException- If connecting fails.AdminException- If the administrator identification is incorrect.
-
connect
public static void connect(String host, int port, String name, String password) throws UnknownHostException, ConnectException, AdminException
Opens a TCP connection with the Joram server running on a given host and listening to a given port.- Parameters:
host- The name or IP address of the host the server is running on.port- The number of the port the server is listening to.name- Administrator's name.password- Administrator's password.- Throws:
UnknownHostException- If the host is invalid.ConnectException- If connecting fails.AdminException- If the administrator identification is incorrect.
-
connect
public static void connect(String host, int port, String name, String password, int cnxTimer) throws UnknownHostException, ConnectException, AdminException
Deprecated.Next to Joram 5.2 use connect methods with ConnectionFactory.Opens a TCP connection with the Joram server running on a given host and listening to a given port.- Parameters:
host- The name or IP address of the host the server is running on.port- The number of the port the server is listening to.name- Administrator's name.password- Administrator's password.cnxTimer- Timer in seconds during which connecting to the server is attempted.- Throws:
UnknownHostException- If the host is invalid.ConnectException- If connecting fails.AdminException- If the administrator identification is incorrect.
-
connect
public static void connect(String name, String password, int cnxTimer, String reliableClass) throws UnknownHostException, ConnectException, AdminException
Deprecated.Next to Joram 5.2 use connect methods with ConnectionFactory.Opens a TCP connection with the Joram server running on the default "locahost" host and listening to the default 16010 port.- Parameters:
name- Administrator's name.password- Administrator's password.cnxTimer- Timer in seconds during which connecting to the server is attempted.reliableClass- Reliable class name.- Throws:
UnknownHostException- Never thrown.ConnectException- If connecting fails.AdminException- If the administrator identification is incorrect.
-
connect
public static void connect(String host, int port, String name, String password, int cnxTimer, String reliableClass) throws UnknownHostException, ConnectException, AdminException
Deprecated.Next to Joram 5.2 use connect methods with ConnectionFactory.Opens a TCP connection with the Joram server running on a given host and listening to a given port.- Parameters:
host- The name or IP address of the host the server is running on.port- The number of the port the server is listening to.name- Administrator's name.password- Administrator's password.cnxTimer- Timer in seconds during which connecting to the server is attempted.reliableClass- Reliable class name.- Throws:
UnknownHostException- If the host is invalid.ConnectException- If connecting fails.AdminException- If the administrator identification is incorrect.
-
connect
public static void connect(String host, int port, String name, String password, int cnxTimer, String reliableClass, String identityClass) throws UnknownHostException, ConnectException, AdminException
Deprecated.Next to Joram 5.2 use connect methods with ConnectionFactory.Opens a TCP connection with the Joram server running on a given host and listening to a given port.- Parameters:
host- The name or IP address of the host the server is running on.port- The number of the port the server is listening to.name- Administrator's name.password- Administrator's password.cnxTimer- Timer in seconds during which connecting to the server is attempted.reliableClass- Reliable class name.identityClass- identity class name.- Throws:
UnknownHostException- If the host is invalid.ConnectException- If connecting fails.AdminException- If the administrator identification is incorrect.
-
doConnect
private static void doConnect(String host, int port, String name, String password, int cnxTimer, String reliableClass, String identityClass) throws UnknownHostException, ConnectException, AdminException
Opens a TCP connection with the Joram server running on a given host and listening to a given port.- Parameters:
host- The name or IP address of the host the server is running on.port- The number of the port the server is listening to.name- Administrator's name.password- Administrator's password.cnxTimer- Timer in seconds during which connecting to the server is attempted.reliableClass- Reliable class name.identityClass- identity class name.- Throws:
UnknownHostException- If the host is invalid.ConnectException- If connecting fails.AdminException- If the administrator identification is incorrect.
-
collocatedConnect
public static void collocatedConnect() throws ConnectException, AdminExceptionOpens a connection with the collocated Joram server.Default administrator login name and password are used for connection as defined in
AbstractConnectionFactory.getDefaultRootLogin()andAbstractConnectionFactory.getDefaultRootPassword().- Throws:
UnknownHostException- Never thrown.ConnectException- If connecting fails.AdminException- If the administrator identification is incorrect.
-
collocatedConnect
public static void collocatedConnect(String name, String password) throws ConnectException, AdminException
Opens a connection with the collocated JORAM server.- Parameters:
name- Administrator's name.password- Administrator's password.- Throws:
ConnectException- If connecting fails.AdminException- If the administrator identification is incorrect.
-
collocatedConnect
public static void collocatedConnect(String name, String password, String identityClass) throws ConnectException, AdminException
Deprecated.Next to Joram 5.2 use connect methods with ConnectionFactory.Opens a connection with the collocated JORAM server.- Parameters:
name- Administrator's name.password- Administrator's password.identityClass- identity class name.- Throws:
ConnectException- If connecting fails.AdminException- If the administrator identification is incorrect.
-
doCollocatedConnect
public static void doCollocatedConnect(String name, String password, String identityClass) throws ConnectException, AdminException
Opens a connection with the collocated JORAM server.- Parameters:
name- Administrator's name.password- Administrator's password.identityClass- identity class name.- Throws:
ConnectException- If connecting fails.AdminException- If the administrator identification is incorrect.
-
doConnect
private static void doConnect(AbstractConnectionFactory cf, String name, String password, String identityClass) throws ConnectException, AdminException
Opens a connection dedicated to administering with the Joram server which parameters are wrapped by a givenConnectionFactory.- Parameters:
cf- The Joram's ConnectionFactory to use for connecting.name- Administrator's name.password- Administrator's password.identityClass- identity class name.- Throws:
ConnectException- If connecting fails.AdminException- If the administrator identification is incorrect.
-
doRequest
public static org.objectweb.joram.shared.admin.AdminReply doRequest(org.objectweb.joram.shared.admin.AdminRequest request) throws AdminException, ConnectExceptionDeprecated.Method actually sending anAdminRequestinstance to the platform and getting anAdminReplyinstance.- Parameters:
request- the administration request to send- Returns:
- the reply message
- Throws:
ConnectException- If the connection to the platform fails.AdminException- If the platform's reply is invalid, or if the request failed.
-
disconnect
public static void disconnect()
Closes the administration connection.
-
stopServer
public static void stopServer(int serverId) throws ConnectException, AdminExceptionStops a given server of the platform.The request fails if the target server does not belong to the platform.
- Parameters:
serverId- Identifier of the server to stop.- Throws:
ConnectException- If the connection fails.AdminException- If the request fails.
-
stopServer
public static void stopServer() throws ConnectException, AdminExceptionStops the platform local server.- Throws:
ConnectException- If the connection fails.AdminException- Never thrown.
-
addServer
public static void addServer(int sid, String host, String domain, int port, String server) throws ConnectException, AdminExceptionAdds a server to the platform.- Parameters:
sid- Id of the added serverhost- Address of the host where the added server is starteddomain- Name of the domain where the server is addedport- Listening port of the server in the specified domainserver- Name of the added server- Throws:
ConnectException- If the connection fails.AdminException- If the request fails.
-
addServer
public static void addServer(int sid, String host, String domain, int port, String server, String[] services, String[] args) throws ConnectException, AdminExceptionAdds a server to the platform.- Parameters:
sid- Id of the added serverhost- Address of the host where the added server is starteddomain- Name of the domain where the server is addedport- Listening port of the server in the specified domainserver- Name of the added serverservices- Names of the service to start within the serverargs- Services' arguments- Throws:
ConnectException- If the connection fails.AdminException- If the request fails.
-
removeServer
public static void removeServer(int sid) throws ConnectException, AdminExceptionRemoves a server from the platform.- Parameters:
sid- Id of the removed server- Throws:
ConnectException- If the connection fails.AdminException- If the request fails.
-
addDomain
public static void addDomain(String domain, int sid, int port) throws ConnectException, AdminException
Adds a domain to the platform.- Parameters:
domain- Name of the added domain.sid- Id of the router server that gives access to the added domain.port- Listening port in the added domain of the router server.- Throws:
ConnectException- If the connection fails.AdminException- If the request fails.
-
addDomain
public static void addDomain(String domain, String network, int sid, int port) throws ConnectException, AdminException
Adds a domain to the platform using a specific network component.- Parameters:
domain- Name of the added domain.network- Classname of the network component to use.sid- Id of the router server that gives access to the added domain.port- Listening port in the added domain of the router server.- Throws:
ConnectException- If the connection fails.AdminException- If the request fails.
-
removeDomain
public static void removeDomain(String domain) throws ConnectException, AdminException
Removes a domain from the platform.- Parameters:
domain- Name of the added domain- Throws:
ConnectException- If the connection fails.AdminException- If the request fails.
-
getConfiguration
public static String getConfiguration() throws ConnectException, AdminException
Returns the current servers configuration (a3servers.xml).- Throws:
ConnectException- If the connection fails.AdminException- If the request fails.
-
getStatistics
public static Hashtable getStatistics() throws ConnectException, AdminException
Returns statistics for the local server.- Returns:
- statistics for the local server.
- Throws:
ConnectException- If the connection fails.AdminException- Never thrown.- See Also:
getStatistics(int)
-
getStatistics
public static Hashtable getStatistics(int serverId) throws ConnectException, AdminException
Returns statistics for the the specified server.The request fails if the target server does not belong to the platform.
- Parameters:
serverId- Unique identifier of the server.- Returns:
- the statistics for the the specified server.
- Throws:
ConnectException- If the connection fails.AdminException- If the request fails.
-
getJMXAttribute
public static Hashtable getJMXAttribute(String attname) throws ConnectException, AdminException
Returns JMX attribute value for the local server.- Returns:
- Corresponding JMX attribute value for the local server.
- Throws:
ConnectException- If the connection fails.AdminException- Never thrown.- See Also:
getStatistics(int)
-
getJMXAttribute
public static Hashtable getJMXAttribute(int serverId, String attname) throws ConnectException, AdminException
Returns JMX attribute value for the specified server.The request fails if the target server does not belong to the platform.
- Parameters:
serverId- Unique identifier of the server.- Returns:
- the statistics for the the specified server.
- Throws:
ConnectException- If the connection fails.AdminException- If the request fails.
-
getDefaultDMQ
public static Queue getDefaultDMQ() throws ConnectException, AdminException
Returns the default dead message queue for the local server, null if not set.- Throws:
ConnectException- If the connection fails.AdminException- Never thrown.
-
getDefaultDMQ
public static Queue getDefaultDMQ(int serverId) throws ConnectException, AdminException
Returns the default dead message queue for a given server, null if not set.The request fails if the target server does not belong to the platform.
- Parameters:
serverId- Unique identifier of the server.- Throws:
ConnectException- If the connection fails.AdminException- If the request fails.
-
setDefaultDMQ
public static void setDefaultDMQ(Queue dmq) throws ConnectException, AdminException
Sets a given dead message queue as the default DMQ for the local server (nullfor unsetting previous DMQ).- Parameters:
dmq- The dmq to be set as the default one.- Throws:
ConnectException- If the connection fails.AdminException- Never thrown.
-
setDefaultDMQ
public static void setDefaultDMQ(int serverId, Queue dmq) throws ConnectException, AdminExceptionSets a given dead message queue as the default DMQ for a given server (nullfor unsetting previous DMQ).The request fails if the target server does not belong to the platform.
- Parameters:
serverId- The identifier of the server.dmq- The dmq to be set as the default one.- Throws:
ConnectException- If the connection fails.AdminException- If the request fails.
-
getDefaultDMQId
public static String getDefaultDMQId() throws ConnectException, AdminException
Returns the default dead message queue for the local server, null if not set.- Throws:
ConnectException- If the connection fails.AdminException- Never thrown.
-
getDefaultDMQId
public static String getDefaultDMQId(int serverId) throws ConnectException, AdminException
Returns the default dead message queue for a given server, null if not set.The request fails if the target server does not belong to the platform.
- Throws:
ConnectException- If the connection fails.AdminException- If the request fails.
-
setDefaultDMQId
public static void setDefaultDMQId(String dmqId) throws ConnectException, AdminException
Sets a given dead message queue as the default DMQ for the local server (nullfor unsetting previous DMQ).- Parameters:
dmqId- The dmqId (AgentId) to be set as the default one.- Throws:
ConnectException- If the connection fails.AdminException- Never thrown.
-
setDefaultDMQId
public static void setDefaultDMQId(int serverId, String dmqId) throws ConnectException, AdminExceptionSets a given dead message queue as the default DMQ for a given server (nullfor unsetting previous DMQ).The request fails if the target server does not belong to the platform.
- Parameters:
serverId- The identifier of the server.dmqId- The dmqId (AgentId) to be set as the default one.- Throws:
ConnectException- If the connection fails.AdminException- If the request fails.
-
getDefaultThreshold
public static int getDefaultThreshold() throws ConnectException, AdminExceptionReturns the default threshold value for the local server, -1 if not set.- Throws:
ConnectException- If the connection fails.AdminException- Never thrown.
-
getDefaultThreshold
public static int getDefaultThreshold(int serverId) throws ConnectException, AdminExceptionReturns the default threshold value for a given server, -1 if not set.The request fails if the target server does not belong to the platform.
- Throws:
ConnectException- If the connection fails.AdminException- If the request fails.
-
setDefaultThreshold
public static void setDefaultThreshold(int threshold) throws ConnectException, AdminExceptionSets a given value as the default threshold for the local server (-1 for unsetting previous value).- Parameters:
threshold- The threshold value to be set.- Throws:
ConnectException- If the connection fails.AdminException- Never thrown.
-
setDefaultThreshold
public static void setDefaultThreshold(int serverId, int threshold) throws ConnectException, AdminExceptionSets a given value as the default threshold for a given server (-1 for unsetting previous value).The request fails if the target server does not belong to the platform.
- Parameters:
serverId- The identifier of the server.threshold- The threshold value to be set.- Throws:
ConnectException- If the connection fails.AdminException- If the request fails.
-
getServersIds
public static List getServersIds() throws ConnectException, AdminException
Deprecated.No longer supported next to Joram 5.2Returns the list of the platform's servers' identifiers.- Throws:
ConnectException- If the connection fails.AdminException- Never thrown.
-
getServersIds
public static List getServersIds(String domain) throws ConnectException, AdminException
Deprecated.No longer supported next to Joram 5.2Returns the list of the servers' identifiers that belong to the specified domain- Parameters:
domain- Name of the domain.- Throws:
ConnectException- If the connection fails.AdminException- Never thrown.
-
getServers
public static Server[] getServers() throws ConnectException, AdminException
- Throws:
ConnectExceptionAdminException
-
getServers
public static Server[] getServers(String domain) throws ConnectException, AdminException
Returns the list of the servers' that belong to the specified domain- Parameters:
domain- Name of the domain.- Returns:
- An array containing the list of the servers of the specified domain.
- Throws:
ConnectException- If the connection fails.AdminException- Never thrown.
-
getDomainNames
public static String[] getDomainNames(int serverId) throws ConnectException, AdminException
Returns the list of the domain names that contains the specified server.- Parameters:
serverId- Unique identifier of the server.- Throws:
ConnectException- If the connection fails.AdminException- Never thrown.
-
getDestinationsList
public static List getDestinationsList() throws ConnectException, AdminException
Deprecated.No longer supported next to Joram 5.2Returns the list of all destinations that exist on the local server, or an empty list if none exist.- Throws:
ConnectException- If the admin connection is closed or broken.AdminException- Never thrown.
-
getDestinationsList
public static List getDestinationsList(int serverId) throws ConnectException, AdminException
Deprecated.No longer supported next to Joram 5.2Returns the list of all destinations that exist on a given server, or an empty list if none exist.The request fails if the target server does not belong to the platform.
- Throws:
ConnectException- If the admin connection is closed or broken.AdminException- If the request fails.
-
getDestinations
public static Destination[] getDestinations() throws ConnectException, AdminException
Returns the list of all destinations that exist on the local server, or null if none exist.- Returns:
- An array containing the list of all destinations of the local server or null if none exists.
- Throws:
ConnectException- If the admin connection is closed or broken.AdminException- Never thrown.
-
getDestinations
public static Destination[] getDestinations(int serverId) throws ConnectException, AdminException
Returns the list of all destinations that exist on a given server, or null if none exist.The request fails if the target server does not belong to the platform.
- Parameters:
serverId- The unique identifier of the selected server.- Returns:
- An array containing the list of all destinations of the local server or null if none exists.
- Throws:
ConnectException- If the admin connection is closed or broken.AdminException- If the request fails.
-
createQueue
public static Destination createQueue(int serverId, String name, String className, Properties prop) throws ConnectException, AdminException
Creates or retrieves a queue destination on a given JORAM server.- Parameters:
serverId- The identifier of the server where deploying the queue.name- The name of the queue.className- The queue class name.prop- The queue properties.- Throws:
ConnectException- If the admin connection is closed or broken.AdminException- If the request fails.- See Also:
AdminWrapper.createQueue(int, String, String, Properties)
-
createTopic
public static Destination createTopic(int serverId, String name, String className, Properties prop) throws ConnectException, AdminException
Creates or retrieves a topic destination on a given JORAM server.- Parameters:
serverId- The identifier of the server where deploying the topic.name- The name of the topic.className- The topic class name.prop- The topic properties.- Throws:
ConnectException- If the admin connection is closed or broken.AdminException- If the request fails.- See Also:
AdminWrapper.createTopic(int, String, String, Properties)
-
getUsersList
public static List getUsersList() throws ConnectException, AdminException
Deprecated.No longer supported next to Joram 5.2Returns the list of all users that exist on the local server, or an empty list if none exist.- Throws:
ConnectException- If the connection fails.AdminException- Never thrown.
-
getUsersList
public static List getUsersList(int serverId) throws ConnectException, AdminException
Deprecated.No longer supported next to Joram 5.2Returns the list of all users that exist on a given server, or an empty list if none exist.The request fails if the target server does not belong to the platform.
- Throws:
ConnectException- If the connection fails.AdminException- If the request fails.
-
getUsers
public static User[] getUsers() throws ConnectException, AdminException
Returns the list of all users that exist on the local server, or null if none exist.- Returns:
- An array containing all users defined on the local server, or null if none exist.
- Throws:
ConnectException- If the connection fails.AdminException- Never thrown.
-
getUsers
public static User[] getUsers(int serverId) throws ConnectException, AdminException
Returns the list of all users that exist on a given server, or null if none exist.The request fails if the target server does not belong to the platform.
- Parameters:
serverId- Unique identifier of the given server.- Returns:
- An array containing all users defined on the local server, or null if none exist.
- Throws:
ConnectException- If the connection fails.AdminException- If the request fails.
-
getLocalServer
public static Server getLocalServer() throws ConnectException, AdminException
- Throws:
ConnectExceptionAdminException
-
createUser
public static User createUser(String name, String password, int serverId, String identityClassName) throws ConnectException, AdminException
Admin method creating a user for a given server and instantiating the correspondingUserobject.- Parameters:
name- Name of the user.password- Password of the user.serverId- The identifier of the user's server.identityClassName- By default user/password for SimpleIdentity.- Throws:
ConnectException- If the connection fails.AdminException- If the request fails.- See Also:
AdminWrapper.createUser(String, String, int, String)
-
getLocalServerId
public static int getLocalServerId() throws ConnectException, AdminExceptionReturns the identifier of the server the module is connected to.- Throws:
ConnectException- If the admin connection is not established.AdminException
-
getLocalHost
public static String getLocalHost() throws ConnectException
Returns the host name of the server the module is connected to.- Throws:
ConnectException- If the admin connection is not established.
-
getLocalPort
public static int getLocalPort() throws ConnectExceptionReturns the port number of the server the module is connected to.- Throws:
ConnectException- If the admin connection is not established.
-
abortRequest
public static void abortRequest() throws ConnectException- Throws:
ConnectException
-
executeXMLAdmin
public static void executeXMLAdmin(String cfgDir, String cfgFileName) throws Exception
This method execute the XML script file that the location is given in parameter.- Parameters:
cfgDir- The directory containing the file.cfgFileName- The script filename.- Throws:
Exception- Since:
- 4.3.10
-
executeXMLAdmin
public static void executeXMLAdmin(String path) throws Exception
This method execute the XML script file that the pathname is given in parameter.- Parameters:
path- The script pathname.- Throws:
Exception- Since:
- 4.3.10
-
exportRepositoryToFile
public static void exportRepositoryToFile(String exportDir, String exportFilename) throws AdminException
Export the repository content to an XML file - only the destinations objects are retrieved in this version - xml script format of the admin objects (joramAdmin.xml)- Parameters:
exportDir- target directory where the export file will be putexportFilename- filename of the export file- Throws:
AdminException- if an error occurs
-
setTimeOutToAbortRequest
public static void setTimeOutToAbortRequest(long timeOut) throws ConnectExceptionSets the timeout in ms before abortion of administration requests.Be careful, the value can be changed prior to the connection only using the
AdminRequestor.REQUEST_TIMEOUT_PROPproperty.- Parameters:
timeOut- The timeout- Throws:
ConnectException- if the connection is not established.- Since:
- 5.2.2
-
getTimeOutToAbortRequest
public static long getTimeOutToAbortRequest() throws ConnectExceptionGets the timeout in ms before abortion of administration requests.- Returns:
- the timeout
- Throws:
ConnectException- if the connection is not established.- Since:
- 5.2.2
-
processAdmin
public static org.objectweb.joram.shared.admin.AdminReply processAdmin(String targetId, int command, Properties prop) throws ConnectException, AdminException
The method send the admin JMS message on JORAM server (AdminTopic).- Parameters:
targetId- agent Id target.command- the command to execute.prop- the properties.- Returns:
- the reply.
- Throws:
AdminExceptionConnectException- If the connection fails.
-
invokeStaticServerMethod
public static String invokeStaticServerMethod(String className, String methodName, Class<?>[] parameterTypes, Object[] args) throws ConnectException, AdminException
Invokes the specified static method with the specified parameters on the local server. The parameters types of the invoked method must be java primitive types, the java objects wrapping them or String type.- Parameters:
className- the name of the class holding the static methodmethodName- the name of the invoked methodparameterTypes- the list of parametersargs- the arguments used for the method call- Returns:
- the result of the invoked method after applying the toString method.
- Throws:
ConnectException- If the connection fails.AdminException- If the invocation can't be done or fails
-
invokeStaticServerMethod
public static String invokeStaticServerMethod(String className, String methodName, Class<?>[] parameterTypes, Object[] args, boolean async) throws ConnectException, AdminException
Invokes the specified static method with the specified parameters on the local server. The parameters types of the invoked method must be java primitive types, the java objects wrapping them or String type. The method can be invoked either asynchronously or not by the server depending of the parameter async.- Parameters:
className- the name of the class holding the static methodmethodName- the name of the invoked methodparameterTypes- the list of parametersargs- the arguments used for the method callasync- if true the method is invoked asynchronously by the server and the result is lost.- Returns:
- the result of the invoked method after applying the toString method.
- Throws:
ConnectException- If the connection fails.AdminException- If the invocation can't be done or fails
-
invokeStaticServerMethod
public static String invokeStaticServerMethod(int serverId, String className, String methodName, Class<?>[] parameterTypes, Object[] args) throws ConnectException, AdminException
Invokes the specified static method with the specified parameters on the chosen server. The parameters types of the invoked method must be java primitive types, the java objects wrapping them or String type.- Parameters:
serverId- the identifier of the server.className- the name of the class holding the static methodmethodName- the name of the invoked methodparameterTypes- the list of parametersargs- the arguments used for the method call- Returns:
- the result of the invoked method after applying the toString method
- Throws:
ConnectException- If the connection fails.AdminException- If the invocation can't be done or fails
-
invokeStaticServerMethod
public static String invokeStaticServerMethod(int serverId, String className, String methodName, Class<?>[] parameterTypes, Object[] args, boolean async) throws ConnectException, AdminException
Invokes the specified static method with the specified parameters on the chosen server. The parameters types of the invoked method must be java primitive types, the java objects wrapping them or String type. The method can be invoked either asynchronously or not by the server depending of the parameter async.- Parameters:
serverId- the identifier of the server.className- the name of the class holding the static methodmethodName- the name of the invoked methodparameterTypes- the list of parametersargs- the arguments used for the method callasync- if true the method is invoked asynchronously by the server and the result is lost.- Returns:
- the result of the invoked method after applying the toString method
- Throws:
ConnectException- If the connection fails.AdminException- If the invocation can't be done or fails
-
addAMQPBridgeConnection
public static String addAMQPBridgeConnection(int serverId, String urls) throws ConnectException, AdminException
Adds an AMQP server and starts a live connection with it, accessible via the url provided. A server is uniquely identified by the given name. Adding an existing server won't do anything.- Parameters:
serverId- the serverIdurls- the amqp url list identifying the servers separate by space, for example: "amqp://user:pass@localhost:5672/?name=serv1 amqp://user:pass@localhost:5678/?name=serv2"- Returns:
- the result of the method
- Throws:
ConnectException- If the connection fails.AdminException- If the invocation can't be done or fails
-
deleteAMQPBridgeConnection
public static String deleteAMQPBridgeConnection(int serverId, String names) throws ConnectException, AdminException
Removes the live connection to the specified AMQP server.- Parameters:
serverId- the serverIdnames- the name identifying the server or list of name separate by space- Returns:
- the result of the method
- Throws:
ConnectException- If the connection fails.AdminException- If the invocation can't be done or fails
-
addJMSBridgeConnection
public static String addJMSBridgeConnection(int serverId, String urls) throws ConnectException, AdminException
Adds a JMS server and starts a live connection with it, accessible via the url provided. A server is uniquely identified by the given name. Adding an existing server won't do anything.- Parameters:
serverId- the serverIdurls- the jms url list identifying the servers separate by space, for example: "jndi_url/?name=cnx1&cf=cfName&jndiFactoryClass=com.xxx.yyy&user=user1&pass=pass1&clientID=clientID"- Returns:
- the result of the method
- Throws:
ConnectException- If the connection fails.AdminException- If the invocation can't be done or fails
-
deleteJMSBridgeConnection
public static String deleteJMSBridgeConnection(int serverId, String names) throws ConnectException, AdminException
Removes the live connection to the specified AMQP server.- Parameters:
serverId- the serverIdnames- the name identifying the server or list of name separate by space- Returns:
- the result of the method
- Throws:
ConnectException- If the connection fails.AdminException- If the invocation can't be done or fails
-
deleteJMSBridgeConnection
public static String deleteJMSBridgeConnection(int serverId, String names, boolean async) throws ConnectException, AdminException
Removes the live connection to the specified AMQP server.- Parameters:
serverId- the serverIdnames- the name identifying the server or list of name separate by spaceasync- invoke asynchronously- Returns:
- the result of the method
- Throws:
ConnectException- If the connection fails.AdminException- If the invocation can't be done or fails
-
deleteJMSPBridgeConnection
public static String deleteJMSPBridgeConnection(int serverId, String names) throws ConnectException, AdminException
Deprecated.Removes the live connection to the specified AMQP server.- Parameters:
serverId- the serverIdnames- the name identifying the server or list of name separate by space- Returns:
- the result of the method
- Throws:
ConnectException- If the connection fails.AdminException- If the invocation can't be done or fails
-
deleteJMSPBridgeConnection
public static String deleteJMSPBridgeConnection(int serverId, String names, boolean async) throws ConnectException, AdminException
Deprecated.Removes the live connection to the specified AMQP server.- Parameters:
serverId- the serverIdnames- the name identifying the server or list of name separate by spaceasync- invoke asynchronously- Returns:
- the result of the method
- Throws:
ConnectException- If the connection fails.AdminException- If the invocation can't be done or fails
-
-