/** * Verifies if the module is not started. * * @param inMessage the message to use when the module is started. * * @throws IllegalStateException if the module is started. */ private void failIfStarted(I18NMessage0P inMessage) { if(getState().isStarted()) { throw new IllegalStateException(inMessage.getText()); } }
requesterLock.lock(); ModuleState state = inRequester.getState(); if (!(state.canRequestFlows())) { throw new ModuleStateException(new I18NBoundMessage3P( Messages.DATAFLOW_FAILED_REQ_MODULE_STATE_INCORRECT, (!module.getState().canParticipateFlows())) { throw new ModuleStateException(new I18NBoundMessage3P( Messages.DATAFLOW_FAILED_PCPT_MODULE_STATE_INCORRECT,
if(!state.canBeStopped()) { throw new ModuleStateException(new I18NBoundMessage3P( Messages.MODULE_NOT_STOPPED_STATE_INCORRECT,
if(!module.getState().canBeDeleted()) { throw new ModuleStateException(new I18NBoundMessage3P( Messages.DELETE_FAILED_MODULE_STATE_INCORRECT,
if (!state.canCancelFlows()) { throw new ModuleStateException(new I18NBoundMessage4P( Messages.CANCEL_FAILED_MODULE_STATE_INCORRECT,
if(!state.canBeStarted()) { throw new ModuleStateException(new I18NBoundMessage3P( Messages.MODULE_NOT_STARTED_STATE_INCORRECT,
@Override public boolean isConnected() { return getState().isStarted() && mDataEmitter != null && mDataEmitter.isConnected(); }
@Override public void setRoutingOrdersToORS(boolean inValue) { try { if(routeOrdersToORS != inValue) { if(getState().isStarted()) { if(inValue) { establishORSRouting(); } else { disconnectORSRouting(); } } } // change the value only if the above call succeeded routeOrdersToORS = inValue; } catch (Exception e) { throw new RuntimeException(e); } } /* (non-Javadoc)
/** * Start the given provider if necessary. * * @param inProviderUrn a <code>ModuleURN</code> value */ private void startProviderIfNecessary(ModuleURN inProviderUrn) { ModuleManager moduleManager = ModuleManager.getInstance(); ModuleInfo moduleInfo = moduleManager.getModuleInfo(inProviderUrn); SLF4JLoggerProxy.debug(this, "{} is {}", inProviderUrn, moduleInfo); if(!moduleInfo.getState().isStarted()) { moduleManager.start(inProviderUrn); } } /**
/** * Sends an attribute change notification for change in the * {@link #isConnected()} value. * * @param inOldValue the old attribute value. * @param inNewValue the new attribute value. */ @Override public void connectionStatusChanged(boolean inOldValue, boolean inNewValue) { if (getState().isStarted() || getState() == ModuleState.STARTING || getState() == ModuleState.STOPPING) { SLF4JLoggerProxy.debug(this, "Sending attrib changed from {} to {}", //$NON-NLS-1$ inOldValue, inNewValue); mNotifySupport.sendNotification(new AttributeChangeNotification( getURN().toString(), mSequence.getAndIncrement(), System.currentTimeMillis(), Messages.ATTRIB_CHANGE_NOTIFICATION.getText(), "Connected", //$NON-NLS-1$ "boolean", //$NON-NLS-1$ inOldValue, inNewValue)); } }
ModuleURN instanceUrn = new ModuleURN("metc:mdata:" + moduleName+":single"); ModuleInfo moduleInfo = moduleManager.getModuleInfo(instanceUrn); if(!moduleInfo.getState().isStarted()) { moduleManager.start(instanceUrn);