当前位置: 首页>>代码示例>>Java>>正文


Java SimpleRegistry.put方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例13: 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

示例14: CmdProducer

import org.apache.camel.impl.SimpleRegistry; //导入方法依赖的package包/类
@Inject
CmdProducer(CommandsDataSetsRoute datasetRoute) throws Exception  {
	
	main = new Main() ;
	main.enableHangupSupport();
	registry = new SimpleRegistry();
	context = new DefaultCamelContext(registry);
	
	populate();
	
	registry.put("createCommandDataset", new CreateCommandDataSet(ids, dataSetSize));
	registry.put("increaseCommandDataset", new IncreaseCommandDataSet(ids, dataSetSize));
	registry.put("decreaseCommandDataset", new DecreaseCommandDataSet(ids, dataSetSize));

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

示例15: createCamelContext

import org.apache.camel.impl.SimpleRegistry; //导入方法依赖的package包/类
@Override
protected CamelContext createCamelContext() throws Exception {
    SimpleRegistry registry = new SimpleRegistry();
    dataSource = EmbeddedDataSourceFactory.getDataSource("sql/schema.sql");

    DataSourceTransactionManager transactionManager = new DataSourceTransactionManager(dataSource);
    registry.put("transactionManager", transactionManager);

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

    auditLogDao = new AuditLogDao(dataSource);
    messageDao = new MessageDao(dataSource);

    CamelContext camelContext = new DefaultCamelContext(registry);

    SqlComponent sqlComponent = new SqlComponent();
    sqlComponent.setDataSource(dataSource);
    camelContext.addComponent("sql", sqlComponent);

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


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