public final class AgentId extends Object implements Serializable, Encodable
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).
The two requirements are then:
AgentIdStamp
,
Serialized FormModifier and Type | Field and Description |
---|---|
static int |
AMQPAgentStamp
Reserved stamp for AMQPAgent.
|
static int |
ControlTopicStamp
Reserved stamp for JMS topic
AgentId in charge of sending control events. |
(package private) static AgentId |
factoryId
AgentId for local factory agent. |
static int |
FactoryIdStamp
Reserved stamp for factory
AgentId . |
static int |
FileTransfertStamp
Reserved stamp for fileTransfert service
AgentId . |
(package private) short |
from
The identification of the agent server hosting the creating agent.
|
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 . |
(package private) static AgentId |
localId
Used by channel to send messages without source agent (from proxy
or engine).
|
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 |
MqttAgentStamp
Reserved stamp for MQTT proxy agent.
|
static int |
MqttDefault$TopicStamp
Reserved stamp for MQTT default $ topic.
|
static int |
MqttDefaultTopicStamp
Reserved stamp for MQTT default topic.
|
static int |
NameServiceStamp
Reserved stamp for name service
AgentId . |
static AgentId |
nullId
null
AgentId . |
static int |
NullIdStamp
Reserved stamp for NullId.
|
static int |
ResourceAgentStamp
Reserved stamp for ResourceAgent.
|
static int |
SCAdminProxyStamp
Reserved stamp for SCAdmin proxy
AgentId . |
static int |
SchedulerServiceStamp
Reserved stamp for scheduler service
AgentId . |
(package private) static long |
serialVersionUID
Define serialVersionUID for interoperability.
|
static int |
ServerConfigStamp
Reserved stamp for the server reconfiguration agent
AgentId . |
(package private) int |
stamp
The stamp, local to the agent server hosting the creating agent.
|
(package private) String |
str
A temporary string representation of object in order to improve
performances.
|
(package private) short |
to
The identification of the agent server hosting the created agent.
|
BOOLEAN_ENCODED_SIZE, BYTE_ENCODED_SIZE, DOUBLE_ENCODED_SIZE, FLOAT_ENCODED_SIZE, INT_ENCODED_SIZE, LONG_ENCODED_SIZE, SHORT_ENCODED_SIZE
Constructor and Description |
---|
AgentId()
Allocates an
AgentId object for a new agent hosted by
this agent server. |
AgentId(short to)
Allocates an
AgentId object for a new agent hosted by
specified agent server. |
AgentId(short from,
short to,
int stamp)
Allocates a new
AgentId object. |
Modifier and Type | Method and Description |
---|---|
void |
decode(Decoder decoder)
Decodes the object.
|
void |
encode(Encoder encoder)
Encodes the object.
|
boolean |
equals(Object obj)
Indicates whether some other agent id. is "equal to" this one.
|
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 . |
int |
getEncodableClassId()
The class id is still not defined.
|
int |
getEncodedSize()
Returns the size of the encoded object.
|
short |
getFrom() |
int |
getStamp() |
short |
getTo() |
int |
hashCode()
Returns a hashcode for this
AgentId object. |
(package private) static void |
init()
Statically initializes
AgentId class. |
boolean |
isLocal() |
boolean |
isNullId() |
static AgentId |
localId(short sid) |
static int |
parseInt(String str,
int idx,
int end)
Parses the string argument as a non signed integer.
|
private void |
readObject(ObjectInputStream in)
The
readObject is responsible for reading from the stream
and restoring the classes fields. |
String |
toString()
Returns a string representation of this
AgentId object. |
private void |
writeObject(ObjectOutputStream out)
The
writeObject method is responsible for writing the
state of the object for its particular class so that the corresponding
readObject method can restore it. |
static final long serialVersionUID
transient short from
transient short to
transient int stamp
transient String str
public static final int NullIdStamp
public static final int FactoryIdStamp
AgentId
.public static final int MaxSystemIdStamp
public static int MinWKSIdStamp
public static int NameServiceStamp
AgentId
.public static int SchedulerServiceStamp
AgentId
.public static int FileTransfertStamp
AgentId
.public static int JndiServiceStamp
AgentId
.public static int LocalJndiServiceStamp
AgentId
.public static int SCAdminProxyStamp
AgentId
.public static int JoramAdminStamp
AgentId
.public static int JoramAdminPxStamp
AgentId
.public static int ControlTopicStamp
AgentId
in charge of sending control events.public static int ServerConfigStamp
AgentId
.public static int ResourceAgentStamp
public static int AMQPAgentStamp
public static int MqttAgentStamp
public static int MqttDefaultTopicStamp
public static int MqttDefault$TopicStamp
public static int MaxWKSIdStamp
public static int MaxIdStamp
public static final AgentId nullId
AgentId
.static AgentId localId
Engine
,
Channel.sendTo(AgentId, Notification)
static AgentId factoryId
AgentId
for local factory agent.AgentFactory
AgentId() throws IOException
AgentId
object for a new agent hosted by
this agent server.IOException
AgentId(short to) throws IOException
AgentId
object for a new agent hosted by
specified agent server.to
- The identification of the agent server hosting the agent.IOException
public AgentId(short from, short to, int stamp)
AgentId
object.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.private void writeObject(ObjectOutputStream out) throws IOException
writeObject
method is responsible for writing the
state of the object for its particular class so that the corresponding
readObject
method can restore it.out
- the underlying output stream.IOException
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
readObject
is responsible for reading from the stream
and restoring the classes fields.in
- the underlying input stream.ClassNotFoundException
IOException
public static final AgentId factoryId(short sid)
AgentId
for a remote factory agent.sid
- remote server id.AgentId
for a remote factory agent.public static final AgentId localId(short sid)
static void init() throws IOException, ClassNotFoundException
AgentId
class.IOException
ClassNotFoundException
public final short getFrom()
public final short getTo()
public final int getStamp()
public static final int parseInt(String str, int idx, int end) throws NumberFormatException
str
- the String
containing the integer
representation to be parsed.idx
- the beginning index, inclusive.end
- the ending index, exclusive.NumberFormatException
- if the String
does not contain a parsable int
.public static final AgentId fromString(String str)
AgentId
.AgentId
object represented by the argument.public final String toString()
AgentId
object.public int hashCode()
AgentId
object.public final boolean isNullId()
true
if this id is equals to NullId; false
otherwise.public final boolean isLocal()
true
if this the 2 agents are colocated; false
otherwise.public boolean equals(Object obj)
true
if and only if obj is an AgentId
and refer to the same agent (from, to and stamp fields are equals).public int getEncodableClassId()
getEncodableClassId
in interface Encodable
public int getEncodedSize() throws Exception
getEncodedSize
in interface Encodable
if
- an error occursException
- if an error occursCopyright © 2020 ScalAgent D.T.. All rights reserved.