madkit.netcomm
Class MadkitNetworkAgent

java.lang.Object
  extended by madkit.kernel.AbstractAgent
      extended by madkit.kernel.Agent
          extended by madkit.netcomm.MadkitNetworkAgent
All Implemented Interfaces:
java.io.Serializable, java.lang.Runnable
Direct Known Subclasses:
NetAgent

public abstract class MadkitNetworkAgent
extends Agent

This the generic Networking Agent. Containts mostly standard information usefull for several agents type in the networking MAS

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

Field Summary
protected static java.lang.String community
          Utility variable.
protected static java.lang.String group
          The Netwoking group.
protected static java.lang.Object memberCard
          This is the member card for the networking agents. only agents extending this type of agent will be allowed into the Community.
protected  AgentAddress myKernel
          The Local's kernel address.
 
Constructor Summary
MadkitNetworkAgent()
           
 
Method Summary
 void activate()
          This methods has been overloaded to initialize some of the variables provided by this agent.
protected  void bytesReceived(long bytes)
           
protected  void bytesSent(long bytes)
           
 void debug(java.lang.String s)
          Print out debug information only if the debug flag is on
protected  void fatatError(java.lang.String msg)
          Used to report fatal errors in the communications proccess.
protected  void fatatError(java.lang.String msg, java.lang.Throwable exp)
          Used to report fatal errors in the communications proccess.
protected  long getReceivedBytesCount()
           
protected  long getSentBytesCount()
           
protected  void handleConfigMessage(NetConfigMessage message)
          Handles the Configuration messages.
protected abstract  void handleNetworkMessage(NetworkMessage message)
          Handles the internal messages.
 void print(java.lang.String theString)
          Prints text information in a environment-independant way (GUI, console, ...)
 void println(java.lang.String theString)
          Prints text information in a environment-independant way (GUI, console, ...)
protected  void reset()
           
 
Methods inherited from class madkit.kernel.Agent
connectAgencyToAgency, createPlace, createPlace, enableMobility, enableMobility, exitImmediatlyOnKill, getAgencyNamed, joinPlace, joinPlace, joinPlace, live, pause, receiveMessage, run, waitNextMessage, waitNextMessage
 
Methods inherited from class madkit.kernel.AbstractAgent
broadcastMessage, broadcastMessage, connectedWithCommunity, createGroup, createGroup, disposeMyGUI, end, foundGroup, getAddress, getAgentInformation, getAgentsWithRole, getAgentsWithRole, getAgentWithRole, getAgentWithRole, getAvailableCommunities, getBean, getController, getCurrentKernelAddress, getDebug, getExistingGroups, getExistingGroups, getExistingRoles, getExistingRoles, getGroups, getGUIObject, getMessageBoxSize, getMyGroups, getMyGroups, getMyRoles, getMyRoles, getName, getRoles, hasGUI, initGUI, isBelongingToGroup, isBelongingToGroup, isCommunity, isGroup, isGroup, isMemberOf, isMemberOf, isMessageBoxEmpty, isRole, isRole, joinGroup, killAgent, launchAgent, launchAgent, leaveGroup, leaveGroup, leaveRole, leaveRole, nextMessage, redisplayMyGUI, requestRole, requestRole, requestRole, restoreAgent, sendMessage, sendMessage, sendMessage, setBean, setController, setDebug, setGUIObject, setName, setOutput, setOutputWriter, windowClosing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

memberCard

protected static java.lang.Object memberCard
This is the member card for the networking agents. only agents extending this type of agent will be allowed into the Community. This Is mainly because of security reasons.


community

protected static final java.lang.String community
Utility variable. It holds the Community name for the Networking agent.

See Also:
Constant Field Values

group

protected static final java.lang.String group
The Netwoking group.

See Also:
Constant Field Values

myKernel

protected AgentAddress myKernel
The Local's kernel address.

Constructor Detail

MadkitNetworkAgent

public MadkitNetworkAgent()
Method Detail

debug

public void debug(java.lang.String s)
Description copied from class: AbstractAgent
Print out debug information only if the debug flag is on

Overrides:
debug in class AbstractAgent

print

public void print(java.lang.String theString)
Description copied from class: AbstractAgent
Prints text information in a environment-independant way (GUI, console, ...)

Overrides:
print in class AbstractAgent

println

public void println(java.lang.String theString)
Description copied from class: AbstractAgent
Prints text information in a environment-independant way (GUI, console, ...)

Overrides:
println in class AbstractAgent

fatatError

protected void fatatError(java.lang.String msg,
                          java.lang.Throwable exp)
Used to report fatal errors in the communications proccess. This method should be used only when a unrecoverable error has occured

Parameters:
msg -
exp -

fatatError

protected void fatatError(java.lang.String msg)
Used to report fatal errors in the communications proccess. This method should be used only when a unrecoverable error has occured

Parameters:
msg -

handleNetworkMessage

protected abstract void handleNetworkMessage(NetworkMessage message)
Handles the internal messages.

Parameters:
message -
See Also:
NetworkMessage

handleConfigMessage

protected void handleConfigMessage(NetConfigMessage message)
Handles the Configuration messages. These messages might have influence only in a few type of agents.

Parameters:
message -
See Also:
NetConfigMessage

activate

public void activate()
This methods has been overloaded to initialize some of the variables provided by this agent. Please remember to all it before your own activate method.

Overrides:
activate in class AbstractAgent
See Also:
AbstractAgent.activate()

getSentBytesCount

protected long getSentBytesCount()

getReceivedBytesCount

protected long getReceivedBytesCount()

bytesReceived

protected void bytesReceived(long bytes)

bytesSent

protected void bytesSent(long bytes)

reset

protected void reset()


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