Search in sources :

Example 1 with AlmaSubsystemContext

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);
    }
}
Also used : AlmaSubsystemActions(alma.ACS.MasterComponentImpl.statemachine.AlmaSubsystemActions) ROstringSeqImpl(alma.ACS.impl.ROstringSeqImpl) AcsJException(alma.acs.exceptions.AcsJException) ROstringSeqPOATie(alma.ACS.ROstringSeqPOATie) ComponentLifecycleException(alma.acs.component.ComponentLifecycleException) AlmaSubsystemContext(alma.ACS.MasterComponentImpl.statemachine.AlmaSubsystemContext) ComponentLifecycleException(alma.acs.component.ComponentLifecycleException) AcsJException(alma.acs.exceptions.AcsJException)

Aggregations

AlmaSubsystemActions (alma.ACS.MasterComponentImpl.statemachine.AlmaSubsystemActions)1 AlmaSubsystemContext (alma.ACS.MasterComponentImpl.statemachine.AlmaSubsystemContext)1 ROstringSeqPOATie (alma.ACS.ROstringSeqPOATie)1 ROstringSeqImpl (alma.ACS.impl.ROstringSeqImpl)1 ComponentLifecycleException (alma.acs.component.ComponentLifecycleException)1 AcsJException (alma.acs.exceptions.AcsJException)1