public abstract class DiscoveryAgent
extends java.lang.Object
implements jadex.bridge.service.types.awareness.IDiscoveryService
Modifier and Type | Field and Description |
---|---|
protected jadex.bridge.IInternalAccess |
agent
The agent.
|
protected java.util.Map<java.lang.Byte,jadex.bridge.service.types.message.ICodec> |
allcodecs
The map of all codecs.
|
protected jadex.bridge.service.types.message.ICodec[] |
defaultcodecs
The default codecs.
|
protected long |
delay
The send (remotes) delay.
|
protected java.lang.String[] |
excludes
The excludes list.
|
protected boolean |
fast
Flag for enabling fast startup awareness (pingpong send behavior).
|
protected java.lang.String[] |
includes
The includes list.
|
protected boolean |
killed
Flag indicating agent killed.
|
protected boolean |
received_self
Flag indicating that the agent has received its own discovery info.
|
protected ReceiveHandler |
receiver
The receive handler.
|
protected jadex.bridge.IComponentIdentifier |
root
The root component id.
|
protected SendHandler |
sender
The send handler.
|
protected boolean |
started
Flag indicating that the agent is started and the send behavior may be activated.
|
protected java.util.Timer |
timer
The timer.
|
Constructor and Description |
---|
DiscoveryAgent() |
Modifier and Type | Method and Description |
---|---|
jadex.commons.future.IFuture<java.lang.Void> |
agentCreated() |
jadex.commons.future.IFuture<java.lang.Void> |
agentKilled()
Called just before the agent is removed from the platform.
|
jadex.commons.future.IFuture<jadex.bridge.service.types.awareness.AwarenessInfo> |
createAwarenessInfo()
Create awareness info of myself.
|
jadex.commons.future.IFuture<jadex.bridge.service.types.awareness.AwarenessInfo> |
createAwarenessInfo(java.lang.String state,
java.lang.String masterid)
Create awareness info of myself.
|
protected java.lang.String |
createMasterId()
Create the master id.
|
abstract ReceiveHandler |
createReceiveHandler()
Create the receive handler.
|
abstract SendHandler |
createSendHandler()
Create the send handler.
|
static java.lang.Object |
decodeObject(byte[] data,
java.util.Map<java.lang.Byte,jadex.bridge.service.types.message.ICodec> codecs,
java.lang.ClassLoader classloader)
Decode an object.
|
void |
doWaitFor(long delay,
jadex.bridge.IComponentStep<?> step)
Overriden wait for to not use platform clock.
|
static byte[] |
encodeObject(java.lang.Object object,
jadex.bridge.service.types.message.ICodec[] codecs,
java.lang.ClassLoader classloader)
Encode an object.
|
void |
executeBody()
Execute the functional body of the agent.
|
java.util.Map<java.lang.Byte,jadex.bridge.service.types.message.ICodec> |
getAllCodecs()
Get the allcodecs.
|
long |
getClockTime()
Get the current time.
|
jadex.bridge.service.types.message.ICodec[] |
getDefaultCodecs()
Get the defaultcodecs.
|
long |
getDelay()
Get the delay.
|
java.lang.String[] |
getExcludes()
Get the excludes.
|
java.lang.String[] |
getIncludes()
Get the includes.
|
jadex.bridge.IInternalAccess |
getMicroAgent()
Get the agent.
|
ReceiveHandler |
getReceiver()
Get the receiver.
|
jadex.bridge.IComponentIdentifier |
getRoot()
Get the root.
|
SendHandler |
getSender()
Get the sender.
|
protected abstract void |
initNetworkRessource()
(Re)init sending/receiving ressource.
|
boolean |
isFast()
Get the fast startup awareness flag.
|
boolean |
isKilled()
Get the killed.
|
boolean |
isStarted()
Get the started.
|
void |
republish()
Republish the awareness info.
|
void |
setDelay(long delay)
Set the delay.
|
void |
setExcludes(java.lang.String[] excludes)
Set the excludes.
|
void |
setFast(boolean fast)
Set the fast startup awareness flag
|
void |
setIncludes(java.lang.String[] includes)
Set the includes.
|
void |
setKilled(boolean killed)
Set the killed.
|
void |
setRoot(jadex.bridge.IComponentIdentifier root)
Set the root.
|
void |
setStarted(boolean started)
Set the started.
|
protected abstract void |
terminateNetworkRessource()
Terminate sending/receiving ressource.
|
protected jadex.bridge.IInternalAccess agent
protected long delay
protected boolean fast
protected java.lang.String[] includes
protected java.lang.String[] excludes
protected boolean started
protected boolean killed
protected java.util.Timer timer
protected jadex.bridge.IComponentIdentifier root
protected SendHandler sender
protected ReceiveHandler receiver
protected boolean received_self
protected jadex.bridge.service.types.message.ICodec[] defaultcodecs
protected java.util.Map<java.lang.Byte,jadex.bridge.service.types.message.ICodec> allcodecs
public jadex.commons.future.IFuture<java.lang.Void> agentCreated()
public void executeBody()
public jadex.commons.future.IFuture<java.lang.Void> agentKilled()
protected java.lang.String createMasterId()
public abstract SendHandler createSendHandler()
public abstract ReceiveHandler createReceiveHandler()
public java.lang.String[] getIncludes()
public void setIncludes(java.lang.String[] includes)
setIncludes
in interface jadex.bridge.service.types.awareness.IDiscoveryService
includes
- The includes.public java.lang.String[] getExcludes()
public void setExcludes(java.lang.String[] excludes)
setExcludes
in interface jadex.bridge.service.types.awareness.IDiscoveryService
excludes
- The excludes.public boolean isStarted()
public void setStarted(boolean started)
started
- The started to set.public boolean isKilled()
public void setKilled(boolean killed)
killed
- The killed to set.public jadex.bridge.IComponentIdentifier getRoot()
public void setRoot(jadex.bridge.IComponentIdentifier root)
root
- The root to set.public long getDelay()
public void setDelay(long delay)
setDelay
in interface jadex.bridge.service.types.awareness.IDiscoveryService
delay
- The delay to set.public void setFast(boolean fast)
setFast
in interface jadex.bridge.service.types.awareness.IDiscoveryService
public boolean isFast()
public void republish()
republish
in interface jadex.bridge.service.types.awareness.IDiscoveryService
public long getClockTime()
public void doWaitFor(long delay, jadex.bridge.IComponentStep<?> step)
public static byte[] encodeObject(java.lang.Object object, jadex.bridge.service.types.message.ICodec[] codecs, java.lang.ClassLoader classloader)
object
- The object.public static java.lang.Object decodeObject(byte[] data, java.util.Map<java.lang.Byte,jadex.bridge.service.types.message.ICodec> codecs, java.lang.ClassLoader classloader)
data
- The byte array.public java.util.Map<java.lang.Byte,jadex.bridge.service.types.message.ICodec> getAllCodecs()
public jadex.bridge.service.types.message.ICodec[] getDefaultCodecs()
public jadex.commons.future.IFuture<jadex.bridge.service.types.awareness.AwarenessInfo> createAwarenessInfo()
public jadex.commons.future.IFuture<jadex.bridge.service.types.awareness.AwarenessInfo> createAwarenessInfo(java.lang.String state, java.lang.String masterid)
public jadex.bridge.IInternalAccess getMicroAgent()
public SendHandler getSender()
public ReceiveHandler getReceiver()
protected abstract void initNetworkRessource()
protected abstract void terminateNetworkRessource()