@Override public void requestData(DataRequest inRequest, DataEmitterSupport inSupport) throws IllegalRequestParameterValue { Object obj = inRequest.getData(); if(obj != null) { throw new IllegalRequestParameterValue(getURN(), obj); } DataFlowHandler handler = new DataFlowHandler(inSupport); handler.setFuture(mService.submit(handler)); addFlow(inSupport, handler); }
/** * Connects the strategy to the ORS, if necessary. * * If the strategy is already connected to the ORS, this method does nothing * * @throws ModuleException if the data flow cannot be established */ private void establishORSRouting() throws ModuleException { SLF4JLoggerProxy.debug(this, "Establishing connection to ORS"); //$NON-NLS-1$ try(CloseableLock closeableLock = CloseableLock.create(dataFlowLock.writeLock())) { closeableLock.lock(); if(orsFlow == null) { // no current routing, establish one orsFlow = dataFlowSupport.createDataFlow(new DataRequest[] { new DataRequest(getURN(), OutputType.ORDERS), new DataRequest(ClientModuleFactory.INSTANCE_URN) }, false); new RequestContainer(orsFlow, counter.incrementAndGet()); } } } /**
/** * Converts this request to a string data request instance. * The returned instance is similar to this instance except * that the request data is converted to string using its * <code>toString()</code> method. * * @return the equivalent string data request. */ StringDataRequest toStringRequest() { return new StringDataRequest(getRequestURN(), getCoupling(), getData() == null ? null : getData().toString()); } /* (non-Javadoc)
/** * Creates an instance. * * @param inManager the module manager instance. * @param inRequesterURN the data flow requester URN. * @param inRequests the data requests specified when requesting * this data flow. * @param inModules the modules participating in this data flow. * * @throws ModuleException if there was an error generating a flowID * for this data flow. */ DataFlow(ModuleManager inManager, ModuleURN inRequesterURN, DataRequest[] inRequests, Module[] inModules) throws ModuleException { mFlowID = generateFlowID(); mRequesterURN = inRequesterURN; mRequests = inRequests; mCouplers = new AbstractDataCoupler[inModules.length - 1]; assert inModules.length == mRequests.length; for(int i = mCouplers.length - 1; i >= 0; i--) { mCouplers[i] = mRequests[i].getCoupling().createCoupler(inManager, inModules[i], inModules[i + 1], mFlowID, mRequests[i+1].getExceptionHandler()); } }
@Override public String toString() { return toStringRequest().getData(); } /**
? null : inRequester.getURN(), request.getRequestURN()));
mRequests[i].toStringRequest(), isEmitter ? mCouplers[i].getEmitterURN()
throws UnsupportedRequestParameterType, IllegalRequestParameterValue { Object obj = inRequest.getData(); if(obj == null) { throw new IllegalRequestParameterValue(getURN(), null);
DataRequest sourceRequest = new DataRequest(inSourceUrn, inMarketDataRequest); DataRequest targetRequest = new DataRequest(getURN()); DataFlowID dataFlowId = dataFlowSupport.createDataFlow(new DataRequest[] { sourceRequest, targetRequest }, false);
@Override public void requestData(DataRequest inRequest, final DataEmitterSupport inSupport) throws RequestDataException { //No request parameters are supported. //All reports received are emitted. //Verify no request parameters are specified if(inRequest.getData() != null) { throw new IllegalRequestParameterValue( Messages.REQUEST_PARAMETER_SPECIFIED); } try { ReportListener listener = new ReportListenerEmitter(inSupport); getClient().addReportListener(listener); mRequestTable.put(inSupport.getRequestID(), listener); } catch (ClientInitException e) { throw new RequestDataException(e, Messages.REQUEST_CLIENT_NOT_INITIALIZED); } }
inRequest = null; return new DataRequest(urn, coupling, inRequest);
@Override public void requestData(DataRequest inRequest, DataEmitterSupport inSupport) throws RequestDataException { if(inRequest == null) { throw new IllegalRequestParameterValue(getURN(), null); } Object obj = inRequest.getData(); if(obj == null) { throw new IllegalRequestParameterValue(getURN(), null); } String query; if(obj instanceof String) { query = (String)obj; } else { throw new UnsupportedRequestParameterType(getURN(), obj); } String[] querySplit = query.split(QUERY_DELIM); if (querySplit.length != 4 || !QUERY_SPLIT[0].equals(querySplit[0]) ||!QUERY_SPLIT[1].equals(querySplit[1]) ||!QUERY_SPLIT[2].equals(querySplit[2])) { throw new RequestDataException(new I18NBoundMessage1P(Messages.INVALID_QUERY, query)); } // find the type they are requesting (ie select * from <type>) String type = query.substring(QUERY_PREFIX.length()); Class<?> theClass = getClassForRequest(type); if (theClass == null) { throw new RequestDataException(new I18NBoundMessage1P(Messages.UNSUPPORTED_TYPE, type)); } Pair<Class<?>, DataEmitterSupport> request = new Pair<Class<?>, DataEmitterSupport>(theClass, inSupport); mRequestMap.put(inSupport.getRequestID(), request); }
closeableLock.lock(); DataFlowID cepFlow = dataFlowSupport.createDataFlow(new DataRequest[] { new DataRequest(getURN(),new InternalRequest(inCEPModule)),new DataRequest(inCEPModule) }, false); new RequestContainer(cepFlow,
throws UnsupportedRequestParameterType, IllegalRequestParameterValue Object requestPayload = inRequest.getData(); OutputType request; if(requestPayload == null) {
closeableLock.lock(); try { DataFlowID flowID = dataFlowSupport.createDataFlow(new DataRequest[] { new DataRequest(providerURN, determineCepStatements(inSource, inStatements)), new DataRequest(getURN()) }, false); new RequestContainer(flowID,
Object payload = inRequest.getData(); try { if(payload == null) {
try(CloseableLock closeableLock = CloseableLock.create(dataFlowLock.writeLock())) { closeableLock.lock(); DataFlowID dataFlowID = dataFlowSupport.createDataFlow(new DataRequest[] { new DataRequest(marketDataURN, inRequest), new DataRequest(cepDataURN, determineCepStatements(inCEPSource, inStatements)), new DataRequest(getURN()) }, false); new RequestContainer(dataFlowID,
throws UnsupportedRequestParameterType, IllegalRequestParameterValue Object requestPayload = inRequest.getData(); if(requestPayload == null) { throw new IllegalRequestParameterValue(instanceURN,
createDataFlow(new DataRequest[] { new DataRequest(getURN(), OutputType.ALL), new DataRequest(outputDestination) }, false); closeableLock.lock(); try { DataFlowID reportsDataFlow = dataFlowSupport.createDataFlow(new DataRequest[] { new DataRequest(ClientModuleFactory.INSTANCE_URN), new DataRequest(getURN()) }, false); new RequestContainer(reportsDataFlow,
inRequest, marketDataURN); DataFlowID dataFlowID = dataFlowSupport.createDataFlow(new DataRequest[] { new DataRequest(marketDataURN, inRequest), new DataRequest(getURN()) }, false); new RequestContainer(dataFlowID,