Real-Time Java AOCS Framework v1.0 API Specification

RtjAocsFramework.ReconfigurationManagement
Class ReconfigurerHelper

java.lang.Object
  |
  +--RtjAocsFramework.BasicObjects.RootObject
        |
        +--RtjAocsFramework.BasicObjects.AocsObject
              |
              +--RtjAocsFramework.ReconfigurationManagement.ReconfigurerHelper
All Implemented Interfaces:
Configurable, Reconfigurable, Resettable, Telemeterable

public class ReconfigurerHelper
extends AocsObject
implements Reconfigurable

Helper class for managing a reconfiguration group. The reconfigurable functionality is represented by interface Reconfigurable. There are however certain standard operations pertaining to the management of a reconfiguration group that apply in general to all reconfiguration groups and it is therefore convenient to capture their implementation and make it available to reconfiguration managers. The ReconfigurerHelper class was introduced for this purpose. Essentially, the reconfigurer helper manages a set of n identical configurations and implements all the methods defined by interface Reconfigurable for this situation . Specific reconfiguration managers would normally create an internal instance of the reconfigurer helper and delegate to it implementation of as many of the Reconfigurable operations as is possible.

This object can fire reconfiguration events. An event is fired when: 1) the configuration is updated, 2) when the health status of one of the configurations is updated, 3) when a reconfiguration fails. Typically listeners to reconfiguration events are the reconfiguration event repository and the system manager.

Copyright: see the Copyright Notice.

Change record:

Version:
1.1
Author:
Alessandro Pasetti (University of Konstanz)
See Also:
The Reconfiguration Framelet Document., Reconfigurable

Field Summary
 
Fields inherited from interface RtjAocsFramework.TelemetryManagement.Telemeterable
DEBUG_TM, LONG_TM, NORMAL_TM, NTMFORMATS, SHORT_TM
 
Constructor Summary
ReconfigurerHelper()
          Parameterless constructor.
ReconfigurerHelper(short numberOfConfig, int numberOfListener, short defaultConfig, Reconfigurable reconfigManager)
          This constructor assumes that the system manager has already been loaded in the AocsObject base class.
 
Method Summary
 void addReconfigurationListener(ReconfigurationListener l)
          Register a listener to reconfiguration events
 boolean canReconfigure()
          Return true if a reconfiguration is possible
 void disableConfiguration(short n)
          Disable the n-th configuration.
 void disableReconfiguration()
          Disable all configurations
 void enableConfiguration(short n)
          Enable the n-th configuration.
 void enableReconfiguration()
          Enable all configurations.
 AocsObject getAocsObject()
          Return the reconfiguration manager as an instance of type AocsObject.
 short getConfiguration()
          Return current configuration.
 short getConfigurationRank(short n)
          Return the rank of configuration n
 RecoveryAction getReconfigurationErrorRecoveryAction()
          Getter method for the recovery action associated to a failed reconfiguration request
 int getReconfigurationOrder()
          Return the reconfiguration order
 int getTelemetryImageLength()
          Return the length (in bits) of the telemetry image of the object.
 boolean isConfigurationHealthy(short n)
          Return true if configuration n is healthy
protected  boolean isConfigurationLegal(short n)
          Return true if a reconfiguration to configuration n is legal.
 boolean isConfigured()
          Return false if some configuration data are missing.
 void markConfiguration(short n, boolean mark)
          Mark configuration n healthy (true) or unhealthy (false).
 void rankConfiguration(short n, short r)
          Set the rank of configuration n to r.
 void reconfigure()
          Perform a reconfiguration, if one is possible.
 void removeReconfigurationListener(ReconfigurationListener l)
          Unregister a listener to reconfiguration events
 void reset()
          Mark all configurations as healthy and enabled, enable reconfigurations, give all configurations the same rank.
 void resetConfiguration()
          Unload recovery action and reset configuration of event listeners.
 void restoreConfiguration(ConfigurationState s)
          Set the internal configuration to the value coded in the ConfigurationState object.
 void saveConfiguration(ConfigurationState s)
          Save internal configuration in a ConfigurationState object.
 void setConfiguration(short newConfiguration)
          Set the current configuration to newConfiguration.
 void setDefaultConfiguration(short n)
          Initialization method to set the default configuration.
 void setMaxNumberOfReconfigurationListeners(int n)
          Initialization method to set the maximum number of listeners to reconfiguration events fired by this reconfigurer helper.
 void setNumberOfConfigurations(short n)
          Initialization method to set the number of configurations in the configuration group managed by this reconfigurer helper.
 void setReconfigurationErrorRecoveryAction(RecoveryAction r)
          Setter method for the recovery action associated to a failed reconfiguration request
 void setReconfigurationManager(Reconfigurable r)
          Initialization method to set the reconfiguration manager that is using this reconfigurer helper.
 void writeToTelemetry(TelemetryStream tmStream)
          Direct the object to write its own state to the telemetry stream.
 
Methods inherited from class RtjAocsFramework.BasicObjects.AocsObject
addConfigurationListener, addFailureListener, finalize, getAocsClock, getConfigurationListenerList, getCycle, getDestructionRecoveryAction, getFailureListenerList, getSystemManager, getTelemetryFormat, getTime, removeConfigurationListener, removeFailureListener, reportConfigurationEvent, reportFailure, resetStaticConfiguration, setAocsClock, setDestructionRecoveryAction, setMaxNumberOfConfigurationListeners, setMaxNumberOfFailureListeners, setSystemManager, setTelemetryFormat
 
Methods inherited from class RtjAocsFramework.BasicObjects.RootObject
getClassId, getInstanceId, setClassId
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReconfigurerHelper

public ReconfigurerHelper(short numberOfConfig,
                          int numberOfListener,
                          short defaultConfig,
                          Reconfigurable reconfigManager)
This constructor assumes that the system manager has already been loaded in the AocsObject base class.

Parameters:
numberOfConfig - number of configuration in the configuration group
defaultConfig - default configuration
reconfigManager - reconfiguration manager who is using this reconfiguration helper

ReconfigurerHelper

public ReconfigurerHelper()
Parameterless constructor. The component should only be used after it has been initialized by setting the number of configurations (setNumberOfConfigurations), the number of listeners for reconfiguration events (setMaxNumberOfReconfigurationListeners), the default configuration (setDefaultConfiguration), and the reconfiguration manager (setReconfigurationManager). These four methods should be called in the order in which they are listed here. The constructor assumes that the system manager has already been loaded in the AocsObject base class.

Method Detail

isConfigurationLegal

protected boolean isConfigurationLegal(short n)
Return true if a reconfiguration to configuration n is legal. If it isn't, a configuration error is declared and reported.


setNumberOfConfigurations

public void setNumberOfConfigurations(short n)
Initialization method to set the number of configurations in the configuration group managed by this reconfigurer helper.


setMaxNumberOfReconfigurationListeners

public void setMaxNumberOfReconfigurationListeners(int n)
Initialization method to set the maximum number of listeners to reconfiguration events fired by this reconfigurer helper.


setDefaultConfiguration

public void setDefaultConfiguration(short n)
Initialization method to set the default configuration. The default configuration is the configuration after a reset or at object initialization.


setReconfigurationManager

public void setReconfigurationManager(Reconfigurable r)
Initialization method to set the reconfiguration manager that is using this reconfigurer helper. A reconfigurer helper acts on behalf of another reconfiguration manager. This method allows the master reconfiguration manager to be specified. This will ensure that events fired by the reconfigurer helper will have the master as the originating reconfiguration manager.


getConfiguration

public short getConfiguration()
Description copied from interface: Reconfigurable
Return current configuration.

Specified by:
getConfiguration in interface Reconfigurable

setConfiguration

public void setConfiguration(short newConfiguration)
Set the current configuration to newConfiguration. The change is only performed if the target configuration is legal and if the target configuration is different from the starting configuration. If the request for the configuration change originates from outside the reconfigurer helper, the starting configuration is marked as 'unhealthy'. A reconfiguration event is fired to all registered listeners to inform them of the configuration change. The configuration change is performed regardless of the enable status of the target configuration or of the enable status of reconfigurations.

Specified by:
setConfiguration in interface Reconfigurable

markConfiguration

public void markConfiguration(short n,
                              boolean mark)
Description copied from interface: Reconfigurable
Mark configuration n healthy (true) or unhealthy (false).

Specified by:
markConfiguration in interface Reconfigurable

rankConfiguration

public void rankConfiguration(short n,
                              short r)
Description copied from interface: Reconfigurable
Set the rank of configuration n to r.

Specified by:
rankConfiguration in interface Reconfigurable

enableConfiguration

public void enableConfiguration(short n)
Description copied from interface: Reconfigurable
Enable the n-th configuration.

Specified by:
enableConfiguration in interface Reconfigurable

disableConfiguration

public void disableConfiguration(short n)
Description copied from interface: Reconfigurable
Disable the n-th configuration.

Specified by:
disableConfiguration in interface Reconfigurable

enableReconfiguration

public void enableReconfiguration()
Description copied from interface: Reconfigurable
Enable all configurations.

Specified by:
enableReconfiguration in interface Reconfigurable

disableReconfiguration

public void disableReconfiguration()
Description copied from interface: Reconfigurable
Disable all configurations

Specified by:
disableReconfiguration in interface Reconfigurable

reconfigure

public void reconfigure()
Description copied from interface: Reconfigurable
Perform a reconfiguration, if one is possible. The reconfiguration is performed only if reconfigurations are enabled and if there is at least one healthy and enabled configuration. The end configuration is the one with the highest rank among the healthy and enabled configurations. If the reconfiguration is not possible because there are no more healthy enabled configurations, a failure is declared.

Specified by:
reconfigure in interface Reconfigurable

canReconfigure

public boolean canReconfigure()
Description copied from interface: Reconfigurable
Return true if a reconfiguration is possible

Specified by:
canReconfigure in interface Reconfigurable

isConfigurationHealthy

public boolean isConfigurationHealthy(short n)
Description copied from interface: Reconfigurable
Return true if configuration n is healthy

Specified by:
isConfigurationHealthy in interface Reconfigurable

getReconfigurationOrder

public int getReconfigurationOrder()
Description copied from interface: Reconfigurable
Return the reconfiguration order

Specified by:
getReconfigurationOrder in interface Reconfigurable

getConfigurationRank

public short getConfigurationRank(short n)
Description copied from interface: Reconfigurable
Return the rank of configuration n

Specified by:
getConfigurationRank in interface Reconfigurable

restoreConfiguration

public void restoreConfiguration(ConfigurationState s)
Set the internal configuration to the value coded in the ConfigurationState object. In this implementation, the ConfigurationState encapsulates an integer, the memory pad. Its lower byte stores the currently active configuration. Its upper bytes stores health status as follows: if the i-th bit in the upper byte is set, then the i-th configuration is healthy. This implementation assumes a maximum of 16 configurations.

Specified by:
restoreConfiguration in interface Reconfigurable
See Also:
Reconfigurable.restoreConfiguration(ConfigurationState)

saveConfiguration

public void saveConfiguration(ConfigurationState s)
Save internal configuration in a ConfigurationState object. In this implementation, the ConfigurationState encapsulates an integer, the memory pad. Its lower byte stores the currently active configuration. Its upper bytes stores health status as follows: if the i-th bit in the upper byte is set, then the i-th configuration is healthy. This implementation assumes a maximum of 16 configurations.

Specified by:
saveConfiguration in interface Reconfigurable
See Also:
Reconfigurable.saveConfiguration(ConfigurationState)

setReconfigurationErrorRecoveryAction

public void setReconfigurationErrorRecoveryAction(RecoveryAction r)
Description copied from interface: Reconfigurable
Setter method for the recovery action associated to a failed reconfiguration request

Specified by:
setReconfigurationErrorRecoveryAction in interface Reconfigurable

getReconfigurationErrorRecoveryAction

public RecoveryAction getReconfigurationErrorRecoveryAction()
Description copied from interface: Reconfigurable
Getter method for the recovery action associated to a failed reconfiguration request

Specified by:
getReconfigurationErrorRecoveryAction in interface Reconfigurable

resetConfiguration

public void resetConfiguration()
Unload recovery action and reset configuration of event listeners.

Specified by:
resetConfiguration in interface Configurable
Overrides:
resetConfiguration in class AocsObject

isConfigured

public boolean isConfigured()
Description copied from interface: Configurable
Return false if some configuration data are missing.

Typically, a false value indicates that a plug-in component is missing or that the object has not been initialized. This is a negative check only: a return value of true cannot guarantee that the object is correctly configured.

Calls to resetConfiguration on an object A are normally not propagated objects of type AocsObject that are contained or otherwise aggregated to A. The rationale for this policy is that all objects of type AocsObject implement interface configurable and therefore their configuration status should be checked externally (probably through the configuration check service of the system manager).

Specified by:
isConfigured in interface Configurable
Overrides:
isConfigured in class AocsObject

reset

public void reset()
Mark all configurations as healthy and enabled, enable reconfigurations, give all configurations the same rank.

Specified by:
reset in interface Resettable
Overrides:
reset in class AocsObject

getAocsObject

public AocsObject getAocsObject()
Description copied from interface: Reconfigurable
Return the reconfiguration manager as an instance of type AocsObject. If the reconfiguration manager is not derived from class AocsObject, then null is returned.

Specified by:
getAocsObject in interface Reconfigurable

addReconfigurationListener

public void addReconfigurationListener(ReconfigurationListener l)
Description copied from interface: Reconfigurable
Register a listener to reconfiguration events

Specified by:
addReconfigurationListener in interface Reconfigurable

removeReconfigurationListener

public void removeReconfigurationListener(ReconfigurationListener l)
Description copied from interface: Reconfigurable
Unregister a listener to reconfiguration events

Specified by:
removeReconfigurationListener in interface Reconfigurable

writeToTelemetry

public void writeToTelemetry(TelemetryStream tmStream)
Description copied from interface: Telemeterable
Direct the object to write its own state to the telemetry stream.

Specified by:
writeToTelemetry in interface Telemeterable
Overrides:
writeToTelemetry in class AocsObject

getTelemetryImageLength

public int getTelemetryImageLength()
Description copied from interface: Telemeterable
Return the length (in bits) of the telemetry image of the object. This method is useful to verify that the quantity of data generated by a given object is compatible with the capacity of the telemetry channel.

Specified by:
getTelemetryImageLength in interface Telemeterable
Overrides:
getTelemetryImageLength in class AocsObject

Real-Time Java AOCS Framework v1.0 API Specification

Real-Time Java AOCS Framework project home page

Automatic Control Laboratory, ETH Zuerich
Physikstrasse 3
CH-8092 Zuerich, Switzerland