/** * Converts a string value to Data Flow ID. If the supplied string * is null or empty, the returned value is null. * * @param inFlowID the flow ID represented as a string. * * @return the data flow ID. */ private DataFlowID toFlowID(String inFlowID) { return inFlowID == null || inFlowID.trim().isEmpty() ? null : new DataFlowID(inFlowID); }
@Override public String toString() { return getValue(); }
throw new DataFlowException(new I18NBoundMessage1P( Messages.DATA_FLOW_ALREADY_CANCELING, getFlowID().toString())); } else { mCancelling = true;
@Override public Object getAttribute(String attribute) throws AttributeNotFoundException { Integer value = null; if (attribute.startsWith(ATTRIB_PREFIX)) { String flowID = attribute.substring(ATTRIB_PREFIX.length()); if(!flowID.isEmpty()) { DataFlowID id = new DataFlowID(flowID); DataFlowHandler handler = mFlows.get(id); if(handler != null) { value = handler.getQueueSize(); } } } if(value == null) { throw new AttributeNotFoundException(attribute); } else { return value; } }
/** * Returns details of data flow given the data flow ID. * Only active data flows can be queried via this mechanism. * * @param inFlowID the data flow ID * * @return the data flow details * * @throws DataFlowNotFoundException if the data flow, specified by * the ID, could not be found. */ public DataFlowInfo getDataFlowInfo(DataFlowID inFlowID) throws DataFlowNotFoundException { DataFlow flow = mDataFlows.get(inFlowID); if (flow != null) { return flow.toDataFlowInfo(); } else { throw new DataFlowNotFoundException(new I18NBoundMessage1P( Messages.DATA_FLOW_NOT_FOUND, inFlowID.getValue())); } }
@Override public AttributeList getAttributes(String[] attributes) { Map<DataFlowID, Integer> sizes = getQueueSizes(); AttributeList list = new AttributeList(); for(String attribute: attributes) { if (attribute.startsWith(ATTRIB_PREFIX)) { Integer value = null; String flowID = attribute.substring(ATTRIB_PREFIX.length()); if(!flowID.isEmpty()) { DataFlowID id = new DataFlowID(flowID); value = sizes.get(id); } if (value != null) { list.add(new Attribute(attribute, value)); } } } return list; }
throw new ModuleStateException(new I18NBoundMessage4P( Messages.CANCEL_FAILED_MODULE_STATE_INCORRECT, inFlowID.getValue(), inRequester.getURN().toString(), state, ModuleState.CANCEL_FLOW_STATES.toString())); if(flow == null) { throw new DataFlowNotFoundException(new I18NBoundMessage1P( Messages.DATA_FLOW_NOT_FOUND, inFlowID.getValue()));
/** * Generates a unique ID for a data flow. * * @return a unique ID for identifying a data flow * * @throws ModuleException if there were errors generating the * data flow ID. */ private static DataFlowID generateFlowID() throws ModuleException { try { return new DataFlowID(sIDFactory.getNext()); } catch (NoMoreIDsException e) { throw new ModuleException(e, Messages.UNABLE_GENERATE_FLOW_ID); } }
} else { throw new UnsupportedDataTypeException(new I18NBoundMessage2P( Messages.UNSUPPORTED_DATA_TYPE, inFlowID.getValue(), ObjectUtils.toString(inData))); } catch (OrderValidationException e) { throw new ReceiveDataException(e, new I18NBoundMessage2P( Messages.SEND_ORDER_VALIDATION_FAILED, inFlowID.getValue(), ObjectUtils.toString(inData))); } catch (ClientInitException e) {