class AgentEngineContextImpl extends Object implements AgentEngineContext
AgentEngine
implemented in
another package to invoke operations that cannot be accessed
outside of the fr.dyade.aaa.agent
package.
An AgentEngineContext
should be for the unique private use of its associated
AgentEngine
and should not be shared with any other components otherwise
the agent server security would be broken.Modifier and Type | Field and Description |
---|---|
private static EncodableFactory |
messageFactory |
Constructor and Description |
---|
AgentEngineContextImpl()
Package constructor not accessible from outside this package.
|
Modifier and Type | Method and Description |
---|---|
void |
channelPost(Message msg)
Posts a message in the channel.
|
void |
checkMessageFrom(Message msg)
Checks the message 'from'.
|
Agent |
createAgentFactory()
Creates an instance of
AgentFactory . |
Message |
createMessage(AgentId from,
AgentId to,
Notification not)
Creates a message.
|
void |
deleteMessage(Message msg)
Deletes and frees the specified message.
|
void |
directSendTo(AgentId to,
Notification not)
Sends a notification to the specified destination
with a local id.
|
MessageConsumer |
getConsumer(short id)
Returns the specified
MessageConsumer |
AgentId |
getLocalAgentId()
Returns the local agent id.
|
void |
incReactNumber(Agent ag)
Increments the reaction counter of
the specified agent.
|
void |
initAgentLogger(Agent agent)
Initializes the agent's logger.
|
void |
initializeAgent(AgentId id,
Agent agent)
Initializes an agent after creation.
|
void |
initializeReloadedAgent(Agent agent)
Initializes a reloaded agent.
|
Agent |
loadAgent(AgentId id)
Loads the specified agent.
|
void |
saveAgent(Agent agent)
Saves the agent
|
void |
saveChannel()
Saves the channel
|
void |
setAgentLast(Agent ag,
long last)
Sets the agent last reaction count.
|
void |
setSaveAgent(Agent agent)
Sets the agent as to be saved.
|
void |
stampAndSave(Message msg,
int stamp)
Stamps and saves the specified message.
|
void |
validateChannel()
Validates the Channel.
|
private static EncodableFactory messageFactory
AgentEngineContextImpl()
public Agent createAgentFactory() throws IOException
AgentFactory
.createAgentFactory
in interface AgentEngineContext
AgentFactory
IOException
public void initializeAgent(AgentId id, Agent agent) throws Exception
initializeAgent
in interface AgentEngineContext
id
- the identifier of the agent to initializeagent
- the agent to initializeException
public void directSendTo(AgentId to, Notification not)
directSendTo
in interface AgentEngineContext
to
- the notification destinationnot
- the notification to sendpublic void initAgentLogger(Agent agent) throws Exception
initAgentLogger
in interface AgentEngineContext
agent
- the agent to initializeException
public Agent loadAgent(AgentId id) throws IOException, ClassNotFoundException
loadAgent
in interface AgentEngineContext
id
- the identifier of the agent to loadIOException
ClassNotFoundException
public void setAgentLast(Agent ag, long last)
setAgentLast
in interface AgentEngineContext
ag
- the agent to modifylast
- the reaction count to setpublic void initializeReloadedAgent(Agent agent) throws Exception
initializeReloadedAgent
in interface AgentEngineContext
agent
- Exception
public void setSaveAgent(Agent agent)
setSaveAgent
in interface AgentEngineContext
agent
- the agent to updatepublic void saveAgent(Agent agent) throws IOException
saveAgent
in interface AgentEngineContext
agent
- the agent to saveIOException
public Message createMessage(AgentId from, AgentId to, Notification not)
createMessage
in interface AgentEngineContext
from
- the source of the messageto
- the destination of the messagenot
- the notification to be transmitted by the messagepublic void deleteMessage(Message msg)
deleteMessage
in interface AgentEngineContext
msg
- public AgentId getLocalAgentId()
getLocalAgentId
in interface AgentEngineContext
public void incReactNumber(Agent ag)
incReactNumber
in interface AgentEngineContext
ag
- the agent to updatepublic void validateChannel()
validateChannel
in interface AgentEngineContext
public void checkMessageFrom(Message msg)
checkMessageFrom
in interface AgentEngineContext
msg
- the message to checkpublic MessageConsumer getConsumer(short id) throws UnknownServerException
MessageConsumer
getConsumer
in interface AgentEngineContext
id
- the identifier of the MessageConsumer
MessageConsumer
UnknownServerException
public void channelPost(Message msg) throws Exception
channelPost
in interface AgentEngineContext
msg
- the message to postException
public void saveChannel() throws IOException
saveChannel
in interface AgentEngineContext
IOException
public void stampAndSave(Message msg, int stamp) throws IOException
stampAndSave
in interface AgentEngineContext
msg
- the message to stamp and savestamp
- the stamp to assignIOException
Copyright © 2020 ScalAgent D.T.. All rights reserved.