unsw.cse.mica.blackboard
Class SimpleBlackboard

java.lang.Object
  extended by unsw.cse.mica.blackboard.DefaultBlackboard
      extended by unsw.cse.mica.blackboard.SimpleBlackboard
All Implemented Interfaces:
Blackboard, BlackboardActions, BlackboardMessageSender, MicaConstants

public class SimpleBlackboard
extends DefaultBlackboard

A blackboard that stors mobs in a hashmap. Its very simple, albeit not very efficient. It is useful for debugging purposes.

Author:
jhw

Field Summary
static java.lang.String PERSISTENCE
           
static java.lang.String PREFIX
           
static java.lang.String TYPEOF
           
static java.lang.String WHERE
           
 
Fields inherited from interface unsw.cse.mica.util.MicaConstants
DEFAULT_DB_PATH, DEFAULT_HOST, DEFAULT_MICA_HOME, DEFAULT_PERSISTENCE, DEFAULT_PERSISTENT, DEFAULT_PORT, DEFAULT_TYPE_PATH, INTERNAL_SLOT_NAMES, PARAM_DB_PATH, PARAM_DEBUG, PARAM_HOST, PARAM_MICA_HOME, PARAM_PERSISTENT, PARAM_PORT, PARAM_TYPE_PATH, PERSISTENCE_CONNECTED, PERSISTENCE_PERMANENT, PERSISTENCE_TRANSIENT, PERSISTENCES, RESULT_ERROR, RESULT_NOSUCHAGENT, RESULT_NOSUCHMOB, RESULT_SUCCESS, SLOT_CREATIONTIME, SLOT_CREATOR, SLOT_DELETER, SLOT_DELETIONTIME, SLOT_MODIFICATIONTIME, SLOT_MODIFIER, UNKNOWN_AGENT
 
Constructor Summary
SimpleBlackboard()
           
 
Method Summary
 java.lang.String deleteMob(java.lang.String agentName, java.lang.String mobName)
          Delete a frame from the blackboard.
 int getMobCount()
           
 void init(MicaProperties args)
          Initialise the blackboard.
 java.util.List mobSearch(java.lang.String agentName, java.lang.String query)
          Current supports searchs of the form "select * from mobs [where CONDITION(mob,'STRING')]" where condition can be one of typeOf persistence Note that the spacing must be observed...
 Mob readMob(java.lang.String agentName, java.lang.String mobName)
          Retrieve a mob by its name.
 java.lang.String replaceMob(java.lang.String agentName, Mob newMob)
          replace a mob on the blackboard.
 boolean running()
           
 void terminate()
          Ask a blackboard to shut down
 java.lang.String writeMob(java.lang.String agentName, Mob mob)
          Makes a frame on the blackboard.
 
Methods inherited from class unsw.cse.mica.blackboard.DefaultBlackboard
connect, countAgentRegistrations, disconnect, getAgentNames, getAgentRegistrations, getNextPermanentID, getNextTransientID, getTransport, getTypeManager, register, sendDeletedMob, sendNewMob, sendReplacedMob, sendTypeManagerChanged, setTransport, unregister
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PREFIX

public static final java.lang.String PREFIX
See Also:
Constant Field Values

WHERE

public static final java.lang.String WHERE
See Also:
Constant Field Values

TYPEOF

public static final java.lang.String TYPEOF
See Also:
Constant Field Values

PERSISTENCE

public static final java.lang.String PERSISTENCE
See Also:
Constant Field Values
Constructor Detail

SimpleBlackboard

public SimpleBlackboard()
Method Detail

init

public void init(MicaProperties args)
          throws MicaException
Description copied from class: DefaultBlackboard
Initialise the blackboard. The type manager is created as a LocalTypeManager, with values read from a directory specified by parameters whose key is the value of MicaConstants.PARAM_MICA_HOME and MicaConstants.PARAM_TYPE_PATH.

Specified by:
init in interface Blackboard
Overrides:
init in class DefaultBlackboard
Parameters:
args - the parameters used for initialisation
Throws:
MicaException
See Also:
LocalTypeManager.loadTypesDirectory(unsw.cse.mica.util.MicaProperties)

running

public boolean running()

terminate

public void terminate()
               throws MicaException
Description copied from interface: Blackboard
Ask a blackboard to shut down

Specified by:
terminate in interface Blackboard
Overrides:
terminate in class DefaultBlackboard
Throws:
MicaException

readMob

public Mob readMob(java.lang.String agentName,
                   java.lang.String mobName)
Description copied from interface: BlackboardActions
Retrieve a mob by its name.

Parameters:
agentName - the agent requesting the mob
mobName - the name of the desired mob
Returns:
The desired mob, or null if it was not found or an error occurred

writeMob

public java.lang.String writeMob(java.lang.String agentName,
                                 Mob mob)
Description copied from interface: BlackboardActions
Makes a frame on the blackboard.

Parameters:
agentName - the name of the agent that sent the mob
mob - the mob to write to the blackboard
Returns:
The name that has been given to the frame, or MicaConstants.RESULT_ERROR if an error occurred.

deleteMob

public java.lang.String deleteMob(java.lang.String agentName,
                                  java.lang.String mobName)
Description copied from interface: BlackboardActions
Delete a frame from the blackboard.

Parameters:
agentName - the name of the agent that wants the mob deleted
mobName - the name of the mob to delete
Returns:
MicaConstants.RESULT_SUCCESS, MicaConstants.RESULT_NOSUCHMOB or MicaConstants.RESULT_ERROR

replaceMob

public java.lang.String replaceMob(java.lang.String agentName,
                                   Mob newMob)
Description copied from interface: BlackboardActions
replace a mob on the blackboard.

Parameters:
agentName - the name of the agent that wants the mob replaced
newMob - the new value for the mob
Returns:
MicaConstants.RESULT_SUCCESS, MicaConstants.RESULT_NOSUCHMOB or MicaConstants.RESULT_ERROR

mobSearch

public java.util.List mobSearch(java.lang.String agentName,
                                java.lang.String query)
Current supports searchs of the form "select * from mobs [where CONDITION(mob,'STRING')]" where condition can be one of Note that the spacing must be observed...

Returns:
A (possibly empty) list of mobs matching the criteria, or null if an error occurred

getMobCount

public int getMobCount()