madkit.netcomm
Class NetworkMessage

java.lang.Object
  extended by madkit.kernel.Message
      extended by madkit.netcomm.NetworkMessage
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public final class NetworkMessage
extends Message

Internal communication messages. Used for request within the netcomm MAS.

Version:
$Revision: 1.3 $
Author:
Sebastian Rodriguez - sebastian.rodriguez@utbm.fr
See Also:
Serialized Form

Field Summary
static int CONNECT_KERNEL
          Used to request the RouterAgent to create a connection with a distant client The argument is a vector containing: 0. the socket to use in the connection.
static int DIE
          Used to kill the p2pAgents
static int DISCONNECT
          Used to demand a P2PAgent to close the connection with its distant kernel
static int DISTANT_MESSAGE
          Used to indicate a P2PAgent that the argument is a distant message that should be sent to the kernel on the other end.
static int FOWARD_TO_KERNEL
          Used to request the Netagent to forward a message to the local kernel.
static int HANDLE_KERNEL_COMM
          Used to request a multipleConnectionHandler to handle the communication with a distant kernel.
static int KERNEL_CONNECTED
          This type of message is used to inform of a new Kernel connection.
static int KERNEL_DISCONNECTED
          This type of message is used to inform of a new Kernel disconnection.
static int ROUTE_MESSAGE
          Used to ask the Router Agent to Route a message;
static int SYNCH_REQUEST
          This type of messages request to the Router agent to build the HashSet containing the known kernel, their SocketKernels and the agent to route it.
static int SYNCH_REQUEST_REPLY
          This type of message is the reponse of the RouterAgent to the sender of a SYNCH_REQUEST The sent argument is a HashSet containg DistantKernelInformation objects.
static int UPDATE_AGENCIES_INFORMATIONS
          Used to allow an agent to get the KernelAddress of the agent named name.
static int UPDATE_ROUTE
          Used to request the router to update the agent who connects the kernel with a distant kernel.
static int UPDATE_ROUTE_DONE
          Used to ack a request to update a route.
 
Constructor Summary
NetworkMessage(int type, java.lang.Object arg)
          Creates a NetworkMessage type.
 
Method Summary
 java.lang.Object getArgument()
          Gets the argument of the message.
 int getType()
          Gets the message type
 
Methods inherited from class madkit.kernel.Message
clone, getCreationDate, getReceiver, getSender, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SYNCH_REQUEST

public static final int SYNCH_REQUEST
This type of messages request to the Router agent to build the HashSet containing the known kernel, their SocketKernels and the agent to route it. Althought the last information is not used at this moment, it will be used in future version to provide decentralized route when possible. The argument must containt a vector containing only the SocketKernels known by the distant Kernel.

See Also:
SYNCH_REQUEST_REPLY, Constant Field Values

SYNCH_REQUEST_REPLY

public static final int SYNCH_REQUEST_REPLY
This type of message is the reponse of the RouterAgent to the sender of a SYNCH_REQUEST The sent argument is a HashSet containg DistantKernelInformation objects.

See Also:
SYNCH_REQUEST, Constant Field Values

KERNEL_CONNECTED

public static final int KERNEL_CONNECTED
This type of message is used to inform of a new Kernel connection. The argument contains a String with the host and port

See Also:
Constant Field Values

KERNEL_DISCONNECTED

public static final int KERNEL_DISCONNECTED
This type of message is used to inform of a new Kernel disconnection. The argument is null.

See Also:
Constant Field Values

DISCONNECT

public static final int DISCONNECT
Used to demand a P2PAgent to close the connection with its distant kernel

See Also:
Constant Field Values

FOWARD_TO_KERNEL

public static final int FOWARD_TO_KERNEL
Used to request the Netagent to forward a message to the local kernel. This is need to ensure that the communications are handled by the Communicator.(This is tested by the site agent. eg. for new connections) the Argument is the message to foward.

See Also:
Constant Field Values

DISTANT_MESSAGE

public static final int DISTANT_MESSAGE
Used to indicate a P2PAgent that the argument is a distant message that should be sent to the kernel on the other end.

See Also:
Constant Field Values

ROUTE_MESSAGE

public static final int ROUTE_MESSAGE
Used to ask the Router Agent to Route a message;

See Also:
Constant Field Values

CONNECT_KERNEL

public static final int CONNECT_KERNEL
Used to request the RouterAgent to create a connection with a distant client The argument is a vector containing: 0. the socket to use in the connection.
1. the KernelAddress ID if it's known (Broadcast) or null
2. the SocketKernel if known.

See Also:
Constant Field Values

DIE

public static final int DIE
Used to kill the p2pAgents

See Also:
Constant Field Values

HANDLE_KERNEL_COMM

public static final int HANDLE_KERNEL_COMM
Used to request a multipleConnectionHandler to handle the communication with a distant kernel. The argument contains a vector with:
0. the socket
1. a hashset with the distant kernles

See Also:
Constant Field Values

UPDATE_ROUTE

public static final int UPDATE_ROUTE
Used to request the router to update the agent who connects the kernel with a distant kernel.
The Argument contains a Vector with:
0. The KernelAddress of the concerned kernel.
1. The AgentAddress of the P2PAgent responsible for the connection.
2. The new protocol.

See Also:
Constant Field Values

UPDATE_ROUTE_DONE

public static final int UPDATE_ROUTE_DONE
Used to ack a request to update a route.
The Argument containts: the kernelAddress of the updated route.

See Also:
Constant Field Values

UPDATE_AGENCIES_INFORMATIONS

public static final int UPDATE_AGENCIES_INFORMATIONS
Used to allow an agent to get the KernelAddress of the agent named name.
The Argument containts: the name of the kernel the agent is looking for.

See Also:
Constant Field Values
Constructor Detail

NetworkMessage

public NetworkMessage(int type,
                      java.lang.Object arg)
Creates a NetworkMessage type.

Parameters:
type - Type of the message
arg - message type dependant Argument.
Method Detail

getType

public int getType()
Gets the message type

Returns:
The type of message

getArgument

public java.lang.Object getArgument()
Gets the argument of the message. Please refer to the different message types to check its return.

Returns:
the message type


Copyright © Madkit Team (O. Gutknecht, J. Ferber, F. Michel et al.) All Rights Reserved.