org.objectweb.joram.mom.dest
Class Destination

java.lang.Object
  extended by fr.dyade.aaa.agent.Agent
      extended by org.objectweb.joram.mom.dest.Destination
All Implemented Interfaces:
AgentMBean, java.io.Serializable, AdminDestinationItf
Direct Known Subclasses:
Queue, Topic

public abstract class Destination
extends Agent
implements AdminDestinationItf

A Destination agent is an agent hosting a MOM destination, for example a Queue or a Topic. Its behavior is provided by a DestinationImpl instance.

See Also:
AdminDestinationItf, Serialized Form

Field Summary
protected  DestinationImpl destImpl
          The reference of the DestinationItf instance providing this this agent with its Destination behaviour.
static org.objectweb.util.monolog.api.Logger logger
          logger
protected  WakeUpTask task
           
 
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.
abstract  DestinationImpl createsImpl(AgentId adminId, java.util.Properties prop)
          Creates the specific implementation.
 java.lang.String getMBeanName()
           
abstract  byte getType()
          Returns the type of this destination: Queue or Topic.
 void init(AgentId adminId, java.util.Properties props)
          Initializes the destination by creating the DestinationItf object.
 void react(AgentId from, Notification not)
          Distributes the received notifications to the appropriate reactions.
 void setFreeReading(boolean freeReading)
           
 void setFreeWriting(boolean freeWriting)
           
protected  void setNoSave()
          Sets the updated field to false so that the agent state is not saved after the current reaction; the field is set back to true for the next reaction.
private  void setPeriod(long period)
           
protected  void setSave()
          Sets the updated field to true so that the agent state is saved after the current reaction.
 
Methods inherited from class fr.dyade.aaa.agent.Agent
delete, delete, delete, deploy, deploy, getAgentId, getCommitTime, getId, getLogTopic, getName, getReactNb, getReactTime, isDeployed, isFixed, needToBeCommited, save, sendTo, sendTo, sendTo, setName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

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


destImpl

protected DestinationImpl destImpl
The reference of the DestinationItf instance providing this this agent with its Destination behaviour.


task

protected transient WakeUpTask task
Constructor Detail

Destination

public Destination()
Empty constructor for newInstance().


Destination

protected Destination(java.lang.String name,
                      boolean fixed,
                      int stamp)
Constructor with parameters for fixing the destination and specifying its identifier. It is uniquely used by the AdminTopic agent.

Method Detail

setFreeReading

public void setFreeReading(boolean freeReading)

setFreeWriting

public void setFreeWriting(boolean freeWriting)

init

public final void init(AgentId adminId,
                       java.util.Properties props)
                throws RequestException
Initializes the destination by creating the DestinationItf object.

Specified by:
init in interface AdminDestinationItf
Parameters:
adminId - Identifier of the destination administrator.
props - The initial set of properties.
Throws:
RequestException

createsImpl

public abstract DestinationImpl createsImpl(AgentId adminId,
                                            java.util.Properties prop)
                                     throws RequestException
Creates the specific implementation.

Parameters:
adminId - Identifier of the topic administrator.
prop - The initial set of properties.
Throws:
RequestException

getType

public abstract byte getType()
Returns the type of this destination: Queue or Topic.

Returns:
the type of this destination.
See Also:
DestinationConstants.TOPIC_TYPE, DestinationConstants.QUEUE_TYPE

agentInitialize

protected void agentInitialize(boolean firstTime)
                        throws java.lang.Exception
Gives this agent an opportunity to initialize after having been deployed, and each time it is loaded into memory.

Overrides:
agentInitialize in class Agent
Parameters:
firstTime - true when first called by the factory
Throws:
java.lang.Exception - unspecialized exception

agentFinalize

public void agentFinalize(boolean lastTime)
Finalizes the agent before it is garbaged.

Overrides:
agentFinalize in class Agent
Parameters:
lastTime - true when last called by the factory on agent deletion.

getMBeanName

public java.lang.String getMBeanName()

react

public void react(AgentId from,
                  Notification not)
           throws java.lang.Exception
Distributes the received notifications to the appropriate reactions.

Overrides:
react in class Agent
Parameters:
from - agent sending notification
not - notification to react to
Throws:
java.lang.Exception

setPeriod

private void setPeriod(long period)

setNoSave

protected void setNoSave()
Description copied from class: Agent
Sets the updated field to false so that the agent state is not saved after the current reaction; the field is set back to true for the next reaction.

Overrides:
setNoSave in class Agent

setSave

protected void setSave()
Description copied from class: Agent
Sets the updated field to true so that the agent state is saved after the current reaction.

Overrides:
setSave in class Agent


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