Framework Professional Edition Package


org.mbs.services.device.abstractdriver
Class AbstractDeviceModel

java.lang.Object
  extended by org.mbs.services.cu.generator.DefaultControlUnitModel
      extended by org.mbs.services.device.abstractdriver.AbstractDeviceModel
All Implemented Interfaces:
ControlUnitModel

public abstract class AbstractDeviceModel
extends DefaultControlUnitModel

Base model class for all device models. A model holds the current state of a device.

Author:
Stoyan Zoubev

Field Summary
static java.lang.String COMP_NAME
          Constant used for logging
protected  java.lang.String currentState
          id of the current state of the state graph
protected  java.lang.Object device
          Reference to the underlying device service
static java.lang.Integer INTEGER_MINUS_ONE
          a frequent value for state variables
static java.lang.Integer INTEGER_ONE
          a frequent value for state variables
static java.lang.Integer INTEGER_ZERO
          a frequent value for state variables
protected  DeviceStateGraph stateGraph
          Device State Graph, may be null
static java.lang.String SVAR_ADDITIONAL_NAME
          the id of allowed actions state variable
static java.lang.String SVAR_ALLOWED_ACTIONS
          the id of allowed actions state variable
static java.lang.String SVAR_ATTACHMENT_TIME
          the id of allowed actions state variable
 
Fields inherited from class org.mbs.services.cu.generator.DefaultControlUnitModel
callback, id, stateVarValues, type
 
Constructor Summary
AbstractDeviceModel(java.lang.Object device, java.lang.String type, java.lang.String id)
          Constructs the model
 
Method Summary
protected  java.util.Dictionary getStateVariableValues()
           
protected abstract  void handleInconsistency()
          This method is invoked when a device model is found to be inconsistent.
 void release()
          Free the resources for the model.
 void setDeviceStateGraph(DeviceStateGraph stateGraph)
           
 boolean updateSV(java.lang.String stateVarId, java.lang.Object stateVarValue)
          Check if the old value of the state variable stateVarId is different from the new one and notify all listeners that have registered interest in the stateVar with id stateVarId
 
Methods inherited from class org.mbs.services.cu.generator.DefaultControlUnitModel
getControlUnitCallback, getId, getModelInitValues, getType, queryStateVariable, reset, setControlUnitCallback, updateStateVariableList
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INTEGER_ONE

public static final java.lang.Integer INTEGER_ONE
a frequent value for state variables


INTEGER_ZERO

public static final java.lang.Integer INTEGER_ZERO
a frequent value for state variables


INTEGER_MINUS_ONE

public static final java.lang.Integer INTEGER_MINUS_ONE
a frequent value for state variables


COMP_NAME

public static java.lang.String COMP_NAME
Constant used for logging


SVAR_ALLOWED_ACTIONS

public static final java.lang.String SVAR_ALLOWED_ACTIONS
the id of allowed actions state variable

See Also:
Constant Field Values

SVAR_ADDITIONAL_NAME

public static final java.lang.String SVAR_ADDITIONAL_NAME
the id of allowed actions state variable

See Also:
Constant Field Values

SVAR_ATTACHMENT_TIME

public static final java.lang.String SVAR_ATTACHMENT_TIME
the id of allowed actions state variable

See Also:
Constant Field Values

device

protected java.lang.Object device
Reference to the underlying device service


stateGraph

protected DeviceStateGraph stateGraph
Device State Graph, may be null


currentState

protected java.lang.String currentState
id of the current state of the state graph

Constructor Detail

AbstractDeviceModel

public AbstractDeviceModel(java.lang.Object device,
                           java.lang.String type,
                           java.lang.String id)
Constructs the model

Parameters:
device - the device service
type - type of the device
id - id of the device
Method Detail

setDeviceStateGraph

public void setDeviceStateGraph(DeviceStateGraph stateGraph)

updateSV

public boolean updateSV(java.lang.String stateVarId,
                        java.lang.Object stateVarValue)
Check if the old value of the state variable stateVarId is different from the new one and notify all listeners that have registered interest in the stateVar with id stateVarId

Specified by:
updateSV in interface ControlUnitModel
Overrides:
updateSV in class DefaultControlUnitModel
Parameters:
stateVarId - state variable id
stateVarValue - the new value for the state variable
Returns:
if the stateVariable value was changed

handleInconsistency

protected abstract void handleInconsistency()
This method is invoked when a device model is found to be inconsistent. Inconsistency situations are discovered by device state graph. If no device state graph is loaded, then no inconsistencies will be handled.


getStateVariableValues

protected java.util.Dictionary getStateVariableValues()

release

public void release()
Description copied from class: DefaultControlUnitModel
Free the resources for the model. Subclasses may override this method to fit their needs.

Specified by:
release in interface ControlUnitModel
Overrides:
release in class DefaultControlUnitModel

Framework Professional Edition Package


Copyright © 1999-2007 ProSyst Software GmbH. All Rights Reserved