|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.objectweb.joram.client.jms.admin.AdminWrapper
public class AdminWrapper
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
|
private AdminRequestor |
requestor
The requestor for sending the synchronous requests. |
private Server |
server
The description of the server the module is connected to. |
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. |
private Identity |
createIdentity(java.lang.String user,
java.lang.String passwd,
java.lang.String identityClassName)
Create a user Identity. |
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,
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. |
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 |
---|
private Server server
private AdminRequestor requestor
public static final java.lang.String ADM_NAME_PROPERTY
public static final java.lang.String DEFAULT_ADM_NAME
public static org.objectweb.util.monolog.api.Logger logger
Constructor Detail |
---|
public AdminWrapper(javax.jms.Connection cnx) throws javax.jms.JMSException, java.net.ConnectException, AdminException
cnx
- A valid connection to the Joram server.
javax.jms.JMSException
- A problem occurs during initialization.
java.net.ConnectException
AdminException
Method Detail |
---|
public final void setTimeOutToAbortRequest(long timeOut) throws java.net.ConnectException
timeOut
- the maximum time in ms before aborting request.
java.net.ConnectException
- if the connection is not established.public final long getTimeOutToAbortRequest() throws java.net.ConnectException
java.net.ConnectException
- if the connection is not established.public void close()
public boolean isClosed()
public final void stopServer() throws java.net.ConnectException, AdminException
java.net.ConnectException
- If the connection fails.
AdminException
- If the request fails.stopServer(int)
public final void stopServer(int serverId) throws java.net.ConnectException, AdminException
The request fails if the target server does not belong to the platform.
serverId
- Identifier of the server to stop.
java.net.ConnectException
- If the connection fails.
AdminException
- If the request fails.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
The server is configured without any service.
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
java.net.ConnectException
- If the connection fails.
AdminException
- If the request fails.addServer(int, String, String, int, String, String[], String[])
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
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
java.net.ConnectException
- If the connection fails.
AdminException
- If the request fails.public final void removeServer(int sid) throws java.net.ConnectException, AdminException
sid
- Id of the removed server
java.net.ConnectException
- If the connection fails.
AdminException
- If the request fails.public final void addDomain(java.lang.String domain, int sid, int port) throws java.net.ConnectException, AdminException
The domain will use the default network component "SimpleNetwork".
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.
java.net.ConnectException
- If the connection fails.
AdminException
- If the request fails.public final void addDomain(java.lang.String domain, java.lang.String network, int sid, int port) throws java.net.ConnectException, AdminException
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.
java.net.ConnectException
- If the connection fails.
AdminException
- If the request fails.public final void removeDomain(java.lang.String domain) throws java.net.ConnectException, AdminException
domain
- Name of the domain to remove
java.net.ConnectException
- If the connection fails.
AdminException
- If the request fails.public final java.lang.String getConfiguration() throws java.net.ConnectException, AdminException
java.net.ConnectException
- If the connection fails.
AdminException
- If the request fails.public final java.util.Hashtable getStatistics() throws java.net.ConnectException, AdminException
java.net.ConnectException
- If the connection fails.
AdminException
- Never thrown.getStatistics(int)
public final java.util.Hashtable getStatistics(int serverId) throws java.net.ConnectException, AdminException
The request fails if the target server does not belong to the platform.
serverId
- Unique identifier of the server.
java.net.ConnectException
- If the connection fails.
AdminException
- If the request fails.public final java.lang.String getDefaultDMQId() throws java.net.ConnectException, AdminException
java.net.ConnectException
- If the connection fails.
AdminException
- Never thrown.getDefaultDMQId(int)
public final java.lang.String getDefaultDMQId(int serverId) throws java.net.ConnectException, AdminException
The request fails if the target server does not belong to the platform.
serverId
- Unique identifier of the server.
java.net.ConnectException
- If the connection fails.
AdminException
- If the request fails.public final void setDefaultDMQId(java.lang.String dmqId) throws java.net.ConnectException, AdminException
null
for unsetting previous DMQ).
dmqId
- The dmqId (AgentId) to be set as the default one.
java.net.ConnectException
- If the connection fails.
AdminException
- Never thrown.setDefaultDMQId(int, String)
public final void setDefaultDMQId(int serverId, java.lang.String dmqId) throws java.net.ConnectException, AdminException
null
for unsetting previous DMQ).
The request fails if the target server does not belong to the platform.
serverId
- The identifier of the server.dmqId
- The dmqId (AgentId) to be set as the default one.
java.net.ConnectException
- If the connection fails.
AdminException
- If the request fails.public final Queue getDefaultDMQ() throws java.net.ConnectException, AdminException
java.net.ConnectException
- If the connection fails.
AdminException
- Never thrown.getDefaultDMQ(int)
public final Queue getDefaultDMQ(int serverId) throws java.net.ConnectException, AdminException
The request fails if the target server does not belong to the platform.
serverId
- Unique identifier of the server.
java.net.ConnectException
- If the connection fails.
AdminException
- If the request fails.public final void setDefaultDMQ(Queue dmq) throws java.net.ConnectException, AdminException
null
for unsetting previous DMQ).
dmq
- The dmq to be set as the default one.
java.net.ConnectException
- If the connection fails.
AdminException
- Never thrown.setDefaultDMQ(int, Queue)
public final void setDefaultDMQ(int serverId, Queue dmq) throws java.net.ConnectException, AdminException
null
for unsetting previous DMQ).
The request fails if the target server does not belong to the platform.
serverId
- The identifier of the server.dmq
- The dmq to be set as the default one.
java.net.ConnectException
- If the connection fails.
AdminException
- If the request fails.public final int getDefaultThreshold() throws java.net.ConnectException, AdminException
java.net.ConnectException
- If the connection fails.
AdminException
- Never thrown.getDefaultThreshold(int)
public final int getDefaultThreshold(int serverId) throws java.net.ConnectException, AdminException
The request fails if the target server does not belong to the platform.
java.net.ConnectException
- If the connection fails.
AdminException
- If the request fails.public final void setDefaultThreshold(int threshold) throws java.net.ConnectException, AdminException
threshold
- The threshold value to be set.
java.net.ConnectException
- If the connection fails.
AdminException
- Never thrown.setDefaultThreshold(int, int)
public final void setDefaultThreshold(int serverId, int threshold) throws java.net.ConnectException, AdminException
The request fails if the target server does not belong to the platform.
serverId
- The identifier of the server.threshold
- The threshold value to be set.
java.net.ConnectException
- If the connection fails.
AdminException
- If the request fails.public final int[] getServersIds() throws java.net.ConnectException, AdminException
java.net.ConnectException
- If the connection fails.
AdminException
- Never thrown.getServers(String)
public final int[] getServersIds(java.lang.String domain) throws java.net.ConnectException, AdminException
domain
- Name of the domain.
java.net.ConnectException
- If the connection fails.
AdminException
- Never thrown.public final java.lang.String[] getServersNames() throws java.net.ConnectException, AdminException
java.net.ConnectException
- If the connection fails.
AdminException
- Never thrown.getServers(String)
public final java.lang.String[] getServersNames(java.lang.String domain) throws java.net.ConnectException, AdminException
domain
- Name of the domain.
java.net.ConnectException
- If the connection fails.
AdminException
- Never thrown.public final Server[] getServers() throws java.net.ConnectException, AdminException
java.net.ConnectException
AdminException
getServers(String)
public final Server[] getServers(java.lang.String domain) throws java.net.ConnectException, AdminException
domain
- Name of the domain.
java.net.ConnectException
- If the connection fails.
AdminException
- Never thrown.public final java.lang.String[] getDomainNames(int serverId) throws java.net.ConnectException, AdminException
serverId
- Unique identifier of the server.
java.net.ConnectException
- If the connection fails.
AdminException
- Never thrown.public final Destination[] getDestinations() throws java.net.ConnectException, AdminException
java.net.ConnectException
- If the admin connection is closed or broken.
AdminException
- Never thrown.getDestinations(int)
public final Destination[] getDestinations(int serverId) throws java.net.ConnectException, AdminException
The request fails if the target server does not belong to the platform.
serverId
- Unique identifier of the server.
java.net.ConnectException
- If the admin connection is closed or broken.
AdminException
- If the request fails.public Destination createQueue(java.lang.String name) throws AdminException, java.net.ConnectException
name
- The name of the queue.
java.net.ConnectException
- If the admin connection is closed or broken.
AdminException
- If the request fails.createQueue(int, String, String, Properties)
public Destination createQueue(int serverId, java.lang.String name) throws AdminException, java.net.ConnectException
serverId
- The identifier of the server where deploying the topic.name
- The name of the queue.
java.net.ConnectException
- If the admin connection is closed or broken.
AdminException
- If the request fails.createQueue(int, String, String, Properties)
public Destination createQueue(int serverId, java.lang.String name, java.lang.String className, java.util.Properties prop) throws java.net.ConnectException, AdminException
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.
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.
java.net.ConnectException
- If the admin connection is closed or broken.
AdminException
- If the request fails.public Destination createTopic(java.lang.String name) throws AdminException, java.net.ConnectException
name
- The name of the topic.
java.net.ConnectException
- If the admin connection is closed or broken.
AdminException
- If the request fails.createTopic(int, String, String, Properties)
public Destination createTopic(int serverId, java.lang.String name) throws AdminException, java.net.ConnectException
serverId
- The identifier of the server where deploying the topic.name
- The name of the topic.
java.net.ConnectException
- If the admin connection is closed or broken.
AdminException
- If the request fails.createTopic(int, String, String, Properties)
public Destination createTopic(int serverId, java.lang.String name, java.lang.String className, java.util.Properties prop) throws java.net.ConnectException, AdminException
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.
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.
java.net.ConnectException
- If the admin connection is closed or broken.
AdminException
- If the request fails.public Queue createDeadMQueue(int serverId, java.lang.String name) throws java.net.ConnectException, AdminException
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.
serverId
- The identifier of the server where deploying the topic.name
- The name of the queue.
java.net.ConnectException
- If the admin connection is closed or broken.
AdminException
- If the request fails.public final User[] getUsers() throws java.net.ConnectException, AdminException
java.net.ConnectException
- If the connection fails.
AdminException
- Never thrown.getUsers(int)
public final User[] getUsers(int serverId) throws java.net.ConnectException, AdminException
The request fails if the target server does not belong to the platform.
serverId
- Unique identifier of the given server.
java.net.ConnectException
- If the connection fails.
AdminException
- If the request fails.public User createUser(java.lang.String name, java.lang.String password) throws java.net.ConnectException, AdminException
name
- Name of the user.password
- Password of the user.
java.net.ConnectException
- If the connection fails.
AdminException
- If the request fails.createUser(String, String, int, String)
public User createUser(java.lang.String name, java.lang.String password, int serverId) throws java.net.ConnectException, AdminException
name
- Name of the user.password
- Password of the user.serverId
- The identifier of the user's server.
java.net.ConnectException
- If the connection fails.
AdminException
- If the request fails.createUser(String, String, int, String)
public User createUser(java.lang.String name, java.lang.String password, java.lang.String identityClass) throws AdminException, java.net.ConnectException
name
- Name of the user.password
- Password of the user.identityClass
- Classname for authentication, by default SimpleIdentity for user/password.
java.net.ConnectException
- If the connection fails.
AdminException
- If the request fails.createUser(String, String, int, String)
public User createUser(java.lang.String name, java.lang.String password, int serverId, java.lang.String identityClassName) throws java.net.ConnectException, AdminException
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.
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.
java.net.ConnectException
- If the connection fails.
AdminException
- If the request fails.private Identity createIdentity(java.lang.String user, java.lang.String passwd, java.lang.String identityClassName) throws AdminException
user
- Name of the user.passwd
- Password of the user.identityClassName
- identity class name (simple, jaas).
AdminException
public final Server getLocalServer() throws java.net.ConnectException, AdminException
java.net.ConnectException
- If the connection fails.
AdminException
- If the request fails.public final int getLocalServerId() throws java.net.ConnectException, AdminException
java.net.ConnectException
- If the admin connection is not established.
AdminException
- If the request fails.getLocalServer()
public final java.lang.String getLocalHost() throws java.net.ConnectException, AdminException
java.net.ConnectException
- If the admin connection is not established.
AdminException
- If the request fails.getLocalServer()
public final java.lang.String getLocalName() throws java.net.ConnectException, AdminException
java.net.ConnectException
- If the admin connection is not established.
AdminException
- If the request fails.getLocalServer()
public AdminReply doRequest(AdminRequest request) throws AdminException, java.net.ConnectException
AdminRequest
instance to
the platform and getting an AdminReply
instance.
request
- the administration request to send
java.net.ConnectException
- If the connection to the platform fails.
AdminException
- If the platform's reply is invalid, or if
the request failed.public void abortRequest() throws java.net.ConnectException
java.net.ConnectException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |