public class User extends AdministeredObject implements UserMBean
User
class is a utility class needed for administering Joram users.
The User class is a factory for Joram's users through the create static methods, the User object provides Joram specific administration and monitoring methods.
The User object provides methods to add and remove Interceptors, such an interceptor can handle each incoming and outgoing message. Interceptors can read and also modify the messages. This enables filtering, transformation or content enrichment, for example adding a property into the message. Also Interceptors can stop the Interceptor chain by simply returning false to their intercept method invocation, in this case the transmission of the message is stopped.
There is two distinct chains of interceptors:
Modifier and Type | Field and Description |
---|---|
protected String |
JMXBeanName |
static org.objectweb.util.monolog.api.Logger |
logger |
(package private) String |
name
The name of the user.
|
(package private) String |
proxyId
Identifier of the user's proxy agent.
|
static String |
REDELIVERY_DELAY |
private static long |
serialVersionUID
define serialVersionUID for interoperability
|
(package private) AdminWrapper |
wrapper
Administration wrapper used to perform administration stuff.
|
Constructor and Description |
---|
User() |
User(String name)
Constructs an
User instance. |
User(String name,
String proxyId)
Constructs an
User instance. |
Modifier and Type | Method and Description |
---|---|
void |
addInterceptorIN(String interceptor,
Properties properties)
Add interceptor
|
void |
addInterceptorOUT(String interceptor,
Properties properties)
Add interceptor
|
void |
addInterceptorsIN(String interceptors)
Add interceptors
|
void |
addInterceptorsOUT(String interceptors)
Add interceptors
|
void |
clearSubscription(String subName) |
static User |
create(String name,
String password)
Admin method creating a user on the local server and instantiating the
corresponding
User object. |
static User |
create(String name,
String password,
int serverId)
Admin method creating a user for a given server and instantiating the
corresponding
User object. |
static User |
create(String name,
String password,
int serverId,
String identityClassName)
Admin method creating a user for a given server and instantiating the
corresponding
User object. |
static User |
create(String name,
String password,
int serverId,
String identityClassName,
Properties prop)
Admin method creating a user for a given server and instantiating the
corresponding
User object. |
private static Identity |
createIdentity(String user,
String passwd,
String identityClassName)
Create a user Identity.
|
void |
delete()
Removes this user.
|
void |
deleteMessage(String subName,
String msgId) |
private AdminReply |
doRequest(AdminRequest request)
Method actually sending an
AdminRequest instance to
the platform and getting an AdminReply instance. |
boolean |
equals(Object o)
Returns
true if the parameter object is a Joram user wrapping
the same Joram's User. |
void |
fromReference(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.
|
String |
getDMQId()
Monitoring method returning the dead message queue id of this user,
null if not set.
|
String |
getInterceptorsIN()
Get interceptors.
|
String |
getInterceptorsOUT()
Get interceptors.
|
static String |
getJMXBeanName(String base,
User user) |
Message |
getMessage(String subName,
String msgId)
Returns a copy of a message of the subscription.
|
String |
getMessageDigest(String subName,
String msgId) |
Properties |
getMessageHeader(String subName,
String msgId) |
String[] |
getMessageIds(String subName) |
Properties |
getMessageProperties(String subName,
String msgId) |
String |
getName()
Returns the user name.
|
int |
getNbMaxMsg(String subName)
Monitoring method returning the nbMaxMsg of this subscription, -1 if no limit.
|
String |
getProxyId()
Returns the identifier of the user's proxy.
|
Subscription |
getSubscription(String subName)
Returns a subscription.
|
List |
getSubscriptionList()
used by MBean jmx
|
Subscription[] |
getSubscriptions()
Returns the subscriptions owned by a user.
|
String |
getSubscriptionString(String subName)
used by MBean jmx
|
int |
getThreshold()
Returns the threshold for this user, -1 if not set.
|
int |
getThreshold(String subname)
Returns the threshold for a particular subscription of this user,
-1 if not set.
|
protected AdminWrapper |
getWrapper()
Returns the administration wrapper to use.
|
int |
hashCode() |
Message |
readMessage(String subName,
String msgId)
Deprecated.
|
String |
registerMBean(String base) |
void |
removeInterceptorsIN(String interceptors)
Remove interceptors
|
void |
removeInterceptorsOUT(String interceptors)
Remove interceptors
|
void |
replaceInterceptorIN(String newInterceptor,
String oldInterceptor)
Replace interceptor IN
|
void |
replaceInterceptorIN(String newInterceptor,
String oldInterceptor,
Properties properties)
Replace interceptor IN
|
void |
replaceInterceptorOUT(String newInterceptor,
String oldInterceptor)
Replace interceptor OUT
|
void |
replaceInterceptorOUT(String newInterceptor,
String oldInterceptor,
Properties properties)
Replace interceptor OUT
|
void |
setDMQ(Queue dmq)
Admin method setting a given dead message queue for this user.
|
void |
setDMQId(String dmqId)
Admin method setting a given dead message queue for this user.
|
void |
setNbMaxMsg(String subName,
int nbMaxMsg)
Admin method setting nbMaxMsg for this subscription.
|
void |
setRedeliveryDelay(int redeliveryDelay)
Set redeliveryDelay attribute.
|
void |
setThreshold(int threshold)
Admin method setting a given value as the threshold for this user.
|
void |
setThreshold(String subname,
int threshold)
Admin method setting a given value as the threshold for a particular
subscription of this user.
|
void |
setWrapper(AdminWrapper wrapper)
Sets the administration wrapper to use.
|
void |
toReference(Reference ref)
Sets the naming reference of a connection factory.
|
String |
toString()
Returns a string view of this
User instance. |
void |
unregisterMBean() |
void |
update(String newName,
String newPassword)
Admin method updating this user identification.
|
void |
update(String newName,
String newPassword,
String identityClassName)
Admin method updating this user identification.
|
getReference
private static final long serialVersionUID
public static final String REDELIVERY_DELAY
public static org.objectweb.util.monolog.api.Logger logger
String name
String proxyId
AdminWrapper wrapper
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.
protected transient String JMXBeanName
public User()
public User(String name)
User
instance.name
- The name of the user.public String toString()
User
instance.public boolean equals(Object o)
true
if the parameter object is a Joram user wrapping
the same Joram's User.protected final AdminWrapper getWrapper() throws ConnectException
ConnectException
- if no wrapper is defined.public void setWrapper(AdminWrapper wrapper)
wrapper
- The wrapper to use or null to unset.private final AdminReply doRequest(AdminRequest request) throws AdminException, ConnectException
AdminRequest
instance to
the platform and getting an AdminReply
instance.request
- the administration request to sendConnectException
- If the connection to the platform fails.AdminException
- If the platform's reply is invalid, or if
the request failed.public static User create(String name, String password, int serverId) throws 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.
Be careful this method use the static AdminModule connection.
name
- Name of the user.password
- Password of the user.serverId
- The identifier of the user's server.ConnectException
- If the connection fails.AdminException
- If the request fails.public static User create(String name, String password) throws ConnectException, AdminException
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.
name
- Name of the user.password
- Password of the user.ConnectException
- If the connection fails.AdminException
- If the request fails.public static User create(String name, String password, int serverId, String identityClassName) throws 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.
Be careful this method use the static AdminModule connection.
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).ConnectException
- If the connection fails.AdminException
- If the request fails.public static User create(String name, String password, int serverId, String identityClassName, Properties prop) throws 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.
Be careful this method use the static AdminModule connection.
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).prop
- propertiesConnectException
- If the connection fails.AdminException
- If the request fails.public void unregisterMBean()
private static Identity createIdentity(String user, String passwd, String identityClassName) throws AdminException
user
- Name of the user.passwd
- Password of the user.identityClassName
- identity class name (simple, jaas).AdminException
public void update(String newName, String newPassword) throws ConnectException, AdminException
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.
newName
- The new name of the user.newPassword
- The new password of the user.ConnectException
- If the connection fails.AdminException
- If the request fails.public void update(String newName, String newPassword, String identityClassName) throws ConnectException, AdminException
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.
newName
- The new name of the user.newPassword
- The new password of the user.identityClassName
- user/password or JAAS... (default SimpleIdentity).ConnectException
- If the connection fails.AdminException
- If the request fails.public void delete() throws ConnectException, AdminException
delete
in interface UserMBean
ConnectException
- If the connection fails.AdminException
- Never thrown.public void setDMQ(Queue dmq) throws ConnectException, AdminException
The request fails if the user is deleted server side.
dmq
- The dead message queue to be set.ConnectException
- If the connection fails.AdminException
- If the request fails.public void setDMQId(String dmqId) throws ConnectException, AdminException
The request fails if the user is deleted server side.
setDMQId
in interface UserMBean
dmqId
- The dead message queue Id to be set.ConnectException
- If the connection fails.AdminException
- If the request fails.public Queue getDMQ() throws ConnectException, AdminException
The request fails if the user is deleted server side.
ConnectException
- If the administration connection is closed or broken.AdminException
- If the request fails.public String getDMQId() throws ConnectException, AdminException
The request fails if the destination is deleted server side.
getDMQId
in interface UserMBean
ConnectException
- If the administration connection is closed or broken.AdminException
- If the request fails.public void setThreshold(int threshold) throws ConnectException, AdminException
The request fails if the user is deleted server side.
setThreshold
in interface UserMBean
threshold
- The threshold value to be set (-1 for unsetting
previous value).ConnectException
- If the connection fails.AdminException
- If the request fails.public void setThreshold(String subname, int threshold) throws ConnectException, AdminException
The request fails if the user is deleted server side.
subname
- The subscription name.threshold
- The threshold value to be set (-1 for unsetting
previous value).ConnectException
- If the connection fails.AdminException
- If the request fails.public int getThreshold() throws ConnectException, AdminException
The request fails if the user is deleted server side.
getThreshold
in interface UserMBean
ConnectException
- If the connection fails.AdminException
- If the request fails.public int getThreshold(String subname) throws ConnectException, AdminException
The request fails if the user is deleted server side.
subname
- The subscription name.ConnectException
- If the connection fails.AdminException
- If the request fails.public void setNbMaxMsg(String subName, int nbMaxMsg) throws ConnectException, AdminException
The request fails if the sub is deleted server side.
setNbMaxMsg
in interface UserMBean
subName
- the name of the subscription.nbMaxMsg
- nb Max of Message (-1 no limit).ConnectException
- If the admin connection is closed or broken.AdminException
- If the request fails.public int getNbMaxMsg(String subName) throws ConnectException, AdminException
The request fails if the sub is deleted server side.
getNbMaxMsg
in interface UserMBean
subName
- the name of the subscription.ConnectException
- If the admin connection is closed or broken.AdminException
- If the request fails.public Subscription[] getSubscriptions() throws AdminException, ConnectException
getSubscriptions
in interface UserMBean
AdminException
- If an error is raised by the administration operation.ConnectException
- If the admin connection is not established.public List getSubscriptionList() throws AdminException, ConnectException
AdminException
ConnectException
public Subscription getSubscription(String subName) throws AdminException, ConnectException
getSubscription
in interface UserMBean
subName
- the name of the subscription.AdminException
- If an error is raised by the administration operation.ConnectException
- If the admin connection is not established.public String getSubscriptionString(String subName) throws AdminException, ConnectException
getSubscriptionString
in interface UserMBean
AdminException
ConnectException
public String[] getMessageIds(String subName) throws AdminException, ConnectException
getMessageIds
in interface UserMBean
AdminException
ConnectException
public Message getMessage(String subName, String msgId) throws AdminException, ConnectException, JMSException
subName
- The name of the related subscription.msgId
- The identifier of the message.AdminException
ConnectException
JMSException
public String getMessageDigest(String subName, String msgId) throws AdminException, ConnectException, JMSException
getMessageDigest
in interface UserMBean
AdminException
ConnectException
JMSException
public Properties getMessageHeader(String subName, String msgId) throws AdminException, ConnectException, JMSException
getMessageHeader
in interface UserMBean
AdminException
ConnectException
JMSException
public Properties getMessageProperties(String subName, String msgId) throws AdminException, ConnectException, JMSException
getMessageProperties
in interface UserMBean
AdminException
ConnectException
JMSException
public void addInterceptorsIN(String interceptors) throws ConnectException, AdminException
addInterceptorsIN
in interface UserMBean
interceptors
- list of string className interceptor (separate with ",")ConnectException
AdminException
public void addInterceptorIN(String interceptor, Properties properties) throws ConnectException, AdminException
interceptor
- the className interceptorproperties
- the interceptor propertiesConnectException
AdminException
public String getInterceptorsIN() throws ConnectException, AdminException
getInterceptorsIN
in interface UserMBean
ConnectException
AdminException
public void removeInterceptorsIN(String interceptors) throws ConnectException, AdminException
removeInterceptorsIN
in interface UserMBean
interceptors
- list of string className interceptor (separate with ",")ConnectException
AdminException
public void addInterceptorsOUT(String interceptors) throws ConnectException, AdminException
addInterceptorsOUT
in interface UserMBean
interceptors
- list of string className interceptor (separate with ",")ConnectException
AdminException
public void addInterceptorOUT(String interceptor, Properties properties) throws ConnectException, AdminException
interceptor
- the className interceptorproperties
- the interceptor propertiesConnectException
AdminException
public String getInterceptorsOUT() throws ConnectException, AdminException
getInterceptorsOUT
in interface UserMBean
ConnectException
AdminException
public void removeInterceptorsOUT(String interceptors) throws ConnectException, AdminException
removeInterceptorsOUT
in interface UserMBean
interceptors
- list of string className interceptor (separate with ",")ConnectException
AdminException
public void replaceInterceptorIN(String newInterceptor, String oldInterceptor) throws ConnectException, AdminException
newInterceptor
- the new className interceptor.oldInterceptor
- the old className interceptor.ConnectException
AdminException
public void replaceInterceptorIN(String newInterceptor, String oldInterceptor, Properties properties) throws ConnectException, AdminException
newInterceptor
- the new className interceptor.oldInterceptor
- the old className interceptor.properties
- the new interceptor propertiesConnectException
AdminException
public void replaceInterceptorOUT(String newInterceptor, String oldInterceptor) throws ConnectException, AdminException
newInterceptor
- the new className interceptor.oldInterceptor
- the old className interceptor.ConnectException
AdminException
public void replaceInterceptorOUT(String newInterceptor, String oldInterceptor, Properties properties) throws ConnectException, AdminException
newInterceptor
- the new className interceptor.oldInterceptor
- the old className interceptor.properties
- the new interceptor propertiesConnectException
AdminException
public void setRedeliveryDelay(int redeliveryDelay) throws ConnectException, AdminException
redeliveryDelay
- The delay use to wait before re-delivering messages after a deny.ConnectException
AdminException
public Message readMessage(String subName, String msgId) throws AdminException, ConnectException, JMSException
public void deleteMessage(String subName, String msgId) throws AdminException, ConnectException
deleteMessage
in interface UserMBean
AdminException
ConnectException
public void clearSubscription(String subName) throws AdminException, ConnectException
clearSubscription
in interface UserMBean
AdminException
ConnectException
public String getProxyId()
getProxyId
in interface UserMBean
public void toReference(Reference ref) throws NamingException
toReference
in class AdministeredObject
NamingException
public void fromReference(Reference ref) throws NamingException
fromReference
in class AdministeredObject
NamingException
Copyright © 2021 ScalAgent D.T.. All rights reserved.