/** * Check whether the converter registry has been defined, throw a * ReferenceServiceException if not */ protected final void checkConverterRegistry() throws ReferenceServiceException { if (converterRegistry == null) { throw new ReferenceServiceException( "Reference service must be configued with an " + "instance registry of ValueToReferenceConvertorSPI " + "to enable on the fly mapping of arbitrary objects " + "during compound registration"); } }
public void run() { ReferenceService referenceService = callback.getContext().getReferenceService(); try { T2Reference id = referenceService.register(value, 0, true, callback.getContext()); Map<String,T2Reference> outputData = new HashMap<String, T2Reference>(); outputData.put("value", id); callback.receiveResult(outputData, new int[0]); } catch (ReferenceServiceException e) { callback.fail(e.getMessage(),e); } }
public void resultTokenProduced(WorkflowDataToken dataToken, String portname) { if (dataToken.getIndex().length == 0) { T2Reference reference = dataToken.getData(); System.out.println("Output reference made = " + reference); Object value = reference; if (reference.containsErrors()) { System.out.println("Contains errors!"); printAllErrors(context.getReferenceService().resolveIdentifier( reference, null, context)); } else { try { value = context.getReferenceService().renderIdentifier( reference, Object.class, context); } catch (ReferenceServiceException ex) { ex.printStackTrace(); } } resultMap.put(portname, value); synchronized (this) { outputCount--; } } }
/** * Check whether the converter registry has been defined, throw a * ReferenceServiceException if not */ protected final void checkConverterRegistry() throws ReferenceServiceException { if (converterRegistry == null) { throw new ReferenceServiceException( "Reference service must be configued with an " + "instance registry of ValueToReferenceConvertorSPI " + "to enable on the fly mapping of arbitrary objects " + "during compound registration"); } }
/** * Check whether the converter registry has been defined, throw a * ReferenceServiceException if not */ protected final void checkConverterRegistry() throws ReferenceServiceException { if (converters == null) { throw new ReferenceServiceException( "Reference service must be configued with an " + "instance registry of ValueToReferenceConvertorSPI " + "to enable on the fly mapping of arbitrary objects " + "during compound registration"); } }
/** * Throw a ReferenceServiceException if methods in ReferenceService are * called without the necessary sub-services configured. */ protected final void checkServices() throws ReferenceServiceException { if (errorDocumentService == null) { throw new ReferenceServiceException( "Reference service must be configued with an " + "instance of ErrorDocumentService to function"); } if (referenceSetService == null) { throw new ReferenceServiceException( "Reference service must be configued with an " + "instance of ReferenceSetService to function"); } if (listService == null) { throw new ReferenceServiceException( "Reference service must be configued with an " + "instance of ListService to function"); } }
/** * Throw a ReferenceServiceException if methods in ReferenceService are * called without the necessary sub-services configured. */ protected final void checkServices() throws ReferenceServiceException { if (errorDocumentService == null) { throw new ReferenceServiceException( "Reference service must be configued with an " + "instance of ErrorDocumentService to function"); } if (referenceSetService == null) { throw new ReferenceServiceException( "Reference service must be configued with an " + "instance of ReferenceSetService to function"); } if (listService == null) { throw new ReferenceServiceException( "Reference service must be configued with an " + "instance of ListService to function"); } }
/** * Throw a ReferenceServiceException if methods in ReferenceService are * called without the necessary sub-services configured. */ protected final void checkServices() throws ReferenceServiceException { if (errorDocumentService == null) { throw new ReferenceServiceException( "Reference service must be configued with an " + "instance of ErrorDocumentService to function"); } if (referenceSetService == null) { throw new ReferenceServiceException( "Reference service must be configued with an " + "instance of ReferenceSetService to function"); } if (listService == null) { throw new ReferenceServiceException( "Reference service must be configued with an " + "instance of ListService to function"); } }
public void deleteReferencesForWorkflowRun(String workflowRunId) throws ReferenceServiceException { String errorString = ""; try{ listService.deleteIdentifiedListsForWorkflowRun(workflowRunId); } catch(ReferenceServiceException resex){ errorString += "Failed to delete lists for workflow run: " + workflowRunId + "."; } try{ referenceSetService.deleteReferenceSetsForWorkflowRun(workflowRunId); } catch(ReferenceServiceException resex){ errorString += "Failed to delete reference sets for workflow run: " + workflowRunId + "."; } try{ errorDocumentService.deleteErrorDocumentsForWorkflowRun(workflowRunId); } catch(ReferenceServiceException resex){ errorString += "Failed to delete error documents for workflow run: " + workflowRunId +"."; } if (!errorString.equals("")){ throw new ReferenceServiceException(errorString); } }
throw new ReferenceServiceException("Cannot register at depth " + currentDepth + ": " + o); throw new ReferenceServiceException("Cannot register list at depth " + currentDepth); return newList.getId(); } catch (ListServiceException lse) { throw new ReferenceServiceException(lse); return newList.getId(); } catch (ListServiceException lse) { throw new ReferenceServiceException(lse); && (o instanceof ExternalReferenceSPI == false)) { if (currentDepth != 0) { throw new ReferenceServiceException( "Cannot register object " + o + " at depth " + currentDepth); throw new ReferenceServiceException( "Failed to register object " + o + ", found a type '" + o.getClass().getCanonicalName() return doc.getId(); } catch (ErrorDocumentServiceException edse) { throw new ReferenceServiceException(edse); throw new ReferenceServiceException("Cannot register external references at depth " + currentDepth); return rs.getId();
public Object renderIdentifier(T2Reference id, Class<?> leafClass, ReferenceContext context) throws ReferenceServiceException { // Check we have the services installed checkServices(); // Insert an empty context if context was null context = EmptyReferenceContext.checkContext(context); // Reject if the source reference contains errors if (id.containsErrors()) { throw new ReferenceServiceException( "Can't render an identifier which contains errors to a POJO"); } // Attempt to find an appropriate StreamToValueConverterSPI instance to // build the specified class StreamToValueConverterSPI<?> converter = null; if (valueBuilderRegistry != null) { for (StreamToValueConverterSPI<?> stvc : valueBuilderRegistry) { Class<?> builtClass = stvc.getPojoClass(); if (leafClass.isAssignableFrom(builtClass)) { converter = stvc; break; } } } if (converter == null) { log.warn("No stream->value converters found for type '" + leafClass.getCanonicalName() + "'"); } // Render the identifier return renderIdentifierInner(id, leafClass, context, converter); }
IdentifiedList<T2Reference> idList = listService.getList(id); if (idList == null) { throw new ReferenceServiceException("Could not find IdentifiedList " + id); throw new ReferenceServiceException(lse); ReferenceSet rs = referenceSetService.getReferenceSet(id); if (rs == null) { throw new ReferenceServiceException("Could not find ReferenceSet " + id); throw new ReferenceServiceException( "Can't render an empty reference set to a POJO"); throw new ReferenceServiceException(e); throw new ReferenceServiceException( "No converter found, and reference set didn't contain" + " an appropriate value carrying reference, cannot render to POJO"); throw new ReferenceServiceException("Unsupported ID type : " + id.getReferenceType());
throw new ReferenceServiceException( "Can't render an identifier which contains errors to a POJO");
throw new ReferenceServiceException("Could not find ReferenceSet " + id); throw new ReferenceServiceException(rsse); ErrorDocument ed = errorDocumentService.getError(id); if (ed == null) { throw new ReferenceServiceException("Could not find ErrorDocument " + id); throw new ReferenceServiceException(edse); IdentifiedList<T2Reference> idList = listService.getList(id); if (idList == null) { throw new ReferenceServiceException("Could not find IdentifiedList " + id); return newList; } catch (ListServiceException lse) { throw new ReferenceServiceException(lse); throw new ReferenceServiceException("Unsupported ID type : " + id.getReferenceType());
return newList.getId(); } catch (ListServiceException lse) { throw new ReferenceServiceException(lse); return newList.getId(); } catch (ListServiceException lse) { throw new ReferenceServiceException(lse); throw new ReferenceServiceException( "Failed to register POJO, found a type '" + o.getClass().getCanonicalName() return doc.getId(); } catch (ErrorDocumentServiceException edse) { throw new ReferenceServiceException(edse); return rs.getId(); } catch (ReferenceSetServiceException rsse) { throw new ReferenceServiceException(rsse); throw new ReferenceServiceException( "Should never see this, reference registration" + " logic has fallen off the end of the"
throw new ReferenceServiceException( "Can't render an identifier which contains errors to a POJO");
return newList.getId(); } catch (ListServiceException lse) { throw new ReferenceServiceException(lse); return newList.getId(); } catch (ListServiceException lse) { throw new ReferenceServiceException(lse); throw new ReferenceServiceException( "Failed to register POJO, found a type '" + o.getClass().getCanonicalName() return doc.getId(); } catch (ErrorDocumentServiceException edse) { throw new ReferenceServiceException(edse); return rs.getId(); } catch (ReferenceSetServiceException rsse) { throw new ReferenceServiceException(rsse); throw new ReferenceServiceException( "Should never see this, reference registration" + " logic has fallen off the end of the"
throw new ReferenceServiceException(lse); throw new ReferenceServiceException( "Can't render an empty reference set to a POJO"); throw new ReferenceServiceException(e); throw new ReferenceServiceException( "No converter found, and reference set didn't contain" + " an appropriate value carrying reference, cannot render to POJO"); throw new ReferenceServiceException("Unsupported ID type : " + id.getReferenceType());
throw new ReferenceServiceException(lse); throw new ReferenceServiceException( "Can't render an empty reference set to a POJO"); throw new ReferenceServiceException(e); throw new ReferenceServiceException( "No converter found, and reference set didn't contain" + " an appropriate value carrying reference, cannot render to POJO"); throw new ReferenceServiceException("Unsupported ID type : " + id.getReferenceType());
public boolean delete(T2Reference reference) throws ReferenceServiceException { boolean result=false; switch (reference.getReferenceType()) { case IdentifiedList: result=listService.delete(reference); break; case ReferenceSet: result=referenceSetService.delete(reference); break; case ErrorDocument: result=errorDocumentService.delete(reference); break; default: throw new ReferenceServiceException( "Unknown reference type!"); } return result; }