org.jactr.core.runtime
Class ACTRRuntime

java.lang.Object
  extended by org.jactr.core.runtime.ACTRRuntime

public class ACTRRuntime
extends java.lang.Object


Field Summary
static org.apache.commons.logging.Log LOGGER
          logger definition
 
Method Summary
 void addListener(IACTRRuntimeListener listener, java.util.concurrent.Executor executor)
           
 void addModel(IModel model)
          add a model to this runtime.
 void dispatch(ACTRRuntimeEvent event)
           
 java.lang.Object getApplicationData()
           
 org.commonreality.time.IClock getClock(IModel model)
          return the clock for the model in this runtime.
 IConnector getConnector()
           
 IController getController()
           
 java.util.Collection<IACTRRuntimeListener> getListeners()
           
 java.util.Collection<IModel> getModels()
          return all the models associated with the runtime
 java.lang.Runnable getOnStart()
           
 java.lang.Runnable getOnStop()
          called by controller
static ACTRRuntime getRuntime()
          return the ACTRRuntime singleton
 java.io.File getWorkingDirectory()
           
 boolean hasListeners()
           
 void removeListener(IACTRRuntimeListener listener)
           
 void removeModel(IModel model)
          remove this model, assuming that it is not running.
 void setApplicationData(java.lang.Object applicationData)
           
 void setConnector(IConnector connector)
           
 void setController(IController controller)
          will call IController.attach()
 void setOnStart(java.lang.Runnable onStart)
          runnable to be executed after the runtime is started by the controller
 void setOnStop(java.lang.Runnable onStop)
          runnable to be executed after the runtime has stopped.
 void setWorkingDirectory(java.io.File workingDirectory)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

public static final org.apache.commons.logging.Log LOGGER
logger definition

Method Detail

getRuntime

public static ACTRRuntime getRuntime()
return the ACTRRuntime singleton

Returns:

getWorkingDirectory

public java.io.File getWorkingDirectory()

setWorkingDirectory

public void setWorkingDirectory(java.io.File workingDirectory)

getConnector

public IConnector getConnector()

setConnector

public void setConnector(IConnector connector)

getController

public IController getController()

setController

public void setController(IController controller)
will call IController.attach()

Parameters:
controller -

getClock

public org.commonreality.time.IClock getClock(IModel model)
return the clock for the model in this runtime. originally this was a zero parameter method but since when connected to common reality, each model has its own clock instance, we use the proxy clock to return a valid clock if connected to common reality, otherwise it returns a default shared clock

Parameters:
model - if null will always return the default shared clock
Returns:

addModel

public void addModel(IModel model)
add a model to this runtime. if the runtime is already actively running, this model will be added and immediately started. The model should have had all of its listeners attached before being added to the runtime. this will ensure that if the model is suspended that all events are delivered appropriately

Parameters:
model -

removeModel

public void removeModel(IModel model)
remove this model, assuming that it is not running. If it is, a runtime excepiton will be thrown

Parameters:
model -

getModels

public java.util.Collection<IModel> getModels()
return all the models associated with the runtime

Returns:

setOnStart

public void setOnStart(java.lang.Runnable onStart)
runnable to be executed after the runtime is started by the controller

Parameters:
onStart -

getOnStart

public java.lang.Runnable getOnStart()

setOnStop

public void setOnStop(java.lang.Runnable onStop)
runnable to be executed after the runtime has stopped. ie. all models terminated


getOnStop

public java.lang.Runnable getOnStop()
called by controller

Returns:

setApplicationData

public void setApplicationData(java.lang.Object applicationData)
Parameters:
applicationData -

getApplicationData

public java.lang.Object getApplicationData()

hasListeners

public boolean hasListeners()

getListeners

public java.util.Collection<IACTRRuntimeListener> getListeners()

addListener

public void addListener(IACTRRuntimeListener listener,
                        java.util.concurrent.Executor executor)

removeListener

public void removeListener(IACTRRuntimeListener listener)

dispatch

public void dispatch(ACTRRuntimeEvent event)