All Packages Class Hierarchy This Package Previous Next Index
Class ajanta.server.AgentEnv
java.lang.Object
|
+----ajanta.server.AgentEnv
- public class AgentEnv
- extends Object
class AgentEnv represents the server's context.
A reference to an AgentEnv object is passed to each agent when it is
executed. Methods in the AgentEnv class provide the agent with primitive
operations like migration, resource binding, etc.
-
createRMIProxy(String)
- Create and install an RMI server which has the same interface as the
caller agent.
-
createRMIProxy(String, String)
- Create and install an RMI server which has the same interface as the
caller agent.
-
createURN(String)
- Create a URN by appending the given string onto the server's URN
-
deleteResource(URN)
- Delete registered resource entry whose URN is passed as argument.
-
getAgentURN()
- Find the name currently executing agent in the same thread group.
-
getCurrentAgent()
- Find the currently executing agent in the same thread group.
-
getHostURN()
- Return the current host's name
-
getNameReg()
- Return a reference to the name registry access class ( NRAccess )
of the current agent server.
-
getResource(URN)
- Return an a proxy for the named resource and if it has not yet
been registered then return null.
-
go(URN)
- Migrate caller to the specified destination and execute the
(parameterless) "run" method
-
go(URN, MethodSpec)
- Migrate caller to the specified destination and execute the
method specified in the MethodSpec
-
go(URN, String, Class[], Object[])
- Migrate caller agent to a specified destination and execute the
named method with the specified formal and actual parameters
-
go(URN, String, Object[])
- Migrate caller to the specified destination and execute the named method
with the given actual parameters, assuming they exactly match the
formal parameter types.
-
launch(Agent, URN)
- Send specified agent to the named destination and execute the
(parameterless) "run" method
-
launch(Agent, URN, MethodSpec)
- Send specified agent to the named destination and execute the
method specified in the MethodSpec
-
launch(Agent, URN, String, Class[], Object[], boolean)
- Launch the given agent to the desired destination, specifying the method
to be executed there.
-
launch(Agent, URN, String, Object[])
- Launch agent to the specified destination and execute the named method
with the given actual parameters, assuming they exactly match the
formal parameter types.
-
registerAgent(Agent)
- Registers an agent with the name registry, If an older entry exists try to rebind.
-
registerResource(URN, Resource)
- It creates a resource ( RREntry ) in the agent server's resource registry
with the given resource name and resource object
-
registerResourceName(URN)
- It creates a resource ( RREntry) in the agent server's resource registry.
-
waitForResource(URN)
- Return an a proxy for the named resource and if it has not yet
been registered then wait for it.
getCurrentAgent
public Agent getCurrentAgent()
- Find the currently executing agent in the same thread group.
- Returns:
- Reference to if one exists in current thread group and null otherwise
- See Also:
- Agent
getAgentURN
public URN getAgentURN()
- Find the name currently executing agent in the same thread group.
- Returns:
- URN of the agent if one exists in current thread group and null otherwise
- See Also:
- URN
getNameReg
public NRAccess getNameReg()
- Return a reference to the name registry access class ( NRAccess )
of the current agent server.
- Returns:
- NRAccess object of the agent server.
- See Also:
- NRAccess
go
public void go(URN dest,
String method,
Class formals[],
Object actuals[]) throws UnknownHostException, LaunchFailedException
- Migrate caller agent to a specified destination and execute the
named method with the specified formal and actual parameters
- Parameters:
- dest - URN of the destination
- method - name of the method to execute
- formals - array of class names of method parametrs
- actuals - array of objects i.e. values of the parametrs to the method
go
public void go(URN dest,
String method,
Object actuals[]) throws UnknownHostException, LaunchFailedException
- Migrate caller to the specified destination and execute the named method
with the given actual parameters, assuming they exactly match the
formal parameter types.
- Parameters:
- dest - URN of the destination
- method - name of the method to execute
- actuals - array of objects i.e. values of the parametrs to the method
go
public void go(URN dest) throws UnknownHostException, LaunchFailedException
- Migrate caller to the specified destination and execute the
(parameterless) "run" method
- Parameters:
- dest - URN of the destination
go
public void go(URN dest,
MethodSpec act) throws UnknownHostException, LaunchFailedException
- Migrate caller to the specified destination and execute the
method specified in the MethodSpec
- Parameters:
- dest - URN of the destination
- act - MethodSpec of the method tb executed at destination
- See Also:
- MethodSpec
launch
public void launch(Agent ag,
URN dest,
String method,
Class formals[],
Object actuals[],
boolean first) throws LaunchFailedException
- Launch the given agent to the desired destination, specifying the method
to be executed there. It is internally called by go methods with
first = false.
- Parameters:
- ag - Reference to the agent being launched
- dest - URN of the destination
- method - name of the method to execute
- formals - array of class names of method parametrs
- actuals - array of objects i.e. values of the parametrs to the method
- first - true indicate very first launch of the agent ( just after creation ) wheras false
indicates a luanch at a later stage in the itinerary
- See Also:
- Agent
launch
public void launch(Agent ag,
URN dest,
String method,
Object actuals[]) throws UnknownHostException, LaunchFailedException
- Launch agent to the specified destination and execute the named method
with the given actual parameters, assuming they exactly match the
formal parameter types.
- Parameters:
- ag - Reference to the agent being launched
- dest - URN of the destination
- method - name of the method to execute
- actuals - array of objects i.e. values of the parametrs to the method
- See Also:
- Agent
launch
public void launch(Agent ag,
URN dest) throws UnknownHostException, LaunchFailedException
- Send specified agent to the named destination and execute the
(parameterless) "run" method
- Parameters:
- ag - Reference to the agent being launched
- dest - URN of the destination
- See Also:
- Agent
launch
public void launch(Agent ag,
URN dest,
MethodSpec act) throws UnknownHostException, LaunchFailedException
- Send specified agent to the named destination and execute the
method specified in the MethodSpec
- Parameters:
- ag - Reference to the agent being launched
- dest - URN of the destination
- act - MethodSpec to be executed
- See Also:
- Agent
getHostURN
public URN getHostURN()
- Return the current host's name
- Returns:
- URN of the current agent server ( host )
registerResourceName
public synchronized void registerResourceName(URN name)
- It creates a resource ( RREntry) in the agent server's resource registry.
It just associate a null entry with the given URN of the resource.
It is usefuel when someone has to wait for a resource which will
be initialized by second party at a later stage. It helps in synchronizing
them.
- Parameters:
- name - URN of the resource to be created
registerResource
public synchronized void registerResource(URN name,
Resource obj)
- It creates a resource ( RREntry ) in the agent server's resource registry
with the given resource name and resource object
- Parameters:
- name - URN of the resource to be created
- obj - Resource object to be registered
- See Also:
- Resource
deleteResource
public synchronized void deleteResource(URN name)
- Delete registered resource entry whose URN is passed as argument.
- Parameters:
- name - URN of the resource
waitForResource
public synchronized Resource waitForResource(URN resName)
- Return an a proxy for the named resource and if it has not yet
been registered then wait for it. The proxy to be returned depends
on the credentials of the calling agent.Special case - if the resource
being requested is this server,return a pointer to the agent server object itself
- Parameters:
- resName - URN of the resource
- Returns:
- Resource instance of the proxy for the requested resource.
getResource
public Resource getResource(URN resName)
- Return an a proxy for the named resource and if it has not yet
been registered then return null. The proxy to be returned depends
on the credentials of the calling agent.Special case - if the resource
being requested is this server,return a pointer to the agent server object itself
- Parameters:
- resName - URN of the resource
- Returns:
- Resource instance of the proxy for the requested resource.
createURN
public URN createURN(String name)
- Create a URN by appending the given string onto the server's URN
- Parameters:
- name - - string used for urn
- Returns:
- newly creted URN of the form server urn: name
createRMIProxy
public void createRMIProxy(String interf)
- Create and install an RMI server which has the same interface as the
caller agent. The proxy server has an embedded reference to the agent.
It receives the RMI calls and forwards them to the agent. The interface,
and the associated proxy class must currently be available on the agent
server's classpath. It calls createRMIProxy (String interf,String extension)
with extension as "".
- Parameters:
- interf - name of the "Remote" interface which the agent supports.
Extension of the proxy class is "Proxy".
createRMIProxy
public void createRMIProxy(String interf,
String extension)
- Create and install an RMI server which has the same interface as the
caller agent. The proxy server has an embedded reference to the agent.
It receives the RMI calls and forwards them to the agent. The interface,
and the associated proxy class must currently be available on the agent
server's classpath.
- Parameters:
- interf - name of the "Remote" interface which the agent supports.
- extension - file name extension of the proxy class name, if it is "" then
by default "Proxy" is used as extension.
registerAgent
public void registerAgent(Agent ag)
- Registers an agent with the name registry, If an older entry exists try to rebind.
- Parameters:
- ag - Agent to be registered
All Packages Class Hierarchy This Package Previous Next Index