|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfr.dyade.aaa.agent.Agent
org.objectweb.joram.mom.dest.Destination
public abstract class Destination
The Destination
class implements the common behavior of
MOM destinations.
Field Summary | |
---|---|
static java.lang.String[] |
_rights
|
protected java.util.Hashtable |
clients
Table of the destination readers and writers. |
long |
creationDate
date of creation. |
protected AgentId |
dmqId
Identifier of the dead message queue this destination must send its dead messages to, if any. |
protected boolean |
freeReading
true if the READ access is granted to everybody. |
protected boolean |
freeWriting
true if the WRITE access is granted to everybody. |
static org.objectweb.util.monolog.api.Logger |
logger
|
protected long |
nbMsgsDeliverSinceCreation
|
protected long |
nbMsgsReceiveSinceCreation
|
protected long |
nbMsgsSentToDMQSinceCreation
|
static int |
READ
READ access value. |
static int |
READWRITE
READ and WRITE access value. |
protected WakeUpTask |
task
|
static java.lang.String |
WAKEUP_PERIOD
|
static int |
WRITE
WRITE access value. |
Fields inherited from class fr.dyade.aaa.agent.Agent |
---|
emptyString, fixed, logmon |
Constructor Summary | |
---|---|
|
Destination()
Empty constructor for newInstance(). |
protected |
Destination(java.lang.String name,
boolean fixed,
int stamp)
Constructor with parameters for fixing the destination and specifying its identifier. |
Method Summary | |
---|---|
void |
agentFinalize(boolean lastTime)
Finalizes the agent before it is garbaged. |
protected void |
agentInitialize(boolean firstTime)
Gives this agent an opportunity to initialize after having been deployed, and each time it is loaded into memory. |
protected void |
clientMessages(AgentId from,
ClientMessages not)
Method implementing the reaction to a ClientMessages
notification holding messages sent by a client. |
void |
delete()
Permits this agent to destroy itself. |
protected void |
deleteNot(AgentId from,
DeleteNot not)
Method implementing the reaction to a DeleteNot
notification requesting the deletion of the destination. |
protected abstract void |
doClientMessages(AgentId from,
ClientMessages not)
|
protected abstract void |
doDeleteNot(DeleteNot not)
|
protected abstract void |
doRightRequest(AgentId user,
int right)
This method is needed for right revocation. |
protected abstract void |
doUnknownAgent(UnknownAgent not)
|
protected void |
forward(AgentId to,
Notification not)
|
java.lang.String |
getCreationDate()
Returns this destination creation time through a String of
the form: dow mon dd hh:mm:ss zzz yyyy . |
long |
getCreationTimeInMillis()
Returns this destination creation time as a long. |
java.lang.String |
getDestinationId()
Returns the unique identifier of the destination. |
AgentId |
getDMQAgentId()
|
java.lang.String |
getDMQId()
Return the unique identifier of DMQ set for this destination if any. |
protected java.util.Hashtable |
getJMXStatistics()
Returns values of all valid JMX attributes about the destination. |
java.lang.String |
getMBeanName()
|
long |
getNbMsgsDeliverSinceCreation()
Returns the number of messages delivered since creation time of this destination. |
abstract long |
getNbMsgsReceiveSinceCreation()
Returns the number of messages received since creation time of this destination. |
long |
getNbMsgsSentToDMQSinceCreation()
Returns the number of erroneous messages forwarded to the DMQ since creation time of this destination.. |
long |
getPeriod()
Returns the period value of this destination, -1 if not set. |
java.lang.String |
getRight(java.lang.String userid)
Returns a string representation of rights set on this destination for a particular user. |
java.lang.String[] |
getRights()
Returns a string representation of the rights set on this destination. |
protected void |
getRights(AgentId from,
GetRightsRequestNot not)
Method implementing the reaction to a GetRightsRequest
notification requesting the rights about this destination. |
abstract byte |
getType()
Returns the type of this destination: Queue or Topic. |
protected void |
handleAdminRequestNot(AgentId from,
FwdAdminRequestNot not)
|
protected void |
handleDeniedMessage(java.lang.String msgId,
AgentId replyTo)
Method used to do specific actions when a message is denied because of a lack of rights. |
protected abstract void |
initialize(boolean firstTime)
Initializes the destination. |
protected boolean |
interceptorsAvailable()
|
protected boolean |
isAdministrator(AgentId client)
Checks the administering permission of a given client agent. |
boolean |
isFreeReading()
Tests if this destination is free for reading. |
boolean |
isFreeWriting()
Tests if this destination is free for writing. |
protected boolean |
isLocal(AgentId id)
|
protected boolean |
isReader(AgentId client)
Checks the reading permission of a given client agent. |
protected boolean |
isValidJMXAttribute(java.lang.String attrName)
This method allows to exclude some JMX attribute of getJMXStatistics method. |
protected boolean |
isWriter(AgentId client)
Checks the writing permission of a given client agent. |
protected void |
postProcess(ClientMessages msgs)
This method is needed to add processing after the standard handling. |
protected ClientMessages |
preProcess(AgentId from,
ClientMessages msgs)
This method is needed to add processing before the standard handling. |
protected void |
processAdminCommand(AdminCommandRequest request,
AgentId replyTo,
java.lang.String requestMsgId)
Proccess an admin command. |
protected Message |
processInterceptors(Message msg)
Interceptors process |
protected void |
processSetRight(AgentId user,
int right)
set user right. |
protected java.util.Properties |
processStartHandler(java.util.Properties prop)
Start the acquisition queue/topic handler. |
protected java.util.Properties |
processStopHandler(java.util.Properties prop)
Stop the acquisition queue/topic handler. |
void |
react(AgentId from,
Notification not)
Distributes the received notifications to the appropriate reactions. |
protected void |
replyToTopic(AdminReply reply,
AgentId replyTo,
java.lang.String requestMsgId,
java.lang.String replyMsgId)
|
protected void |
requestGroupNot(AgentId from,
RequestGroupNot not)
|
void |
setAdminId(AgentId adminId)
Sets the administrator of the destination. |
void |
setFreeReading(boolean on)
Sets the FreeReading attribute for this destination. |
void |
setFreeWriting(boolean on)
Sets the FreeWriting attribute for this destination. |
void |
setPeriod(long period)
Sets or unsets the period for this destination. |
void |
setProperties(java.util.Properties prop)
Configures a Destination . |
protected void |
setRight(SetRight request,
AgentId replyTo,
java.lang.String requestMsgId,
java.lang.String replyMsgId)
Method implementing the reaction to a SetRightRequest
notification requesting rights to be set for a user. |
protected void |
unknownAgent(AgentId from,
UnknownAgent not)
Method implementing the reaction to an UnknownAgent
notification. |
protected void |
updateProperties(java.util.Properties prop)
Update properties configuration. |
abstract void |
wakeUpNot(WakeUpNot not)
|
Methods inherited from class fr.dyade.aaa.agent.Agent |
---|
delete, delete, deploy, deploy, getAgentId, getCommitTime, getId, getLogTopic, getName, getReactNb, getReactTime, isDeployed, isFixed, needToBeCommited, save, sendTo, sendTo, sendTo, setName, setNoSave, setSave, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.objectweb.joram.mom.dest.DestinationMBean |
---|
getName, toString |
Methods inherited from interface fr.dyade.aaa.agent.AgentMBean |
---|
getAgentId, getCommitTime, getReactNb, getReactTime, isFixed |
Field Detail |
---|
public static org.objectweb.util.monolog.api.Logger logger
public static final java.lang.String WAKEUP_PERIOD
protected transient WakeUpTask task
protected boolean freeReading
true
if the READ access is granted to everybody.
protected boolean freeWriting
true
if the WRITE access is granted to everybody.
protected java.util.Hashtable clients
public static int READ
public static int WRITE
public static int READWRITE
protected AgentId dmqId
public long creationDate
protected long nbMsgsReceiveSinceCreation
protected long nbMsgsDeliverSinceCreation
protected long nbMsgsSentToDMQSinceCreation
public static java.lang.String[] _rights
Constructor Detail |
---|
public Destination()
protected Destination(java.lang.String name, boolean fixed, int stamp)
Method Detail |
---|
public abstract byte getType()
DestinationConstants.TOPIC_TYPE
,
DestinationConstants.QUEUE_TYPE
protected void agentInitialize(boolean firstTime) throws java.lang.Exception
agentInitialize
in class Agent
firstTime
- true when first called by the factory
java.lang.Exception
- unspecialized exceptionpublic void agentFinalize(boolean lastTime)
agentFinalize
in class Agent
lastTime
- true when last called by the factory on agent deletion.public java.lang.String getMBeanName()
public void react(AgentId from, Notification not) throws java.lang.Exception
react
in class Agent
from
- agent sending notificationnot
- notification to react to
java.lang.Exception
public final void setAdminId(AgentId adminId)
adminId
- Identifier of the administrator of the destination.public void setProperties(java.util.Properties prop) throws RequestException
Destination
.
prop
- The initial set of properties.
RequestException
protected abstract void initialize(boolean firstTime)
firstTime
- true when first called by the factoryprotected boolean isLocal(AgentId id)
public long getPeriod()
getPeriod
in interface DestinationMBean
public void setPeriod(long period)
setPeriod
in interface DestinationMBean
period
- The period value to be set or -1 for unsetting previous
value (ignore 0).public abstract void wakeUpNot(WakeUpNot not)
protected void setRight(SetRight request, AgentId replyTo, java.lang.String requestMsgId, java.lang.String replyMsgId)
SetRightRequest
notification requesting rights to be set for a user.
not
- The notification describing the security modifications.protected abstract void doRightRequest(AgentId user, int right)
user
- The user about right modification.right
- The right modification.protected void processSetRight(AgentId user, int right) throws RequestException
RequestException
protected void getRights(AgentId from, GetRightsRequestNot not) throws AccessException
GetRightsRequest
notification requesting the rights about this destination.
AccessException
- If the requester is not the administrator.public java.lang.String[] getRights()
getRights
in interface DestinationMBean
public java.lang.String getRight(java.lang.String userid)
getRight
in interface DestinationMBean
userid
- The user's unique identifier.
protected boolean isValidJMXAttribute(java.lang.String attrName)
attrName
- name of attribute to test.
protected final java.util.Hashtable getJMXStatistics()
protected void clientMessages(AgentId from, ClientMessages not) throws AccessException
ClientMessages
notification holding messages sent by a client.
If the sender is not a writer on the destination the messages are sent to the DMQ and an exception is thrown. Otherwise, the processing of the received messages is performed in subclasses.
AccessException
- If the sender is not a WRITER on the
destination.protected void handleDeniedMessage(java.lang.String msgId, AgentId replyTo)
protected void unknownAgent(AgentId from, UnknownAgent not)
UnknownAgent
notification.
If the unknown agent is the DMQ, its identifier is set to null. If it is a client of the destination, it is removed. Specific processing is also done in subclasses.
protected void deleteNot(AgentId from, DeleteNot not)
DeleteNot
notification requesting the deletion of the destination.
The processing is done in subclasses if the sender is an administrator.
protected void requestGroupNot(AgentId from, RequestGroupNot not)
protected boolean isReader(AgentId client)
client
- AgentId of the client requesting a reading permission.protected boolean isWriter(AgentId client)
client
- AgentId of the client requesting a writing permission.protected boolean isAdministrator(AgentId client)
client
- AgentId of the client requesting an admin permission.protected abstract void doClientMessages(AgentId from, ClientMessages not)
protected abstract void doUnknownAgent(UnknownAgent not)
protected abstract void doDeleteNot(DeleteNot not)
public void delete()
Agent
delete
in interface AgentMBean
delete
in interface DestinationMBean
delete
in class Agent
protected ClientMessages preProcess(AgentId from, ClientMessages msgs)
Queue
and Topic
.
The incoming messages can be modified or deleted during the processing.
from
- The sender of the messagemsgs
- The incoming messages.
protected void postProcess(ClientMessages msgs)
Queue
and Topic
.
The incoming messages can be modified or deleted during the processing.
from
- The sender of the messagemsgs
- The incoming messages.public final java.lang.String getDestinationId()
getDestinationId
in interface DestinationMBean
public boolean isFreeReading()
isFreeReading
in interface DestinationMBean
public void setFreeReading(boolean on)
FreeReading
attribute for this destination.
setFreeReading
in interface DestinationMBean
on
- if true anyone can receive message from this destination.public boolean isFreeWriting()
isFreeWriting
in interface DestinationMBean
public void setFreeWriting(boolean on)
FreeWriting
attribute for this destination.
setFreeWriting
in interface DestinationMBean
on
- if true anyone can send message to this destination.public java.lang.String getDMQId()
getDMQId
in interface DestinationMBean
public AgentId getDMQAgentId()
public long getCreationTimeInMillis()
getCreationTimeInMillis
in interface DestinationMBean
public java.lang.String getCreationDate()
String
of
the form: dow mon dd hh:mm:ss zzz yyyy
.
getCreationDate
in interface DestinationMBean
public abstract long getNbMsgsReceiveSinceCreation()
getNbMsgsReceiveSinceCreation
in interface DestinationMBean
public long getNbMsgsDeliverSinceCreation()
getNbMsgsDeliverSinceCreation
in interface DestinationMBean
public long getNbMsgsSentToDMQSinceCreation()
getNbMsgsSentToDMQSinceCreation
in interface DestinationMBean
protected void replyToTopic(AdminReply reply, AgentId replyTo, java.lang.String requestMsgId, java.lang.String replyMsgId)
protected final void forward(AgentId to, Notification not)
protected void handleAdminRequestNot(AgentId from, FwdAdminRequestNot not)
from
- not
- protected void processAdminCommand(AdminCommandRequest request, AgentId replyTo, java.lang.String requestMsgId)
request
- The administration request.replyTo
- The destination to reply.requestMsgId
- The JMS message id needed to reply.protected void updateProperties(java.util.Properties prop) throws java.lang.Exception
prop
- properties to update.
java.lang.Exception
protected java.util.Properties processStartHandler(java.util.Properties prop) throws java.lang.Exception
prop
- properties for start if needed (can be null)
java.lang.Exception
protected java.util.Properties processStopHandler(java.util.Properties prop) throws java.lang.Exception
prop
- properties for start if needed (can be null)
java.lang.Exception
protected Message processInterceptors(Message msg)
msg
- the message
protected boolean interceptorsAvailable()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |