• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java SimpleRegistry类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.camel.impl.SimpleRegistry的典型用法代码示例。如果您正苦于以下问题:Java SimpleRegistry类的具体用法?Java SimpleRegistry怎么用?Java SimpleRegistry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SimpleRegistry类属于org.apache.camel.impl包,在下文中一共展示了SimpleRegistry类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: setUp

import org.apache.camel.impl.SimpleRegistry; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    camelContext = new DefaultCamelContext();
    SimpleRegistry registry = new SimpleRegistry();
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("custName", "Willem");
    // bind the params
    registry.put("params", params);
    camelContext.setRegistry(registry);
    
    template = camelContext.createProducerTemplate();
    ServiceHelper.startServices(template, camelContext);

    Endpoint value = camelContext.getEndpoint(getEndpointUri());
    assertNotNull("Could not find endpoint!", value);
    assertTrue("Should be a JPA endpoint but was: " + value, value instanceof JpaEndpoint);
    endpoint = (JpaEndpoint)value;

    transactionTemplate = endpoint.createTransactionTemplate();
    entityManager = endpoint.createEntityManager();
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:22,代码来源:JpaWithNamedQueryAndParametersTest.java


示例2: setUp

import org.apache.camel.impl.SimpleRegistry; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
    // create the registry to be the SimpleRegistry which is just a Map based implementation
    SimpleRegistry registry = new SimpleRegistry();
    // register our HelloBean under the name helloBean
    registry.put("helloBean", new HelloBean());

    // tell Camel to use our SimpleRegistry
    context = new DefaultCamelContext(registry);

    // create a producer template to use for testing
    template = context.createProducerTemplate();

    // add the route using an inlined RouteBuilder
    context.addRoutes(new RouteBuilder() {
        public void configure() throws Exception {
            from("direct:hello").bean("helloBean", "hello");
        }
    });
    // star Camel
    context.start();
}
 
开发者ID:camelinaction,项目名称:camelinaction2,代码行数:23,代码来源:SimpleRegistryTest.java


示例3: setup

import org.apache.camel.impl.SimpleRegistry; //导入依赖的package包/类
/** Prepares Db and data source, which must be added to Camel registry. */
@BeforeClass
public static void setup() throws Exception {
    DeleteDbFiles.execute("~", "jbpm-db-test", true);

    h2Server = Server.createTcpServer(new String[0]);
    h2Server.start();

    setupDb();

    DataSource ds = setupDataSource();

    SimpleRegistry simpleRegistry = new SimpleRegistry();
    simpleRegistry.put("myDs", ds);

    handler = new CamelHandler(new SQLURIMapper(), new RequestPayloadMapper("payload"), new ResponsePayloadMapper("queryResult"), new DefaultCamelContext(simpleRegistry));
}
 
开发者ID:jboss-integration,项目名称:fuse-bxms-integ,代码行数:18,代码来源:CamelSqlTest.java


示例4: createCamelContext

import org.apache.camel.impl.SimpleRegistry; //导入依赖的package包/类
@Override
protected CamelContext createCamelContext() throws Exception {
    SimpleRegistry registry = new SimpleRegistry();
    ActiveMQConnectionFactory connectionFactory =
        new ActiveMQConnectionFactory("vm://embedded?broker.persistent=false");
    registry.put("connectionFactory", connectionFactory);

    JmsTransactionManager jmsTransactionManager = new JmsTransactionManager();
    jmsTransactionManager.setConnectionFactory(connectionFactory);
    registry.put("jmsTransactionManager", jmsTransactionManager);

    SpringTransactionPolicy propagationRequired = new SpringTransactionPolicy();
    propagationRequired.setTransactionManager(jmsTransactionManager);
    propagationRequired.setPropagationBehaviorName("PROPAGATION_REQUIRED");
    registry.put("PROPAGATION_REQUIRED", propagationRequired);

    SpringTransactionPolicy propagationNotSupported = new SpringTransactionPolicy();
    propagationNotSupported.setTransactionManager(jmsTransactionManager);
    propagationNotSupported.setPropagationBehaviorName("PROPAGATION_NOT_SUPPORTED");
    registry.put("PROPAGATION_NOT_SUPPORTED", propagationNotSupported);

    CamelContext camelContext = new DefaultCamelContext(registry);

    ActiveMQComponent activeMQComponent = new ActiveMQComponent();
    activeMQComponent.setConnectionFactory(connectionFactory);
    activeMQComponent.setTransactionManager(jmsTransactionManager);
    camelContext.addComponent("jms", activeMQComponent);

    return camelContext;
}
 
开发者ID:CamelCookbook,项目名称:camel-cookbook-examples,代码行数:31,代码来源:JmsTransactionRequestReplyTest.java


示例5: unregisterExecutorComponent

import org.apache.camel.impl.SimpleRegistry; //导入依赖的package包/类
@SuppressWarnings("Convert2streamapi")
private void unregisterExecutorComponent(Executor... executors) {
	for (Executor executor : executors) {
		//unregister beans
		Registry registry = context.getRegistry();
		if (registry instanceof PropertyPlaceholderDelegateRegistry) {
			registry = ((PropertyPlaceholderDelegateRegistry) registry).getRegistry();
		}
		SimpleRegistry openexRegistry = (SimpleRegistry) registry;
		Set<Map.Entry<String, Object>> beansEntries = executor.beans().entrySet();
		for (Map.Entry<String, Object> beansEntry : beansEntries) {
			if (openexRegistry.containsKey(beansEntry.getKey())) {
				openexRegistry.remove(beansEntry.getKey());
			}
		}
		//unregister components
		Set<String> keys = executor.components().keySet();
		for (String key : keys) {
			if (context.getComponentNames().contains(key)) {
				context.removeComponent(key);
			}
		}
	}
}
 
开发者ID:LuatixHQ,项目名称:openex-worker,代码行数:25,代码来源:OpenexContext.java


示例6: registerExecutorComponent

import org.apache.camel.impl.SimpleRegistry; //导入依赖的package包/类
@SuppressWarnings("Convert2streamapi")
private void registerExecutorComponent(Executor... executors) {
	for (Executor executor : executors) {
		//register beans
		Registry registry = context.getRegistry();
		if (registry instanceof PropertyPlaceholderDelegateRegistry) {
			registry = ((PropertyPlaceholderDelegateRegistry) registry).getRegistry();
		}
		SimpleRegistry openexRegistry = (SimpleRegistry) registry;
		Set<Map.Entry<String, Object>> beansEntries = executor.beans().entrySet();
		for (Map.Entry<String, Object> beansEntry : beansEntries) {
			if (!openexRegistry.containsKey(beansEntry.getKey())) {
				openexRegistry.put(beansEntry.getKey(), beansEntry.getValue());
			}
		}
		//register components
		Set<Map.Entry<String, org.apache.camel.Component>> components = executor.components().entrySet();
		for (Map.Entry<String, org.apache.camel.Component> entry : components) {
			if (!context.getComponentNames().contains(entry.getKey())) {
				context.addComponent(entry.getKey(), entry.getValue());
			}
		}
	}
}
 
开发者ID:LuatixHQ,项目名称:openex-worker,代码行数:25,代码来源:OpenexContext.java


示例7: testLoadRegistry

import org.apache.camel.impl.SimpleRegistry; //导入依赖的package包/类
public void testLoadRegistry() throws Exception {
    SimpleRegistry registry = new SimpleRegistry();
    registry.put("myBean", "This is a log4j logging configuation file");

    CamelContext context = new DefaultCamelContext(registry);
    context.start();

    InputStream is = ResourceHelper.resolveMandatoryResourceAsInputStream(context, "ref:myBean");
    assertNotNull(is);

    String text = context.getTypeConverter().convertTo(String.class, is);
    assertNotNull(text);
    assertTrue(text.contains("log4j"));
    is.close();

    context.stop();
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:18,代码来源:ResourceHelperTest.java


示例8: testErrorListener

import org.apache.camel.impl.SimpleRegistry; //导入依赖的package包/类
public void testErrorListener() throws Exception {
    try {
        SimpleRegistry registry = new SimpleRegistry();
        registry.put("myListener", listener);

        RouteBuilder builder = createRouteBuilder();
        CamelContext context = new DefaultCamelContext(registry);
        context.addRoutes(builder);
        context.start();

        fail("Should have thrown an exception due XSLT file not found");
    } catch (FailedToCreateRouteException e) {
        // expected
    }

    assertFalse(listener.isWarning());
    assertTrue("My error listener should been invoked", listener.isError());
    assertTrue("My error listener should been invoked", listener.isFatalError());
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:20,代码来源:XsltCustomErrorListenerTest.java


示例9: createCamelContext

import org.apache.camel.impl.SimpleRegistry; //导入依赖的package包/类
@Override
protected CamelContext createCamelContext() throws Exception {

    final PropertiesComponent pc = new PropertiesComponent("classpath:org/apache/camel/component/properties/myproperties.properties");
    pc.setPropertiesResolver(new PropertiesResolver() {
        public Properties resolveProperties(CamelContext context, boolean ignoreMissingLocation, String... uri) throws Exception {
            resolvedCount++;
            return new DefaultPropertiesResolver(pc).resolveProperties(context, ignoreMissingLocation, uri);
        }
    });

    // put the properties component into the registry so that it survives restarts
    SimpleRegistry registry = new SimpleRegistry();
    registry.put("properties", pc);

    return new DefaultCamelContext(registry);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:18,代码来源:PropertiesComponentRestartTest.java


示例10: shouldFailWhenThereIsNoJobLauncher

import org.apache.camel.impl.SimpleRegistry; //导入依赖的package包/类
@Test(expected = FailedToCreateRouteException.class)
public void shouldFailWhenThereIsNoJobLauncher() throws Exception {
    // Given
    SimpleRegistry registry = new SimpleRegistry();
    registry.put("mockJob", job);
    CamelContext camelContext = new DefaultCamelContext(registry);
    camelContext.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("direct:start").to("spring-batch:mockJob");
        }
    });

    // When
    camelContext.start();
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:17,代码来源:SpringBatchEndpointTest.java


示例11: shouldFailWhenThereIsMoreThanOneJobLauncher

import org.apache.camel.impl.SimpleRegistry; //导入依赖的package包/类
@Test(expected = FailedToCreateRouteException.class)
public void shouldFailWhenThereIsMoreThanOneJobLauncher() throws Exception {
    // Given
    SimpleRegistry registry = new SimpleRegistry();
    registry.put("mockJob", job);
    registry.put("launcher1", jobLauncher);
    registry.put("launcher2", jobLauncher);
    CamelContext camelContext = new DefaultCamelContext(registry);
    camelContext.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("direct:start").to("spring-batch:mockJob");
        }
    });

    // When
    camelContext.start();
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:19,代码来源:SpringBatchEndpointTest.java


示例12: shouldResolveAnyJobLauncher

import org.apache.camel.impl.SimpleRegistry; //导入依赖的package包/类
@Test
public void shouldResolveAnyJobLauncher() throws Exception {
    // Given
    SimpleRegistry registry = new SimpleRegistry();
    registry.put("mockJob", job);
    registry.put("someRandomName", jobLauncher);
    CamelContext camelContext = new DefaultCamelContext(registry);
    camelContext.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("direct:start").to("spring-batch:mockJob");
        }
    });

    // When
    camelContext.start();

    // Then
    SpringBatchEndpoint batchEndpoint = camelContext.getEndpoint("spring-batch:mockJob", SpringBatchEndpoint.class);
    JobLauncher batchEndpointJobLauncher = (JobLauncher) FieldUtils.readField(batchEndpoint, "jobLauncher", true);
    assertSame(jobLauncher, batchEndpointJobLauncher);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:23,代码来源:SpringBatchEndpointTest.java


示例13: createCamelContext

import org.apache.camel.impl.SimpleRegistry; //导入依赖的package包/类
@Override
public CamelContext createCamelContext() throws Exception {
    SimpleRegistry registry = new SimpleRegistry();
    registry.put("testStrategy", new ListAggregationStrategy());
    ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(broker.getTcpConnectorUri());

    SjmsComponent sjmsComponent = new SjmsComponent();
    sjmsComponent.setConnectionFactory(connectionFactory);

    SjmsBatchComponent sjmsBatchComponent = new SjmsBatchComponent();
    sjmsBatchComponent.setConnectionFactory(connectionFactory);

    CamelContext context = new DefaultCamelContext(registry);
    context.addComponent("sjms", sjmsComponent);
    context.addComponent("sjms-batch", sjmsBatchComponent);
    return context;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:18,代码来源:SjmsBatchConsumerTest.java


示例14: createCamelContext

import org.apache.camel.impl.SimpleRegistry; //导入依赖的package包/类
@Override
protected CamelContext createCamelContext() throws Exception {
    SimpleRegistry registry = new SimpleRegistry();
    registry.put("aggStrategy", AggregationStrategies.groupedExchange());

    ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory();
    connectionFactory.setBrokerURL(broker.getTcpConnectorUri());

    SjmsComponent sjmsComponent = new SjmsComponent();
    sjmsComponent.setConnectionFactory(connectionFactory);

    SjmsBatchComponent sjmsBatchComponent = new SjmsBatchComponent();
    sjmsBatchComponent.setConnectionFactory(connectionFactory);

    CamelContext context = new DefaultCamelContext(registry);
    context.addComponent("sjms-batch", sjmsBatchComponent);
    context.addComponent("sjms", sjmsComponent);

    return context;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:21,代码来源:SjmsBatchEndpointTest.java


示例15: invalidConfiguration

import org.apache.camel.impl.SimpleRegistry; //导入依赖的package包/类
@Test
public void invalidConfiguration() throws Exception {
    // Given
    SimpleRegistry registry = new SimpleRegistry();
    registry.put("eventBus", new EventBus());
    CamelContext context = new DefaultCamelContext(registry);
    context.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("guava-eventbus:eventBus?listenerInterface=org.apache.camel.component.guava.eventbus.CustomListener&eventClass=org.apache.camel.component.guava.eventbus.MessageWrapper").
                    to("mock:customListenerEvents");
        }
    });

    try {
        context.start();
        fail("Should throw exception");
    } catch (FailedToCreateRouteException e) {
        IllegalStateException ise = assertIsInstanceOf(IllegalStateException.class, e.getCause());
        assertEquals("You cannot set both 'eventClass' and 'listenerInterface' parameters.", ise.getMessage());
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:23,代码来源:GuavaEventBusConsumerConfigurationTest.java


示例16: createContextWithGivenRoute

import org.apache.camel.impl.SimpleRegistry; //导入依赖的package包/类
protected void createContextWithGivenRoute(RouteBuilder route, int timeWork) throws Exception, InterruptedException {
    SimpleRegistry registry = new SimpleRegistry();
    ModelCamelContext context = new DefaultCamelContext(registry);
    Tracer tracer = new Tracer();
    tracer.setLogName("MyTracerLog");
    tracer.getDefaultTraceFormatter().setShowProperties(false);
    tracer.getDefaultTraceFormatter().setShowHeaders(false);
    tracer.getDefaultTraceFormatter().setShowBody(true);
    context.addInterceptStrategy(tracer);
    context.addRoutes(route);
    context.addComponent("activeMq", activeMq);

    this.camelContext = context;
    this.ct = context.createConsumerTemplate();
    this.pt = context.createProducerTemplate();

    context.start();
    context.setTracing(false);
    Thread.sleep(timeWork);
    context.stop();
}
 
开发者ID:przodownikR1,项目名称:cxf_over_jms_kata,代码行数:22,代码来源:CommonCreateCamelContext.java


示例17: testSendA19

import org.apache.camel.impl.SimpleRegistry; //导入依赖的package包/类
public void testSendA19() throws Exception {

        SimpleRegistry registry = new SimpleRegistry();
        HL7MLLPCodec codec = new HL7MLLPCodec();
        codec.setCharset("iso-8859-1");
        codec.setConvertLFtoCR(true);

        registry.put("hl7codec", codec);
        CamelContext camelContext = new DefaultCamelContext(registry);
        camelContext.start();
        ProducerTemplate template = camelContext.createProducerTemplate();
        String line1 = "MSH|^~\\&|MYSENDER|MYRECEIVER|MYAPPLICATION||200612211200||QRY^A19|1234|P|2.4";
        String line2 = "QRD|200612211200|R|I|GetPatient|||1^RD|0101701234|DEM||";

        StringBuilder in = new StringBuilder();
        in.append(line1);
        in.append("\r");
        in.append(line2);

        template.requestBody("mina2:tcp://127.0.0.1:" + MINA2_PORT + "?sync=true&codec=#hl7codec", in.toString());
        
        template.stop();
        camelContext.stop();
    }
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:25,代码来源:HL7Client.java


示例18: init

import org.apache.camel.impl.SimpleRegistry; //导入依赖的package包/类
@Override
public void init(ServiceDomain domain) {
    if (_logger.isDebugEnabled()) {
        _logger.debug("Initialization of CamelExchangeBus for domain " + domain.getName());
    }

    SimpleRegistry registry = _camelContext.getWritebleRegistry();
    for (Processors processor : Processors.values()) {
        registry.put(processor.name(), processor.create(domain));
    }

    // CAMEL-7728 introduces an issue on finding BeanManager due to the fact that default
    // applicationContextClassLoader in the CamelContext is not a bundle deployment class loader.
    // We need to ensure the applicationContextClassLoader is the bundle deployment class loader
    // for now. This will be unnecessary once CAMEL-7759 is merged.
    _camelContext.setApplicationContextClassLoader(Thread.currentThread().getContextClassLoader());
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:18,代码来源:CamelExchangeBus.java


示例19: setUp

import org.apache.camel.impl.SimpleRegistry; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
    // create the registry to be the SimpleRegistry which is just a Map based implementation
    SimpleRegistry registry = new SimpleRegistry();
    // register our HelloBean under the name helloBean
    registry.put("helloBean", new HelloBean());

    // tell Camel to use our SimpleRegistry
    context = new DefaultCamelContext(registry);

    // create a producer template to use for testing
    template = context.createProducerTemplate();

    // add the route using an inlined RouteBuilder
    context.addRoutes(new RouteBuilder() {
        public void configure() throws Exception {
            from("direct:hello").beanRef("helloBean");
        }
    });
    // star Camel
    context.start();
}
 
开发者ID:camelinaction,项目名称:camelinaction,代码行数:23,代码来源:SimpleRegistryTest.java


示例20: JdbiExample

import org.apache.camel.impl.SimpleRegistry; //导入依赖的package包/类
@Inject
JdbiExample(ReceiveCommandsAsJsonRoute receiveCommandsRoute,
			JdbiConsumeCommandsRoute consumeCommandsRoute, 
			JdbiConsumeEventsRoute consumeEventsRoute) throws Exception  {
	
	main = new Main() ;
	main.enableHangupSupport();
	registry = new SimpleRegistry();
	context = new DefaultCamelContext(registry);

	context.addRoutes(receiveCommandsRoute);
	context.addRoutes(consumeCommandsRoute);
	context.addRoutes(consumeEventsRoute);
	
	main.getCamelContexts().clear();
	main.getCamelContexts().add(context);
	main.setDuration(-1);
	main.start();
	
	
}
 
开发者ID:rodolfodpk,项目名称:myeslib,代码行数:22,代码来源:JdbiExample.java



注:本文中的org.apache.camel.impl.SimpleRegistry类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java WXImageObject类代码示例发布时间:2022-05-21
下一篇:
Java Schema类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap