Search in sources :

Example 16 with ComponentLifecycleException

use of alma.acs.component.ComponentLifecycleException in project ACS by ACS-Community.

the class EventConsumerImpl method initialize.

/**
	 * Sets up the {@link AcsEventSubscriber}.
	 */
public void initialize(ContainerServices containerServices) throws ComponentLifecycleException {
    super.initialize(containerServices);
    try {
        m_consumer = containerServices.createNotificationChannelSubscriber(alma.FRIDGE.CHANNELNAME_FRIDGE.value, temperatureDataBlockEvent.class);
        m_consumer.addSubscription(this);
        m_consumer.startReceivingEvents();
        m_logger.info("ConsumerComp is waiting for 'temperatureDataBlockEvent' events.");
    } catch (Exception ex) {
        if (m_consumer != null) {
            try {
                m_consumer.disconnect();
            } catch (Exception ex2) {
                m_logger.log(Level.WARNING, "Failed to disconnect a messed-up NC subscriber", ex2);
            }
        }
        throw new ComponentLifecycleException("failed to connect as an event consumer to channel " + CHANNELNAME_FRIDGE.value, ex);
    }
}
Also used : ComponentLifecycleException(alma.acs.component.ComponentLifecycleException) FRIDGE.temperatureDataBlockEvent(alma.FRIDGE.temperatureDataBlockEvent) ComponentLifecycleException(alma.acs.component.ComponentLifecycleException)

Example 17 with ComponentLifecycleException

use of alma.acs.component.ComponentLifecycleException in project ACS by ACS-Community.

the class NCReceiverImpl method initialize.

public void initialize(ContainerServices containerServices) throws ComponentLifecycleException {
    super.initialize(containerServices);
    try {
        m_consumer = m_containerServices.createNotificationChannelSubscriber(alma.FRIDGE.CHANNELNAME_FRIDGE.value, temperatureDataBlockEvent.class);
        m_consumer.addSubscription(this);
        m_consumer.startReceivingEvents();
        m_logger.info("ConsumerComp is waiting for 'temperatureDataBlockEvent' events.");
    } catch (Exception e) {
        // here we omit "m_consumer.disconnect()" and let the container services do the cleanup 
        throw new ComponentLifecycleException("failed to connect as an event consumer to channel " + alma.FRIDGE.CHANNELNAME_FRIDGE.value);
    }
}
Also used : ComponentLifecycleException(alma.acs.component.ComponentLifecycleException) FRIDGE.temperatureDataBlockEvent(alma.FRIDGE.temperatureDataBlockEvent) ComponentLifecycleException(alma.acs.component.ComponentLifecycleException)

Example 18 with ComponentLifecycleException

use of alma.acs.component.ComponentLifecycleException in project ACS by ACS-Community.

the class LampAccessImpl method initialize.

/////////////////////////////////////////////////////////////
// Implementation of ComponentLifecycle
/////////////////////////////////////////////////////////////
public void initialize(ContainerServices containerServices) throws ComponentLifecycleException {
    super.initialize(containerServices);
    m_logger.finer("initialize() called...");
    try {
        getLampBrightnessProperty();
    } catch (Exception e) {
        throw new ComponentLifecycleException("failed to get reference to 'brightness' " + "property of the lamp component.", e);
    }
}
Also used : ComponentLifecycleException(alma.acs.component.ComponentLifecycleException) ComponentLifecycleException(alma.acs.component.ComponentLifecycleException)

Example 19 with ComponentLifecycleException

use of alma.acs.component.ComponentLifecycleException 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)

Example 20 with ComponentLifecycleException

use of alma.acs.component.ComponentLifecycleException in project ACS by ACS-Community.

the class SpecialTestMasterComponentImpl method initialize.

/**
	 * As part of the initialization of this test master component, 
	 * the baci property 'someOtherProperty' is set up.
	 * 
	 * @see alma.acs.component.ComponentLifecycle#initialize(alma.acs.container.ContainerServices)
	 */
public void initialize(ContainerServices containerServices) throws ComponentLifecycleException {
    super.initialize(containerServices);
    try {
        RWdoubleImpl someOtherPropertyImpl = new RWdoubleImpl("someOtherProperty", this);
        m_someOtherPropertyDataAccess = someOtherPropertyImpl.getDataAccess();
        RWdoublePOATie someOtherPropertyTie = new RWdoublePOATie(someOtherPropertyImpl);
        m_someOtherProperty = RWdoubleHelper.narrow(this.registerProperty(someOtherPropertyImpl, someOtherPropertyTie));
    } catch (Throwable th) {
        throw new ComponentLifecycleException("Failed to create ACS property 'someOtherProperty'.", th);
    }
}
Also used : RWdoubleImpl(alma.ACS.impl.RWdoubleImpl) RWdoublePOATie(alma.ACS.RWdoublePOATie) ComponentLifecycleException(alma.acs.component.ComponentLifecycleException)

Aggregations

ComponentLifecycleException (alma.acs.component.ComponentLifecycleException)30 MemoryDataAccess (alma.ACS.jbaci.MemoryDataAccess)4 AcsJContainerServicesEx (alma.JavaContainerError.wrappers.AcsJContainerServicesEx)4 AcsJException (alma.acs.exceptions.AcsJException)4 EventDescription (alma.acsnc.EventDescription)4 ROdoublePOATie (alma.ACS.ROdoublePOATie)3 ROpatternPOATie (alma.ACS.ROpatternPOATie)3 RWdoublePOATie (alma.ACS.RWdoublePOATie)3 ROdoubleImpl (alma.ACS.impl.ROdoubleImpl)3 ROpatternImpl (alma.ACS.impl.ROpatternImpl)3 RWdoubleImpl (alma.ACS.impl.RWdoubleImpl)3 DataAccess (alma.ACS.jbaci.DataAccess)3 AcsComponentClassLoader (alma.acs.classloading.AcsComponentClassLoader)3 ROstringSeqPOATie (alma.ACS.ROstringSeqPOATie)2 ROstringSeqImpl (alma.ACS.impl.ROstringSeqImpl)2 FRIDGE.temperatureDataBlockEvent (alma.FRIDGE.temperatureDataBlockEvent)2 Consumer (alma.acs.nc.Consumer)2 QueueFileHandler (alma.acs.xmlfilestore.common.QueueFileHandler)2 File (java.io.File)2 IDLEntity (org.omg.CORBA.portable.IDLEntity)2