Interface AgentEngineContext

  • All Known Implementing Classes:
    AgentEngineContextImpl

    public interface AgentEngineContext
    Context enabling an 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.
    • Method Detail

      • createAgentFactory

        Agent createAgentFactory()
                          throws IOException
        Creates an instance of AgentFactory.
        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 initialize
        agent - 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 destination
        not - 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.
      • setAgentLast

        void setAgentLast​(Agent ag,
                          long last)
        Sets the agent last reaction count.
        Parameters:
        ag - the agent to modify
        last - 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 message
        to - the destination of the message
        not - 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
      • channelPost

        void channelPost​(Message msg)
                  throws Exception
        Posts a message in the channel.
        Parameters:
        msg - the message to post
        Throws:
        Exception - 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 save
        stamp - the stamp to assign
        Throws:
        IOException - an error occurs.