/** * The receiver module's URN. * * @return receiver module's URN. */ final ModuleURN getReceiverURN() { return mReceiver.getURN(); }
/** * The emitter module's URN. * * @return emitter module's URN. */ final ModuleURN getEmitterURN() { return mEmitter.getURN(); }
/** * Adds a new module instance to be tracked. * * @param inModule the module instance to track. */ synchronized void add(Module inModule) { mModules.put(inModule.getURN(), inModule); }
@Override public final void send(Object inData) { //ignore data if the request has been canceled if(mRequestCanceled) { return; } mEmitted.incrementAndGet(); SLF4JLoggerProxy.debug(this,"Module {} emitted \"{}\"", //$NON-NLS-1$ mEmitter.getURN(), inData); process(inData); }
return createModuleImpl(inProviderURN, inParameters).getURN();
/** * Cancels the data flow as requested by either the emitter * or receiver module. * * @param inRequester the module requesting cancellation of * the data flow. */ private void cancelDataFlow(Module inRequester) { try { mManager.cancel(mFlowID,inRequester); } catch (Exception e) { Messages.LOG_UNEXPECTED_ERROR_CANCELING_FLOW.error(this, e, mFlowID, inRequester.getURN()); } } /* (non-Javadoc)
if(!mModules.has(inModule.getURN())) { return; mDataFlows.getFlowsParticipatingNotInitiated(inModule.getURN()); if(flows == null || flows.isEmpty()) { Messages.LOG_DELETE_AUTO_CREATED_MODULE.info( this, inModule.getURN(), inFlowID); try { stopModule(inModule); deleteModule(inModule.getURN()); } catch (Exception e) { Messages.LOG_DELETE_AUTO_CREATED_MODULE_FAIL.warn(this, e, inModule.getURN());
@Override public final void dataEmitError(I18NBoundMessage inMessage, boolean inStopDataFlow) { if(mRequestCanceled) { return; } mEmitErrors.incrementAndGet(); mLastEmitError = inMessage.getText(); Messages.LOG_MODULE_EMIT_ERROR.warn(this, mEmitter.getURN(), inMessage.getText()); if(inStopDataFlow) { cancelDataFlow(mEmitter); } }
inRequester == null ? null : inRequester.getURN(), request.getRequestURN()));
if(applicationContext == null) { Messages.NO_APPLICATION_CONTEXT_MODULE.warn(this, inModule.getURN()); if(inModule.getClass().isAnnotationPresent(AutowiredModule.class)) { throw new ModuleException(new I18NBoundMessage1P(Messages.MODULE_REQUIRES_AUTOWIRING, inModule.getURN())); Messages.CANNOT_AUTOWIRE_MODULE.warn(this, e, inModule.getURN()); throw new ModuleException(e, new I18NBoundMessage1P(Messages.CANNOT_AUTOWIRE_MODULE, inModule.getURN()));
throw new ModuleStateException(new I18NBoundMessage3P( Messages.MODULE_NOT_STOPPED_STATE_INCORRECT, inModule.getURN().toString(), state, ModuleState.STOPPABLE_STATES.toString())); if(inModule.getURN().equals(SinkModuleFactory.INSTANCE_URN)) { throw new ModuleException(Messages.CANNOT_STOP_SINK_MODULE); getFlowsParticipatingNotInitiated(inModule.getURN()); if(participating != null && (!participating.isEmpty())) { throw new DataFlowException(new I18NBoundMessage2P( Messages.CANNOT_STOP_MODULE_DATAFLOWS, inModule.getURN().toString(), participating.toString())); inModule.preStop(); initiated = mDataFlows.getInitiatedFlows(inModule.getURN()); if (initiated != null) { for(DataFlowID flowID: initiated) { Messages.LOG_MODULE_STOPPED.info(this, inModule.getURN()); } catch (ModuleException e) { inModule.setLastStopFailure(e.getLocalizedDetail()); Messages.LOG_STOP_MODULE_FAILED.warn(this, e, inModule.getURN()); throw e; } finally {
getModule(inModule.getURN()); throw new ModuleStateException(new I18NBoundMessage3P( Messages.MODULE_NOT_STARTED_STATE_INCORRECT, inModule.getURN().toString(), state, ModuleState.STARTABLE_STATES.toString())); throw new ModuleCreationException(e, new I18NBoundMessage1P(Messages.CANNOT_AUTOWIRE_MODULE, inModule.getURN())); Messages.LOG_MODULE_STARTED.info(this, inModule.getURN()); } catch(ModuleException e) { inModule.setLastStartFailure(e.getLocalizedDetail()); Messages.LOG_START_MODULE_FAILED.warn(this,inModule.getURN(),e.getI18NBoundMessage().getText()); throw e; } finally { inModule.getURN()); if(flows != null && !flows.isEmpty()) { for(DataFlowID id: flows) { Messages.LOG_CANCEL_DATA_FLOW_START_FAILED.info( this, id, inModule.getURN()); cancel(id);
throw new ModuleStateException(new I18NBoundMessage3P( Messages.DATAFLOW_FAILED_REQ_MODULE_STATE_INCORRECT, inRequester.getURN().toString(), state, ModuleState.REQUEST_FLOW_STATES.toString())); modules[modules.length - 1].getURN())) && throw new DataFlowException(new I18NBoundMessage1P( Messages.MODULE_NOT_EMITTER, module.getURN().toString())); throw new DataFlowException(new I18NBoundMessage1P( Messages.MODULE_NOT_RECEIVER, module.getURN().toString())); throw new ModuleStateException(new I18NBoundMessage3P( Messages.DATAFLOW_FAILED_PCPT_MODULE_STATE_INCORRECT, module.getURN().toString(), module.getState(), ModuleState.PARTICIPATE_FLOW_STATES.toString())); inRequester == null ? null : inRequester.getURN(), inRequests, modules); DataFlowID id = flow.getFlowID();
/** * Returns module info describing the current state of the module. * * @param inInitiatedFlows the set of IDs for the data flows that this * module has initiated * @param inParticipatingFlows the set of IDs for the data flows that this * module is participating in. * * @return the module info. */ final ModuleInfo getModuleInfo(DataFlowID[] inInitiatedFlows, DataFlowID[] inParticipatingFlows) { return new ModuleInfo(getURN(), getState(), inInitiatedFlows, inParticipatingFlows, getCreated(), getStarted(), getStopped(), isAutoStart(), isAutoCreated(), this instanceof DataReceiver, this instanceof DataEmitter, this instanceof DataFlowRequester, getLastStartFailure(), getLastStopFailure(), mLock.getReadLockCount(), mLock.isWriteLocked(), mLock.getQueueLength()); }
urn = module.getURN();