/** * Asynchronously process the given document put or document update using the processing * chain of this service, and call the specified ProcessingEndpoint when done. * * @throws RuntimeException caused by a QueueFullException if this DocprocService has a bounded input queue and the queue is full * @throws IllegalStateException if this DocprocService is not accepting new incoming processings */ public void process(DocumentOperation documentOperation, ProcessingEndpoint endp) { addProcessing(new Processing(getName(), documentOperation, new CallStack(getCallStack()), endp)); }
/** * Asynchronously process the given document operations as one unit * using the processing chain of this service, * and call the specified ProcessingEndpoint when done. * * @throws RuntimeException caused by a QueueFullException if this DocprocService has a bounded input queue and the queue is full * @throws IllegalStateException if this DocprocService is not accepting new incoming processings */ public void processDocumentOperations(List<DocumentOperation> documentOperations, ProcessingEndpoint endp) { addProcessing(Processing.createProcessingFromDocumentOperations(getName(), documentOperations, new CallStack(getCallStack()), endp)); }
/** * Asynchronously process the given Processing using the processing * chain of this service, and call the specified ProcessingEndpoint when done. * * @throws RuntimeException caused by a QueueFullException if this DocprocService has a bounded input queue and the queue is full * @throws IllegalStateException if this DocprocService is not accepting new incoming processings */ public void process(Processing processing, ProcessingEndpoint endp) { processing.setServiceName(getName()); processing.setCallStack(new CallStack(getCallStack())); processing.setEndpoint(endp); addProcessing(processing); }
/** * Sets a new processing stack for this service. This will be the Prototype * for the call stacks of individual processings in this service */ public void setCallStack(CallStack stack) { DocprocExecutor ex = ((getExecutor() == null) ? new DocprocExecutor(getName(), stack) : new DocprocExecutor(getExecutor(), stack)); setExecutor(ex); }
/** * Returns the processing chain of this service. This stack can not be modified. * To change the stack, set a new one. */ // TODO: Enforce unmodifiability public CallStack getCallStack() { DocprocExecutor ex = getExecutor(); return (ex == null) ? null : ex.getCallStack(); }
/** * Creates a new docproc service, which is set to be in service. * * @param id the component id of the new service. * @param stack the call stack to use. * @param mgr the document type manager to use. */ public DocprocService(ComponentId id, CallStack stack, DocumentTypeManager mgr) { this(id); setCallStack(stack); setDocumentTypeManager(mgr); setInService(true); }
private void schemaMapProcessing(Processing processing) { final List<DocumentOperation> documentOperations = processing.getDocumentOperations(); for (int i = 0; i < documentOperations.size(); i++) { DocumentOperation op = documentOperations.get(i); if (op instanceof DocumentPut) { documentOperations.set(i, configDoc(processor, (DocumentPut) op)); } else if (op instanceof DocumentUpdate) { documentOperations.set(i, configDocUpd(processor, (DocumentUpdate) op)); } } }
private void incrementNumDocsProcessed(Processing processing) { int increment = processing.getNumDocsToBeProcessed(); if (increment != 0) { incrementNumDocsProcessed(increment); } }
/** * Adds an element just before the first occurence of some element on the * stack. This can not be called during an iteration. * * @param before * the call to add this before. If this call is not present (the * same object instance), the new processor is added as the last * element * @param processor the processor to add * @return this for convenience */ public CallStack addBefore(final Call before, DocumentProcessor processor) { return addBefore(before, new Call(processor, name, statistics, metric)); }
/** * Returns the ID of the processor to call. * * @return the ID of the processor to call */ public ComponentId getDocumentProcessorId() { return processor.getId(); }
/** * Asynchronously process the given Processing using the processing * chain of this service * * @throws RuntimeException caused by a QueueFullException if this DocprocService has a bounded input queue and the queue is full * @throws IllegalStateException if this DocprocService is not accepting new incoming processings */ public void process(Processing processing) { process(processing, null); }
/** * * @param service the unique name of the service processing this * @param documentsAndUpdates the document operation list. This <b>transfers ownership</b> of this list * to this class. The caller <i>must not</i> modify it * @param callStack the document processors to call in this processing. * This <b>transfers ownership</b> of this structure * to this class. The caller <i>must not</i> modify it */ public static Processing createProcessingFromDocumentOperations(String service, List<DocumentOperation> documentsAndUpdates, CallStack callStack) { return new Processing(service, documentsAndUpdates, callStack, null, false); }
/** * Asynchronously process the given document operations as one unit * using the processing chain of this service. * * @throws RuntimeException caused by a QueueFullException if this DocprocService has a bounded input queue and the queue is full * @throws IllegalStateException if this DocprocService is not accepting new incoming processings */ public void processDocumentOperations(List<DocumentOperation> documentOperations) { processDocumentOperations(documentOperations, null); }
@Override public DocumentOperation getWrappedDocumentOperation() { DocumentOperation innermostDocOp = docU; while (innermostDocOp instanceof DocumentOperationWrapper) { innermostDocOp = ((DocumentOperationWrapper) innermostDocOp).getWrappedDocumentOperation(); } return innermostDocOp; }
private Processing(DocumentOperation documentOperation) { this(); addDocumentOperation(documentOperation); }
/** * Asynchronously process the given document operation using the processing * chain of this service. * * @throws RuntimeException caused by a QueueFullException if this DocprocService has a bounded input queue and the queue is full * @throws IllegalStateException if this DocprocService is not accepting new incoming processings */ public void process(DocumentOperation documentOperation) { process(documentOperation, null); }
/** * Create a Processing from the given document operation */ public static Processing of(DocumentOperation documentOperation) { return new Processing(documentOperation); }