org.objectweb.joram.mom.dest

Class TopicImpl

Implemented Interfaces:
java.io.Serializable
Known Direct Subclasses:
AdminTopicImpl, BridgeTopicImpl

public class TopicImpl
extends DestinationImpl

The TopicImpl class implements the MOM topic behaviour, basically distributing the received messages to subscribers.

A Topic might be part of a hierarchy; if it is the case, and if the topic is not on top of that hierarchy, it will have a father to forward messages to.

A topic might also be part of a cluster; if it is the case, it will have friends to forward messages to.

A topic can't be part of a hierarchy and of a cluster at the same time.

See Also:
Serialized Form

Field Summary

protected boolean
alreadySentLocally
Internal boolean used for tagging local sendings.
protected AgentId
fatherId
Identifier of this topic's father, if any.
protected Vector
friends
Vector of cluster fellows, if any.
protected Hashtable
selectors
Table of subscribers' selectors.
protected Vector
subscribers
Vector of subscribers' identifiers.

Fields inherited from class org.objectweb.joram.mom.dest.DestinationImpl

READ, READWRITE, WRITE, adminId, clients, destId, dmqId, freeReading, freeWriting

Constructor Summary

TopicImpl(AgentId destId, AgentId adminId)
Constructs a TopicImpl instance.

Method Summary

protected void
doProcess(DeleteNot not)
Method specifically processing a fr.dyade.aaa.agent.DeleteNot instance.
protected void
doProcess(UnknownAgent uA)
Method specifically processing an UnknownAgent instance.
protected void
doProcess(ClientMessages not)
Method specifically processing a ClientMessages instance.
protected void
doProcess(SetRightRequest not)
Method specifically processing a SetRightRequest instance.
protected void
doReact(AgentId from, org.objectweb.joram.mom.dest.ClusterAck ack)
Method implementing the reaction to a ClusterAck notification sent by a topic requested to join the cluster.
protected void
doReact(AgentId from, org.objectweb.joram.mom.dest.ClusterNot not)
Method implementing the reaction to a ClusterNot notification sent by a fellow topic for notifying this topic of a new cluster fellow.
protected void
doReact(AgentId from, org.objectweb.joram.mom.dest.ClusterTest not)
Method implementing the reaction to a ClusterTest notification sent by a fellow topic for testing if this topic might be part of a cluster.
protected void
doReact(AgentId from, org.objectweb.joram.mom.dest.FatherAck not)
Method reacting to a FatherAck notification coming from the topic this topic requested as a father.
protected void
doReact(AgentId from, org.objectweb.joram.mom.dest.FatherTest not)
Method reacting to a FatherTest notification checking if it can be a father to a topic.
protected void
doReact(AgentId from, org.objectweb.joram.mom.dest.TopicForwardNot not)
Method implementing the reaction to a TopicForwardNot instance, carrying messages forwarded by a cluster fellow or a hierarchical son.
protected void
doReact(AgentId from, org.objectweb.joram.mom.dest.UnclusterNot not)
Method implementing the reaction to an UnclusterNot notification sent by a topic leaving the cluster.
protected void
doReact(AgentId from, ClusterRequest req)
Method implementing the reaction to a ClusterRequest instance requesting to add a topic to the cluster, or to set a cluster with a given topic.
protected void
doReact(AgentId from, Monit_GetCluster not)
Method implementing the reaction to a Monit_GetCluster notification requesting the identifiers of the cluster's topics.
protected void
doReact(AgentId from, Monit_GetFather not)
Method implementing the reaction to a Monit_GetFather notification requesting the identifier of the hierarchical father.
protected void
doReact(AgentId from, Monit_GetSubscriptions not)
Method implementing the reaction to a Monit_GetSubscriptions notification requesting the number of subscriptions.
protected void
doReact(AgentId from, SetFatherRequest request)
Method implementing the reaction to a SetFatherRequest instance notifying this topic it is part of a hierarchy as a son.
protected void
doReact(AgentId from, SubscribeRequest not)
Method implementing the reaction to a SubscribeRequest instance.
protected void
doReact(AgentId from, UnclusterRequest request)
Method implementing the reaction to an UnclusterRequest instance requesting this topic to leave the cluster it is part of.
protected void
doReact(AgentId from, UnsetFatherRequest request)
Method implementing the reaction to an UnsetFatherRequest instance notifying this topic to leave its father.
protected void
doReact(AgentId from, UnsubscribeRequest not)
Method implementing the reaction to an UnsubscribeRequest instance, requesting to remove a subscriber.
protected void
forwardMessages(ClientMessages messages)
Actually forwards a vector of messages to the father or the cluster fellows, if any.
protected void
processMessages(ClientMessages not)
Actually processes the distribution of the received messages to the valid subscriptions by sending a TopicMsgsReply notification to the valid subscribers.
void
react(AgentId from, Notification not)
Distributes the received notifications to the appropriate reactions.
protected void
specialProcess(Notification not)
The DestinationImpl class calls this method for passing notifications which have been partly processed, so that they are specifically processed by the TopicImpl class.
String
toString()

Methods inherited from class org.objectweb.joram.mom.dest.DestinationImpl

canBeDeleted, doReact, doReact, doReact, doReact, doReact, doReact, doReact, doReact, doReact, doReact, isAdministrator, isReader, isWriter, processSetRight, react, sendToDMQ, specialAdminProcess, specialProcess

Field Details

alreadySentLocally

protected boolean alreadySentLocally
Internal boolean used for tagging local sendings.


fatherId

protected AgentId fatherId
Identifier of this topic's father, if any.


friends

protected Vector friends
Vector of cluster fellows, if any.


selectors

protected Hashtable selectors
Table of subscribers' selectors.


subscribers

protected Vector subscribers
Vector of subscribers' identifiers.

Constructor Details

TopicImpl

public TopicImpl(AgentId destId,
                 AgentId adminId)
Constructs a TopicImpl instance.

Parameters:
destId - Identifier of the agent hosting the topic.
adminId - Identifier of the administrator of the topic.

Method Details

doProcess

protected void doProcess(DeleteNot not)
Method specifically processing a fr.dyade.aaa.agent.DeleteNot instance.

UnknownAgent notifications are sent to each subscriber and UnclusterNot notifications to the cluster fellows.


doProcess

protected void doProcess(UnknownAgent uA)
Method specifically processing an UnknownAgent instance.

This method notifies the administrator of the failing cluster or hierarchy building request, if needed, or removes the subscriptions of the deleted client, if any, or sets the father identifier to null if it comes from a deleted father.


doProcess

protected void doProcess(ClientMessages not)
Method specifically processing a ClientMessages instance.

This method may forward the messages to the topic father if any, or to the cluster fellows if any.It may finally send TopicMsgsReply instances to the valid subscribers.


doProcess

protected void doProcess(SetRightRequest not)
Method specifically processing a SetRightRequest instance.

When a reader is removed, deleting this reader's subscription if any, and sending an ExceptionReply notification to the client.


doReact

protected void doReact(AgentId from,
                       org.objectweb.joram.mom.dest.ClusterAck ack)
Method implementing the reaction to a ClusterAck notification sent by a topic requested to join the cluster.


doReact

protected void doReact(AgentId from,
                       org.objectweb.joram.mom.dest.ClusterNot not)
Method implementing the reaction to a ClusterNot notification sent by a fellow topic for notifying this topic of a new cluster fellow.


doReact

protected void doReact(AgentId from,
                       org.objectweb.joram.mom.dest.ClusterTest not)
Method implementing the reaction to a ClusterTest notification sent by a fellow topic for testing if this topic might be part of a cluster.


doReact

protected void doReact(AgentId from,
                       org.objectweb.joram.mom.dest.FatherAck not)
Method reacting to a FatherAck notification coming from the topic this topic requested as a father.


doReact

protected void doReact(AgentId from,
                       org.objectweb.joram.mom.dest.FatherTest not)
Method reacting to a FatherTest notification checking if it can be a father to a topic.


doReact

protected void doReact(AgentId from,
                       org.objectweb.joram.mom.dest.TopicForwardNot not)
Method implementing the reaction to a TopicForwardNot instance, carrying messages forwarded by a cluster fellow or a hierarchical son.


doReact

protected void doReact(AgentId from,
                       org.objectweb.joram.mom.dest.UnclusterNot not)
Method implementing the reaction to an UnclusterNot notification sent by a topic leaving the cluster.


doReact

protected void doReact(AgentId from,
                       ClusterRequest req)
            throws AccessException
Method implementing the reaction to a ClusterRequest instance requesting to add a topic to the cluster, or to set a cluster with a given topic.

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


doReact

protected void doReact(AgentId from,
                       Monit_GetCluster not)
            throws AccessException
Method implementing the reaction to a Monit_GetCluster notification requesting the identifiers of the cluster's topics.

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


doReact

protected void doReact(AgentId from,
                       Monit_GetFather not)
            throws AccessException
Method implementing the reaction to a Monit_GetFather notification requesting the identifier of the hierarchical father.

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


doReact

protected void doReact(AgentId from,
                       Monit_GetSubscriptions not)
            throws AccessException
Method implementing the reaction to a Monit_GetSubscriptions notification requesting the number of subscriptions.

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


doReact

protected void doReact(AgentId from,
                       SetFatherRequest request)
            throws MomException
Method implementing the reaction to a SetFatherRequest instance notifying this topic it is part of a hierarchy as a son.


doReact

protected void doReact(AgentId from,
                       SubscribeRequest not)
            throws AccessException
Method implementing the reaction to a SubscribeRequest instance.

Throws:
AccessException - If the sender is not a READER.


doReact

protected void doReact(AgentId from,
                       UnclusterRequest request)
            throws MomException
Method implementing the reaction to an UnclusterRequest instance requesting this topic to leave the cluster it is part of.


doReact

protected void doReact(AgentId from,
                       UnsetFatherRequest request)
            throws MomException
Method implementing the reaction to an UnsetFatherRequest instance notifying this topic to leave its father.


doReact

protected void doReact(AgentId from,
                       UnsubscribeRequest not)
Method implementing the reaction to an UnsubscribeRequest instance, requesting to remove a subscriber.


forwardMessages

protected void forwardMessages(ClientMessages messages)
Actually forwards a vector of messages to the father or the cluster fellows, if any.


processMessages

protected void processMessages(ClientMessages not)
Actually processes the distribution of the received messages to the valid subscriptions by sending a TopicMsgsReply notification to the valid subscribers.


react

public void react(AgentId from,
                  Notification not)
            throws UnknownNotificationException
Distributes the received notifications to the appropriate reactions.
Overrides:
react in interface DestinationImpl

Throws:
UnknownNotificationException - If a received notification is unexpected by the topic.


specialProcess

protected void specialProcess(Notification not)
The DestinationImpl class calls this method for passing notifications which have been partly processed, so that they are specifically processed by the TopicImpl class.
Overrides:
specialProcess in interface DestinationImpl


toString

public String toString()


Copyright B) 2004 Scalagent - All rights reserved