Joram 5.0.7

org.objectweb.joram.client.jms.admin
Class AdminModule

java.lang.Object
  extended by org.objectweb.joram.client.jms.admin.AdminModule

public class AdminModule
extends java.lang.Object

The AdminModule class allows to set an administrator connection to a given JORAM server, and provides administration and monitoring methods at a server/platform level.


Nested Class Summary
static class AdminModule.AdminRequestor
           
 
Field Summary
static java.lang.String ADM_NAME_PROPERTY
           
static java.lang.String DEFAULT_ADM_NAME
           
static long DEFAULT_REQUEST_TIMEOUT
           
protected static java.lang.String localHost
          The host name or IP address this client is connected to.
protected static int localPort
          The port number of the client connection.
protected static AdminReply reply
          Reply object received from the platform.
static java.lang.String REQUEST_TIMEOUT_PROP
           
 
Constructor Summary
AdminModule()
           
 
Method Summary
static void abortRequest()
           
static void addDomain(java.lang.String domainName, int sid, int port)
          Adds a domain to the platform.
static void addServer(int sid, java.lang.String hostName, java.lang.String domainName, int port, java.lang.String serverName)
          Adds a server to the platform.
static void addServer(int sid, java.lang.String hostName, java.lang.String domainName, int port, java.lang.String serverName, java.lang.String[] serviceNames, java.lang.String[] serviceArgs)
          Adds a server to the platform.
static void collocatedConnect(java.lang.String name, java.lang.String password)
          Opens a connection with the collocated JORAM server.
static void connect(java.lang.String hostName, int port, java.lang.String name, java.lang.String password, int cnxTimer)
          Opens a TCP connection with the Joram server running on a given host and listening to a given port.
static void connect(java.lang.String hostName, int port, java.lang.String name, java.lang.String password, int cnxTimer, java.lang.String reliableClass)
          Opens a TCP connection with the Joram server running on a given host and listening to a given port.
static void connect(java.lang.String name, java.lang.String password, int cnxTimer)
          Opens a TCP connection with the Joram server running on the default "locahost" host and listening to the default 16010 port.
static void connect(java.lang.String name, java.lang.String password, int cnxTimer, java.lang.String reliableClass)
          Opens a TCP connection with the Joram server running on the default "locahost" host and listening to the default 16010 port.
static void connect(javax.jms.TopicConnectionFactory cnxFact, java.lang.String name, java.lang.String password)
          Opens a connection dedicated to administering with the Joram server which parameters are wrapped by a given TopicConnectionFactory.
static void disconnect()
          Closes the administration connection.
static AdminReply doRequest(AdminRequest request)
          Method actually sending an AdminRequest instance to the platform and getting an AdminReply instance.
static AdminReply doRequest(AdminRequest request, long timeout)
          Method actually sending an AdminRequest instance to the platform and getting an AdminReply instance.
static boolean executeAdmin(java.io.Reader reader)
           
static boolean executeXMLAdmin(java.lang.String path)
          This method execute the XML script file that the pathname is given in parameter.
static boolean executeXMLAdmin(java.lang.String cfgDir, java.lang.String cfgFileName)
          This method execute the XML script file that the location is given in parameter.
static java.lang.String getConfiguration()
          Returns the current servers configuration (a3servers.xml).
static DeadMQueue getDefaultDMQ()
          Returns the default dead message queue for the local server, null if not set.
static DeadMQueue getDefaultDMQ(int serverId)
          Returns the default dead message queue for a given server, null if not set.
static java.lang.String getDefaultDMQId()
          Returns the default dead message queue for the local server, null if not set.
static java.lang.String getDefaultDMQId(int serverId)
          Returns the default dead message queue for a given server, null if not set.
static int getDefaultThreshold()
          Returns the default threshold value for the local server, -1 if not set.
static int getDefaultThreshold(int serverId)
          Returns the default threshold value for a given server, -1 if not set.
static java.util.List getDestinations()
          Returns the list of all destinations that exist on the local server, or an empty list if none exist.
static java.util.List getDestinations(int serverId)
          Returns the list of all destinations that exist on a given server, or an empty list if none exist.
static java.util.List getDestinations(int serverId, long delay)
          Returns the list of all destinations that exist on a given server, or an empty list if none exist.
static java.lang.String[] getDomainNames(int serverId)
          Returns the list of the domain names that contains the specified server.
static java.lang.String getLocalHost()
          Returns the host name of the server the module is connected to.
static int getLocalPort()
          Returns the port number of the server the module is connected to.
static Server getLocalServer()
           
static int getLocalServerId()
          Returns the identifier of the server the module is connected to.
static Server[] getServers()
           
static Server[] getServers(java.lang.String domainName)
           
static java.util.List getServersIds()
          Returns the list of the platform's servers' identifiers.
static java.util.List getServersIds(java.lang.String domainName)
          Returns the list of the servers' identifiers that belong to the specified domain
static java.util.List getUsers()
          Returns the list of all users that exist on the local server, or an empty list if none exist.
static java.util.List getUsers(int serverId)
          Returns the list of all users that exist on a given server, or an empty list if none exist.
static java.util.List getUsers(int serverId, long delay)
          Returns the list of all users that exist on a given server, or an empty list if none exist.
static void main(java.lang.String[] args)
          This method execute the XML script file that the path is given in parameter.
static void removeDomain(java.lang.String domainName)
          Removes a domain from the platform.
static void removeServer(int sid)
          Removes a server from the platform.
static void setDefaultDMQ(DeadMQueue dmq)
          Sets a given dead message queue as the default DMQ for the local server (null for unsetting previous DMQ).
static void setDefaultDMQ(int serverId, DeadMQueue dmq)
          Sets a given dead message queue as the default DMQ for a given server (null for unsetting previous DMQ).
static void setDefaultDMQId(int serverId, java.lang.String dmqId)
          Sets a given dead message queue as the default DMQ for a given server (null for unsetting previous DMQ).
static void setDefaultDMQId(java.lang.String dmqId)
          Sets a given dead message queue as the default DMQ for the local server (null for unsetting previous DMQ).
static void setDefaultThreshold(int threshold)
          Sets a given value as the default threshold for the local server (-1 for unsetting previous value).
static void setDefaultThreshold(int serverId, int threshold)
          Sets a given value as the default threshold for a given server (-1 for unsetting previous value).
static void setHa(boolean isHa)
           
static void stopServer()
          Stops the platform local server.
static void stopServer(int serverId)
          Stops a given server of the platform.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ADM_NAME_PROPERTY

public static final java.lang.String ADM_NAME_PROPERTY
See Also:
Constant Field Values

DEFAULT_ADM_NAME

public static final java.lang.String DEFAULT_ADM_NAME
See Also:
Constant Field Values

REQUEST_TIMEOUT_PROP

public static final java.lang.String REQUEST_TIMEOUT_PROP
See Also:
Constant Field Values

DEFAULT_REQUEST_TIMEOUT

public static final long DEFAULT_REQUEST_TIMEOUT
See Also:
Constant Field Values

localHost

protected static java.lang.String localHost
The host name or IP address this client is connected to.


localPort

protected static int localPort
The port number of the client connection.


reply

protected static AdminReply reply
Reply object received from the platform.

Constructor Detail

AdminModule

public AdminModule()
Method Detail

main

public static void main(java.lang.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(javax.jms.TopicConnectionFactory cnxFact,
                           java.lang.String name,
                           java.lang.String password)
                    throws java.net.ConnectException,
                           AdminException
Opens a connection dedicated to administering with the Joram server which parameters are wrapped by a given TopicConnectionFactory.

Parameters:
cnxFact - The TopicConnectionFactory to use for connecting.
name - Administrator's name.
password - Administrator's password.
Throws:
java.net.ConnectException - If connecting fails.
AdminException - If the administrator identification is incorrect.

connect

public static void connect(java.lang.String hostName,
                           int port,
                           java.lang.String name,
                           java.lang.String password,
                           int cnxTimer)
                    throws java.net.UnknownHostException,
                           java.net.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.
Throws:
java.net.UnknownHostException - If the host is invalid.
java.net.ConnectException - If connecting fails.
AdminException - If the administrator identification is incorrect.

connect

public static void connect(java.lang.String hostName,
                           int port,
                           java.lang.String name,
                           java.lang.String password,
                           int cnxTimer,
                           java.lang.String reliableClass)
                    throws java.net.UnknownHostException,
                           java.net.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.
Throws:
java.net.UnknownHostException - If the host is invalid.
java.net.ConnectException - If connecting fails.
AdminException - If the administrator identification is incorrect.

connect

public static void connect(java.lang.String name,
                           java.lang.String password,
                           int cnxTimer)
                    throws java.net.UnknownHostException,
                           java.net.ConnectException,
                           AdminException
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.
Throws:
java.net.UnknownHostException - Never thrown.
java.net.ConnectException - If connecting fails.
AdminException - If the administrator identification is incorrect.

connect

public static void connect(java.lang.String name,
                           java.lang.String password,
                           int cnxTimer,
                           java.lang.String reliableClass)
                    throws java.net.UnknownHostException,
                           java.net.ConnectException,
                           AdminException
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:
java.net.UnknownHostException - Never thrown.
java.net.ConnectException - If connecting fails.
AdminException - If the administrator identification is incorrect.

collocatedConnect

public static void collocatedConnect(java.lang.String name,
                                     java.lang.String password)
                              throws java.net.ConnectException,
                                     AdminException
Opens a connection with the collocated JORAM server.

Parameters:
name - Administrator's name.
password - Administrator's password.
Throws:
java.net.ConnectException - If connecting fails.
AdminException - If the administrator identification is incorrect.

disconnect

public static void disconnect()
Closes the administration connection.


stopServer

public static void stopServer(int serverId)
                       throws java.net.ConnectException,
                              AdminException
Stops 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:
java.net.ConnectException - If the connection fails.
AdminException - If the request fails.

stopServer

public static void stopServer()
                       throws java.net.ConnectException,
                              AdminException
Stops the platform local server.

Throws:
java.net.ConnectException - If the connection fails.
AdminException - Never thrown.

addServer

public static void addServer(int sid,
                             java.lang.String hostName,
                             java.lang.String domainName,
                             int port,
                             java.lang.String serverName)
                      throws java.net.ConnectException,
                             AdminException
Adds a server to the platform.

Parameters:
serverId - Id of the added server
hostName - Address of the host where the added server is started
domainName - Name of the domain where the server is added
port - Listening port of the server in the specified domain
serverName - Name of the added server
Throws:
java.net.ConnectException - If the connection fails.
AdminException - If the request fails.

addServer

public static void addServer(int sid,
                             java.lang.String hostName,
                             java.lang.String domainName,
                             int port,
                             java.lang.String serverName,
                             java.lang.String[] serviceNames,
                             java.lang.String[] serviceArgs)
                      throws java.net.ConnectException,
                             AdminException
Adds a server to the platform.

Parameters:
serverId - Id of the added server
hostName - Address of the host where the added server is started
domainName - Name of the domain where the server is added
port - Listening port of the server in the specified domain
serverName - Name of the added server
serviceNames - Names of the service to start within the server
args - Services' arguments
Throws:
java.net.ConnectException - If the connection fails.
AdminException - If the request fails.

removeServer

public static void removeServer(int sid)
                         throws java.net.ConnectException,
                                AdminException
Removes a server from the platform.

Parameters:
sid - Id of the removed server
Throws:
java.net.ConnectException - If the connection fails.
AdminException - If the request fails.

addDomain

public static void addDomain(java.lang.String domainName,
                             int sid,
                             int port)
                      throws java.net.ConnectException,
                             AdminException
Adds a domain to the platform.

Parameters:
domainName - 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:
java.net.ConnectException - If the connection fails.
AdminException - If the request fails.

removeDomain

public static void removeDomain(java.lang.String domainName)
                         throws java.net.ConnectException,
                                AdminException
Removes a domain from the platform.

Parameters:
domainName - Name of the added domain
Throws:
java.net.ConnectException - If the connection fails.
AdminException - If the request fails.

getConfiguration

public static java.lang.String getConfiguration()
                                         throws java.net.ConnectException,
                                                AdminException
Returns the current servers configuration (a3servers.xml).

Throws:
java.net.ConnectException - If the connection fails.
AdminException - If the request fails.

setDefaultDMQ

public static void setDefaultDMQ(int serverId,
                                 DeadMQueue dmq)
                          throws java.net.ConnectException,
                                 AdminException
Sets a given dead message queue as the default DMQ for a given server (null for 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:
java.net.ConnectException - If the connection fails.
AdminException - If the request fails.

setDefaultDMQId

public static void setDefaultDMQId(int serverId,
                                   java.lang.String dmqId)
                            throws java.net.ConnectException,
                                   AdminException
Sets a given dead message queue as the default DMQ for a given server (null for 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:
java.net.ConnectException - If the connection fails.
AdminException - If the request fails.

setDefaultDMQ

public static void setDefaultDMQ(DeadMQueue dmq)
                          throws java.net.ConnectException,
                                 AdminException
Sets a given dead message queue as the default DMQ for the local server (null for unsetting previous DMQ).

Parameters:
dmq - The dmq to be set as the default one.
Throws:
java.net.ConnectException - If the connection fails.
AdminException - Never thrown.

setDefaultDMQId

public static void setDefaultDMQId(java.lang.String dmqId)
                            throws java.net.ConnectException,
                                   AdminException
Sets a given dead message queue as the default DMQ for the local server (null for unsetting previous DMQ).

Parameters:
dmqId - The dmqId (AgentId) to be set as the default one.
Throws:
java.net.ConnectException - If the connection fails.
AdminException - Never thrown.

setDefaultThreshold

public static void setDefaultThreshold(int serverId,
                                       int threshold)
                                throws java.net.ConnectException,
                                       AdminException
Sets 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:
java.net.ConnectException - If the connection fails.
AdminException - If the request fails.

setDefaultThreshold

public static void setDefaultThreshold(int threshold)
                                throws java.net.ConnectException,
                                       AdminException
Sets 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:
java.net.ConnectException - If the connection fails.
AdminException - Never thrown.

getServersIds

public static java.util.List getServersIds()
                                    throws java.net.ConnectException,
                                           AdminException
Returns the list of the platform's servers' identifiers.

Throws:
java.net.ConnectException - If the connection fails.
AdminException - Never thrown.

getServersIds

public static java.util.List getServersIds(java.lang.String domainName)
                                    throws java.net.ConnectException,
                                           AdminException
Returns the list of the servers' identifiers that belong to the specified domain

Throws:
java.net.ConnectException - If the connection fails.
AdminException - Never thrown.

getServers

public static Server[] getServers()
                           throws java.net.ConnectException,
                                  AdminException
Throws:
java.net.ConnectException
AdminException

getServers

public static Server[] getServers(java.lang.String domainName)
                           throws java.net.ConnectException,
                                  AdminException
Throws:
java.net.ConnectException
AdminException

getLocalServer

public static Server getLocalServer()
                             throws java.net.ConnectException,
                                    AdminException
Throws:
java.net.ConnectException
AdminException

getDomainNames

public static java.lang.String[] getDomainNames(int serverId)
                                         throws java.net.ConnectException,
                                                AdminException
Returns the list of the domain names that contains the specified server.

Throws:
java.net.ConnectException - If the connection fails.
AdminException - Never thrown.

getDefaultDMQ

public static DeadMQueue getDefaultDMQ(int serverId)
                                throws java.net.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:
java.net.ConnectException - If the connection fails.
AdminException - If the request fails.

getDefaultDMQ

public static DeadMQueue getDefaultDMQ()
                                throws java.net.ConnectException,
                                       AdminException
Returns the default dead message queue for the local server, null if not set.

Throws:
java.net.ConnectException - If the connection fails.
AdminException - Never thrown.

getDefaultDMQId

public static java.lang.String getDefaultDMQId()
                                        throws java.net.ConnectException,
                                               AdminException
Returns the default dead message queue for the local server, null if not set.

Throws:
java.net.ConnectException - If the connection fails.
AdminException - Never thrown.

getDefaultDMQId

public static java.lang.String getDefaultDMQId(int serverId)
                                        throws java.net.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:
java.net.ConnectException - If the connection fails.
AdminException - If the request fails.

getDefaultThreshold

public static int getDefaultThreshold(int serverId)
                               throws java.net.ConnectException,
                                      AdminException
Returns 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:
java.net.ConnectException - If the connection fails.
AdminException - If the request fails.

getDefaultThreshold

public static int getDefaultThreshold()
                               throws java.net.ConnectException,
                                      AdminException
Returns the default threshold value for the local server, -1 if not set.

Throws:
java.net.ConnectException - If the connection fails.
AdminException - Never thrown.

getDestinations

public static java.util.List getDestinations(int serverId)
                                      throws java.net.ConnectException,
                                             AdminException
Returns 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:
java.net.ConnectException - If the admin connection is closed or broken.
AdminException - If the request fails.

getDestinations

public static java.util.List getDestinations()
                                      throws java.net.ConnectException,
                                             AdminException
Returns the list of all destinations that exist on the local server, or an empty list if none exist.

Throws:
java.net.ConnectException - If the admin connection is closed or broken.
AdminException - Never thrown.

getDestinations

public static java.util.List getDestinations(int serverId,
                                             long delay)
                                      throws java.net.ConnectException,
                                             AdminException
Returns the list of all destinations that exist on a given server, or an empty list if none exist. The request is abort after delay.

Throws:
java.net.ConnectException - If the admin connection is closed or broken.
AdminException - If the request fails.

getUsers

public static java.util.List getUsers(int serverId)
                               throws java.net.ConnectException,
                                      AdminException
Returns 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:
java.net.ConnectException - If the connection fails.
AdminException - If the request fails.

getUsers

public static java.util.List getUsers(int serverId,
                                      long delay)
                               throws java.net.ConnectException,
                                      AdminException
Returns the list of all users that exist on a given server, or an empty list if none exist. The request is abort after delay.

Throws:
java.net.ConnectException - If the connection fails.
AdminException - If the request fails.

getUsers

public static java.util.List getUsers()
                               throws java.net.ConnectException,
                                      AdminException
Returns the list of all users that exist on the local server, or an empty list if none exist.

Throws:
java.net.ConnectException - If the connection fails.
AdminException - Never thrown.

getLocalServerId

public static int getLocalServerId()
                            throws java.net.ConnectException
Returns the identifier of the server the module is connected to.

Throws:
java.net.ConnectException - If the admin connection is not established.

getLocalHost

public static java.lang.String getLocalHost()
                                     throws java.net.ConnectException
Returns the host name of the server the module is connected to.

Throws:
java.net.ConnectException - If the admin connection is not established.

getLocalPort

public static int getLocalPort()
                        throws java.net.ConnectException
Returns the port number of the server the module is connected to.

Throws:
java.net.ConnectException - If the admin connection is not established.

doRequest

public static AdminReply doRequest(AdminRequest request)
                            throws AdminException,
                                   java.net.ConnectException
Method actually sending an AdminRequest instance to the platform and getting an AdminReply instance.

Throws:
java.net.ConnectException - If the connection to the platform fails.
AdminException - If the platform's reply is invalid, or if the request failed.

doRequest

public static AdminReply doRequest(AdminRequest request,
                                   long timeout)
                            throws AdminException,
                                   java.net.ConnectException
Method actually sending an AdminRequest instance to the platform and getting an AdminReply instance.

Throws:
java.net.ConnectException - If the connection to the platform fails.
AdminException - If the platform's reply is invalid, or if the request failed.

abortRequest

public static void abortRequest()
                         throws javax.jms.JMSException
Throws:
javax.jms.JMSException

executeXMLAdmin

public static boolean executeXMLAdmin(java.lang.String cfgDir,
                                      java.lang.String cfgFileName)
                               throws java.lang.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:
java.lang.Exception
Since:
4.3.10

executeXMLAdmin

public static boolean executeXMLAdmin(java.lang.String path)
                               throws java.lang.Exception
This method execute the XML script file that the pathname is given in parameter.

Parameters:
path - The script pathname.
Throws:
java.lang.Exception
Since:
4.3.10

executeAdmin

public static boolean executeAdmin(java.io.Reader reader)
                            throws java.lang.Exception
Throws:
java.lang.Exception

setHa

public static void setHa(boolean isHa)

Joram 5.0.7

Copyright © 2005 Scalagent - All rights reserved