Joram 5.2.5

org.objectweb.joram.mom.dest
Class DestinationImpl

java.lang.Object
  extended by org.objectweb.joram.mom.dest.DestinationImpl
All Implemented Interfaces:
java.io.Serializable, DestinationImplMBean
Direct Known Subclasses:
QueueImpl, TopicImpl

public abstract class DestinationImpl
extends java.lang.Object
implements java.io.Serializable, DestinationImplMBean

The DestinationImpl class implements the common behaviour of MOM destinations.

See Also:
Serialized Form

Field Summary
static java.lang.String[] _rights
           
protected  Destination agent
          Reference to the agent hosting the destination.
protected  java.util.Hashtable clients
          Table of the destination readers and writers.
 long creationDate
          date of creation.
protected  fr.dyade.aaa.agent.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.
static int WRITE
          WRITE access value.
 
Constructor Summary
DestinationImpl(fr.dyade.aaa.agent.AgentId adminId, java.util.Properties prop)
          Constructs a DestinationImpl.
 
Method Summary
 boolean canBeDeleted()
          Returns true if the destination might be deleted.
protected  void clientMessages(fr.dyade.aaa.agent.AgentId from, ClientMessages not)
          Method implementing the reaction to a ClientMessages notification holding messages sent by a client.
 void deleteNot(fr.dyade.aaa.agent.AgentId from, fr.dyade.aaa.agent.DeleteNot not)
          Method implementing the reaction to a DeleteNot notification requesting the deletion of the destination.
abstract  void destinationAdminRequestNot(fr.dyade.aaa.agent.AgentId from, DestinationAdminRequestNot not)
           
protected abstract  void doClientMessages(fr.dyade.aaa.agent.AgentId from, ClientMessages not)
           
protected abstract  void doDeleteNot(fr.dyade.aaa.agent.DeleteNot not)
           
protected abstract  void doRightRequest(SetRightRequest not)
           
protected abstract  void doUnknownAgent(fr.dyade.aaa.agent.UnknownAgent not)
           
 void forward(fr.dyade.aaa.agent.AgentId to, fr.dyade.aaa.agent.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.
 java.lang.String getDMQId()
          Return the unique identifier of DMQ set for this destination if any.
 fr.dyade.aaa.agent.AgentId getId()
          Identifier of the agent hosting the destination.
 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..
 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  java.util.Hashtable getStatisticHashtable()
          Gets some statistics about the destination
protected  void handleDeniedMessage(java.lang.String msgId, fr.dyade.aaa.agent.AgentId replyTo)
          Method used to do specific actions when a message is denied because of a lack of rights.
abstract  void initialize(boolean firstTime)
          Initializes the destination.
protected  boolean isAdministrator(fr.dyade.aaa.agent.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(fr.dyade.aaa.agent.AgentId id)
           
protected  boolean isReader(fr.dyade.aaa.agent.AgentId client)
          Checks the reading permission of a given client agent.
protected  boolean isWriter(fr.dyade.aaa.agent.AgentId client)
          Checks the writing permission of a given client agent.
 void monitFreeAccess(fr.dyade.aaa.agent.AgentId from, Monit_FreeAccess not)
          Method implementing the reaction to a Monit_FreeAccess notification requesting the free access status of this destination.
 void monitGetDMQSettings(fr.dyade.aaa.agent.AgentId from, Monit_GetDMQSettings not)
          Method implementing the reaction to a Monit_GetDMQSettings notification requesting the destination's DMQ settings.
 void monitGetReaders(fr.dyade.aaa.agent.AgentId from, Monit_GetReaders not)
          Method implementing the reaction to a Monit_GetReaders notification requesting the identifiers of the destination's readers.
 void monitGetStat(fr.dyade.aaa.agent.AgentId from, Monit_GetStat not)
          Method implementing the reaction to a Monit_GetStat notification requesting to get statistic of this destination.
 void monitGetWriters(fr.dyade.aaa.agent.AgentId from, Monit_GetWriters not)
          Method implementing the reaction to a Monit_GetWriters notification requesting the identifiers of the destination's writers.
 void postProcess(ClientMessages msgs)
           
 void postProcess(SetRightRequest req)
           
 ClientMessages preProcess(fr.dyade.aaa.agent.AgentId from, ClientMessages msgs)
           
 SetRightRequest preProcess(SetRightRequest req)
           
protected  void processSetRight(fr.dyade.aaa.agent.AgentId user, int right)
          set user right.
protected  void replyToTopic(AdminReply reply, fr.dyade.aaa.agent.AgentId replyTo, java.lang.String requestMsgId, java.lang.String replyMsgId)
           
 void requestGroupNot(fr.dyade.aaa.agent.AgentId from, RequestGroupNot not)
           
 void setAgent(Destination agent)
           
 void setDMQRequest(fr.dyade.aaa.agent.AgentId from, SetDMQRequest not)
          Method implementing the reaction to a SetDMQRequest notification setting the dead message queue identifier for this destination.
 void setFreeReading(boolean on)
          Sets the FreeReading attribute for this destination.
 void setFreeWriting(boolean on)
          Sets the FreeWriting attribute for this destination.
 void setRightRequest(fr.dyade.aaa.agent.AgentId from, SetRightRequest not)
          Method implementing the reaction to a SetRightRequest notification requesting rights to be set for a user.
protected  java.lang.Object specialAdminProcess(SpecialAdminRequest not)
           
 void specialAdminRequest(fr.dyade.aaa.agent.AgentId from, SpecialAdminRequest not)
          Method implementing the reaction to a SpecialAdminRequest notification requesting the special administration of the destination.
 void unknownAgent(fr.dyade.aaa.agent.AgentId from, fr.dyade.aaa.agent.UnknownAgent not)
          Method implementing the reaction to an UnknownAgent notification.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.objectweb.joram.mom.dest.DestinationImplMBean
toString
 

Field Detail

logger

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

agent

protected transient Destination agent
Reference to the agent hosting the destination.


freeReading

protected boolean freeReading
true if the READ access is granted to everybody.


freeWriting

protected boolean freeWriting
true if the WRITE access is granted to everybody.


clients

protected java.util.Hashtable clients
Table of the destination readers and writers.


READ

public static int READ
READ access value.


WRITE

public static int WRITE
WRITE access value.


READWRITE

public static int READWRITE
READ and WRITE access value.


dmqId

protected fr.dyade.aaa.agent.AgentId dmqId
Identifier of the dead message queue this destination must send its dead messages to, if any.


creationDate

public long creationDate
date of creation.


nbMsgsReceiveSinceCreation

protected long nbMsgsReceiveSinceCreation

nbMsgsDeliverSinceCreation

protected long nbMsgsDeliverSinceCreation

nbMsgsSentToDMQSinceCreation

protected long nbMsgsSentToDMQSinceCreation

_rights

public static java.lang.String[] _rights
Constructor Detail

DestinationImpl

public DestinationImpl(fr.dyade.aaa.agent.AgentId adminId,
                       java.util.Properties prop)
Constructs a DestinationImpl.

Parameters:
adminId - Identifier of the administrator of the destination.
prop - The initial set of properties.
Method Detail

getId

public final fr.dyade.aaa.agent.AgentId getId()
Identifier of the agent hosting the destination.


initialize

public abstract void initialize(boolean firstTime)
Initializes the destination.

Parameters:
firstTime - true when first called by the factory

setAgent

public void setAgent(Destination agent)

isLocal

protected boolean isLocal(fr.dyade.aaa.agent.AgentId id)

canBeDeleted

public boolean canBeDeleted()
Returns true if the destination might be deleted.


setRightRequest

public void setRightRequest(fr.dyade.aaa.agent.AgentId from,
                            SetRightRequest not)
                     throws AccessException
Method implementing the reaction to a SetRightRequest notification requesting rights to be set for a user.

Throws:
AccessException - If the requester is not the administrator.

processSetRight

protected void processSetRight(fr.dyade.aaa.agent.AgentId user,
                               int right)
                        throws RequestException
set user right.

Throws:
RequestException

setDMQRequest

public void setDMQRequest(fr.dyade.aaa.agent.AgentId from,
                          SetDMQRequest not)
                   throws AccessException
Method implementing the reaction to a SetDMQRequest notification setting the dead message queue identifier for this destination.

Throws:
AccessException - If the requester is not the administrator.

monitGetReaders

public void monitGetReaders(fr.dyade.aaa.agent.AgentId from,
                            Monit_GetReaders not)
                     throws AccessException
Method implementing the reaction to a Monit_GetReaders notification requesting the identifiers of the destination's readers.

Throws:
AccessException - If the requester is not the administrator.

monitGetWriters

public void monitGetWriters(fr.dyade.aaa.agent.AgentId from,
                            Monit_GetWriters not)
                     throws AccessException
Method implementing the reaction to a Monit_GetWriters notification requesting the identifiers of the destination's writers.

Throws:
AccessException - If the requester is not the administrator.

getRights

public java.lang.String[] getRights()
Returns a string representation of the rights set on this destination.

Specified by:
getRights in interface DestinationImplMBean
Returns:
the rights set on this destination.

getRight

public java.lang.String getRight(java.lang.String userid)
Returns a string representation of rights set on this destination for a particular user. The user is pointed out by its unique identifier.

Specified by:
getRight in interface DestinationImplMBean
Parameters:
userid - The user's unique identifier.
Returns:
the rights set on this destination.

monitFreeAccess

public void monitFreeAccess(fr.dyade.aaa.agent.AgentId from,
                            Monit_FreeAccess not)
                     throws AccessException
Method implementing the reaction to a Monit_FreeAccess notification requesting the free access status of this destination.

Throws:
AccessException - If the requester is not the administrator.

monitGetDMQSettings

public void monitGetDMQSettings(fr.dyade.aaa.agent.AgentId from,
                                Monit_GetDMQSettings not)
                         throws AccessException
Method implementing the reaction to a Monit_GetDMQSettings notification requesting the destination's DMQ settings.

Throws:
AccessException - If the requester is not the administrator.

monitGetStat

public void monitGetStat(fr.dyade.aaa.agent.AgentId from,
                         Monit_GetStat not)
                  throws AccessException
Method implementing the reaction to a Monit_GetStat notification requesting to get statistic of this destination.

Throws:
AccessException - If the requester is not the administrator.

getStatisticHashtable

protected java.util.Hashtable getStatisticHashtable()
Gets some statistics about the destination

Returns:
a Hashtable with some information statistics about the destination. Keys are String describing the values.

clientMessages

protected void clientMessages(fr.dyade.aaa.agent.AgentId from,
                              ClientMessages not)
                       throws AccessException
Method implementing the reaction to a 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.

Throws:
AccessException - If the sender is not a WRITER on the destination.

handleDeniedMessage

protected void handleDeniedMessage(java.lang.String msgId,
                                   fr.dyade.aaa.agent.AgentId replyTo)
Method used to do specific actions when a message is denied because of a lack of rights.


unknownAgent

public void unknownAgent(fr.dyade.aaa.agent.AgentId from,
                         fr.dyade.aaa.agent.UnknownAgent not)
Method implementing the reaction to an 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.


deleteNot

public void deleteNot(fr.dyade.aaa.agent.AgentId from,
                      fr.dyade.aaa.agent.DeleteNot not)
Method implementing the reaction to a DeleteNot notification requesting the deletion of the destination.

The processing is done in subclasses if the sender is an administrator.


specialAdminRequest

public void specialAdminRequest(fr.dyade.aaa.agent.AgentId from,
                                SpecialAdminRequest not)
Method implementing the reaction to a SpecialAdminRequest notification requesting the special administration of the destination.


requestGroupNot

public void requestGroupNot(fr.dyade.aaa.agent.AgentId from,
                            RequestGroupNot not)

specialAdminProcess

protected java.lang.Object specialAdminProcess(SpecialAdminRequest not)
                                        throws RequestException
Throws:
RequestException

isReader

protected boolean isReader(fr.dyade.aaa.agent.AgentId client)
Checks the reading permission of a given client agent.

Parameters:
client - AgentId of the client requesting a reading permission.

isWriter

protected boolean isWriter(fr.dyade.aaa.agent.AgentId client)
Checks the writing permission of a given client agent.

Parameters:
client - AgentId of the client requesting a writing permission.

isAdministrator

protected boolean isAdministrator(fr.dyade.aaa.agent.AgentId client)
Checks the administering permission of a given client agent.

Parameters:
client - AgentId of the client requesting an admin permission.

doRightRequest

protected abstract void doRightRequest(SetRightRequest not)

doClientMessages

protected abstract void doClientMessages(fr.dyade.aaa.agent.AgentId from,
                                         ClientMessages not)

doUnknownAgent

protected abstract void doUnknownAgent(fr.dyade.aaa.agent.UnknownAgent not)

doDeleteNot

protected abstract void doDeleteNot(fr.dyade.aaa.agent.DeleteNot not)

preProcess

public SetRightRequest preProcess(SetRightRequest req)

postProcess

public void postProcess(SetRightRequest req)

preProcess

public ClientMessages preProcess(fr.dyade.aaa.agent.AgentId from,
                                 ClientMessages msgs)

postProcess

public void postProcess(ClientMessages msgs)

getDestinationId

public final java.lang.String getDestinationId()
Returns the unique identifier of the destination.

Specified by:
getDestinationId in interface DestinationImplMBean
Returns:
the unique identifier of the destination.

isFreeReading

public boolean isFreeReading()
Tests if this destination is free for reading.

Specified by:
isFreeReading in interface DestinationImplMBean
Returns:
true if anyone can receive messages from this destination; false otherwise.

setFreeReading

public void setFreeReading(boolean on)
Sets the FreeReading attribute for this destination.

Specified by:
setFreeReading in interface DestinationImplMBean
Parameters:
on - if true anyone can receive message from this destination.

isFreeWriting

public boolean isFreeWriting()
Tests if this destination is free for writing.

Specified by:
isFreeWriting in interface DestinationImplMBean
Returns:
true if anyone can send messages to this destination; false otherwise.

setFreeWriting

public void setFreeWriting(boolean on)
Sets the FreeWriting attribute for this destination.

Specified by:
setFreeWriting in interface DestinationImplMBean
Parameters:
on - if true anyone can send message to this destination.

getDMQId

public java.lang.String getDMQId()
Return the unique identifier of DMQ set for this destination if any.

Specified by:
getDMQId in interface DestinationImplMBean
Returns:
the unique identifier of DMQ set for this destination if any; null otherwise.

getCreationTimeInMillis

public long getCreationTimeInMillis()
Returns this destination creation time as a long.

Specified by:
getCreationTimeInMillis in interface DestinationImplMBean
Returns:
the destination creation time as UTC milliseconds from the epoch.

getCreationDate

public java.lang.String getCreationDate()
Returns this destination creation time through a String of the form: dow mon dd hh:mm:ss zzz yyyy.

Specified by:
getCreationDate in interface DestinationImplMBean
Returns:
the destination creation time.

getNbMsgsReceiveSinceCreation

public abstract long getNbMsgsReceiveSinceCreation()
Returns the number of messages received since creation time of this destination.

Specified by:
getNbMsgsReceiveSinceCreation in interface DestinationImplMBean
Returns:
the number of messages received since creation time.

getNbMsgsDeliverSinceCreation

public long getNbMsgsDeliverSinceCreation()
Returns the number of messages delivered since creation time of this destination. It includes messages all delivered messages to a consumer, already acknowledged or not.

Specified by:
getNbMsgsDeliverSinceCreation in interface DestinationImplMBean
Returns:
the number of messages delivered since creation time.

getNbMsgsSentToDMQSinceCreation

public long getNbMsgsSentToDMQSinceCreation()
Returns the number of erroneous messages forwarded to the DMQ since creation time of this destination..

Specified by:
getNbMsgsSentToDMQSinceCreation in interface DestinationImplMBean
Returns:
the number of erroneous messages forwarded to the DMQ.

replyToTopic

protected void replyToTopic(AdminReply reply,
                            fr.dyade.aaa.agent.AgentId replyTo,
                            java.lang.String requestMsgId,
                            java.lang.String replyMsgId)

forward

public final void forward(fr.dyade.aaa.agent.AgentId to,
                          fr.dyade.aaa.agent.Notification not)

destinationAdminRequestNot

public abstract void destinationAdminRequestNot(fr.dyade.aaa.agent.AgentId from,
                                                DestinationAdminRequestNot not)

Joram 5.2.5

Copyright © 2000 - 2009 Scalagent D.T. - All rights reserved