|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.iids.aos.systemservices.module.AbstractModule
org.iids.aos.api.AgentScapeApiImpl
public class AgentScapeApiImpl
Implementation of the AgentScapeApi.
This class does not directly implement the AgentScapeApi interface (this is implemented by the AgentScapeApiRmiServer. The RMI server (or some other RPC mechanism, like a SunRpc server) receives incoming function calls, and forwards these to this AgentScapeApiImpl.
All functions in this class have exactly the same semantics as the functions
in the AgentScapeApi, except for that methods do not throw a
RemoteException. Therefore, the JavaDoc documentation can
be found in that interface. The methods behave exactly the same.
AgentScapeApi| Method Summary | |
|---|---|
AgreementOffer |
acceptLease(AgentScapeID location,
java.lang.String leaseId)
|
AgentInfo |
createAgent(AgentScapeID location,
AgentArchive arch)
|
AgentInfo |
createAgent(AgentScapeID location,
Language lang)
|
AgentInfo |
createAgent(AgentScapeID location,
Language lang,
byte[] code)
|
AgentInfo |
createAgent(java.lang.String lease,
AgentArchive arch)
|
AgentHandle |
createAgentHandle(AgentHandle handle)
|
static AgentScapeApiImpl |
createInstance(AgentScapeConfig config,
Communicator comm,
AsLookupService lookupService)
Create instance of the API. |
static AgentScapeApiImpl |
createPrivateInstance(AgentScapeConfig config,
Communicator comm,
AsLookupService lookupService)
Creates a 'private' instance of the agentscape api. |
void |
deleteCodeSegment(AgentHandle handle,
AgentCodeSegment segment)
|
void |
deleteDataSegment(AgentHandle handle,
AgentDataSegment segment)
|
AgentArchive |
exportAgent(AgentHandle handle)
|
java.util.Hashtable<java.lang.String,java.util.Hashtable<java.lang.String,java.util.Vector<java.util.Vector<java.lang.Object>>>> |
find(java.lang.String key,
java.lang.String value)
|
AgentHandle[] |
getAgentHandles(AgentHandle handle)
|
static AgentScapeApiImpl |
getInstance()
Obtain reference to the AgentScapeApiImpl instance in this JVM. |
boolean |
isStarted()
|
void |
killAgent(AgentHandle handle)
|
void |
killAgent(AgentID id)
|
java.util.Hashtable<java.lang.String,java.util.Hashtable<java.lang.String,java.util.Vector<java.util.Vector<java.lang.Object>>>> |
list(java.lang.String key)
|
java.util.List<AgentHandle> |
listAgentHandles(AgentID id)
|
java.util.HashMap<AgentScapeID,java.util.List<AgentID>> |
listAgents(AgentScapeID location)
|
AgentCodeSegment[] |
listCodeSegments(AgentHandle handle)
|
AgentDataSegment[] |
listDataSegments(AgentHandle handle)
|
java.util.Hashtable<java.lang.String,java.util.Vector<java.util.Vector<java.lang.Object>>> |
lookup(java.lang.String identifier)
|
void |
moveAgent(AgentHandle handle,
AgentScapeID targetLocation)
|
void |
moveAgent(AgentHandle handle,
AgentScapeID location,
java.lang.String leaseId)
|
byte[] |
readCodeSegment(AgentHandle handle,
AgentCodeSegment segment)
|
byte[] |
readDataSegment(AgentHandle handle,
AgentDataSegment segment)
|
Envelope |
receiveMessage(AgentHandle handle,
boolean block)
|
Envelope |
receiveMessage(AgentHandle handle,
java.util.List<AgentHandle> handles,
boolean block)
|
Envelope[] |
receiveMessages(AgentHandle handle,
java.util.List<AgentHandle> handles,
boolean block)
|
long |
register(java.lang.String identifier,
java.lang.String key,
java.lang.String value,
float duration)
|
AgreementOffer |
requestLease(AgentScapeID location,
AgreementOffer leaseRequest)
|
TemplateList |
requestTemplates(AgentScapeID location)
|
void |
sendMessage(Envelope envelope)
|
void |
sendMessages(java.util.List<Envelope> envelopes)
|
void |
setDefaultCodeSegment(AgentHandle handle,
AgentCodeSegment active)
|
void |
start()
|
void |
startAgent(AgentHandle handle,
boolean collect,
java.lang.String... args)
|
void |
startAgent(AgentHandle handle,
java.lang.String... args)
|
void |
stop()
|
AgentArchive |
waitForAgent(AgentHandle handle,
boolean pickup)
|
AgentCodeSegment |
writeCodeSegment(AgentHandle handle,
AgentCodeSegment codeSegment,
byte[] code)
|
AgentCodeSegment |
writeCodeSegment(AgentHandle handle,
java.lang.String description,
Language language,
byte[] code)
|
AgentDataSegment |
writeDataSegment(AgentHandle handle,
AgentDataSegment dataSegment,
byte[] data)
|
AgentDataSegment |
writeDataSegment(AgentHandle handle,
java.lang.String description,
java.lang.String subtype,
byte[] data)
|
| Methods inherited from class org.iids.aos.systemservices.module.AbstractModule |
|---|
getCommunicator, getModuleName |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static AgentScapeApiImpl createInstance(AgentScapeConfig config,
Communicator comm,
AsLookupService lookupService)
After an instance is created once, all threads in the JVM that created
the instance can obtain the API by getInstance().
Creating this instance also creates two servers that listen for
imcoming method calls,
one using java rmi (AgentScapeApiRmiServer)
and one using SunRpc (AgentScapeApiSunrpcDispatcher).
TODO: actually, the rmi/sunrpc dispatchers should be created independent of the API, no? I.e. the API should not really be the one to create these servers?
config - AgentScape configuration (from parameter map). Required for
creating the rmi server. If it is null, then the rmi server will
only be registered using the generic rmi url (which is
AgentScapeApi.RMINAME)comm - Communicator, required for lookup service, and for all
AbstractModule implementations.lookupService - Required for lookup calls (and lookup cache).
public static AgentScapeApiImpl createPrivateInstance(AgentScapeConfig config,
Communicator comm,
AsLookupService lookupService)
createInstance(org.iids.aos.systemservices.module.AgentScapeConfig, org.iids.aos.systemservices.communicator.Communicator, org.iids.aos.systemservices.lookupservice.AsLookupService) creates at most one
instance (which will always be returned by subsequent calls to
createInstance(org.iids.aos.systemservices.module.AgentScapeConfig, org.iids.aos.systemservices.communicator.Communicator, org.iids.aos.systemservices.lookupservice.AsLookupService) and getInstance(). However, this
api instance is always bound to the same kernel and
lookup service. Should you want to create a new api instance for
another dedicated lookup service, then use this method.
This seems a little like a hack? Do not use it unless this is
absoultely required?
Another option is to include the lookup server name in the URL
that is registered in the AgentScape api. TODO think about this
some more.. do we even want multiple lookup services??
public static AgentScapeApiImpl getInstance()
null if the
instance was not created before (using
createInstance.
public long register(java.lang.String identifier,
java.lang.String key,
java.lang.String value,
float duration)
AgentScapeApi.register(java.lang.String, java.lang.String, java.lang.String, float)public java.util.Hashtable<java.lang.String,java.util.Vector<java.util.Vector<java.lang.Object>>> lookup(java.lang.String identifier)
AgentScapeApi.lookup(java.lang.String)
public java.util.Hashtable<java.lang.String,java.util.Hashtable<java.lang.String,java.util.Vector<java.util.Vector<java.lang.Object>>>> find(java.lang.String key,
java.lang.String value)
AgentScapeApi.find(java.lang.String, java.lang.String)public java.util.Hashtable<java.lang.String,java.util.Hashtable<java.lang.String,java.util.Vector<java.util.Vector<java.lang.Object>>>> list(java.lang.String key)
AgentScapeApi.list(java.lang.String)public void start()
public void stop()
public boolean isStarted()
public AgentInfo createAgent(AgentScapeID location,
AgentArchive arch)
throws LocationUnknownException,
AgentArchiveException,
NegotiationLibException,
AgentCreationException
LocationUnknownException
AgentArchiveException
NegotiationLibException
AgentCreationExceptionAgentScapeApi.createAgent(AgentScapeID,AgentArchive)
public AgentInfo createAgent(AgentScapeID location,
Language lang)
throws LocationUnknownException,
AgentCreationException
LocationUnknownException
AgentCreationExceptionAgentScapeApi.createAgent(AgentScapeID,Language)
public AgentInfo createAgent(AgentScapeID location,
Language lang,
byte[] code)
throws LocationUnknownException,
LocationUnknownException,
AgentCreationException
LocationUnknownException
AgentCreationException
public AgentInfo createAgent(java.lang.String lease,
AgentArchive arch)
throws NegotiationLibException,
AgentArchiveException
NegotiationLibException
AgentArchiveExceptionAgentScapeApi.createAgent(String,AgentArchive)
public AgentHandle createAgentHandle(AgentHandle handle)
throws AgentUnknownException
AgentUnknownExceptionAgentScapeApi.createAgentHandle(org.iids.aos.systemservices.communicator.structs.AgentHandle)
public AgentHandle[] getAgentHandles(AgentHandle handle)
throws AgentUnknownException
AgentUnknownExceptionAgentScapeApi.getAgentHandles(org.iids.aos.systemservices.communicator.structs.AgentHandle)
public TemplateList requestTemplates(AgentScapeID location)
throws NegotiationLibException,
LocationUnknownException
NegotiationLibException
LocationUnknownExceptionAgentScapeApi.requestTemplates(org.iids.aos.systemservices.communicator.structs.AgentScapeID)
public AgreementOffer requestLease(AgentScapeID location,
AgreementOffer leaseRequest)
throws NegotiationLibException,
LocationUnknownException
NegotiationLibException
LocationUnknownExceptionAgentScapeApi.requestLease(org.iids.aos.systemservices.communicator.structs.AgentScapeID, org.iids.aos.systemservices.datatypes.wsagreement.AgreementOffer)
public AgreementOffer acceptLease(AgentScapeID location,
java.lang.String leaseId)
throws NegotiationLibException,
LocationUnknownException
NegotiationLibException
LocationUnknownExceptionAgentScapeApi.acceptLease(org.iids.aos.systemservices.communicator.structs.AgentScapeID, java.lang.String)
public void startAgent(AgentHandle handle,
boolean collect,
java.lang.String... args)
throws AgentUnknownException,
AgentStartupException
AgentUnknownException
AgentStartupExceptionAgentScapeApi.startAgent(AgentHandle,boolean,String[])
public void startAgent(AgentHandle handle,
java.lang.String... args)
throws AgentUnknownException,
AgentStartupException
AgentUnknownException
AgentStartupExceptionAgentScapeApi.startAgent(AgentHandle,String[])
public AgentCodeSegment writeCodeSegment(AgentHandle handle,
AgentCodeSegment codeSegment,
byte[] code)
throws AgentUnknownException,
AgentContainerException
AgentUnknownException
AgentContainerExceptionAgentScapeApi.writeCodeSegment(AgentHandle,AgentCodeSegment,byte[])
public AgentCodeSegment writeCodeSegment(AgentHandle handle,
java.lang.String description,
Language language,
byte[] code)
throws AgentUnknownException,
AgentContainerException
AgentUnknownException
AgentContainerExceptionAgentScapeApi.writeCodeSegment(AgentHandle,String,Language,byte[])
public AgentDataSegment writeDataSegment(AgentHandle handle,
AgentDataSegment dataSegment,
byte[] data)
throws AgentUnknownException,
AgentContainerException
AgentUnknownException
AgentContainerExceptionAgentScapeApi.writeDataSegment(AgentHandle,AgentDataSegment,byte[])
public AgentDataSegment writeDataSegment(AgentHandle handle,
java.lang.String description,
java.lang.String subtype,
byte[] data)
throws AgentUnknownException,
AgentContainerException
AgentUnknownException
AgentContainerExceptionAgentScapeApi.writeDataSegment(AgentHandle,String,String,byte[])
public byte[] readCodeSegment(AgentHandle handle,
AgentCodeSegment segment)
throws SegmentUnknownException,
AgentUnknownException,
AgentContainerException
SegmentUnknownException
AgentUnknownException
AgentContainerExceptionAgentScapeApi.readCodeSegment(org.iids.aos.systemservices.communicator.structs.AgentHandle, org.iids.aos.agent.AgentCodeSegment)
public byte[] readDataSegment(AgentHandle handle,
AgentDataSegment segment)
throws SegmentUnknownException,
AgentUnknownException,
AgentContainerException
SegmentUnknownException
AgentUnknownException
AgentContainerExceptionAgentScapeApi.readDataSegment(org.iids.aos.systemservices.communicator.structs.AgentHandle, org.iids.aos.agent.AgentDataSegment)
public void setDefaultCodeSegment(AgentHandle handle,
AgentCodeSegment active)
throws AgentUnknownException,
SegmentUnknownException,
AgentContainerException
AgentUnknownException
SegmentUnknownException
AgentContainerExceptionAgentScapeApi.setDefaultCodeSegment(org.iids.aos.systemservices.communicator.structs.AgentHandle, org.iids.aos.agent.AgentCodeSegment)
public AgentCodeSegment[] listCodeSegments(AgentHandle handle)
throws AgentUnknownException,
AgentContainerException
AgentUnknownException
AgentContainerExceptionAgentScapeApi.listCodeSegments(org.iids.aos.systemservices.communicator.structs.AgentHandle)
public AgentDataSegment[] listDataSegments(AgentHandle handle)
throws AgentUnknownException,
AgentContainerException
AgentUnknownException
AgentContainerExceptionAgentScapeApi.listDataSegments(org.iids.aos.systemservices.communicator.structs.AgentHandle)
public void deleteCodeSegment(AgentHandle handle,
AgentCodeSegment segment)
throws AgentUnknownException,
SegmentUnknownException,
AgentContainerException
AgentUnknownException
SegmentUnknownException
AgentContainerExceptionAgentScapeApi.deleteCodeSegment(org.iids.aos.systemservices.communicator.structs.AgentHandle, org.iids.aos.agent.AgentCodeSegment)
public void deleteDataSegment(AgentHandle handle,
AgentDataSegment segment)
throws AgentUnknownException,
SegmentUnknownException,
AgentContainerException
AgentUnknownException
SegmentUnknownException
AgentContainerExceptionAgentScapeApi.deleteDataSegment(org.iids.aos.systemservices.communicator.structs.AgentHandle, org.iids.aos.agent.AgentDataSegment)
public void moveAgent(AgentHandle handle,
AgentScapeID targetLocation)
throws AgentUnknownException,
LocationUnknownException,
AgentStartupException,
MigrationFailedException
AgentUnknownException
LocationUnknownException
AgentStartupException
MigrationFailedExceptionAgentScapeApi.moveAgent(AgentHandle,AgentScapeID)
public void moveAgent(AgentHandle handle,
AgentScapeID location,
java.lang.String leaseId)
throws NegotiationLibException,
AgentUnknownException,
AgentStartupException,
MigrationFailedException
NegotiationLibException
AgentUnknownException
AgentStartupException
MigrationFailedExceptionAgentScapeApi.moveAgent(AgentHandle,AgentScapeID,String)
public void sendMessage(Envelope envelope)
throws MessageException
MessageExceptionAgentScapeApi.sendMessage(org.iids.aos.messagecenter.Envelope)
public void sendMessages(java.util.List<Envelope> envelopes)
throws MessageException
MessageExceptionAgentScapeApi.sendMessages(java.util.List)
public Envelope receiveMessage(AgentHandle handle,
java.util.List<AgentHandle> handles,
boolean block)
throws AgentUnknownException
AgentUnknownExceptionAgentScapeApi.receiveMessage(org.iids.aos.systemservices.communicator.structs.AgentHandle, java.util.List, boolean)
public Envelope receiveMessage(AgentHandle handle,
boolean block)
throws AgentUnknownException
AgentUnknownException
public Envelope[] receiveMessages(AgentHandle handle,
java.util.List<AgentHandle> handles,
boolean block)
throws AgentUnknownException
AgentUnknownExceptionAgentScapeApi.receiveMessages(org.iids.aos.systemservices.communicator.structs.AgentHandle, java.util.List, boolean)
public AgentArchive waitForAgent(AgentHandle handle,
boolean pickup)
throws AgentUnknownException,
AgentContainerException
AgentUnknownException
AgentContainerExceptionAgentScapeApi.waitForAgent(org.iids.aos.systemservices.communicator.structs.AgentHandle, boolean)
public AgentArchive exportAgent(AgentHandle handle)
throws AgentUnknownException,
AgentContainerException
AgentUnknownException
AgentContainerException
public java.util.HashMap<AgentScapeID,java.util.List<AgentID>> listAgents(AgentScapeID location)
throws LocationUnknownException
LocationUnknownExceptionAgentScapeApi.listAgents(org.iids.aos.systemservices.communicator.structs.AgentScapeID)
public void killAgent(AgentHandle handle)
throws AgentUnknownException
AgentUnknownExceptionAgentScapeApi.killAgent(AgentHandle)
public void killAgent(AgentID id)
throws AgentIDUnknownException
AgentIDUnknownExceptionAgentScapeApi.killAgent(AgentID)
public java.util.List<AgentHandle> listAgentHandles(AgentID id)
throws AgentIDUnknownException
AgentIDUnknownExceptionAgentScapeApi.listAgentHandles(AgentID)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||