All Packages Class Hierarchy This Package Previous Next Index
Class ajanta.server.AgentServer
java.lang.Object
|
+----java.rmi.server.RemoteObject
|
+----java.rmi.server.RemoteServer
|
+----java.rmi.server.UnicastRemoteObject
|
+----ajanta.server.AgentServer
- public class AgentServer
- extends UnicastRemoteObject
- implements AServer, Resource, Reportable
Ajanta provides a generic agent server that can be suitably
extended by a programmer to define an application-specific server.
It supports several important functions:
1. Agent Transfer Protocol for agent migration to/from other servers.
2. Execution of visiting agents within secure protection domains.
3. Secure access to server resources for agents.
4. Primitives for inter-agent communication, resource access and migration.
5. Secure agent control and monitoring functions for agent creators.
The server's agent environment object acts as the interface
between agents and the services provided at the host. Agents can
invoke operations on their environment that allow them to migrate,
communicate, access resources, etc. Each server maintains a
domain registry that keeps track of the agents currently executing on
it. A server usually provides access to some application-defined resources.
Such resources are registered in the server's resource registry. This
registry maps the URN of a resource to its object reference. A server has
to explicitly make a resource visible to visiting agents by registering it
in the resource registry by using the registerResource function.
-
atp
- thread which handles agent transfer
-
atp_port
- port number on which agent transfer take place
-
codeBase
- Code server running in this Agent Server
-
cs
- class (code) server thread
-
cs_port
- port number of class (code) server thread
-
dd
- The domains database table -- conatin an entry for all the agent currently residing on the server
-
dsa
- DSA signature object
-
dsa_priv
- DSA private key
-
dsa_pub
- DSA public key
-
dsa_v
- DSA object for signature verification
-
eg
- ElGamal object used for encryption
-
eg_priv
- ElGamal private key for server's owner
-
eg_pub
- ElGamal public key for server's owner
-
host
- server's context object -- an instance of this is passed to all the visting agents
-
myHost
- DNS name of my host machine
-
myURN
- this agent server's URN ( name )
-
namereg
- a sycronized class for calling namereg api's
-
nameTGmap
- maps agent names to thread group id
-
rmiRegURL
- local server specific rmi registry
-
rr
- The resource registry table -- contain an entry for each registered resource
-
securityManager
- the security manager for the server
-
srand
- Secure random number generator
-
tkt
- used for ticket generation/verification
-
AgentServer(String)
- AgentServer constructor
-
authenticate(URN, int)
- It is used to obtain ticket from this server from a remote site.
-
decrypt(EGCipherText)
-
-
deleteDDEntry(DDEntry)
- This function removes the calling agent DDEntry from the domain database.
-
encrypt(EGPublicKey, byte[])
-
-
getAgentCurrentServer(URN)
- given URN of agent it locates it's current server and return
reference to the server.
-
getNR()
- It returns a reference to NRAcess - sycronized class for calling namereg api's
-
getRegURL()
-
Return local server specific rmi registry URL.
-
launch(Agent, URN, String, Class[], Object[])
- It launches a given agent to the specified destination.
-
main(String[])
- Main program, which starts up the agent server This is only a generic main program.
-
recall(URN, URN, Ticket)
- It is used to recall an agent ...which basically allow an agent
to complete its task at the current server and upon completion
migate it to the reportTo server ( but it aborts its prespecifed itinerary).
-
recall(URN, URN, URN)
- It is used to recall an agent ...which basically allow an agent
to complete its task at the current server ( but it aborts its prespecifed itinerary) and upon completion
migate it to the reportTo server.
-
registerAgent(Agent)
- Registers an agent with the name registry, If an older entry exists try to rebind the agent.
-
remoteServerTicket(AServer, URN, int, PrivateKey)
- It is used to do two way authentication...first it obtains a Ticket
from the remote server and then using that ticket it creates another
ticket and return to the caller.
-
report(Agent)
- This method is invoked by agents which report back to their home site, either
because their task is done, or in response to reacll / retract, or because they
have encountered some exception which they could not handle.
-
retract(URN, URN, Ticket)
- It is used to retract an agent ...it preempts the agent from its
current task and its prespecifed itinerary.
-
retract(URN, URN, URN)
- It is used to retract an agent ...it preempts the agent from its
current task and its prespecified itinerary.
-
sign(byte[])
-
-
terminate(URN)
- It is used to abort an agent ...it immediately kill the agent.
-
terminate(URN, Ticket)
- It is used to abort an agent ...it immediately kills the agent.
-
verify(byte[], byte[], PublicKey)
-
-
whoAreYou()
- A simple method in the AServer interface, for obtaining an agent server's URN
myURN
protected URN myURN
- this agent server's URN ( name )
myHost
protected String myHost
- DNS name of my host machine
codeBase
protected URL codeBase
- Code server running in this Agent Server
rmiRegURL
protected URL rmiRegURL
- local server specific rmi registry
dd
protected Hashtable dd
- The domains database table -- conatin an entry for all the agent currently residing on the server
rr
protected Hashtable rr
- The resource registry table -- contain an entry for each registered resource
nameTGmap
protected Hashtable nameTGmap
- maps agent names to thread group id
atp
protected ATPListener atp
- thread which handles agent transfer
atp_port
protected int atp_port
- port number on which agent transfer take place
cs
protected ClassServer cs
- class (code) server thread
cs_port
protected int cs_port
- port number of class (code) server thread
host
protected AgentEnv host
- server's context object -- an instance of this is passed to all the visting agents
eg_pub
protected EGPublicKey eg_pub
- ElGamal public key for server's owner
eg_priv
protected EGPrivateKey eg_priv
- ElGamal private key for server's owner
dsa_pub
protected PublicKey dsa_pub
- DSA public key
dsa_priv
protected PrivateKey dsa_priv
- DSA private key
eg
protected ElGamal eg
- ElGamal object used for encryption
dsa
protected Signature dsa
- DSA signature object
tkt
protected AgentTicketing tkt
- used for ticket generation/verification
srand
protected SecureRandom srand
- Secure random number generator
dsa_v
protected Signature dsa_v
- DSA object for signature verification
securityManager
protected AjantaSecurityManager securityManager
- the security manager for the server
namereg
protected NRAccess namereg
- a sycronized class for calling namereg api's
AgentServer
public AgentServer(String n) throws RemoteException
- AgentServer constructor
- Parameters:
- n - urn ( name ) of the agent server
- See Also:
- AgentServer
decrypt
public byte[] decrypt(EGCipherText cipher)
encrypt
public EGCipherText encrypt(EGPublicKey pk,
byte plaintext[])
sign
public byte[] sign(byte text[]) throws SignatureException
verify
public boolean verify(byte text[],
byte sig[],
PublicKey pub) throws InvalidKeyException, SignatureException
whoAreYou
public URN whoAreYou() throws RemoteException
- A simple method in the AServer interface, for obtaining an agent server's URN
getAgentCurrentServer
public AServer getAgentCurrentServer(URN agentURN)
- given URN of agent it locates it's current server and return
reference to the server. Useful in recall, retract and terminate
calls
- Parameters:
- agentURN - URN of the agent to be located
- Returns:
- return reference to current server of the agent
- See Also:
- AServer
recall
public void recall(URN target,
URN recaller,
URN reportTo) throws RemoteException
- It is used to recall an agent ...which basically allow an agent
to complete its task at the current server ( but it aborts its prespecifed itinerary) and upon completion
migate it to the reportTo server. This do not involve authentication
and will be deprecated in future release.
- Parameters:
- target - URN of the agent to be relocated
- recaller - URN of the recaller
- reportTo - URN of the entity to whom agent has to report
retract
public void retract(URN target,
URN retractor,
URN reportTo) throws RemoteException
- It is used to retract an agent ...it preempts the agent from its
current task and its prespecified itinerary. Then immediately
migate it to the reportTo server. This do not involve authentication
and will be deprecated in future release.
- Parameters:
- target - URN of the agent to be relocated
- recaller - URN of the retractor
- reportTo - URN of the entity to whom agent has to report
terminate
public void terminate(URN target) throws RemoteException
- It is used to abort an agent ...it immediately kill the agent.
This do not involve authentication
and will be deprecated in future release.
- Parameters:
- target - URN of the agent to be terminated
authenticate
public Ticket authenticate(URN caller,
int nonce)
- It is used to obtain ticket from this server from a remote site.
- Parameters:
- caller - caller identity( URN )
- nonce - random number used as challenge
remoteServerTicket
public Ticket remoteServerTicket(AServer targetServer,
URN caller,
int nonce,
PrivateKey dsa_priv) throws RemoteException
- It is used to do two way authentication...first it obtains a Ticket
from the remote server and then using that ticket it creates another
ticket and return to the caller.
- Parameters:
- targetServer - reference to the remote agent server
- caller - URN of the caller ( server )
- nonce - any random number
- dsa_priv - dsa private key of the caller
- Returns:
- Ticket from the remote server...used for future authentication
recall
public void recall(URN target,
URN reportTo,
Ticket t) throws RemoteException, InvalidKeyException, SignatureException
- It is used to recall an agent ...which basically allow an agent
to complete its task at the current server and upon completion
migate it to the reportTo server ( but it aborts its prespecifed itinerary).
Recaller must authenticate himself with the remote server inorder
to recall the agent.Only owner, creator or gurdian are allowed to recall an agent.
AServer targetServer = getAgentCurrentServer( agentURN );
Ticket ticket = remoteServerTicket ( targetServer, myURN , 3000, dsa_priv );
recall (agentURN , myURN , ticket )
- Parameters:
- target - URN of the agent to be relocated
- reportTo - URN of the entity to whom agent has to report
- t - ticket obtained from the remote server
retract
public void retract(URN target,
URN reportTo,
Ticket t) throws RemoteException, InvalidKeyException, SignatureException
- It is used to retract an agent ...it preempts the agent from its
current task and its prespecifed itinerary. Then
migate the agent to the reportTo server.
Retractor must authenticate himself with the remote server inorder
to retract the agent.Only owner, creator or gurdian are allowed to retract an agent.
AServer targetServer = getAgentCurrentServer( agentURN );
Ticket ticket = remoteServerTicket ( targetServer, myURN , 3000, dsa_priv );
retract (agentURN , myURN , ticket )
- Parameters:
- target - URN of the agent to be retracted
- reportTo - URN of the entity to whom agent has to report
- t - ticket obtained from the remote server
terminate
public void terminate(URN target,
Ticket t) throws RemoteException, InvalidKeyException, SignatureException
- It is used to abort an agent ...it immediately kills the agent.
Caller must authenticate himself with the remote server inorder
to terminate the agent.Only owner, creator or gurdian are allowed to terminate an agent.
AServer targetServer = getAgentCurrentServer( agentURN );
Ticket ticket = remoteServerTicket ( targetServer, myURN , 3000, dsa_priv );
terminate (agentURN , ticket )
- Parameters:
- target - URN of the agent to be terminated
launch
public void launch(Agent ag,
URN dest,
String method,
Class formals[],
Object actuals[]) throws LaunchFailedException
- It launches a given agent to the specified destination.
- Parameters:
- ag - reference of the agent to be 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
report
public void report(Agent ag)
- This method is invoked by agents which report back to their home site, either
because their task is done, or in response to reacll / retract, or because they
have encountered some exception which they could not handle. By default it just
print a message identifying the which agent is reporting. An application' agent
server shoul overide this method to provide application specific handeling.
- Parameters:
- ag - reference of the agent reporting
getNR
public NRAccess getNR()
- It returns a reference to NRAcess - sycronized class for calling namereg api's
deleteDDEntry
public void deleteDDEntry(DDEntry obj)
- This function removes the calling agent DDEntry from the domain database.
- Parameters:
- obj - reference of the DDEntry to be deleted
getRegURL
public URL getRegURL()
- Return local server specific rmi registry URL.
registerAgent
public void registerAgent(Agent ag)
- Registers an agent with the name registry, If an older entry exists try to rebind the agent.
- Parameters:
- ag - reference of the agent to be registered
main
public static void main(String args[])
- Main program, which starts up the agent server This is only a generic main program.
Application developers should create subclasses of AgentServer and implement
their own main() methods. The only requirement is that the main
program should instantiate their agent server class, and use it to
launch agents into the network.
All Packages Class Hierarchy This Package Previous Next Index