fr.dyade.aaa.agent
Class AgentId

java.lang.Object
  extended byfr.dyade.aaa.agent.AgentId
All Implemented Interfaces:
java.io.Serializable

public final class AgentId
extends java.lang.Object
implements java.io.Serializable

An AgentId allows for uniquely identifying and localizing an agent throughout the distributed system. It defines variable members describing the identifier and all needed function members to manipulate the structure (creation, serialization, etc).


However before describing the structure of an AgentId we must take into account a second requirement: an agent may be created onto a remote agent server, and the creating entity needs to know the new identifier created for that agent. As agents live in an asynchronous world it is not so easy to get back the identifier from the remote server. We decided instead to make the creating entity responsible for creating the identifier.

The two requirements are then:


The AgentId is then built of three parts: The three fields form the unique global identifier of the agent, that is two agents may share a common stamp, as long as their from or to fields differ. The to field identifies the agent server hosting the agent, so it is used by the channel to forward notifications to the agent.

See Also:
AgentIdStamp, Serialized Form

Field Summary
static int AdminIdStamp
          Reserved stamp for admin AgentId.
static int ControlTopicStamp
          Reserved stamp for JMS topic AgentId in charge ofsending control events.
static int FactoryIdStamp
          Reserved stamp for factory AgentId.
static int FileTransfertStamp
          Reserved stamp for fileTransfert service AgentId.
static int JndiServiceStamp
          Reserved stamp for JNDI service AgentId.
static int JoramAdminPxStamp
          Reserved stamp for JORAM administration proxy AgentId.
static int JoramAdminStamp
          Reserved stamp for JORAM administration topic AgentId.
static int LocalJndiServiceStamp
          Reserved stamp for local JNDI service AgentId.
static int MaxIdStamp
          Maximum reserved stamp.
static int MaxSystemIdStamp
          Maximum reserved stamp for system services.
static int MaxWKSIdStamp
          Maximum reserved stamp for well known services.
static int MinWKSIdStamp
          Minimum reserved stamp for well known services.
static int NameServiceStamp
          Reserved stamp for name service AgentId.
static AgentId nullId
          null AgentId.
static int NullIdStamp
          Reserved stamp for NullId.
static int SCAdminProxyStamp
          Reserved stamp for SCAdmin proxy AgentId.
static int SchedulerServiceStamp
          Reserved stamp for scheduler service AgentId.
 
Constructor Summary
AgentId(short from, short to, int stamp)
          Allocates a new AgentId object.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Indicates whether some other agent id.
static AgentId factoryId(short sid)
          Returns the AgentId for a remote factory agent.
static AgentId fromString(java.lang.String str)
          Parses the string argument as an AgentId.
 short getFrom()
           
 int getStamp()
           
 short getTo()
           
 int hashCode()
          Returns a hashcode for this AgentId object.
 boolean isNullId()
           
static AgentId localId(short sid)
           
 java.lang.String toString()
          Returns a string representation of this AgentId object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NullIdStamp

public static final int NullIdStamp
Reserved stamp for NullId.

See Also:
Constant Field Values

FactoryIdStamp

public static final int FactoryIdStamp
Reserved stamp for factory AgentId.

See Also:
Constant Field Values

AdminIdStamp

public static final int AdminIdStamp
Reserved stamp for admin AgentId.

See Also:
Constant Field Values

MaxSystemIdStamp

public static final int MaxSystemIdStamp
Maximum reserved stamp for system services.

See Also:
Constant Field Values

MinWKSIdStamp

public static int MinWKSIdStamp
Minimum reserved stamp for well known services.


NameServiceStamp

public static int NameServiceStamp
Reserved stamp for name service AgentId.


SchedulerServiceStamp

public static int SchedulerServiceStamp
Reserved stamp for scheduler service AgentId.


FileTransfertStamp

public static int FileTransfertStamp
Reserved stamp for fileTransfert service AgentId.


JndiServiceStamp

public static int JndiServiceStamp
Reserved stamp for JNDI service AgentId.


LocalJndiServiceStamp

public static int LocalJndiServiceStamp
Reserved stamp for local JNDI service AgentId.


SCAdminProxyStamp

public static int SCAdminProxyStamp
Reserved stamp for SCAdmin proxy AgentId.


JoramAdminStamp

public static int JoramAdminStamp
Reserved stamp for JORAM administration topic AgentId.


JoramAdminPxStamp

public static int JoramAdminPxStamp
Reserved stamp for JORAM administration proxy AgentId.


ControlTopicStamp

public static int ControlTopicStamp
Reserved stamp for JMS topic AgentId in charge ofsending control events.


MaxWKSIdStamp

public static int MaxWKSIdStamp
Maximum reserved stamp for well known services.


MaxIdStamp

public static int MaxIdStamp
Maximum reserved stamp.


nullId

public static final AgentId nullId
null AgentId.

Constructor Detail

AgentId

public AgentId(short from,
               short to,
               int stamp)
Allocates a new AgentId object.

Parameters:
from - The identification of the agent server hosting the creating agent.
to - The identification of the agent server hosting the agent.
stamp - The stamp of agent.
Method Detail

factoryId

public static final AgentId factoryId(short sid)
Returns the AgentId for a remote factory agent.

Parameters:
sid - remote server id.
Returns:
the AgentId for a remote factory agent.

localId

public static final AgentId localId(short sid)

getFrom

public final short getFrom()

getTo

public final short getTo()

getStamp

public final int getStamp()

fromString

public static AgentId fromString(java.lang.String str)
Parses the string argument as an AgentId.

Returns:
The AgentId object represented by the argument.

toString

public final java.lang.String toString()
Returns a string representation of this AgentId object.

Returns:
A string representation of this object.

hashCode

public int hashCode()
Returns a hashcode for this AgentId object.

Returns:
a hash code value for this object, equal to the primitive int value represented by the stamp field.

isNullId

public final boolean isNullId()
Returns:
true if this id is equals to NullId; false otherwise.

equals

public boolean equals(java.lang.Object obj)
Indicates whether some other agent id. is "equal to" this one. This method returns true if and only if obj is an AgentId and refer to the same agent (from, to and stamp fields are equals).

Parameters:
obj - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.


Copyright ? 2004 Scalagent - All rights reserved