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.


Variable Index

 o atp
thread which handles agent transfer
 o atp_port
port number on which agent transfer take place
 o codeBase
Code server running in this Agent Server
 o cs
class (code) server thread
 o cs_port
port number of class (code) server thread
 o dd
The domains database table -- conatin an entry for all the agent currently residing on the server
 o dsa
DSA signature object
 o dsa_priv
DSA private key
 o dsa_pub
DSA public key
 o dsa_v
DSA object for signature verification
 o eg
ElGamal object used for encryption
 o eg_priv
ElGamal private key for server's owner
 o eg_pub
ElGamal public key for server's owner
 o host
server's context object -- an instance of this is passed to all the visting agents
 o myHost
DNS name of my host machine
 o myURN
this agent server's URN ( name )
 o namereg
a sycronized class for calling namereg api's
 o nameTGmap
maps agent names to thread group id
 o rmiRegURL
local server specific rmi registry
 o rr
The resource registry table -- contain an entry for each registered resource
 o securityManager
the security manager for the server
 o srand
Secure random number generator
 o tkt
used for ticket generation/verification

Constructor Index

 o AgentServer(String)
AgentServer constructor

Method Index

 o authenticate(URN, int)
It is used to obtain ticket from this server from a remote site.
 o decrypt(EGCipherText)
 o deleteDDEntry(DDEntry)
This function removes the calling agent DDEntry from the domain database.
 o encrypt(EGPublicKey, byte[])
 o getAgentCurrentServer(URN)
given URN of agent it locates it's current server and return reference to the server.
 o getNR()
It returns a reference to NRAcess - sycronized class for calling namereg api's
 o getRegURL()
Return local server specific rmi registry URL.
 o launch(Agent, URN, String, Class[], Object[])
It launches a given agent to the specified destination.
 o main(String[])
Main program, which starts up the agent server This is only a generic main program.
 o 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).
 o 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.
 o registerAgent(Agent)
Registers an agent with the name registry, If an older entry exists try to rebind the agent.
 o 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.
 o 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.
 o retract(URN, URN, Ticket)
It is used to retract an agent ...it preempts the agent from its current task and its prespecifed itinerary.
 o retract(URN, URN, URN)
It is used to retract an agent ...it preempts the agent from its current task and its prespecified itinerary.
 o sign(byte[])
 o terminate(URN)
It is used to abort an agent ...it immediately kill the agent.
 o terminate(URN, Ticket)
It is used to abort an agent ...it immediately kills the agent.
 o verify(byte[], byte[], PublicKey)
 o whoAreYou()
A simple method in the AServer interface, for obtaining an agent server's URN

Variables

 o myURN
 protected URN myURN
this agent server's URN ( name )

 o myHost
 protected String myHost
DNS name of my host machine

 o codeBase
 protected URL codeBase
Code server running in this Agent Server

 o rmiRegURL
 protected URL rmiRegURL
local server specific rmi registry

 o dd
 protected Hashtable dd
The domains database table -- conatin an entry for all the agent currently residing on the server

 o rr
 protected Hashtable rr
The resource registry table -- contain an entry for each registered resource

 o nameTGmap
 protected Hashtable nameTGmap
maps agent names to thread group id

 o atp
 protected ATPListener atp
thread which handles agent transfer

 o atp_port
 protected int atp_port
port number on which agent transfer take place

 o cs
 protected ClassServer cs
class (code) server thread

 o cs_port
 protected int cs_port
port number of class (code) server thread

 o host
 protected AgentEnv host
server's context object -- an instance of this is passed to all the visting agents

 o eg_pub
 protected EGPublicKey eg_pub
ElGamal public key for server's owner

 o eg_priv
 protected EGPrivateKey eg_priv
ElGamal private key for server's owner

 o dsa_pub
 protected PublicKey dsa_pub
DSA public key

 o dsa_priv
 protected PrivateKey dsa_priv
DSA private key

 o eg
 protected ElGamal eg
ElGamal object used for encryption

 o dsa
 protected Signature dsa
DSA signature object

 o tkt
 protected AgentTicketing tkt
used for ticket generation/verification

 o srand
 protected SecureRandom srand
Secure random number generator

 o dsa_v
 protected Signature dsa_v
DSA object for signature verification

 o securityManager
 protected AjantaSecurityManager securityManager
the security manager for the server

 o namereg
 protected NRAccess namereg
a sycronized class for calling namereg api's

Constructors

 o AgentServer
 public AgentServer(String n) throws RemoteException
AgentServer constructor

Parameters:
n - urn ( name ) of the agent server
See Also:
AgentServer

Methods

 o decrypt
 public byte[] decrypt(EGCipherText cipher)
 o encrypt
 public EGCipherText encrypt(EGPublicKey pk,
                             byte plaintext[])
 o sign
 public byte[] sign(byte text[]) throws SignatureException
 o verify
 public boolean verify(byte text[],
                       byte sig[],
                       PublicKey pub) throws InvalidKeyException, SignatureException
 o whoAreYou
 public URN whoAreYou() throws RemoteException
A simple method in the AServer interface, for obtaining an agent server's URN

 o 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
 o 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
 o 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
 o 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
 o 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
 o 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
 o 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
 o 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
 o 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
 o 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
 o 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
 o getNR
 public NRAccess getNR()
It returns a reference to NRAcess - sycronized class for calling namereg api's

 o 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
 o getRegURL
 public URL getRegURL()
Return local server specific rmi registry URL.

 o 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
 o 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