planet.commonapi.behaviours
Interface Behaviour

All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
AcceptConnectBehaviour, CancelConnectBehaviour, CloseLongConnectBehaviour, CloseNeighbourConnectBehaviour, DataBehaviour, DataBehaviour, DropBehaviour, QueryConnectBehaviour, QueryJoinBehaviour, RoutingBehaviour, SetInfoBehaviour

public interface Behaviour
extends java.io.Serializable

This interface provides a method to add functionality to a behvaiour.

Author:
Marc Sanchez

Method Summary
 java.lang.String getName()
           
 void onMessage(RouteMessage msg, Node node)
          Given a RouteMessage and a Node as input, onMessage's method do execution steps for the behaviour.
 java.lang.String toString()
           
 

Method Detail

onMessage

public void onMessage(RouteMessage msg,
                      Node node)
Given a RouteMessage and a Node as input, onMessage's method do execution steps for the behaviour. Node should be casted to Node's class in order to manage data structures and protocol of designed overlay.

IMPORTANT: The original RouteMessage msg must suffer no changes. Any response must be made with a new RouteMessage, obtained from MessagePool.

Parameters:
msg - RouteMessage taken as input.
node - Node taken as input.
See Also:
RouteMessagePoolImpl

getName

public java.lang.String getName()
Returns:
Returns the name of behaviour.

toString

public java.lang.String toString()
Returns:
Returns a string representation of the behaviour. In general, the toString method returns a string that "textually represents" this behaviour. The result should be a concise but informative representation that is easy for a person to read.