@Override public Processor createChildProcessor(RouteContext routeContext, ProcessorDefinition<?> definition, boolean mandatory) throws Exception { String name = definition.getClass().getSimpleName(); FactoryFinder finder = routeContext.getCamelContext().getFactoryFinder(RESOURCE_PATH); try { if (finder != null) { Object object = finder.newInstance(name); if (object != null && object instanceof ProcessorFactory) { ProcessorFactory pc = (ProcessorFactory) object; return pc.createChildProcessor(routeContext, definition, mandatory); } } } catch (NoFactoryAvailableException e) { // ignore there is no custom factory } return null; }
@Override public Processor createProcessor(RouteContext routeContext, ProcessorDefinition<?> definition) throws Exception { String name = definition.getClass().getSimpleName(); FactoryFinder finder = routeContext.getCamelContext().getFactoryFinder(RESOURCE_PATH); try { if (finder != null) { Object object = finder.newInstance(name); if (object != null && object instanceof ProcessorFactory) { ProcessorFactory pc = (ProcessorFactory) object; return pc.createProcessor(routeContext, definition); } } } catch (NoFactoryAvailableException e) { // ignore there is no custom factory } return null; }
public ProcessorFactory getProcessorFactory() { return processorFactory; }
public void setProcessorFactory(ProcessorFactory processorFactory) { this.processorFactory = processorFactory; }
private void setupCustomServices() { ModelJAXBContextFactory modelJAXBContextFactory = getBeanForType(ModelJAXBContextFactory.class); if (modelJAXBContextFactory != null) { LOG.info("Using custom ModelJAXBContextFactory: {}", modelJAXBContextFactory); getContext().setModelJAXBContextFactory(modelJAXBContextFactory); } ClassResolver classResolver = getBeanForType(ClassResolver.class); if (classResolver != null) { LOG.info("Using custom ClassResolver: {}", classResolver); getContext().setClassResolver(classResolver); } FactoryFinderResolver factoryFinderResolver = getBeanForType(FactoryFinderResolver.class); if (factoryFinderResolver != null) { LOG.info("Using custom FactoryFinderResolver: {}", factoryFinderResolver); getContext().setFactoryFinderResolver(factoryFinderResolver); } ExecutorServiceManager executorServiceStrategy = getBeanForType(ExecutorServiceManager.class); if (executorServiceStrategy != null) { LOG.info("Using custom ExecutorServiceStrategy: {}", executorServiceStrategy); getContext().setExecutorServiceManager(executorServiceStrategy); } ThreadPoolFactory threadPoolFactory = getBeanForType(ThreadPoolFactory.class); if (threadPoolFactory != null) { LOG.info("Using custom ThreadPoolFactory: {}", threadPoolFactory); getContext().getExecutorServiceManager().setThreadPoolFactory(threadPoolFactory); } ProcessorFactory processorFactory = getBeanForType(ProcessorFactory.class); if (processorFactory != null) { LOG.info("Using custom ProcessorFactory: {}", processorFactory); getContext().setProcessorFactory(processorFactory); } Debugger debugger = getBeanForType(Debugger.class); if (debugger != null) { LOG.info("Using custom Debugger: {}", debugger); getContext().setDebugger(debugger); } UuidGenerator uuidGenerator = getBeanForType(UuidGenerator.class); if (uuidGenerator != null) { LOG.info("Using custom UuidGenerator: {}", uuidGenerator); getContext().setUuidGenerator(uuidGenerator); } NodeIdFactory nodeIdFactory = getBeanForType(NodeIdFactory.class); if (nodeIdFactory != null) { LOG.info("Using custom NodeIdFactory: {}", nodeIdFactory); getContext().setNodeIdFactory(nodeIdFactory); } StreamCachingStrategy streamCachingStrategy = getBeanForType(StreamCachingStrategy.class); if (streamCachingStrategy != null) { LOG.info("Using custom StreamCachingStrategy: {}", streamCachingStrategy); getContext().setStreamCachingStrategy(streamCachingStrategy); } MessageHistoryFactory messageHistoryFactory = getBeanForType(MessageHistoryFactory.class); if (messageHistoryFactory != null) { LOG.info("Using custom MessageHistoryFactory: {}", messageHistoryFactory); getContext().setMessageHistoryFactory(messageHistoryFactory); } }
@Override public ProcessorFactory getProcessorFactory() { return context.getProcessorFactory(); }
@Override public void setProcessorFactory(ProcessorFactory processorFactory) { context.setProcessorFactory(processorFactory); }
/** * Gets the current {@link org.apache.camel.spi.ProcessorFactory} * * @return the factory, can be <tt>null</tt> if no custom factory has been set */ ProcessorFactory getProcessorFactory();
/** * Sets a custom {@link org.apache.camel.spi.ProcessorFactory} * * @param processorFactory the custom factory */ void setProcessorFactory(ProcessorFactory processorFactory);