use of alma.ACS.MasterComponentImpl.statemachine.AlmaSubsystemContext in project ACS by ACS-Community.
the class MasterComponentImplBase method initialize.
/******************* [ Lifecycle implementations ] *******************/
/**
* Master component subclasses must call <code>super.initialize()</code> if they override this method!
* @see alma.acs.component.ComponentLifecycle#initialize(alma.acs.container.ContainerServices)
*/
public void initialize(ContainerServices containerServices) throws ComponentLifecycleException {
super.initialize(containerServices);
subsysComponentMonitor = new SubsysResourceMonitor(m_logger, containerServices.getThreadFactory(), 10);
try {
ROstringSeqImpl currentStateHierarchyImpl = new ROstringSeqImpl("currentStateHierarchy", this);
m_currentStateHierarchyDataAccess = currentStateHierarchyImpl.getDataAccess();
ROstringSeqPOATie currentStateHierarchyTie = new ROstringSeqPOATie(currentStateHierarchyImpl);
m_currentStateHierarchy = ROstringSeqHelper.narrow(this.registerProperty(currentStateHierarchyImpl, currentStateHierarchyTie));
} catch (Throwable th) {
throw new ComponentLifecycleException("Failed to create ACS property for nested component states.", th);
}
AlmaSubsystemActions actionHandler = getActionHandler();
if (actionHandler == null) {
throw new ComponentLifecycleException("Action handler was null. Check implementation of method getActionHandler in concrete master component implementation class.");
}
m_stateMachine = new AlmaSubsystemContext(actionHandler, m_logger, m_containerServices.getThreadFactory());
m_stateMachine.addAcsStateChangeListener(this);
if (StateChangeNotificationChecker.monitorStateChangeNotification) {
try {
stateChangeNotificationChecker = new StateChangeNotificationChecker(m_logger);
stateChangeNotificationChecker.createMonitor(m_currentStateHierarchy, m_containerServices);
m_logger.info("Running in state change notification test mode: All externally visible state changes will be compared with the internally triggered changes.");
} catch (Exception e) {
m_logger.log(Level.WARNING, "Master component " + name() + " failed to monitor its state change notification although this was requested by the property '" + StateChangeNotificationChecker.PROPERTYNAME + "'.", e);
}
}
try {
updateStateHierarchy();
} catch (AcsJException e) {
throw new ComponentLifecycleException("failed to initialize state property", e);
}
}
Aggregations