本文整理汇总了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();
}
示例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();
}
示例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;
}
示例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;
}
示例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();
}
}
示例6: MockJndiContextFactoryRule
import org.apache.camel.util.jndi.JndiContext; //导入依赖的package包/类
public MockJndiContextFactoryRule() {
try {
this.context = new JndiContext();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例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();
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}