/** * 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(); }
@Override public ContentChannel handleRequest(Request request, ResponseHandler handler) { RequestContext requestContext; if (request instanceof MbusRequest) { requestContext = new MbusRequestContext((MbusRequest) request, handler, docprocServiceRegistry, docFactoryRegistry, containerDocConfig); } else { //Other types can be added here in the future throw new IllegalArgumentException("Request type not supported: " + request); } if (!requestContext.isProcessable()) { requestContext.skip(); return null; } DocprocService service = docprocServiceRegistry.getComponent(requestContext.getServiceName()); //No need to enqueue a task if the docproc chain is empty, just forward requestContext if (service == null) { log.log(LogLevel.ERROR, "DocprocService for session '" + requestContext.getServiceName() + "' not found, returning request '" + requestContext + "'."); requestContext.processingFailed(RequestContext.ErrorCode.ERROR_PROCESSING_FAILURE, "DocprocService " + requestContext.getServiceName() + " not found."); return null; } else if (service.getExecutor().getCallStack().size() == 0) { //call stack was empty, just forward message requestContext.skip(); return null; } DocumentProcessingTask task = new DocumentProcessingTask(requestContext, this, service); submit(task); return null; }
processing.setServiceName(getName()); if (processing.callStack() == null) { processing.setCallStack(new CallStack(getCallStack()));