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

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

public class AdminWrapper
extends java.lang.Object

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


Field Summary
static java.lang.String ADM_NAME_PROPERTY
           
static java.lang.String DEFAULT_ADM_NAME
           
static org.objectweb.util.monolog.api.Logger logger
           
 
Constructor Summary
AdminWrapper(javax.jms.Connection cnx)
          Creates an administration wrapper for a Joram server.
 
Method Summary
 void abortRequest()
           
 void addDomain(java.lang.String domain, int sid, int port)
          Adds a domain to the platform.
 void addDomain(java.lang.String domain, java.lang.String network, int sid, int port)
          Adds a domain to the platform using a specific network component.
 void addServer(int sid, java.lang.String host, java.lang.String domain, int port, java.lang.String server)
          Adds a server to the platform.
 void addServer(int sid, java.lang.String host, java.lang.String domain, int port, java.lang.String server, java.lang.String[] services, java.lang.String[] args)
          Adds a server to the platform.
 void close()
          Closes the underlying requestor.
 Queue createDeadMQueue(int serverId, java.lang.String name)
          Deprecated. No longer needed, any queue can be used as DMQ.
 Destination createQueue(int serverId, java.lang.String name)
          Creates or retrieves a queue destination on a given JORAM server.
 Destination createQueue(int serverId, java.lang.String name, java.lang.String className, java.util.Properties prop)
          Creates or retrieves a queue destination on a given JORAM server.
 Destination createQueue(java.lang.String name)
          Creates or retrieves a queue destination on a given JORAM server.
 Destination createTopic(int serverId, java.lang.String name)
          Creates or retrieves a topic destination on a given JORAM server.
 Destination createTopic(int serverId, java.lang.String name, java.lang.String className, java.util.Properties prop)
          Creates or retrieves a topic destination on a given JORAM server.
 Destination createTopic(java.lang.String name)
          Creates or retrieves a topic destination on the underlying JORAM server.
 User createUser(java.lang.String name, java.lang.String password)
          Creates or retrieves a user on the underlying JORAM server.
 User createUser(java.lang.String name, java.lang.String password, int serverId)
          Creates or retrieves a user on the underlying JORAM server.
 User createUser(java.lang.String name, java.lang.String password, int serverId, java.lang.String identityClassName)
          Admin method creating a user for a given server and instantiating the corresponding User object.
 User createUser(java.lang.String name, java.lang.String password, int serverId, java.lang.String identityClassName, java.util.Properties prop)
          Admin method creating a user for a given server and instantiating the corresponding User object.
 User createUser(java.lang.String name, java.lang.String password, java.lang.String identityClass)
          Creates or retrieves a user on the underlying JORAM server.
 AdminReply doRequest(AdminRequest request)
          Method actually sending an AdminRequest instance to the platform and getting an AdminReply instance.
 java.lang.String getConfiguration()
          Returns the current servers configuration (a3servers.xml).
 Queue getDefaultDMQ()
          Returns the default dead message queue for the local server, null if not set.
 Queue getDefaultDMQ(int serverId)
          Returns the default dead message queue for a given server, null if not set.
 java.lang.String getDefaultDMQId()
          Returns the unique identifier of the default dead message queue for the local server, null if not set.
 java.lang.String getDefaultDMQId(int serverId)
          Returns the unique identifier of the default dead message queue for a given server, null if not set.
 int getDefaultThreshold()
          Returns the default threshold value for the local server, -1 if not set.
 int getDefaultThreshold(int serverId)
          Returns the default threshold value for a given server, -1 if not set.
 Destination[] getDestinations()
          Returns the list of all destinations that exist on the local server.
 Destination[] getDestinations(int serverId)
          Returns the list of all destinations that exist on a given server.
 java.lang.String[] getDomainNames(int serverId)
          Returns the list of the domain names that contains the specified server.
 java.lang.String getLocalHost()
          Returns the host name of the server the module is connected to.
 java.lang.String getLocalName()
          Returns the port number of the server the module is connected to.
 Server getLocalServer()
          Returns the information about the current server: unique identifier, symbolic name and hostname.
 int getLocalServerId()
          Returns the identifier of the server the module is connected to.
 Server[] getServers()
          Returns the list of the platform's servers' identifiers.
 Server[] getServers(java.lang.String domain)
          Returns the list of the servers' that belong to the specified domain.
 int[] getServersIds()
          Returns the list of the platform's servers' identifiers.
 int[] getServersIds(java.lang.String domain)
          Returns the list of the servers' identifiers that belong to the specified domain
 java.lang.String[] getServersNames()
          Returns the list of the platform's servers' names.
 java.lang.String[] getServersNames(java.lang.String domain)
          Returns the list of the servers' names that belong to the specified domain
 java.util.Hashtable getStatistics()
          Returns statistics for the local server.
 java.util.Hashtable getStatistics(int serverId)
          Returns statistics for the the specified server.
 long getTimeOutToAbortRequest()
          Returns the maximum time in ms before aborting request.
 User[] getUsers()
          Returns the list of all users that exist on the local server.
 User[] getUsers(int serverId)
          Returns the list of all users that exist on a given server.
 boolean isClosed()
          Returns true if the underlying requestor is closed.
 AdminReply processAdmin(java.lang.String targetId, int command, java.util.Properties prop)
          The method send the admin JMS message on JORAM server (AdminTopic).
 void removeDomain(java.lang.String domain)
          Removes a domain from the platform.
 void removeServer(int sid)
          Removes a server from the platform.
 void setDefaultDMQ(int serverId, Queue dmq)
          Sets a given dead message queue as the default DMQ for a given server (null for unsetting previous DMQ).
 void setDefaultDMQ(Queue dmq)
          Sets a given dead message queue as the default DMQ for the local server (null for unsetting previous DMQ).
 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).
 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).
 void setDefaultThreshold(int threshold)
          Sets a given value as the default threshold for the local server (-1 for unsetting previous value).
 void setDefaultThreshold(int serverId, int threshold)
          Sets a given value as the default threshold for a given server (-1 for unsetting previous value).
 void setTimeOutToAbortRequest(long timeOut)
          Set the maximum time in ms before aborting request.
 void stopServer()
          Stops the platform local server.
 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

logger

public static org.objectweb.util.monolog.api.Logger logger
Constructor Detail

AdminWrapper

public AdminWrapper(javax.jms.Connection cnx)
             throws javax.jms.JMSException,
                    java.net.ConnectException,
                    AdminException
Creates an administration wrapper for a Joram server. Be careful, if the connection is not started this method will failed with a ConnectException.

Parameters:
cnx - A valid connection to the Joram server.
Throws:
javax.jms.JMSException - A problem occurs during initialization.
java.net.ConnectException
AdminException
Method Detail

setTimeOutToAbortRequest

public final void setTimeOutToAbortRequest(long timeOut)
                                    throws java.net.ConnectException
Set the maximum time in ms before aborting request.

Parameters:
timeOut - the maximum time in ms before aborting request.
Throws:
java.net.ConnectException - if the connection is not established.

getTimeOutToAbortRequest

public final long getTimeOutToAbortRequest()
                                    throws java.net.ConnectException
Returns the maximum time in ms before aborting request.

Returns:
the maximum time in ms before aborting request.
Throws:
java.net.ConnectException - if the connection is not established.

close

public void close()
Closes the underlying requestor.


isClosed

public boolean isClosed()
Returns true if the underlying requestor is closed.

Returns:
true if the underlying requestor is closed.

stopServer

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

Throws:
java.net.ConnectException - If the connection fails.
AdminException - If the request fails.
See Also:
stopServer(int)

stopServer

public final 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.

addServer

public final void addServer(int sid,
                            java.lang.String host,
                            java.lang.String domain,
                            int port,
                            java.lang.String server)
                     throws java.net.ConnectException,
                            AdminException
Adds a server to the platform.

The server is configured without any service.

Parameters:
sid - Id of the added server
host - Address of the host where the added server is started
domain - Name of the domain where the server is added
port - Listening port of the server in the specified domain
server - Name of the added server
Throws:
java.net.ConnectException - If the connection fails.
AdminException - If the request fails.
See Also:
addServer(int, String, String, int, String, String[], String[])

addServer

public final void addServer(int sid,
                            java.lang.String host,
                            java.lang.String domain,
                            int port,
                            java.lang.String server,
                            java.lang.String[] services,
                            java.lang.String[] args)
                     throws java.net.ConnectException,
                            AdminException
Adds a server to the platform.

Parameters:
sid - Id of the added server
host - Address of the host where the added server is started
domain - Name of the domain where the server is added
port - Listening port of the server in the specified domain
server - Name of the added server
services - 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 final 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 final void addDomain(java.lang.String domain,
                            int sid,
                            int port)
                     throws java.net.ConnectException,
                            AdminException
Adds a domain to the platform.

The domain will use the default network component "SimpleNetwork".

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

addDomain

public final void addDomain(java.lang.String domain,
                            java.lang.String network,
                            int sid,
                            int port)
                     throws java.net.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:
java.net.ConnectException - If the connection fails.
AdminException - If the request fails.

removeDomain

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

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

getConfiguration

public final 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.

getStatistics

public final java.util.Hashtable getStatistics()
                                        throws java.net.ConnectException,
                                               AdminException
Returns statistics for the local server.

Returns:
statistics for the local server.
Throws:
java.net.ConnectException - If the connection fails.
AdminException - Never thrown.
See Also:
getStatistics(int)

getStatistics

public final java.util.Hashtable getStatistics(int serverId)
                                        throws java.net.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:
java.net.ConnectException - If the connection fails.
AdminException - If the request fails.

getDefaultDMQId

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

Returns:
The unique identifier of the default dead message queue for the local server, null if not set.
Throws:
java.net.ConnectException - If the connection fails.
AdminException - Never thrown.
See Also:
getDefaultDMQId(int)

getDefaultDMQId

public final java.lang.String getDefaultDMQId(int serverId)
                                       throws java.net.ConnectException,
                                              AdminException
Returns the unique identifier of 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.
Returns:
The unique identifier of the default dead message queue for the local server, null if not set.
Throws:
java.net.ConnectException - If the connection fails.
AdminException - If the request fails.

setDefaultDMQId

public final 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.
See Also:
setDefaultDMQId(int, String)

setDefaultDMQId

public final 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.

getDefaultDMQ

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

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.
See Also:
getDefaultDMQ(int)

getDefaultDMQ

public final Queue 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.

Parameters:
serverId - Unique identifier of the server.
Returns:
The default dead message queue for the local server, null if not set.
Throws:
java.net.ConnectException - If the connection fails.
AdminException - If the request fails.

setDefaultDMQ

public final void setDefaultDMQ(Queue 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.
See Also:
setDefaultDMQ(int, Queue)

setDefaultDMQ

public final void setDefaultDMQ(int serverId,
                                Queue 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.

getDefaultThreshold

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

Returns:
The default threshold value for the local server, -1 if not set.
Throws:
java.net.ConnectException - If the connection fails.
AdminException - Never thrown.
See Also:
getDefaultThreshold(int)

getDefaultThreshold

public final 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.

Returns:
The default threshold value for the local server, -1 if not set.
Throws:
java.net.ConnectException - If the connection fails.
AdminException - If the request fails.

setDefaultThreshold

public final 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.
See Also:
setDefaultThreshold(int, int)

setDefaultThreshold

public final 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.

getServersIds

public final int[] getServersIds()
                          throws java.net.ConnectException,
                                 AdminException
Returns the list of the platform's servers' identifiers.

Returns:
An array containing the list of server's identifiers.
Throws:
java.net.ConnectException - If the connection fails.
AdminException - Never thrown.
See Also:
getServers(String)

getServersIds

public final int[] getServersIds(java.lang.String domain)
                          throws java.net.ConnectException,
                                 AdminException
Returns the list of the servers' identifiers that belong to the specified domain

Parameters:
domain - Name of the domain.
Returns:
An array containing the list of server's identifiers of the specified domain.
Throws:
java.net.ConnectException - If the connection fails.
AdminException - Never thrown.

getServersNames

public final java.lang.String[] getServersNames()
                                         throws java.net.ConnectException,
                                                AdminException
Returns the list of the platform's servers' names.

Returns:
An array containing the list of server's names.
Throws:
java.net.ConnectException - If the connection fails.
AdminException - Never thrown.
See Also:
getServers(String)

getServersNames

public final java.lang.String[] getServersNames(java.lang.String domain)
                                         throws java.net.ConnectException,
                                                AdminException
Returns the list of the servers' names that belong to the specified domain

Parameters:
domain - Name of the domain.
Returns:
An array containing the list of server's names of the specified domain.
Throws:
java.net.ConnectException - If the connection fails.
AdminException - Never thrown.

getServers

public final Server[] getServers()
                          throws java.net.ConnectException,
                                 AdminException
Returns the list of the platform's servers' identifiers.

Returns:
An array containing the description of all servers.
Throws:
java.net.ConnectException
AdminException
See Also:
getServers(String)

getServers

public final Server[] getServers(java.lang.String domain)
                          throws java.net.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 description of all servers.
Throws:
java.net.ConnectException - If the connection fails.
AdminException - Never thrown.

getDomainNames

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

Parameters:
serverId - Unique identifier of the server.
Throws:
java.net.ConnectException - If the connection fails.
AdminException - Never thrown.

getDestinations

public final Destination[] getDestinations()
                                    throws java.net.ConnectException,
                                           AdminException
Returns the list of all destinations that exist on the local server.

Returns:
An array containing all destinations defined on the given server or null if none exists.
Throws:
java.net.ConnectException - If the admin connection is closed or broken.
AdminException - Never thrown.
See Also:
getDestinations(int)

getDestinations

public final Destination[] getDestinations(int serverId)
                                    throws java.net.ConnectException,
                                           AdminException
Returns the list of all destinations that exist on a given server.

The request fails if the target server does not belong to the platform.

Parameters:
serverId - Unique identifier of the server.
Returns:
An array containing all destinations defined on the given server or null if none exists.
Throws:
java.net.ConnectException - If the admin connection is closed or broken.
AdminException - If the request fails.

createQueue

public Destination createQueue(java.lang.String name)
                        throws AdminException,
                               java.net.ConnectException
Creates or retrieves a queue destination on a given JORAM server.

Parameters:
name - The name of the queue.
Throws:
java.net.ConnectException - If the admin connection is closed or broken.
AdminException - If the request fails.
See Also:
createQueue(int, String, String, Properties)

createQueue

public Destination createQueue(int serverId,
                               java.lang.String name)
                        throws AdminException,
                               java.net.ConnectException
Creates or retrieves a queue destination on a given JORAM server.

Parameters:
serverId - The identifier of the server where deploying the topic.
name - The name of the queue.
Throws:
java.net.ConnectException - If the admin connection is closed or broken.
AdminException - If the request fails.
See Also:
createQueue(int, String, String, Properties)

createQueue

public Destination createQueue(int serverId,
                               java.lang.String name,
                               java.lang.String className,
                               java.util.Properties prop)
                        throws java.net.ConnectException,
                               AdminException
Creates or retrieves a queue destination on a given JORAM server.

First a destination with the specified name is searched on the given server, if it does not exist it is created.

The request fails if the target server does not belong to the platform, or if the destination deployment fails server side.

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:
java.net.ConnectException - If the admin connection is closed or broken.
AdminException - If the request fails.

createTopic

public Destination createTopic(java.lang.String name)
                        throws AdminException,
                               java.net.ConnectException
Creates or retrieves a topic destination on the underlying JORAM server.

Parameters:
name - The name of the topic.
Throws:
java.net.ConnectException - If the admin connection is closed or broken.
AdminException - If the request fails.
See Also:
createTopic(int, String, String, Properties)

createTopic

public Destination createTopic(int serverId,
                               java.lang.String name)
                        throws AdminException,
                               java.net.ConnectException
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.
Throws:
java.net.ConnectException - If the admin connection is closed or broken.
AdminException - If the request fails.
See Also:
createTopic(int, String, String, Properties)

createTopic

public Destination createTopic(int serverId,
                               java.lang.String name,
                               java.lang.String className,
                               java.util.Properties prop)
                        throws java.net.ConnectException,
                               AdminException
Creates or retrieves a topic destination on a given JORAM server.

First a destination with the specified name is searched on the given server, if it does not exist it is created.

The request fails if the target server does not belong to the platform, or if the destination deployment fails server side.

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:
java.net.ConnectException - If the admin connection is closed or broken.
AdminException - If the request fails.

createDeadMQueue

public Queue createDeadMQueue(int serverId,
                              java.lang.String name)
                       throws java.net.ConnectException,
                              AdminException
Deprecated. No longer needed, any queue can be used as DMQ.

Creates or retrieves a DeadMessageQueue destination on a given JORAM server.

First a destination with the specified name is searched on the given server, if it does not exist it is created.

The request fails if the target server does not belong to the platform, or if the destination deployment fails server side.

Parameters:
serverId - The identifier of the server where deploying the topic.
name - The name of the queue.
Throws:
java.net.ConnectException - If the admin connection is closed or broken.
AdminException - If the request fails.

getUsers

public final User[] getUsers()
                      throws java.net.ConnectException,
                             AdminException
Returns the list of all users that exist on the local server.

Returns:
An array containing all users defined on the local server, or null if none exist.
Throws:
java.net.ConnectException - If the connection fails.
AdminException - Never thrown.
See Also:
getUsers(int)

getUsers

public final User[] getUsers(int serverId)
                      throws java.net.ConnectException,
                             AdminException
Returns the list of all users that exist on a given server.

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

createUser

public User createUser(java.lang.String name,
                       java.lang.String password)
                throws java.net.ConnectException,
                       AdminException
Creates or retrieves a user on the underlying JORAM server.

Parameters:
name - Name of the user.
password - Password of the user.
Throws:
java.net.ConnectException - If the connection fails.
AdminException - If the request fails.
See Also:
createUser(String, String, int, String)

createUser

public User createUser(java.lang.String name,
                       java.lang.String password,
                       int serverId)
                throws java.net.ConnectException,
                       AdminException
Creates or retrieves a user on the underlying JORAM server.

Parameters:
name - Name of the user.
password - Password of the user.
serverId - The identifier of the user's server.
Throws:
java.net.ConnectException - If the connection fails.
AdminException - If the request fails.
See Also:
createUser(String, String, int, String)

createUser

public User createUser(java.lang.String name,
                       java.lang.String password,
                       java.lang.String identityClass)
                throws AdminException,
                       java.net.ConnectException
Creates or retrieves a user on the underlying JORAM server.

Parameters:
name - Name of the user.
password - Password of the user.
identityClass - Classname for authentication, by default SimpleIdentity for user/password.
Throws:
java.net.ConnectException - If the connection fails.
AdminException - If the request fails.
See Also:
createUser(String, String, int, String)

createUser

public User createUser(java.lang.String name,
                       java.lang.String password,
                       int serverId,
                       java.lang.String identityClassName)
                throws java.net.ConnectException,
                       AdminException
Admin method creating a user for a given server and instantiating the corresponding User object.

If the user has already been set on this server, the method simply returns the corresponding User object. Its fails if the target server does not belong to the platform, or if a proxy could not be deployed server side for a new user.

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

createUser

public User createUser(java.lang.String name,
                       java.lang.String password,
                       int serverId,
                       java.lang.String identityClassName,
                       java.util.Properties prop)
                throws java.net.ConnectException,
                       AdminException
Admin method creating a user for a given server and instantiating the corresponding User object.

If the user has already been set on this server, the method simply returns the corresponding User object. Its fails if the target server does not belong to the platform, or if a proxy could not be deployed server side for a new user.

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.
prop - properties
Throws:
java.net.ConnectException - If the connection fails.
AdminException - If the request fails.

getLocalServer

public final Server getLocalServer()
                            throws java.net.ConnectException,
                                   AdminException
Returns the information about the current server: unique identifier, symbolic name and hostname.

Returns:
The description of the server.
Throws:
java.net.ConnectException - If the connection fails.
AdminException - If the request fails.

getLocalServerId

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

Throws:
java.net.ConnectException - If the admin connection is not established.
AdminException - If the request fails.
See Also:
getLocalServer()

getLocalHost

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

Throws:
java.net.ConnectException - If the admin connection is not established.
AdminException - If the request fails.
See Also:
getLocalServer()

getLocalName

public final java.lang.String getLocalName()
                                    throws java.net.ConnectException,
                                           AdminException
Returns the port number of the server the module is connected to.

Throws:
java.net.ConnectException - If the admin connection is not established.
AdminException - If the request fails.
See Also:
getLocalServer()

processAdmin

public AdminReply processAdmin(java.lang.String targetId,
                               int command,
                               java.util.Properties prop)
                        throws java.net.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:
AdminException
java.net.ConnectException - If the connection fails.

doRequest

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

Parameters:
request - the administration request to send
Returns:
the reply message
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 void abortRequest()
                  throws java.net.ConnectException
Throws:
java.net.ConnectException


Copyright © 2011 ScalAgent D.T.. All Rights Reserved.