use of alma.ACSErrTypeCommon.wrappers.AcsJIllegalStateEventEx in project ACS by ACS-Community.
the class NCSubscriber method createConnectionAction.
protected void createConnectionAction(EventDispatcher evtDispatcher, ErrorReporter errRep, SCInstance scInstance, Collection<TriggerEvent> derivedEvents) throws AcsJStateMachineActionEx {
super.createConnectionAction(evtDispatcher, errRep, scInstance, derivedEvents);
try {
// Register callback for subscribed events
if (corbaRef == null) {
corbaObj = new OSPushConsumerPOATie(NCSubscriber.this);
corbaRef = OSPushConsumerHelper.narrow(helper.getContainerServices().activateOffShoot(corbaObj));
}
// Register callback for reconnection requests
channelReconnectionCallback = new AcsNcReconnectionCallback(NCSubscriber.this, logger);
// if the factory is null, the reconnection callback is not registered
channelReconnectionCallback.registerForReconnect(services, helper.getNotifyFactory());
proxySupplier.connect_structured_push_consumer(org.omg.CosNotifyComm.StructuredPushConsumerHelper.narrow(corbaRef));
} catch (AcsJContainerServicesEx e) {
LOG_NC_SubscriptionConnect_FAIL.log(logger, channelName, getNotificationFactoryName());
throw new AcsJStateMachineActionEx(e);
} catch (org.omg.CosEventChannelAdmin.AlreadyConnected e) {
throw new AcsJStateMachineActionEx(new AcsJIllegalStateEventEx(e));
} catch (org.omg.CosEventChannelAdmin.TypeError ex) {
LOG_NC_SubscriptionConnect_FAIL.log(logger, channelName, getNotificationFactoryName());
throw new AcsJStateMachineActionEx(ex);
} catch (AcsJIllegalArgumentEx ex) {
throw new AcsJStateMachineActionEx(ex);
}
// Create the thread responsible for checking the connection and reconnect
createConCheckerThread();
LOG_NC_SubscriptionConnect_OK.log(logger, channelName, getNotificationFactoryName());
}
use of alma.ACSErrTypeCommon.wrappers.AcsJIllegalStateEventEx in project ACS by ACS-Community.
the class MasterComponentImplBase method doTransition.
/**
* Dispatches the event to the corresponding state machine method.
* <p>
* Relies on CORBA to queue concurrent calls, which this synchronized implementation forcefully serializes.
* Note that calls should always return quickly, since the real work is done asynchronously in activity states.
*
* @see alma.ACS.MasterComponentOperations#doTransition(alma.ACS.MasterComponentPackage.SubsystemStateEvent)
*/
public final synchronized void doTransition(SubsystemStateEvent event) throws IllegalStateEventEx {
if (event == null) {
AcsJIllegalStateEventEx ex = new AcsJIllegalStateEventEx();
ex.setEvent("null");
throw ex.toIllegalStateEventEx();
}
String eventName = event2Name(event);
m_logger.fine("Received event " + eventName);
try {
switch(event.value()) {
case SubsystemStateEvent._SUBSYSEVENT_INITPASS1:
m_stateMachine.initPass1();
break;
case SubsystemStateEvent._SUBSYSEVENT_INITPASS2:
m_stateMachine.initPass2();
break;
case SubsystemStateEvent._SUBSYSEVENT_REINIT:
m_stateMachine.reinit();
break;
case SubsystemStateEvent._SUBSYSEVENT_START:
m_stateMachine.start();
break;
case SubsystemStateEvent._SUBSYSEVENT_STOP:
m_stateMachine.stop();
break;
case SubsystemStateEvent._SUBSYSEVENT_SHUTDOWNPASS1:
m_stateMachine.shutdownPass1();
break;
case SubsystemStateEvent._SUBSYSEVENT_SHUTDOWNPASS2:
m_stateMachine.shutdownPass2();
break;
case SubsystemStateEvent._SUBSYSEVENT_ERROR:
m_stateMachine.error();
break;
default:
// we can only get here if this code is out of sync with the IDL event definitions
String msg = "Unexpected SubsystemStateEvent with integer value " + event.value() + " found; most likely " + MasterComponentImplBase.class.getName() + " must be updated.";
m_logger.warning(msg);
AcsJIllegalStateEventEx ex = new AcsJIllegalStateEventEx();
ex.setEvent(event.toString());
throw ex.toIllegalStateEventEx();
}
} catch (AcsJIllegalStateEventEx ex) {
m_logger.log(Level.WARNING, "Illegal event '" + ex.getEvent() + "' received in state '" + ex.getState() + "'.", ex);
throw ex.toIllegalStateEventEx();
}
}
Aggregations