com.cometway.om
Class AgentServer

java.lang.Object
  extended by com.cometway.props.Props
      extended by com.cometway.ak.Agent
          extended by com.cometway.ak.ServiceAgent
              extended by com.cometway.om.AgentServer
All Implemented Interfaces:
AgentInterface, AgentServerInterface, HasStateMachineModel

public class AgentServer
extends ServiceAgent
implements AgentServerInterface

A standard server interface to the agent kernel.


Field Summary
protected  java.lang.String agent_name_prefix
           
protected  AgentKernelInterface agentKernel
           
protected  Props agentList
           
protected  IObjectManager om
           
 
Fields inherited from class com.cometway.ak.Agent
agent_id, agentController, CREATING_STATE, debugReporter, DESTROYED_STATE, DESTROYING_STATE, errorReporter, FAILED_STATE, printlnReporter, props, RUNNING_STATE, STARTING_STATE, STOPPED_STATE, STOPPING_STATE, warningReporter
 
Constructor Summary
AgentServer()
           
 
Method Summary
 java.lang.String createAgent(ObjectID agentPropsID)
          Creates an agent instance based on an Object Manager Props referenced by the specified ObjectID or String.
 boolean destroyAgent(java.lang.String agentName)
          Calls the agent's destroy method, then destroys the agent instance.
 void initProps()
          Override this method to initialize this agent's properties before it is started.
 void start()
          Registers this instance with the service manager using the service_name property.
 boolean startAgent(java.lang.String agentName)
          Starts the specified agent instance by calling agent's start method.
 void stop()
          Unregisters this instance with the service manager using the service_name property.
 boolean stopAgent(java.lang.String agentName)
          Signals the specified agent to stop by calling the agent's stop method.
 
Methods inherited from class com.cometway.ak.Agent
currentStateEquals, debug, destroy, error, error, getAgentController, getDateTimeStr, getProps, getServiceImpl, getStateMachineModel, println, register, registerService, setAgentController, setProps, toString, unregister, unregisterService, warning, warning
 
Methods inherited from class com.cometway.props.Props
addListener, append, copy, copyFrom, copyTo, decrementInteger, dump, enableListeners, enumerateKeys, format, getBoolean, getByteArray, getCharacter, getDate, getDate, getDateString, getDouble, getFloat, getHexString, getInteger, getKeys, getLong, getNextKey, getProperty, getProperty, getPropsContainer, getSize, getString, getString, getTokens, getTokens, getTrimmedString, getVector, hasProperty, incrementInteger, insertProps, loadProps, notifyPropsChanged, notifyPropsChangedIgnore, notifyPropsChangedIgnore, parse, propertyMatchesRegEx, readFromFile, regExPropertyMatches, removeAll, removeListener, removeProperty, resumeNotify, saveProps, set, setBoolean, setCharacter, setDefault, setDouble, setFloat, setInteger, setLong, setProperty, setProperty, setProperty, setPropsContainer, suspendNotify, writeToFile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

om

protected IObjectManager om

agentKernel

protected AgentKernelInterface agentKernel

agentList

protected Props agentList

agent_name_prefix

protected java.lang.String agent_name_prefix
Constructor Detail

AgentServer

public AgentServer()
Method Detail

initProps

public void initProps()
Description copied from class: Agent
Override this method to initialize this agent's properties before it is started.

Specified by:
initProps in interface AgentInterface
Overrides:
initProps in class Agent

start

public void start()
Description copied from class: ServiceAgent
Registers this instance with the service manager using the service_name property.

Specified by:
start in interface AgentInterface
Overrides:
start in class ServiceAgent

stop

public void stop()
Description copied from class: ServiceAgent
Unregisters this instance with the service manager using the service_name property.

Specified by:
stop in interface AgentInterface
Overrides:
stop in class ServiceAgent

createAgent

public java.lang.String createAgent(ObjectID agentPropsID)
Creates an agent instance based on an Object Manager Props referenced by the specified ObjectID or String. The agent's initProps method is called before this method returns.

Specified by:
createAgent in interface AgentServerInterface
Returns:
a reference to an object identifying the created agent instance.

destroyAgent

public boolean destroyAgent(java.lang.String agentName)
Calls the agent's destroy method, then destroys the agent instance.

Specified by:
destroyAgent in interface AgentServerInterface
Returns:
true if successful; false otherwise.

startAgent

public boolean startAgent(java.lang.String agentName)
Starts the specified agent instance by calling agent's start method.

Specified by:
startAgent in interface AgentServerInterface
Returns:
true if successful; false otherwise.

stopAgent

public boolean stopAgent(java.lang.String agentName)
Signals the specified agent to stop by calling the agent's stop method.

Specified by:
stopAgent in interface AgentServerInterface
Returns:
true if successful; false otherwise.