cgl.narada.protocol
Class ProfilePropagationProtocol

java.lang.Object
  extended by cgl.narada.protocol.ProfilePropagationProtocol
All Implemented Interfaces:
ProtocolDebugFlags

public class ProfilePropagationProtocol
extends Object
implements ProtocolDebugFlags

This determines if a profile change needs to be propagated to a higher level node, and is responsible for doing so. In addition, a node could be gateway at multiple levels. Depending on the level for which profile changes have taken place, the propagation needs to be done accordingly.


Field Summary
 
Fields inherited from interface cgl.narada.protocol.ProtocolDebugFlags
BrokerLocatorCommunicator_Debug, ClientConnectionHandler_Debug, Connection_Debug, ConnectionPropagation_Debug, Destinations_Debug, DuplicateDetection_Debug, EventBuffer_Debug, EventRoutingProtocol_Debug, Gateway_Debug, GatewayInfo_Debug, GatewayPropagation_Debug, JmsProfilePropagation_Debug, LinkCostMatrix_Debug, NodeAdditionProtocol_Debug, NodeAddress_Debug, Path_Debug, PersistentEventRouting_Debug, ProfilePropagationProtocol_Debug, ProtocolException_Debug, ProtocolHandler_Debug, ProtocolID_Debug, ProtocolIDFactory_Debug, RoutingCache_Debug, RtpEventRoutingProtocol_Debug, RtpProfilePropagation_Debug, SecureMessageRouting_Debug, TagValueEventRoutingProtocol_Debug, TagValueProfilePropagation_Debug, XmlEventRoutingProtocol_Debug, XPathProfilePropagation_Debug
 
Constructor Summary
ProfilePropagationProtocol(GatewayInfo gatewayInfo, ProtocolHandler protocolHandler)
           
 
Method Summary
 Object computeEventDestinationsAtLevel(NBEvent nbEvent, int level)
          This method is called only if the isGatewayAtLevel returns true.
 void connectionToClientLost(Object clientIdentifier, String linkId)
           
 boolean isGatewayAtLevel(int level)
          This method indicates if the node in question is a gateway at the level in the argument
static void main(String[] args)
           
 byte[] marshallProfilesForSpecifiedLevelOnwards(int level)
          Marshall the profiles from a specified level onwards to a newly added node.
 void processMarshalledProfiles(byte[] marshalledBytes)
          Process the profiles bytes that have been received.
 void processProfilePropagationRequest(byte[] requestBytes, String sender)
          Handle profile propagation requests.
 void propagateProfileChange(Profile profile, int level, boolean addProfile)
          This method is responsible for propagating profile changes to trees at the next highest level.
 void setAsGatewayAtLevel(int level)
          This designates this node as a gateway at level level.
 void setDestination(Destinations destination)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProfilePropagationProtocol

public ProfilePropagationProtocol(GatewayInfo gatewayInfo,
                                  ProtocolHandler protocolHandler)
Method Detail

setDestination

public void setDestination(Destinations destination)

isGatewayAtLevel

public boolean isGatewayAtLevel(int level)
This method indicates if the node in question is a gateway at the level in the argument

Parameters:
level - The level for which we are testing if the node is a gateway.

setAsGatewayAtLevel

public void setAsGatewayAtLevel(int level)
This designates this node as a gateway at level level.


computeEventDestinationsAtLevel

public Object computeEventDestinationsAtLevel(NBEvent nbEvent,
                                              int level)
This method is called only if the isGatewayAtLevel returns true. This method computes the destinations associated with the matching of an event at a particular level

Parameters:
nbEvent - The event that needs to be matched.
level - The destinations at level (level-1) that we are interested in.
Returns:
The destinations that are associated with the event.

processProfilePropagationRequest

public void processProfilePropagationRequest(byte[] requestBytes,
                                             String sender)
Handle profile propagation requests. In some cases based on the toReach destinations that are received we need to provide the destination address more accurately.


propagateProfileChange

public void propagateProfileChange(Profile profile,
                                   int level,
                                   boolean addProfile)
This method is responsible for propagating profile changes to trees at the next highest level.

Parameters:
profile - This is the subscription profile that needs to be propagated.
level - The level for which this change is being propagated
addProfile - A boolean variable indicating wether this profile is being added to the system or is being removed.

connectionToClientLost

public void connectionToClientLost(Object clientIdentifier,
                                   String linkId)

marshallProfilesForSpecifiedLevelOnwards

public byte[] marshallProfilesForSpecifiedLevelOnwards(int level)
Marshall the profiles from a specified level onwards to a newly added node.

Parameters:
level -
Returns:

processMarshalledProfiles

public void processMarshalledProfiles(byte[] marshalledBytes)
Process the profiles bytes that have been received.

Parameters:
marshalledBytes -

main

public static void main(String[] args)


For comments and suggestions please send e-mail to The NaradaBrokering Project