use of alma.acs.genfw.runtime.sm.AcsState in project ACS by ACS-Community.
the class MasterComponentImplBase method updateStateHierarchy.
/**
* Sets the property value of <code>currentStateHierarchy</code>
* to match the current (sub-)states from the state machine.
* <p>
* This method should not be overloaded by subclasses! We just don't make it final to meet special testing needs.
*/
public void updateStateHierarchy() throws AcsJException {
AcsState[] stateHierarchy = m_stateMachine.getCurrentTopLevelState().getStateHierarchy();
String newState = AcsStateUtil.stateHierarchyToString(stateHierarchy);
// convert to String[]
String[] stateNameHierarchy = new String[stateHierarchy.length];
for (int i = 0; i < stateHierarchy.length; i++) {
stateNameHierarchy[i] = stateHierarchy[i].stateName();
}
// set Baci property and announce the notification to the checker object beforehand if checking is enabled
if (StateChangeNotificationChecker.monitorStateChangeNotification) {
stateChangeNotificationChecker.announceStateChangeNotification(stateNameHierarchy);
}
CompletionHolder ch = new CompletionHolder();
m_currentStateHierarchyDataAccess.set(stateNameHierarchy, ch);
// optimization usually leaves out the completion if ok
if (ch.value != null) {
AcsJCompletion compl = AcsJCompletion.fromCorbaCompletion(ch.value);
if (compl.isError()) {
m_logger.log(Level.WARNING, "failed to update state property!", compl.getAcsJException());
throw compl.getAcsJException();
} else {
m_logger.finest("Changed state property to '" + newState + "'.");
}
} else {
m_logger.finest("Changed state property to '" + newState + "'.");
}
}
use of alma.acs.genfw.runtime.sm.AcsState in project ACS by ACS-Community.
the class AlmaSubsystemContext method setState.
void setState(AlmaSubsystemStateAbstract newState, String eventName) {
AlmaSubsystemStateAbstract oldState = m_currentState;
if (oldState != newState) {
logTransition(m_currentState, newState, eventName);
m_currentState = newState;
m_currentState.entry();
}
AcsState[] currentHierarchy = getCurrentTopLevelState().getStateHierarchy();
// check if there was a state change down the nesting hierarchy
if (!Arrays.equals(currentHierarchy, m_oldHierarchy)) {
// if so, notify listeners
for (Iterator<AcsStateChangeListener> iter = m_stateChangeListeners.iterator(); iter.hasNext(); ) {
AcsStateChangeListener listener = iter.next();
listener.stateChangedNotify(m_oldHierarchy, currentHierarchy);
}
m_oldHierarchy = currentHierarchy;
}
}
Aggregations