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


Java JndiContext类代码示例

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


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

示例1: setUp

import org.apache.camel.util.jndi.JndiContext; //导入依赖的package包/类
public void setUp() throws Exception {
    JndiRegistry registry = new JndiRegistry(new JndiContext());
    RouteBuilder builder = createRouteBuilder();
    CamelContext context = new DefaultCamelContext(registry);

    testConverter = new TestConverter();
    testTransformerFactory = TransformerFactory.newInstance();

    registry.bind("testConverter", testConverter);
    registry.bind("testTransformerFactory", testTransformerFactory);

    ProcessorEndpoint pep1 = context.getEndpoint(TEST_URI_1, ProcessorEndpoint.class);

    context.addRoutes(builder);
    context.start();

    builder1 = (XsltBuilder)pep1.getProcessor();
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:19,代码来源:XsltReferenceParameterTest.java

示例2: testCamelWithJndi

import org.apache.camel.util.jndi.JndiContext; //导入依赖的package包/类
public void testCamelWithJndi() throws Exception {
    JndiContext jndi = new JndiContext();
    jndi.bind("foo", new MyOtherDummyBean());

    CamelContext camel = new DefaultCamelContext(jndi);
    camel.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("direct:start").bean("foo");
        }
    });
    camel.start();

    String reply = camel.createProducerTemplate().requestBody("direct:start", "Camel", String.class);
    assertEquals("Hello Camel", reply);

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

示例3: configure

import org.apache.camel.util.jndi.JndiContext; //导入依赖的package包/类
/** configures camel-drools integration and defines 3 routes:
 * 1) testing route (connection to drools with JSON command format)
 * 2) unmarshalling route (for unmarshalling command results)
 * 3) marshalling route (enables creating commands through API and converting to JSON) */
private CamelContext configure(KieSession session) throws Exception {
    Context context = new JndiContext();
    context.bind("ksession", session);

    CamelContext camelContext = new DefaultCamelContext(context);
    camelContext.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("direct:test-session").policy(new KiePolicy()).unmarshal("json").to("kie://ksession").marshal("json");
            from("direct:unmarshall").policy(new KiePolicy()).unmarshal("json");
            from("direct:marshall").policy(new KiePolicy()).marshal("json");
        }

    });

    return camelContext;
}
 
开发者ID:jboss-integration,项目名称:fuse-bxms-integ,代码行数:22,代码来源:JsonQueryTest.java

示例4: configure

import org.apache.camel.util.jndi.JndiContext; //导入依赖的package包/类
/** configures camel-drools integration and defines 3 routes:
 * 1) testing route (connection to drools with JAXB command format)
 * 2) unmarshalling route (for unmarshalling command results)
 * 3) marshalling route (enables creating commands through API and converting to XML) */
private CamelContext configure(StatefulKnowledgeSession session) throws Exception {
    Context context = new JndiContext();
    context.bind("ksession", session);

    CamelContext camelContext = new DefaultCamelContext(context);
    camelContext.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            JaxbDataFormat jdf = new JaxbDataFormat();
            jdf.setContextPath("org.kie.camel.testdomain");
            jdf.setPrettyPrint(true);

            from("direct:test-session").policy(new KiePolicy()).unmarshal(jdf).to("kie://ksession").marshal(jdf);
            from("direct:unmarshall").policy(new KiePolicy()).unmarshal(jdf);
            from("direct:marshall").policy(new KiePolicy()).marshal(jdf);
        }
    });

    return camelContext;
}
 
开发者ID:jboss-integration,项目名称:fuse-bxms-integ,代码行数:25,代码来源:JaxbInsertTest.java

示例5: testPojoRoutes

import org.apache.camel.util.jndi.JndiContext; //导入依赖的package包/类
@Test
public void testPojoRoutes() throws Exception {

    JndiContext jndctx = new JndiContext();
    jndctx.bind("bye", new SayService("Good Bye!"));

    CamelContext camelContext = new DefaultCamelContext(jndctx);
    camelContext.addRoutes(createRouteBuilder(camelContext));

    camelContext.start();
    try {
        Endpoint endpoint = camelContext.getEndpoint("direct:hello");
        ISay proxy = ProxyHelper.createProxy(endpoint, false, ISay.class);
        String rc = proxy.say();
        Assert.assertEquals("Good Bye!", rc);
    } finally {
        camelContext.stop();
    }
}
 
开发者ID:wildfly-extras,项目名称:wildfly-camel,代码行数:20,代码来源:RmiIntegrationTest.java

示例6: MockJndiContextFactoryRule

import org.apache.camel.util.jndi.JndiContext; //导入依赖的package包/类
public MockJndiContextFactoryRule() {

        try {
            this.context = new JndiContext();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
 
开发者ID:drinkwater-io,项目名称:drinkwater-java,代码行数:9,代码来源:MockJndiContextFactoryRule.java

示例7: main

import org.apache.camel.util.jndi.JndiContext; //导入依赖的package包/类
/**
 * Application entry point
 * @param args application arguments
 * @throws Exception
 */
public static void main(String... args) throws Exception {
    JndiRegistry reg = new JndiRegistry(new JndiContext());

    reg.bind("sslContextParameters",sslParameters());

    CamelContext ctx = new DefaultCamelContext(reg);
    ctx.addRoutes(new WebsocketRouteNoSSL());
    ctx.setUseMDCLogging(true);
    ctx.setTracing(true);
    ctx.start();
}
 
开发者ID:IIlllII,项目名称:bitbreeds-webrtc,代码行数:17,代码来源:SimpleSignalingExample.java

示例8: main

import org.apache.camel.util.jndi.JndiContext; //导入依赖的package包/类
/**
 * Application entry point
 * @param args application arguments
 * @throws Exception
 */
public static void main(String... args) throws Exception {

    JndiRegistry reg = new JndiRegistry(new JndiContext());

    reg.bind("sslContextParameters",sslParameters());

    CamelContext ctx = new DefaultCamelContext(reg);
    ctx.addRoutes(new WebsocketRouteNoSSL());
    ctx.setUseMDCLogging(true);
    ctx.setTracing(true);
    ctx.start();
}
 
开发者ID:IIlllII,项目名称:bitbreeds-webrtc,代码行数:18,代码来源:SimpleSignalingExample.java

示例9: createJndiContext

import org.apache.camel.util.jndi.JndiContext; //导入依赖的package包/类
@Override
protected Context createJndiContext() throws Exception {
    JndiContext answer = new JndiContext();
    answer.bind("myBean", new MyBean());
    answer.bind("myStrategy", new MyAggregationStrategy());
    return answer;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:8,代码来源:BeanRecipientListTimeoutTest.java

示例10: createJndiContext

import org.apache.camel.util.jndi.JndiContext; //导入依赖的package包/类
@Override
protected Context createJndiContext() throws Exception {
    JndiContext answer = new JndiContext();
    answer.bind("myBean", myBean);
    answer.bind("myOtherBean", myOtherBean);
    return answer;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:8,代码来源:BeanOgnMethodWithXPathInjectionTest.java

示例11: createJndiContext

import org.apache.camel.util.jndi.JndiContext; //导入依赖的package包/类
protected Context createJndiContext() throws Exception {
    JndiContext answer = new JndiContext();
    answer.bind("foo", new FooBean());
    answer.bind("bar", new BarBean());
    answer.bind("baz", new BazBean());
    return answer;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:8,代码来源:BeanPipelineTest.java

示例12: createJndiContext

import org.apache.camel.util.jndi.JndiContext; //导入依赖的package包/类
protected Context createJndiContext() throws Exception {
    JndiContext answer = new JndiContext();
    answer.bind("one", new MyBean("one"));
    answer.bind("two", new MyBean("two"));
    answer.bind("three", new MyBean("three"));
    return answer;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:8,代码来源:BeanInPipelineTest.java

示例13: createJndiContext

import org.apache.camel.util.jndi.JndiContext; //导入依赖的package包/类
protected Context createJndiContext() throws Exception {
    JndiContext answer = new JndiContext();
    answer.bind("b", new B());
    answer.bind("p", Proxy.newProxyInstance(I1.class.getClassLoader(), new Class[]{I1.class}, new InvocationHandler() {
        @Override
        public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
            if (method.getName().equals("m1")) {
                return args[0].toString() + args[1].toString();
            } else {
                return null;
            }
        }
    }));
    return answer;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:16,代码来源:BeanWithAnnotationInheritedTest.java

示例14: createJndiContext

import org.apache.camel.util.jndi.JndiContext; //导入依赖的package包/类
@Override
protected Context createJndiContext() throws Exception {
    JndiContext answer = new JndiContext();

    // add ActiveMQ with embedded broker
    ConnectionFactory connectionFactory = CamelJmsTestHelper.createConnectionFactory();
    JmsComponent amq = jmsComponentAutoAcknowledge(connectionFactory);
    amq.setCamelContext(context);

    answer.bind("jms", amq);
    return answer;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:13,代码来源:RemoveEndpointsTest.java

示例15: createJndiContext

import org.apache.camel.util.jndi.JndiContext; //导入依赖的package包/类
@Override
protected Context createJndiContext() throws Exception {
    JndiContext answer = new JndiContext();

    // add ActiveMQ with embedded broker
    ConnectionFactory connectionFactory = CamelJmsTestHelper.createConnectionFactory();
    JmsComponent amq = jmsComponentAutoAcknowledge(connectionFactory);
    amq.setCamelContext(context);

    answer.bind("activemq", amq);
    return answer;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:13,代码来源:NettyAsyncRequestReplyTest.java


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