agentland.util
Class SocketServerAgent

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--metaglue.AgentAgent
                          |
                          +--agentland.util.GoodAgent
                                |
                                +--agentland.resource.ManagedAgent
                                      |
                                      +--agentland.util.SocketServerAgent

public class SocketServerAgent
extends ManagedAgent
implements SocketServer

SocketServerAgent implements a SocketListener and SocketManager at the specified default port. Data of the correct form: |[Message]\n is announced via processMsg. (Where [Message] is the message to be sent.

See Also:
ManagedAgent, SocketServer, Serialized Form

Inner classes inherited from class metaglue.AgentAgent
AgentAgent.Attribute
 
Fields inherited from class agentland.resource.ManagedAgent
rm, society
 
Fields inherited from class agentland.util.GoodAgent
alert, notifier
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Fields inherited from interface metaglue.Agent
ALIVE, DIED, NO_METAGLUE, NOT_RUNNING, STARTING
 
Fields inherited from interface metaglue.Agent
ALIVE, DIED, NO_METAGLUE, NOT_RUNNING, STARTING
 
Constructor Summary
SocketServerAgent()
           
SocketServerAgent(int port)
           
 
Method Summary
 int getDefaultPort()
          Returns the default port on which the socket server should listen.
 void listen(int port)
          Specifies on which port to listen.
 void processMsg(String msg)
          Announces the data from the socket, if it is in the form: |[Message]\n.
 
Methods inherited from class agentland.resource.ManagedAgent
connect, getAlert, getNeed, reliesOn, reliesOn, replace, request, request, request, requestAgent, requestAgent, resources, resourcesByAgentID, setNeed, yank, yank, yank
 
Methods inherited from class agentland.util.GoodAgent
addSpy, addSpy, alert, alertString, beep, error, getHistory, getHistoryElement, getPersistentMap, log, notify, removeSpy, removeSpy, resetHistory, safeRely, safeRely, safeRely, setNiceLogName, tell
 
Methods inherited from class metaglue.AgentAgent
addMonitor, alive, defrost, defrostAll, defrostBoolean, defrostInt, defrostString, fixAttribute, fixAttribute, freeze, freeze, freeze, freezeAll, freezeVar, getAgentID, getAttribute, getCatalog, getCatalogID, getDesignation, getFrozenVariables, getLogLevel, getMetaglueAgent, getMetaglueAgentID, getOccupation, getProperties, getSociety, log, log, obtainMetaglueAgent, obtainMetaglueAgent, obtainMetaglueAgentByName, reliesOn, reliesOnSynch, removeFrozen, replaceExceptionHandler, setFreezeName, setLogLevel, setLogName, shutdown, startAgent, startAgentOn, startAgentOn, startup, status, tiedTo, tiedTo, tiedTo, tiedTo, tieToDesignation, whereAreYou
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SocketServerAgent

public SocketServerAgent(int port)
                  throws RemoteException

SocketServerAgent

public SocketServerAgent()
                  throws RemoteException
Method Detail

listen

public void listen(int port)
            throws RemoteException
Specifies on which port to listen.
Specified by:
listen in interface SocketServer
Parameters:
port - an int value
Throws:
RemoteException - if an error occurs

getDefaultPort

public int getDefaultPort()
                   throws RemoteException
Returns the default port on which the socket server should listen. Overrided in subclasses.
Specified by:
getDefaultPort in interface SocketServer
Returns:
an int value
Throws:
RemoteException - if an error occurs

processMsg

public void processMsg(String msg)
                throws RemoteException
Announces the data from the socket, if it is in the form: |[Message]\n. Announcement is made through System.out. Is Overrided in subclasses.
Specified by:
processMsg in interface SocketServer
Parameters:
msg - a String value
Throws:
RemoteException - if an error occurs