Class FAtiMAConnector

    • Constructor Summary

      Constructors 
      Constructor Description
      FAtiMAConnector​(IArchitecture architecture)
      create a new FAtiMA connector that connects to an old version of FAtiMA that cannot migrate (kept for backwards compatibility)
      FAtiMAConnector​(IArchitecture architecture, java.lang.String options)
      create a new FAtiMA connector, with an additional options parameter this can at the moment contain any of the following substrings in any order - "migrating" : indicates that the fatima connecting here supports migration (see boolean canMigrate) - "sleeping" : immediately send this mind to sleep once it is connected, this is useful, if this platform is awaiting incoming migration and currently inactive - "modular" : indicates the fatima connecting is expected to be the recent (2010+) modular version or an older one (see boolean modular) - "persistent": indicates that the fatima connecting is expected to be the recent (15/11/2011+) version that can disinguish between persistent and non persistent knowledge (see boolean distinguishPersistent)
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void architectureReady()
      informs the mind that the architecture is ready for the mind executing actions
      void awakeMind()
      send a message to FAtiMA telling the mind to resume from a paused state
      boolean distinguishesPersistent()
      returns whether the connected Fatima is expected to distinguish between persistent and non persistent properties (true) or not (false)
      void execute​(MindAction mindAction)
      executes a new action sent by the mind
      java.lang.String getMessageTag()
      This method returns a string that is used to identify the state that is encoded by the implementing class and to select the messages that will be delivered to it.
      boolean isConnected()
      returns whether we have a remote mind connected through a socket
      boolean isMindSleeping()
      returns whether FAtiMA is sleeping/paused or not, this function should be called in conjunction with isConnected, because its return value makes no sense if no mind is connected
      void notifyAgentConnected​(java.lang.String agentName, java.util.HashMap<java.lang.String,​java.lang.Object> properties)
      this is called once FAtiMA has established a connection
      void notifyGetState​(java.lang.String state)
      this message is called by the connected fatima listener, when it receives a state from fatima
      void notifySetState()
      this message is called by the connected fatima listener, when it receives a state from fatima
      void onMigrationFailure()  
      void onMigrationIn()  
      void onMigrationOut()  
      void onMigrationSuccess()  
      void parseSemanticMemory​(java.lang.String msg)
      parse the xml message containing the semantic memory of the connected agent, use it to update the world model
      protected void processActionCancellation​(MindAction a)
      FAtiMA is currently not receiving any cancellation feedback messages, so we don't need to do anything in here
      protected void processActionFailure​(MindAction a)
      report the failure of an action to FAtiMA
      protected void processActionSuccess​(MindAction a)
      report the success of an action to FAtiMA
      protected void processEntityAdded​(java.lang.String entityName)
      informs the mind that a new entity (agent or object) has been added to the world model
      protected void processEntityRemoved​(java.lang.String entityName)
      informs the mind that an entity (agent or object) has been removed from the world model
      protected void processPropertyChanged​(java.lang.String entityName, java.lang.String propertyName, java.lang.String propertyValue, boolean persistent)
      informs the mind that a property of an agent or object in the world model has changed
      protected void processPropertyRemoved​(java.lang.String entityName, java.lang.String propertyName)
      informs the mind that a property of an agent or object in the world model has been removed
      protected void processRawMessage​(java.lang.String message)
      in this message a mind can parse raw messages containing specialised communication / perceptions / requests
      protected void processRemoteAction​(MindAction remoteAction)
      sends a remoteAction (an action that another agent/user has performed) to the mind
      void restoreState​(org.w3c.dom.Element message)
      This method parses the XML element provided and restores the state of the object.
      org.w3c.dom.Element saveState​(org.w3c.dom.Document doc)
      This method encodes the current state of the object and other relevant information in an XML element in order to be migrated.
      void saveStateToDisk()  
      void sendMindToSleep()
      send a message to FAtiMA telling the mind to pause
      • Methods inherited from class ion.Meta.Element

        destroy, getEventFilters, getEventHandlers, getRequestFilters, getRequestHandlers, getSimulation, getUID, schedule, wasDestroyed
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FAtiMAConnector

        public FAtiMAConnector​(IArchitecture architecture)
        create a new FAtiMA connector that connects to an old version of FAtiMA that cannot migrate (kept for backwards compatibility)
      • FAtiMAConnector

        public FAtiMAConnector​(IArchitecture architecture,
                               java.lang.String options)
        create a new FAtiMA connector, with an additional options parameter this can at the moment contain any of the following substrings in any order - "migrating" : indicates that the fatima connecting here supports migration (see boolean canMigrate) - "sleeping" : immediately send this mind to sleep once it is connected, this is useful, if this platform is awaiting incoming migration and currently inactive - "modular" : indicates the fatima connecting is expected to be the recent (2010+) modular version or an older one (see boolean modular) - "persistent": indicates that the fatima connecting is expected to be the recent (15/11/2011+) version that can disinguish between persistent and non persistent knowledge (see boolean distinguishPersistent)
    • Method Detail

      • awakeMind

        public void awakeMind()
        send a message to FAtiMA telling the mind to resume from a paused state
        Specified by:
        awakeMind in class AgentMindConnector
      • isMindSleeping

        public boolean isMindSleeping()
        returns whether FAtiMA is sleeping/paused or not, this function should be called in conjunction with isConnected, because its return value makes no sense if no mind is connected
        Specified by:
        isMindSleeping in class AgentMindConnector
      • processActionCancellation

        protected void processActionCancellation​(MindAction a)
        FAtiMA is currently not receiving any cancellation feedback messages, so we don't need to do anything in here
        Specified by:
        processActionCancellation in class AgentMindConnector
      • processEntityAdded

        protected void processEntityAdded​(java.lang.String entityName)
        Description copied from class: AgentMindConnector
        informs the mind that a new entity (agent or object) has been added to the world model
        Specified by:
        processEntityAdded in class AgentMindConnector
      • processEntityRemoved

        protected void processEntityRemoved​(java.lang.String entityName)
        Description copied from class: AgentMindConnector
        informs the mind that an entity (agent or object) has been removed from the world model
        Specified by:
        processEntityRemoved in class AgentMindConnector
      • processPropertyChanged

        protected void processPropertyChanged​(java.lang.String entityName,
                                              java.lang.String propertyName,
                                              java.lang.String propertyValue,
                                              boolean persistent)
        Description copied from class: AgentMindConnector
        informs the mind that a property of an agent or object in the world model has changed
        Specified by:
        processPropertyChanged in class AgentMindConnector
      • processPropertyRemoved

        protected void processPropertyRemoved​(java.lang.String entityName,
                                              java.lang.String propertyName)
        Description copied from class: AgentMindConnector
        informs the mind that a property of an agent or object in the world model has been removed
        Specified by:
        processPropertyRemoved in class AgentMindConnector
      • notifyAgentConnected

        public void notifyAgentConnected​(java.lang.String agentName,
                                         java.util.HashMap<java.lang.String,​java.lang.Object> properties)
        this is called once FAtiMA has established a connection
      • isConnected

        public boolean isConnected()
        returns whether we have a remote mind connected through a socket
        Overrides:
        isConnected in class CmionComponent
      • getMessageTag

        public java.lang.String getMessageTag()
        Description copied from interface: Migrating
        This method returns a string that is used to identify the state that is encoded by the implementing class and to select the messages that will be delivered to it.
        Specified by:
        getMessageTag in interface Migrating
        Returns:
        the object signature.
      • restoreState

        public void restoreState​(org.w3c.dom.Element message)
        Description copied from interface: Migrating
        This method parses the XML element provided and restores the state of the object.
        Specified by:
        restoreState in interface Migrating
        Parameters:
        message - An XML element that contains the state to be parsed
      • saveStateToDisk

        public void saveStateToDisk()
      • saveState

        public org.w3c.dom.Element saveState​(org.w3c.dom.Document doc)
        Description copied from interface: Migrating
        This method encodes the current state of the object and other relevant information in an XML element in order to be migrated.
        Specified by:
        saveState in interface Migrating
      • notifyGetState

        public void notifyGetState​(java.lang.String state)
        this message is called by the connected fatima listener, when it receives a state from fatima
      • notifySetState

        public void notifySetState()
        this message is called by the connected fatima listener, when it receives a state from fatima
      • execute

        public void execute​(MindAction mindAction)
        executes a new action sent by the mind
      • distinguishesPersistent

        public boolean distinguishesPersistent()
        returns whether the connected Fatima is expected to distinguish between persistent and non persistent properties (true) or not (false)
      • processRawMessage

        protected void processRawMessage​(java.lang.String message)
        Description copied from class: AgentMindConnector
        in this message a mind can parse raw messages containing specialised communication / perceptions / requests
        Specified by:
        processRawMessage in class AgentMindConnector
      • parseSemanticMemory

        public void parseSemanticMemory​(java.lang.String msg)
        parse the xml message containing the semantic memory of the connected agent, use it to update the world model