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

java.lang.Object
  extended by org.objectweb.joram.client.jms.admin.AdministeredObject
      extended by org.objectweb.joram.client.jms.admin.User
All Implemented Interfaces:
SoapObjectItf, java.io.Serializable, javax.naming.Referenceable, UserMBean

public class User
extends AdministeredObject
implements UserMBean

The User class is a utility class needed for administering JORAM users.

See Also:
Serialized Form

Field Summary
protected  java.lang.String JMXBeanName
           
static org.objectweb.util.monolog.api.Logger logger
           
(package private)  java.lang.String name
          The name of the user.
(package private)  java.lang.String proxyId
          Identifier of the user's proxy agent.
private static long serialVersionUID
          define serialVersionUID for interoperability
(package private)  AdminWrapper wrapper
          Administration wrapper used to perform administration stuff.
 
Constructor Summary
User()
           
User(java.lang.String name)
          Constructs an User instance.
User(java.lang.String name, java.lang.String proxyId)
          Constructs an User instance.
 
Method Summary
 void clearSubscription(java.lang.String subName)
           
 java.util.Hashtable code()
          Codes an User instance as a Hashtable for traveling through the SOAP protocol.
static User create(java.lang.String name, java.lang.String password)
          Admin method creating a user on the local server and instantiating the corresponding User object.
static User create(java.lang.String name, java.lang.String password, int serverId)
          Admin method creating a user for a given server and instantiating the corresponding User object.
static User create(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.
private static Identity createIdentity(java.lang.String user, java.lang.String passwd, java.lang.String identityClassName)
          Create a user Identity.
 void decode(java.util.Hashtable h)
          Decodes an User which traveled through the SOAP protocol.
 void delete()
          Removes this user.
 void deleteMessage(java.lang.String subName, java.lang.String msgId)
           
 AdminReply doRequest(AdminRequest request)
          Method actually sending an AdminRequest instance to the platform and getting an AdminReply instance.
 boolean equals(java.lang.Object o)
          Provides a reliable way to compare User instances.
 void fromReference(javax.naming.Reference ref)
          Restores the administered object from a naming reference.
 Queue getDMQ()
          Monitoring method returning the dead message queue of this user, null if not set.
 java.lang.String getDMQId()
          Monitoring method returning the dead message queue id of this user, null if not set.
 Message getMessage(java.lang.String subName, java.lang.String msgId)
           
 java.lang.String getMessageDigest(java.lang.String subName, java.lang.String msgId)
           
 java.util.Properties getMessageHeader(java.lang.String subName, java.lang.String msgId)
           
 java.lang.String[] getMessageIds(java.lang.String subName)
           
 java.util.Properties getMessageProperties(java.lang.String subName, java.lang.String msgId)
           
 java.lang.String getName()
          Returns the user name.
 int getNbMaxMsg(java.lang.String subName)
          Monitoring method returning the nbMaxMsg of this subscription, -1 if no limit.
 java.lang.String getProxyId()
          Returns the identifier of the user's proxy.
 Subscription getSubscription(java.lang.String subName)
          Returns a subscription.
 java.util.List getSubscriptionList()
          used by MBean jmx
 Subscription[] getSubscriptions()
          Returns the subscriptions owned by a user.
 java.lang.String getSubscriptionString(java.lang.String subName)
          Returns a subscription.
 int getThreshold()
          Returns the threshold for this user, -1 if not set.
protected  AdminWrapper getWrapper()
          Returns the administration wrapper to use.
 int hashCode()
           
 Message readMessage(java.lang.String subName, java.lang.String msgId)
          Deprecated.  
 java.lang.String registerMBean(java.lang.String base)
           
 void setDMQ(Queue dmq)
          Admin method setting a given dead message queue for this user.
 void setDMQId(java.lang.String dmqId)
          Admin method setting a given dead message queue for this user.
 void setNbMaxMsg(java.lang.String subName, int nbMaxMsg)
          Admin method setting nbMaxMsg for this subscription.
 void setThreshold(int threshold)
          Admin method setting a given value as the threshold for this user.
 void setWrapper(AdminWrapper wrapper)
          Sets the administration wrapper to use.
 void toReference(javax.naming.Reference ref)
          Sets the naming reference of a connection factory.
 java.lang.String toString()
          Returns a string view of this User instance.
 void unregisterMBean()
           
 void update(java.lang.String newName, java.lang.String newPassword)
          Admin method updating this user identification.
 void update(java.lang.String newName, java.lang.String newPassword, java.lang.String identityClassName)
          Admin method updating this user identification.
 
Methods inherited from class org.objectweb.joram.client.jms.admin.AdministeredObject
getReference
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
define serialVersionUID for interoperability

See Also:
Constant Field Values

logger

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

name

java.lang.String name
The name of the user.


proxyId

java.lang.String proxyId
Identifier of the user's proxy agent.


wrapper

AdminWrapper wrapper
Administration wrapper used to perform administration stuff.

It is defined through AdminModule element, it is closed at the end of the script. if it is not defined the wrapper set at creation is used, if none the static AdminModule connection is used.


JMXBeanName

protected transient java.lang.String JMXBeanName
Constructor Detail

User

public User()

User

public User(java.lang.String name)
Constructs an User instance.

Parameters:
name - The name of the user.

User

public User(java.lang.String name,
            java.lang.String proxyId)
Constructs an User instance.

Parameters:
name - The name of the user.
proxyId - Identifier of the user's proxy agent.
Method Detail

toString

public java.lang.String toString()
Returns a string view of this User instance.

Specified by:
toString in interface UserMBean
Overrides:
toString in class java.lang.Object

getName

public java.lang.String getName()
Returns the user name.

Specified by:
getName in interface UserMBean

equals

public boolean equals(java.lang.Object o)
Provides a reliable way to compare User instances.

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

getWrapper

protected final AdminWrapper getWrapper()
                                 throws java.net.ConnectException
Returns the administration wrapper to use.

Returns:
The wrapper to use.
Throws:
java.net.ConnectException - if no wrapper is defined.

setWrapper

public void setWrapper(AdminWrapper wrapper)
Sets the administration wrapper to use. If not set the AdminModule static connection is used by default.

Parameters:
wrapper - The wrapper to use or null to unset.

doRequest

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

create

public static User create(java.lang.String name,
                          java.lang.String password,
                          int serverId)
                   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.

Be careful this method use the static AdminModule connection.

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.

create

public static User create(java.lang.String name,
                          java.lang.String password)
                   throws java.net.ConnectException,
                          AdminException
Admin method creating a user on the local 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. It fails if a proxy could not be deployed server side for a new user.

Be careful this method use the static AdminModule connection.

Parameters:
name - Name of the user.
password - Password of the user.
Throws:
java.net.ConnectException - If the connection fails.
AdminException - If the request fails.

create

public static User create(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.

Be careful this method use the static AdminModule connection.

Parameters:
name - Name of the user.
password - Password of the user.
serverId - The identifier of the user's server.
identityClassName - user/password or JAAS... (default SimpleIdentity).
Throws:
java.net.ConnectException - If the connection fails.
AdminException - If the request fails.

registerMBean

public java.lang.String registerMBean(java.lang.String base)

unregisterMBean

public void unregisterMBean()

createIdentity

private static Identity createIdentity(java.lang.String user,
                                       java.lang.String passwd,
                                       java.lang.String identityClassName)
                                throws AdminException
Create a user Identity.

Parameters:
user - Name of the user.
passwd - Password of the user.
identityClassName - identity class name (simple, jaas).
Returns:
identity user Identity.
Throws:
AdminException

update

public void update(java.lang.String newName,
                   java.lang.String newPassword)
            throws java.net.ConnectException,
                   AdminException
Admin method updating this user identification.

The request fails if the user does not exist server side, or if the new identification is already taken by a user on the same server.

Parameters:
newName - The new name of the user.
newPassword - The new password of the user.
Throws:
java.net.ConnectException - If the connection fails.
AdminException - If the request fails.

update

public void update(java.lang.String newName,
                   java.lang.String newPassword,
                   java.lang.String identityClassName)
            throws java.net.ConnectException,
                   AdminException
Admin method updating this user identification.

The request fails if the user does not exist server side, or if the new identification is already taken by a user on the same server.

Parameters:
newName - The new name of the user.
newPassword - The new password of the user.
identityClassName - user/password or JAAS... (default SimpleIdentity).
Throws:
java.net.ConnectException - If the connection fails.
AdminException - If the request fails.

delete

public void delete()
            throws java.net.ConnectException,
                   AdminException
Removes this user.

Specified by:
delete in interface UserMBean
Throws:
java.net.ConnectException - If the connection fails.
AdminException - Never thrown.

setDMQ

public void setDMQ(Queue dmq)
            throws java.net.ConnectException,
                   AdminException
Admin method setting a given dead message queue for this user.

The request fails if the user is deleted server side.

Parameters:
dmq - The dead message queue to be set.
Throws:
java.net.ConnectException - If the connection fails.
AdminException - If the request fails.

setDMQId

public void setDMQId(java.lang.String dmqId)
              throws java.net.ConnectException,
                     AdminException
Admin method setting a given dead message queue for this user.

The request fails if the user is deleted server side.

Specified by:
setDMQId in interface UserMBean
Parameters:
dmqId - The dead message queue Id to be set.
Throws:
java.net.ConnectException - If the connection fails.
AdminException - If the request fails.

setThreshold

public void setThreshold(int threshold)
                  throws java.net.ConnectException,
                         AdminException
Admin method setting a given value as the threshold for this user.

The request fails if the user is deleted server side.

Specified by:
setThreshold in interface UserMBean
Parameters:
threshold - The threshold value to be set (-1 for unsetting previous value).
Throws:
java.net.ConnectException - If the connection fails.
AdminException - If the request fails.

getDMQ

public Queue getDMQ()
             throws java.net.ConnectException,
                    AdminException
Monitoring method returning the dead message queue of this user, null if not set.

The request fails if the user is deleted server side.

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

getDMQId

public java.lang.String getDMQId()
                          throws java.net.ConnectException,
                                 AdminException
Monitoring method returning the dead message queue id of this user, null if not set.

The request fails if the destination is deleted server side.

Specified by:
getDMQId in interface UserMBean
Throws:
java.net.ConnectException - If the administration connection is closed or broken.
AdminException - If the request fails.

getThreshold

public int getThreshold()
                 throws java.net.ConnectException,
                        AdminException
Returns the threshold for this user, -1 if not set.

The request fails if the user is deleted server side.

Specified by:
getThreshold in interface UserMBean
Throws:
java.net.ConnectException - If the connection fails.
AdminException - If the request fails.

setNbMaxMsg

public void setNbMaxMsg(java.lang.String subName,
                        int nbMaxMsg)
                 throws java.net.ConnectException,
                        AdminException
Admin method setting nbMaxMsg for this subscription.

The request fails if the sub is deleted server side.

Specified by:
setNbMaxMsg in interface UserMBean
Parameters:
subName - the name of the subscription.
nbMaxMsg - nb Max of Message (-1 no limit).
Throws:
java.net.ConnectException - If the admin connection is closed or broken.
AdminException - If the request fails.

getNbMaxMsg

public int getNbMaxMsg(java.lang.String subName)
                throws java.net.ConnectException,
                       AdminException
Monitoring method returning the nbMaxMsg of this subscription, -1 if no limit.

The request fails if the sub is deleted server side.

Specified by:
getNbMaxMsg in interface UserMBean
Parameters:
subName - the name of the subscription.
Throws:
java.net.ConnectException - If the admin connection is closed or broken.
AdminException - If the request fails.

getSubscriptions

public Subscription[] getSubscriptions()
                                throws AdminException,
                                       java.net.ConnectException
Returns the subscriptions owned by a user.

Specified by:
getSubscriptions in interface UserMBean
Returns:
The subscriptions owned by the user.
Throws:
AdminException - If an error is raised by the administration operation.
java.net.ConnectException - If the admin connection is not established.

getSubscriptionList

public java.util.List getSubscriptionList()
                                   throws AdminException,
                                          java.net.ConnectException
used by MBean jmx

Throws:
AdminException
java.net.ConnectException

getSubscription

public Subscription getSubscription(java.lang.String subName)
                             throws AdminException,
                                    java.net.ConnectException
Returns a subscription.

Specified by:
getSubscription in interface UserMBean
Parameters:
subName - the name of the subscription.
Returns:
The subscription.
Throws:
AdminException - If an error is raised by the administration operation.
java.net.ConnectException - If the admin connection is not established.

getSubscriptionString

public java.lang.String getSubscriptionString(java.lang.String subName)
                                       throws AdminException,
                                              java.net.ConnectException
Description copied from interface: UserMBean
Returns a subscription.

Specified by:
getSubscriptionString in interface UserMBean
Throws:
AdminException
java.net.ConnectException

getMessageIds

public java.lang.String[] getMessageIds(java.lang.String subName)
                                 throws AdminException,
                                        java.net.ConnectException
Specified by:
getMessageIds in interface UserMBean
Throws:
AdminException
java.net.ConnectException

getMessage

public Message getMessage(java.lang.String subName,
                          java.lang.String msgId)
                   throws AdminException,
                          java.net.ConnectException,
                          javax.jms.JMSException
Throws:
AdminException
java.net.ConnectException
javax.jms.JMSException

getMessageDigest

public java.lang.String getMessageDigest(java.lang.String subName,
                                         java.lang.String msgId)
                                  throws AdminException,
                                         java.net.ConnectException,
                                         javax.jms.JMSException
Specified by:
getMessageDigest in interface UserMBean
Throws:
AdminException
java.net.ConnectException
javax.jms.JMSException

getMessageHeader

public java.util.Properties getMessageHeader(java.lang.String subName,
                                             java.lang.String msgId)
                                      throws AdminException,
                                             java.net.ConnectException,
                                             javax.jms.JMSException
Specified by:
getMessageHeader in interface UserMBean
Throws:
AdminException
java.net.ConnectException
javax.jms.JMSException

getMessageProperties

public java.util.Properties getMessageProperties(java.lang.String subName,
                                                 java.lang.String msgId)
                                          throws AdminException,
                                                 java.net.ConnectException,
                                                 javax.jms.JMSException
Specified by:
getMessageProperties in interface UserMBean
Throws:
AdminException
java.net.ConnectException
javax.jms.JMSException

readMessage

public Message readMessage(java.lang.String subName,
                           java.lang.String msgId)
                    throws AdminException,
                           java.net.ConnectException,
                           javax.jms.JMSException
Deprecated. 

Throws:
AdminException
java.net.ConnectException
javax.jms.JMSException

deleteMessage

public void deleteMessage(java.lang.String subName,
                          java.lang.String msgId)
                   throws AdminException,
                          java.net.ConnectException
Specified by:
deleteMessage in interface UserMBean
Throws:
AdminException
java.net.ConnectException

clearSubscription

public void clearSubscription(java.lang.String subName)
                       throws AdminException,
                              java.net.ConnectException
Specified by:
clearSubscription in interface UserMBean
Throws:
AdminException
java.net.ConnectException

getProxyId

public java.lang.String getProxyId()
Returns the identifier of the user's proxy.

Specified by:
getProxyId in interface UserMBean

toReference

public void toReference(javax.naming.Reference ref)
                 throws javax.naming.NamingException
Sets the naming reference of a connection factory.

Specified by:
toReference in class AdministeredObject
Throws:
javax.naming.NamingException

fromReference

public void fromReference(javax.naming.Reference ref)
                   throws javax.naming.NamingException
Restores the administered object from a naming reference.

Specified by:
fromReference in class AdministeredObject
Throws:
javax.naming.NamingException

code

public java.util.Hashtable code()
Codes an User instance as a Hashtable for traveling through the SOAP protocol.

Specified by:
code in interface SoapObjectItf

decode

public void decode(java.util.Hashtable h)
Decodes an User which traveled through the SOAP protocol.

Specified by:
decode in interface SoapObjectItf


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