Package cmion.level3.fatima
Class FAtiMAConnector
- java.lang.Object
-
- ion.Meta.Element
-
- cmion.architecture.CmionComponent
-
- cmion.level3.AgentMindConnector
-
- cmion.level3.fatima.FAtiMAConnector
-
- All Implemented Interfaces:
Migrating,MigrationAware
public class FAtiMAConnector extends AgentMindConnector implements Migrating, MigrationAware
-
-
Field Summary
-
Fields inherited from class cmion.architecture.CmionComponent
architecture
-
-
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 voidarchitectureReady()informs the mind that the architecture is ready for the mind executing actionsvoidawakeMind()send a message to FAtiMA telling the mind to resume from a paused statebooleandistinguishesPersistent()returns whether the connected Fatima is expected to distinguish between persistent and non persistent properties (true) or not (false)voidexecute(MindAction mindAction)executes a new action sent by the mindjava.lang.StringgetMessageTag()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.booleanisConnected()returns whether we have a remote mind connected through a socketbooleanisMindSleeping()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 connectedvoidnotifyAgentConnected(java.lang.String agentName, java.util.HashMap<java.lang.String,java.lang.Object> properties)this is called once FAtiMA has established a connectionvoidnotifyGetState(java.lang.String state)this message is called by the connected fatima listener, when it receives a state from fatimavoidnotifySetState()this message is called by the connected fatima listener, when it receives a state from fatimavoidonMigrationFailure()voidonMigrationIn()voidonMigrationOut()voidonMigrationSuccess()voidparseSemanticMemory(java.lang.String msg)parse the xml message containing the semantic memory of the connected agent, use it to update the world modelprotected voidprocessActionCancellation(MindAction a)FAtiMA is currently not receiving any cancellation feedback messages, so we don't need to do anything in hereprotected voidprocessActionFailure(MindAction a)report the failure of an action to FAtiMAprotected voidprocessActionSuccess(MindAction a)report the success of an action to FAtiMAprotected voidprocessEntityAdded(java.lang.String entityName)informs the mind that a new entity (agent or object) has been added to the world modelprotected voidprocessEntityRemoved(java.lang.String entityName)informs the mind that an entity (agent or object) has been removed from the world modelprotected voidprocessPropertyChanged(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 changedprotected voidprocessPropertyRemoved(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 removedprotected voidprocessRawMessage(java.lang.String message)in this message a mind can parse raw messages containing specialised communication / perceptions / requestsprotected voidprocessRemoteAction(MindAction remoteAction)sends a remoteAction (an action that another agent/user has performed) to the mindvoidrestoreState(org.w3c.dom.Element message)This method parses the XML element provided and restores the state of the object.org.w3c.dom.ElementsaveState(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.voidsaveStateToDisk()voidsendMindToSleep()send a message to FAtiMA telling the mind to pause-
Methods inherited from class cmion.level3.AgentMindConnector
cancel, newAction, onDestroy, registerHandlers
-
Methods inherited from class cmion.architecture.CmionComponent
getArchitecture, raise
-
-
-
-
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:
awakeMindin classAgentMindConnector
-
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:
isMindSleepingin classAgentMindConnector
-
processActionFailure
protected void processActionFailure(MindAction a)
report the failure of an action to FAtiMA- Specified by:
processActionFailurein classAgentMindConnector
-
processActionSuccess
protected void processActionSuccess(MindAction a)
report the success of an action to FAtiMA- Specified by:
processActionSuccessin classAgentMindConnector
-
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:
processActionCancellationin classAgentMindConnector
-
processRemoteAction
protected void processRemoteAction(MindAction remoteAction)
Description copied from class:AgentMindConnectorsends a remoteAction (an action that another agent/user has performed) to the mind- Specified by:
processRemoteActionin classAgentMindConnector
-
sendMindToSleep
public void sendMindToSleep()
send a message to FAtiMA telling the mind to pause- Specified by:
sendMindToSleepin classAgentMindConnector
-
processEntityAdded
protected void processEntityAdded(java.lang.String entityName)
Description copied from class:AgentMindConnectorinforms the mind that a new entity (agent or object) has been added to the world model- Specified by:
processEntityAddedin classAgentMindConnector
-
processEntityRemoved
protected void processEntityRemoved(java.lang.String entityName)
Description copied from class:AgentMindConnectorinforms the mind that an entity (agent or object) has been removed from the world model- Specified by:
processEntityRemovedin classAgentMindConnector
-
processPropertyChanged
protected void processPropertyChanged(java.lang.String entityName, java.lang.String propertyName, java.lang.String propertyValue, boolean persistent)Description copied from class:AgentMindConnectorinforms the mind that a property of an agent or object in the world model has changed- Specified by:
processPropertyChangedin classAgentMindConnector
-
processPropertyRemoved
protected void processPropertyRemoved(java.lang.String entityName, java.lang.String propertyName)Description copied from class:AgentMindConnectorinforms the mind that a property of an agent or object in the world model has been removed- Specified by:
processPropertyRemovedin classAgentMindConnector
-
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:
isConnectedin classCmionComponent
-
architectureReady
protected void architectureReady()
Description copied from class:AgentMindConnectorinforms the mind that the architecture is ready for the mind executing actions- Specified by:
architectureReadyin classAgentMindConnector
-
getMessageTag
public java.lang.String getMessageTag()
Description copied from interface:MigratingThis 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:
getMessageTagin interfaceMigrating- Returns:
- the object signature.
-
onMigrationFailure
public void onMigrationFailure()
- Specified by:
onMigrationFailurein interfaceMigrationAware
-
onMigrationIn
public void onMigrationIn()
- Specified by:
onMigrationInin interfaceMigrationAware
-
onMigrationOut
public void onMigrationOut()
- Specified by:
onMigrationOutin interfaceMigrationAware
-
onMigrationSuccess
public void onMigrationSuccess()
- Specified by:
onMigrationSuccessin interfaceMigrationAware
-
restoreState
public void restoreState(org.w3c.dom.Element message)
Description copied from interface:MigratingThis method parses the XML element provided and restores the state of the object.- Specified by:
restoreStatein interfaceMigrating- 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:MigratingThis method encodes the current state of the object and other relevant information in an XML element in order to be migrated.
-
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:AgentMindConnectorin this message a mind can parse raw messages containing specialised communication / perceptions / requests- Specified by:
processRawMessagein classAgentMindConnector
-
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
-
-