Package fr.dyade.aaa.agent
Interface AgentEngineContext
-
- All Known Implementing Classes:
AgentEngineContextImpl
public interface AgentEngineContextContext enabling anAgentEngineimplemented in another package to invoke operations that cannot be accessed outside of thefr.dyade.aaa.agentpackage. AnAgentEngineContextshould be for the unique private use of its associatedAgentEngineand should not be shared with any other components otherwise the agent server security would be broken.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidchannelPost(Message msg)Posts a message in the channel.voidcheckMessageFrom(Message msg)Checks the message 'from'.AgentcreateAgentFactory()Creates an instance ofAgentFactory.MessagecreateMessage(AgentId from, AgentId to, Notification not)Creates a message.voiddeleteMessage(Message msg)Deletes and frees the specified message.voiddirectSendTo(AgentId to, Notification not)Sends a notification to the specified destination with a local id.MessageConsumergetConsumer(short id)Returns the specifiedMessageConsumerAgentIdgetLocalAgentId()Returns the local agent id.voidincReactNumber(Agent ag)Increments the reaction counter of the specified agent.voidinitAgentLogger(Agent agent)Initializes the agent's logger.voidinitializeAgent(AgentId id, Agent agent)Initializes an agent after creation.voidinitializeReloadedAgent(Agent agent)Initializes a reloaded agent.AgentloadAgent(AgentId id)Loads the specified agent.voidsaveAgent(Agent agent)Saves the agentvoidsaveChannel()Saves the channelvoidsetAgentLast(Agent ag, long last)Sets the agent last reaction count.voidsetSaveAgent(Agent agent)Sets the agent as to be saved.voidstampAndSave(Message msg, int stamp)Stamps and saves the specified message.voidvalidateChannel()Validates the Channel.
-
-
-
Method Detail
-
createAgentFactory
Agent createAgentFactory() throws IOException
Creates an instance ofAgentFactory.- Returns:
- an instance of
AgentFactory - Throws:
IOException- an error occurs.
-
initializeAgent
void initializeAgent(AgentId id, Agent agent) throws Exception
Initializes an agent after creation. First time is true.- Parameters:
id- the identifier of the agent to initializeagent- the agent to initialize- Throws:
Exception- an error occurs.
-
directSendTo
void directSendTo(AgentId to, Notification not)
Sends a notification to the specified destination with a local id.- Parameters:
to- the notification destinationnot- the notification to send
-
initAgentLogger
void initAgentLogger(Agent agent) throws Exception
Initializes the agent's logger.- Parameters:
agent- the agent to initialize- Throws:
Exception- an error occurs.
-
loadAgent
Agent loadAgent(AgentId id) throws IOException, ClassNotFoundException
Loads the specified agent.- Parameters:
id- the identifier of the agent to load- Returns:
- the loaded agent
- Throws:
IOException- an error occurs.ClassNotFoundException- an error occurs.
-
setAgentLast
void setAgentLast(Agent ag, long last)
Sets the agent last reaction count.- Parameters:
ag- the agent to modifylast- the reaction count to set
-
initializeReloadedAgent
void initializeReloadedAgent(Agent agent) throws Exception
Initializes a reloaded agent. First time is false.- Parameters:
agent- the agent to initialize..- Throws:
Exception- an error occurs.
-
setSaveAgent
void setSaveAgent(Agent agent)
Sets the agent as to be saved.- Parameters:
agent- the agent to update
-
saveAgent
void saveAgent(Agent agent) throws IOException
Saves the agent- Parameters:
agent- the agent to save- Throws:
IOException- an error occurs.
-
createMessage
Message createMessage(AgentId from, AgentId to, Notification not)
Creates a message.- Parameters:
from- the source of the messageto- the destination of the messagenot- the notification to be transmitted by the message- Returns:
- the created message.
-
deleteMessage
void deleteMessage(Message msg)
Deletes and frees the specified message.- Parameters:
msg- the message to delete.
-
getLocalAgentId
AgentId getLocalAgentId()
Returns the local agent id.- Returns:
- the local agent id
-
incReactNumber
void incReactNumber(Agent ag)
Increments the reaction counter of the specified agent.- Parameters:
ag- the agent to update
-
validateChannel
void validateChannel()
Validates the Channel.
-
checkMessageFrom
void checkMessageFrom(Message msg)
Checks the message 'from'.- Parameters:
msg- the message to check
-
getConsumer
MessageConsumer getConsumer(short id) throws UnknownServerException
Returns the specifiedMessageConsumer- Parameters:
id- the identifier of theMessageConsumer- Returns:
- the specified
MessageConsumer - Throws:
UnknownServerException- the server is not defined.
-
channelPost
void channelPost(Message msg) throws Exception
Posts a message in the channel.- Parameters:
msg- the message to post- Throws:
Exception- an error occurs.
-
saveChannel
void saveChannel() throws IOExceptionSaves the channel- Throws:
IOException- an error occurs.
-
stampAndSave
void stampAndSave(Message msg, int stamp) throws IOException
Stamps and saves the specified message.- Parameters:
msg- the message to stamp and savestamp- the stamp to assign- Throws:
IOException- an error occurs.
-
-