fr.dyade.aaa.agent

Class AgentId

Implemented Interfaces:
Serializable

public final class AgentId
extends java.lang.Object
implements 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

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 int
NullIdStamp
Reserved stamp for NullId.
static int
SCAdminProxyStamp
Reserved stamp for SCAdmin proxy AgentId.
static int
SchedulerServiceStamp
Reserved stamp for scheduler service AgentId.
static AgentId
nullId
null AgentId.

Constructor Summary

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

Method Summary

boolean
equals(Object obj)
Indicates whether some other agent id.
static AgentId
factoryId(short sid)
Returns the AgentId for a remote factory agent.
static AgentId
fromString(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)
String
toString()
Returns a string representation of this AgentId object.

Field Details

AdminIdStamp

public static final int AdminIdStamp
Reserved stamp for admin AgentId.

Field Value:
2


ControlTopicStamp

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


FactoryIdStamp

public static final int FactoryIdStamp
Reserved stamp for factory AgentId.

Field Value:
1


FileTransfertStamp

public static int FileTransfertStamp
Reserved stamp for fileTransfert service AgentId.


JndiServiceStamp

public static int JndiServiceStamp
Reserved stamp for JNDI service AgentId.


JoramAdminPxStamp

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


JoramAdminStamp

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


LocalJndiServiceStamp

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


MaxIdStamp

public static int MaxIdStamp
Maximum reserved stamp.


MaxSystemIdStamp

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

Field Value:
2


MaxWKSIdStamp

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


MinWKSIdStamp

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


NameServiceStamp

public static int NameServiceStamp
Reserved stamp for name service AgentId.


NullIdStamp

public static final int NullIdStamp
Reserved stamp for NullId.

Field Value:
0


SCAdminProxyStamp

public static int SCAdminProxyStamp
Reserved stamp for SCAdmin proxy AgentId.


SchedulerServiceStamp

public static int SchedulerServiceStamp
Reserved stamp for scheduler service AgentId.


nullId

public static final AgentId nullId
null AgentId.

Constructor Details

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 Details

equals

public boolean equals(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.


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.


fromString

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

Returns:
The AgentId object represented by the argument.


getFrom

public final short getFrom()


getStamp

public final int getStamp()


getTo

public final short getTo()


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.


localId

public static final AgentId localId(short sid)


toString

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

Returns:
A string representation of this object.


Copyright B) 2004 Scalagent - All rights reserved