com.agentfactory.cldc.name_service
Class UniqueNameService

java.lang.Object
  extended by com.agentfactory.cldc.Service
      extended by com.agentfactory.cldc.name_service.UniqueNameService

public class UniqueNameService
extends Service

The unique name service is responsible for updating local agent names so as that they are globally unique. A remote server is contacted to obtain a globally unique value. This value is appended to a local agent name to ensure that the name is unique.

Author:
Conor Muldoon

Constructor Summary
UniqueNameService(java.lang.String[] args, java.lang.Object[] agtNms, Scheduler scheduler)
          Creates a new instance of UniqueNameService.
 
Method Summary
 void modifyBinding(java.lang.Object oldName, java.lang.Object newName)
          Changes the name of an agent in the service's registry if one exists.
 FOS processAction(AgentName agentName, int actionID, FOS data)
          This method is used to determine what agent names have to be update and subsequently when a unique value has been obtained to update that relevant names.
 FOS processPer(AgentName agentName, int perceptionID)
          Perceives information from within the service.
 void run()
          In the unique name service the run method is blank.
 
Methods inherited from class com.agentfactory.cldc.Service
register
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UniqueNameService

public UniqueNameService(java.lang.String[] args,
                         java.lang.Object[] agtNms,
                         Scheduler scheduler)
Creates a new instance of UniqueNameService.

Parameters:
args - a string of arugments passed to the service.
agtNms - an array of agent name.
scheduler - a reference to the scheduler.
Method Detail

modifyBinding

public void modifyBinding(java.lang.Object oldName,
                          java.lang.Object newName)
Description copied from class: Service
Changes the name of an agent in the service's registry if one exists.

Specified by:
modifyBinding in class Service
Parameters:
oldName - the old name of the agent.
newName - the new name of the agent.

processPer

public FOS processPer(AgentName agentName,
                      int perceptionID)
               throws MalformedLogicException
Description copied from class: Service
Perceives information from within the service.

Specified by:
processPer in class Service
Parameters:
agentName - the agent that wishes to perceive the information.
perceptionID - the ID of the information that is to be perceived.
Returns:
a first order structure that represents the information that has been perceived in the service.
Throws:
MalformedLogicException - if there is a logic error.

processAction

public FOS processAction(AgentName agentName,
                         int actionID,
                         FOS data)
                  throws MalformedLogicException
This method is used to determine what agent names have to be update and subsequently when a unique value has been obtained to update that relevant names.

Specified by:
processAction in class Service
Parameters:
agentName - the name of the agent calling service.
actionID - the id of the action to perform.
data - the data to be used within an action.
Returns:
that data that is to be returned to the calling actuator.
Throws:
MalformedLogicException - if there is a logic error.

run

public void run()
In the unique name service the run method is blank.