projectinfosearch
Class AgentServer

java.lang.Object
  |
  +--projectinfosearch.AgentServer
All Implemented Interfaces:
AgentServerInt

public class AgentServer
extends java.lang.Object
implements AgentServerInt

An AgentServer must be "visible" and welcome agents to allow them to perform their mission


Constructor Summary
AgentServer(int serverPort)
          Creates a DiscoveryServer to become visible on a given multicast group and a ServerSocket to receive agents.
 
Method Summary
 void agentMigrate(AgentObject agent, java.net.InetAddress dstAddress, int dstport)
          The agent wants to be sent to dstAddr and dstPort.
 java.util.Vector getFootprints()
          optional, not implemented
 java.util.Vector getResidingAgents()
          optional, not implemented
 java.util.Vector getServerNeighbors()
          This method creates a DiscoveryClient which will find the server's neighbors
static void main(java.lang.String[] args)
          Reads the arguments from the command line (serverPort) and creates an AgentServer, quits if the procedure is wrong (wrong serverPort or nb of arguments).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AgentServer

public AgentServer(int serverPort)
Creates a DiscoveryServer to become visible on a given multicast group and a ServerSocket to receive agents. The TCP connections and the agent handling are performed by ReceivingThread.
Parameters:
serverPort - is the server port on which agents are expected
Method Detail

getServerNeighbors

public java.util.Vector getServerNeighbors()
This method creates a DiscoveryClient which will find the server's neighbors
Specified by:
getServerNeighbors in interface AgentServerInt
Returns:
a vector containing the neighbors

agentMigrate

public void agentMigrate(AgentObject agent,
                         java.net.InetAddress dstAddress,
                         int dstport)
The agent wants to be sent to dstAddr and dstPort. For this purpose a TCP connection is established. If the connection to another server is unsuccessful, the agent is sent home
Specified by:
agentMigrate in interface AgentServerInt
Parameters:
agent - is the AgentObject which wants to migrate
dstAddress - is the destination InetAddress
dstport - is the destination port

getFootprints

public java.util.Vector getFootprints()
optional, not implemented
Specified by:
getFootprints in interface AgentServerInt

getResidingAgents

public java.util.Vector getResidingAgents()
optional, not implemented
Specified by:
getResidingAgents in interface AgentServerInt

main

public static void main(java.lang.String[] args)
Reads the arguments from the command line (serverPort) and creates an AgentServer, quits if the procedure is wrong (wrong serverPort or nb of arguments).