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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
Aggregations