Search in sources :

Example 1 with UuidGenerator

use of org.apache.camel.spi.UuidGenerator in project camel by apache.

the class CamelContextFactoryBeanTest method testGetCustomUuidGenerator.

public void testGetCustomUuidGenerator() throws Exception {
    StaticApplicationContext applicationContext = new StaticApplicationContext();
    applicationContext.registerSingleton("uuidGenerator", SimpleUuidGenerator.class);
    factory.setApplicationContext(applicationContext);
    factory.afterPropertiesSet();
    UuidGenerator uuidGenerator = factory.getContext().getUuidGenerator();
    assertTrue(uuidGenerator instanceof SimpleUuidGenerator);
}
Also used : UuidGenerator(org.apache.camel.spi.UuidGenerator) SimpleUuidGenerator(org.apache.camel.impl.SimpleUuidGenerator) ActiveMQUuidGenerator(org.apache.camel.impl.ActiveMQUuidGenerator) SimpleUuidGenerator(org.apache.camel.impl.SimpleUuidGenerator) StaticApplicationContext(org.springframework.context.support.StaticApplicationContext)

Example 2 with UuidGenerator

use of org.apache.camel.spi.UuidGenerator in project camel by apache.

the class CamelContextFactoryBeanTest method testGetDefaultUuidGenerator.

public void testGetDefaultUuidGenerator() throws Exception {
    factory.setApplicationContext(new StaticApplicationContext());
    factory.afterPropertiesSet();
    UuidGenerator uuidGenerator = factory.getContext().getUuidGenerator();
    assertTrue(uuidGenerator instanceof ActiveMQUuidGenerator);
}
Also used : UuidGenerator(org.apache.camel.spi.UuidGenerator) SimpleUuidGenerator(org.apache.camel.impl.SimpleUuidGenerator) ActiveMQUuidGenerator(org.apache.camel.impl.ActiveMQUuidGenerator) StaticApplicationContext(org.springframework.context.support.StaticApplicationContext) ActiveMQUuidGenerator(org.apache.camel.impl.ActiveMQUuidGenerator)

Example 3 with UuidGenerator

use of org.apache.camel.spi.UuidGenerator in project camel by apache.

the class AbstractCamelContextFactoryBean method setupCustomServices.

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);
    }
}
Also used : Debugger(org.apache.camel.spi.Debugger) FactoryFinderResolver(org.apache.camel.spi.FactoryFinderResolver) MessageHistoryFactory(org.apache.camel.spi.MessageHistoryFactory) NodeIdFactory(org.apache.camel.spi.NodeIdFactory) UuidGenerator(org.apache.camel.spi.UuidGenerator) ExecutorServiceManager(org.apache.camel.spi.ExecutorServiceManager) ThreadPoolFactory(org.apache.camel.spi.ThreadPoolFactory) ModelJAXBContextFactory(org.apache.camel.spi.ModelJAXBContextFactory) ClassResolver(org.apache.camel.spi.ClassResolver) PackageScanClassResolver(org.apache.camel.spi.PackageScanClassResolver) StreamCachingStrategy(org.apache.camel.spi.StreamCachingStrategy) ProcessorFactory(org.apache.camel.spi.ProcessorFactory)

Example 4 with UuidGenerator

use of org.apache.camel.spi.UuidGenerator in project camel by apache.

the class DefaultCamelContextTest method testCreateDefaultUuidGenerator.

public void testCreateDefaultUuidGenerator() {
    DefaultCamelContext ctx = new DefaultCamelContext();
    ctx.disableJMX();
    UuidGenerator uuidGenerator = ctx.getUuidGenerator();
    assertNotNull(uuidGenerator);
    assertEquals(uuidGenerator.getClass(), ActiveMQUuidGenerator.class);
}
Also used : UuidGenerator(org.apache.camel.spi.UuidGenerator)

Aggregations

UuidGenerator (org.apache.camel.spi.UuidGenerator)4 ActiveMQUuidGenerator (org.apache.camel.impl.ActiveMQUuidGenerator)2 SimpleUuidGenerator (org.apache.camel.impl.SimpleUuidGenerator)2 StaticApplicationContext (org.springframework.context.support.StaticApplicationContext)2 ClassResolver (org.apache.camel.spi.ClassResolver)1 Debugger (org.apache.camel.spi.Debugger)1 ExecutorServiceManager (org.apache.camel.spi.ExecutorServiceManager)1 FactoryFinderResolver (org.apache.camel.spi.FactoryFinderResolver)1 MessageHistoryFactory (org.apache.camel.spi.MessageHistoryFactory)1 ModelJAXBContextFactory (org.apache.camel.spi.ModelJAXBContextFactory)1 NodeIdFactory (org.apache.camel.spi.NodeIdFactory)1 PackageScanClassResolver (org.apache.camel.spi.PackageScanClassResolver)1 ProcessorFactory (org.apache.camel.spi.ProcessorFactory)1 StreamCachingStrategy (org.apache.camel.spi.StreamCachingStrategy)1 ThreadPoolFactory (org.apache.camel.spi.ThreadPoolFactory)1