org.objectweb.joram.mom.dest
Class AdminTopic

java.lang.Object
  extended by fr.dyade.aaa.agent.Agent
      extended by org.objectweb.joram.mom.dest.Destination
          extended by org.objectweb.joram.mom.dest.Topic
              extended by org.objectweb.joram.mom.dest.AdminTopic
All Implemented Interfaces:
AgentMBean, java.io.Serializable, AdminTopicMBean, ClusterDestinationMBean, DestinationMBean, TopicMBean

public final class AdminTopic
extends Topic
implements AdminTopicMBean

The AdminTopic class implements the administration topic behavior, basically processing administration requests.

It receives administration requests from the client encapsulated in JMS messages:

(*) Currently the getRights reply is handled differently as it needs the transformation of the user list. This behavior should disappear with the role based mechanism.

See Also:
Serialized Form

Nested Class Summary
static class AdminTopic.DestinationDesc
           
 
Field Summary
 
Fields inherited from class org.objectweb.joram.mom.dest.Topic
alreadySentLocally, fatherId, friends, logger, selectors, subscribers
 
Fields inherited from class org.objectweb.joram.mom.dest.Destination
_rights, clients, creationDate, dmqId, freeReading, freeWriting, nbMsgsDeliverSinceCreation, nbMsgsReceiveSinceCreation, nbMsgsSentToDMQSinceCreation, READ, READWRITE, task, WAKEUP_PERIOD, WRITE
 
Fields inherited from class fr.dyade.aaa.agent.Agent
emptyString, fixed, logmon
 
Constructor Summary
AdminTopic()
          Constructs an AdminTopic agent.
 
Method Summary
protected  void clusterJoin(ClusterJoinNot not)
          Overrides this Topic method; if this AdminTopic is on server0, new cluster fellow is notified to other fellows and other fellows are notified to it.
protected  void clusterJoinAck(ClusterJoinAck ack)
          Overrides this Topic method; a ClusterAck is not expected by an AdminTopic.
 void createQueue(java.lang.String name)
          Creates a new queue on the local server.
 void createQueue(java.lang.String name, int serverId)
          Creates a new queue on the selected server.
 void createQueue(java.lang.String name, java.lang.String queueClassName, int serverId)
          Creates a new queue on the selected server.
 void createTopic(java.lang.String name)
          Creates a new topic on the local server.
 void createTopic(java.lang.String name, int serverId)
          Creates a new topic on the selected server.
 void createTopic(java.lang.String name, java.lang.String topicClassName, int serverId)
          Creates a new topic on the selected server.
 void createUser(java.lang.String user, java.lang.String passwd)
          Creates a new user on the local server.
 void createUser(java.lang.String user, java.lang.String passwd, int serverId)
          Creates a new user on the selected server.
 void createUser(java.lang.String user, java.lang.String passwd, int serverId, java.lang.String identityClassName)
          Creates a new user on the selected server.
 void deleteNot(AgentId from, DeleteNot not)
          Overrides this Destination method.
static void deleteUser(java.lang.String userName)
           
protected  void doUnknownAgent(UnknownAgent uA)
          Specializes this Topic reaction.
static AgentId getDefault()
          Gets the identifier of the default administration topic on the current server.
static AgentId getDefault(short serverId)
          Gets the identifier of the default administration topic on a given server.
protected  void handleDeniedMessage(java.lang.String msgId, AgentId replyTo)
          Method used to send a response when a message is denied because of a lack of rights.
static boolean isAdminTopicId(AgentId id)
          Returns true if the given AgentId is the unique identifier of an AdminTopic agent.
static AdminTopic.DestinationDesc lookupDest(java.lang.String name, byte type)
          Retrieves an existing destination.
protected  ClientMessages preProcess(AgentId from, ClientMessages msgs)
          Overrides this Destination method;
 void react(AgentId from, Notification not)
          Distributes the received notifications to the appropriate reactions.
static void registerDest(AgentId id, java.lang.String name, byte type)
          Registers a newly created destination.
protected  void requestGroupNot(AgentId from, RequestGroupNot not)
           
protected  void topicForwardNot(AgentId from, TopicForwardNot not)
          Overrides this Topic method; the forwarded messages contain admin requests and will be processed.
 java.lang.String toString()
          Returns a string representation of this destination.
static void unregisterDest(java.lang.String name)
          Removes a registered destination.
 
Methods inherited from class org.objectweb.joram.mom.dest.Topic
doClientMessages, doDeleteNot, doRightRequest, forwardMessages, getClusterElements, getNbMsgsReceiveSinceCreation, getNumberOfSubscribers, getSubscriberIds, getType, handleAdminRequestNot, initialize, postSubscribe, postUnsubscribe, preSubscribe, preUnsubscribe, processMessages, sendToCluster, setAlreadySentLocally, subscribeRequest, unsubscribeRequest, wakeUpNot
 
Methods inherited from class org.objectweb.joram.mom.dest.Destination
agentFinalize, agentInitialize, clientMessages, delete, forward, getCreationDate, getCreationTimeInMillis, getDestinationId, getDMQAgentId, getDMQId, getJMXStatistics, getMBeanName, getNbMsgsDeliverSinceCreation, getNbMsgsSentToDMQSinceCreation, getPeriod, getRight, getRights, getRights, interceptorsAvailable, isAdministrator, isFreeReading, isFreeWriting, isLocal, isReader, isValidJMXAttribute, isWriter, postProcess, processAdminCommand, processInterceptors, processSetRight, processStartHandler, processStopHandler, replyToTopic, setAdminId, setFreeReading, setFreeWriting, setPeriod, setProperties, setRight, unknownAgent, updateProperties
 
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
 
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.TopicMBean
getNumberOfSubscribers, getSubscriberIds
 
Methods inherited from interface org.objectweb.joram.mom.dest.DestinationMBean
delete, getCreationDate, getCreationTimeInMillis, getDestinationId, getDMQId, getName, getNbMsgsDeliverSinceCreation, getNbMsgsReceiveSinceCreation, getNbMsgsSentToDMQSinceCreation, getPeriod, getRight, getRights, isFreeReading, isFreeWriting, setFreeReading, setFreeWriting, setPeriod
 
Methods inherited from interface fr.dyade.aaa.agent.AgentMBean
getAgentId, getCommitTime, getReactNb, getReactTime, isFixed
 
Methods inherited from interface org.objectweb.joram.mom.dest.ClusterDestinationMBean
getClusterElements
 

Constructor Detail

AdminTopic

public AdminTopic()
           throws RequestException
Constructs an AdminTopic agent.

Throws:
RequestException
Method Detail

toString

public java.lang.String toString()
Description copied from class: Topic
Returns a string representation of this destination.

Specified by:
toString in interface AgentMBean
Specified by:
toString in interface DestinationMBean
Overrides:
toString in class Topic
Returns:
A string representation of this agent.

getDefault

public static AgentId getDefault(short serverId)
Gets the identifier of the default administration topic on a given server.


getDefault

public static final AgentId getDefault()
Gets the identifier of the default administration topic on the current server.


isAdminTopicId

public static final boolean isAdminTopicId(AgentId id)
Returns true if the given AgentId is the unique identifier of an AdminTopic agent.

Parameters:
id - the AgentId to verify.
Returns:
true if the given AgentId is the unique identifier of an AdminTopic agent.

react

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

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

handleDeniedMessage

protected void handleDeniedMessage(java.lang.String msgId,
                                   AgentId replyTo)
Method used to send a response when a message is denied because of a lack of rights.

Overrides:
handleDeniedMessage in class Destination

requestGroupNot

protected void requestGroupNot(AgentId from,
                               RequestGroupNot not)
Overrides:
requestGroupNot in class Destination

preProcess

protected ClientMessages preProcess(AgentId from,
                                    ClientMessages msgs)
Overrides this Destination method;

Overrides:
preProcess in class Destination
Parameters:
msgs - ClientMessages notifications hold requests sent by an administrator.
from - The sender of the message
Returns:
The incoming messages after processing.

clusterJoinAck

protected void clusterJoinAck(ClusterJoinAck ack)
Overrides this Topic method; a ClusterAck is not expected by an AdminTopic.

Overrides:
clusterJoinAck in class Topic

clusterJoin

protected void clusterJoin(ClusterJoinNot not)
Overrides this Topic method; if this AdminTopic is on server0, new cluster fellow is notified to other fellows and other fellows are notified to it.

Overrides:
clusterJoin in class Topic

topicForwardNot

protected void topicForwardNot(AgentId from,
                               TopicForwardNot not)
Overrides this Topic method; the forwarded messages contain admin requests and will be processed.

Overrides:
topicForwardNot in class Topic

deleteNot

public void deleteNot(AgentId from,
                      DeleteNot not)
Overrides this Destination method. Deletion requests are not accepted by AdminTopics.

Overrides:
deleteNot in class Destination

doUnknownAgent

protected void doUnknownAgent(UnknownAgent uA)
Specializes this Topic reaction.

Overrides:
doUnknownAgent in class Topic

createUser

public void createUser(java.lang.String user,
                       java.lang.String passwd)
                throws java.lang.Exception
Creates a new user on the local server. SimpleIdentity class is used.

Specified by:
createUser in interface AdminTopicMBean
Parameters:
user - the user name
passwd - the user password
Throws:
java.lang.Exception

createUser

public void createUser(java.lang.String user,
                       java.lang.String passwd,
                       int serverId)
                throws java.lang.Exception
Creates a new user on the selected server. SimpleIdentity class is used.

Specified by:
createUser in interface AdminTopicMBean
Parameters:
user - the user name
passwd - the user password
serverId - the server where the user will be created
Throws:
java.lang.Exception

createUser

public void createUser(java.lang.String user,
                       java.lang.String passwd,
                       int serverId,
                       java.lang.String identityClassName)
                throws java.lang.Exception
Creates a new user on the selected server.

Specified by:
createUser in interface AdminTopicMBean
Parameters:
user - the user name
passwd - the user password
serverId - the server where the user will be created
identityClassName - the identity class name to instantiate
Throws:
java.lang.Exception

createQueue

public void createQueue(java.lang.String name)
Creates a new queue on the local server.

Specified by:
createQueue in interface AdminTopicMBean
Parameters:
name - the queue name

createQueue

public void createQueue(java.lang.String name,
                        int serverId)
Creates a new queue on the selected server. The queue will be an instance of Queue.

Specified by:
createQueue in interface AdminTopicMBean
Parameters:
name - the topic name
serverId - the server where the queue will be deployed

createQueue

public void createQueue(java.lang.String name,
                        java.lang.String queueClassName,
                        int serverId)
Creates a new queue on the selected server.

Specified by:
createQueue in interface AdminTopicMBean
Parameters:
name - the topic name
queueClassName - the queue class to instantiate
serverId - the server where the queue will be deployed

createTopic

public void createTopic(java.lang.String name)
Creates a new topic on the local server.

Specified by:
createTopic in interface AdminTopicMBean
Parameters:
name - the topic name

createTopic

public void createTopic(java.lang.String name,
                        int serverId)
Creates a new topic on the selected server. The topic will be an instance of Topic.

Specified by:
createTopic in interface AdminTopicMBean
Parameters:
name - the topic name
serverId - the server where the topic will be deployed

createTopic

public void createTopic(java.lang.String name,
                        java.lang.String topicClassName,
                        int serverId)
Creates a new topic on the selected server.

Specified by:
createTopic in interface AdminTopicMBean
Parameters:
name - the topic name
topicClassName - the topic class to instantiate
serverId - the server where the topic will be deployed

deleteUser

public static void deleteUser(java.lang.String userName)

lookupDest

public static AdminTopic.DestinationDesc lookupDest(java.lang.String name,
                                                    byte type)
                                             throws RequestException
Retrieves an existing destination.

Parameters:
name - The name of the destination.
type - The type of the destination.
Returns:
the descriptor of the destination, null if it does not exist.
Throws:
RequestException - If the existing destination have a different type.

registerDest

public static void registerDest(AgentId id,
                                java.lang.String name,
                                byte type)
Registers a newly created destination.

Parameters:
id - The unique identifier of the created destination.
name - The name of the created destination.
type - The type of the created destination.
Throws:
java.io.IOException - If an error occurs during saving.

unregisterDest

public static void unregisterDest(java.lang.String name)
Removes a registered destination.

Parameters:
name - The name of the destination to remove.


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