kaos.core.csi.extension.state
Class StateMonitorImpl

java.lang.Object
  extended by kaos.core.csi.extension.KAoSExtensionComponentImpl
      extended by kaos.core.csi.extension.state.StateMonitorImpl
All Implemented Interfaces:
KAoSExtensionComponent, StateMonitor

public class StateMonitorImpl
extends KAoSExtensionComponentImpl
implements StateMonitor


Field Summary
 
Fields inherited from class kaos.core.csi.extension.KAoSExtensionComponentImpl
_associatedOntTypes, _componentName
 
Constructor Summary
StateMonitorImpl(java.lang.String name, java.lang.String ontType)
           
 
Method Summary
 void addOntologicalAttribute(java.lang.String ontAttribute)
          Add an ontological attribute the component is associated with.
 OntInstanceDescription getCurrentState()
          Returns an OntInstanceDescription containing the name of the state class and a collection of OntPropertyDescriptions of properties currently monitored.
 ActionClassDescription getStateDescription()
          Returns the state ClassDescription containing the name of the state class and a collection of names of properties as defined in the ontology.
 boolean isStateConformantWithMonitoredState(java.lang.String stateName)
          Check if the given state conforms with the monitored state.
 void removeProperty(java.lang.String propertyName)
          Remove the property with the given name from the collection of monitored properties.
 void setName(java.lang.String componentName)
          Set the name of this component.
 void updateProperty(java.lang.String propertyName, java.lang.String value, java.lang.Object valueDescription)
          kaos.core.csi.extension.state.StateMonitor interface implementation - begin
 
Methods inherited from class kaos.core.csi.extension.KAoSExtensionComponentImpl
getEnabledStatus, getName, getOntologicalAttributes, setEnabledStatus, setProperties
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface kaos.core.csi.extension.KAoSExtensionComponent
getEnabledStatus, getName, getOntologicalAttributes, setEnabledStatus, setProperties
 

Constructor Detail

StateMonitorImpl

public StateMonitorImpl(java.lang.String name,
                        java.lang.String ontType)
Method Detail

setName

public void setName(java.lang.String componentName)
Set the name of this component.

Specified by:
setName in interface KAoSExtensionComponent
Overrides:
setName in class KAoSExtensionComponentImpl
Parameters:
componentName - String containing the name of this component.

addOntologicalAttribute

public void addOntologicalAttribute(java.lang.String ontAttribute)
Add an ontological attribute the component is associated with.

Specified by:
addOntologicalAttribute in interface KAoSExtensionComponent
Overrides:
addOntologicalAttribute in class KAoSExtensionComponentImpl
Parameters:
ontAttribute - String containing the name of the ontological attribute.

updateProperty

public void updateProperty(java.lang.String propertyName,
                           java.lang.String value,
                           java.lang.Object valueDescription)
                    throws InvalidPropertyForMonitoredStateException
kaos.core.csi.extension.state.StateMonitor interface implementation - begin

Specified by:
updateProperty in interface StateMonitor
Parameters:
propertyName - String, specifying the ontological name of the property.
value - String, specifying the value of the property.
valueDescription - Object containing the description of the value. Often it will be kaos.core.csi.OntInstanceDescription
Throws:
InvalidPropertyForMonitoredStateException - if the specified property is not a property of the monitored state (has no been defined in the ontology as the state property).

removeProperty

public void removeProperty(java.lang.String propertyName)
                    throws InvalidPropertyForMonitoredStateException
Description copied from interface: StateMonitor
Remove the property with the given name from the collection of monitored properties.

Specified by:
removeProperty in interface StateMonitor
Parameters:
propertyName - String, specifying the name of property no longer to be monitored.
Throws:
InvalidPropertyForMonitoredStateException - if the specified property is not a property of the monitored state (has no been defined in the ontology as the state property).

getCurrentState

public OntInstanceDescription getCurrentState()
Description copied from interface: StateMonitor
Returns an OntInstanceDescription containing the name of the state class and a collection of OntPropertyDescriptions of properties currently monitored. This collection may be a subset of all properties defined in the ontology for the monitored state.

Specified by:
getCurrentState in interface StateMonitor
Returns:
OntInstanceDescription describing the monitored properties.

getStateDescription

public ActionClassDescription getStateDescription()
Description copied from interface: StateMonitor
Returns the state ClassDescription containing the name of the state class and a collection of names of properties as defined in the ontology.

Specified by:
getStateDescription in interface StateMonitor
Returns:
ClassDescription describing the names of the state class to be monitored and names of its properties.

isStateConformantWithMonitoredState

public boolean isStateConformantWithMonitoredState(java.lang.String stateName)
Description copied from interface: StateMonitor
Check if the given state conforms with the monitored state. (ex. is a subclass of the monitored state, satisfies restrictions of the monitored state, etc. Concrete example: Monitored state is a ComputerState, given state is OverloadedComputerState, defined as a subclass of the ComputerState with property of a given memory usage. Based on the monitored properties, determine if the monitored state is OverloadedComputerState).

Specified by:
isStateConformantWithMonitoredState in interface StateMonitor
Parameters:
stateName - String containing the name of the state to be checked.
Returns:
boolean indicating if the given state conforms to the monitored state.