本文整理汇总了Java中org.apache.camel.impl.ExplicitCamelContextNameStrategy类的典型用法代码示例。如果您正苦于以下问题:Java ExplicitCamelContextNameStrategy类的具体用法?Java ExplicitCamelContextNameStrategy怎么用?Java ExplicitCamelContextNameStrategy使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExplicitCamelContextNameStrategy类属于org.apache.camel.impl包,在下文中一共展示了ExplicitCamelContextNameStrategy类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testContextList
import org.apache.camel.impl.ExplicitCamelContextNameStrategy; //导入依赖的package包/类
@Test
public void testContextList() throws Exception {
CamelContext context = new DefaultCamelContext();
context.setNameStrategy(new ExplicitCamelContextNameStrategy("foobar"));
context.start();
CamelController controller = new DummyCamelController(context);
OutputStream os = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(os);
ContextListCommand command = new ContextListCommand();
command.execute(controller, ps, null);
String out = os.toString();
assertNotNull(out);
LOG.info("\n\n{}\n", out);
// should contain a table with the context
assertTrue(out.contains("foobar"));
assertTrue(out.contains("Started"));
context.stop();
}
开发者ID:HydAu,项目名称:Camel,代码行数:25,代码来源:ContextListCommandTest.java
示例2: testListComponents
import org.apache.camel.impl.ExplicitCamelContextNameStrategy; //导入依赖的package包/类
@Test
public void testListComponents() throws Exception {
CamelContext context = new DefaultCamelContext();
context.setNameStrategy(new ExplicitCamelContextNameStrategy("foobar"));
context.start();
CamelController controller = new DummyCamelController(context);
OutputStream os = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(os);
CatalogComponentListCommand command = new CatalogComponentListCommand(false, null);
command.execute(controller, ps, null);
String out = os.toString();
assertNotNull(out);
LOG.info("\n\n{}\n", out);
context.stop();
}
开发者ID:HydAu,项目名称:Camel,代码行数:21,代码来源:CatalogCommandTest.java
示例3: testComponentInfo
import org.apache.camel.impl.ExplicitCamelContextNameStrategy; //导入依赖的package包/类
@Test
public void testComponentInfo() throws Exception {
CamelContext context = new DefaultCamelContext();
context.setNameStrategy(new ExplicitCamelContextNameStrategy("foobar"));
context.start();
CamelController controller = new DummyCamelController(context);
OutputStream os = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(os);
CatalogComponentInfoCommand command = new CatalogComponentInfoCommand("hdfs", true, "consumer");
command.execute(controller, ps, null);
String out = os.toString();
assertNotNull(out);
LOG.info("\n\n{}\n", out);
context.stop();
}
开发者ID:HydAu,项目名称:Camel,代码行数:21,代码来源:CatalogCommandTest.java
示例4: setupCamelContext
import org.apache.camel.impl.ExplicitCamelContextNameStrategy; //导入依赖的package包/类
protected void setupCamelContext(final BundleContext bundleContext, final String camelContextId) throws Exception {
// Set up CamelContext
if (camelContextId != null) {
context.setNameStrategy(new ExplicitCamelContextNameStrategy(camelContextId));
}
// TODO: allow to configure these options and not hardcode
context.setUseMDCLogging(true);
context.setUseBreadcrumb(true);
// Add routes
for (RoutesBuilder route : getRouteBuilders()) {
context.addRoutes(configure(context, route, log));
}
// ensure we publish this CamelContext to the OSGi service registry
context.getManagementStrategy().addEventNotifier(new OsgiCamelContextPublisher(bundleContext));
}
开发者ID:HydAu,项目名称:Camel,代码行数:18,代码来源:AbstractCamelRunner.java
示例5: nameStrategy
import org.apache.camel.impl.ExplicitCamelContextNameStrategy; //导入依赖的package包/类
private static CamelContextNameStrategy nameStrategy(Annotated annotated) {
if (annotated.isAnnotationPresent(ContextName.class)) {
return new ExplicitCamelContextNameStrategy(annotated.getAnnotation(ContextName.class).value());
} else if (annotated.isAnnotationPresent(Named.class)) {
// TODO: support stereotype with empty @Named annotation
String name = annotated.getAnnotation(Named.class).value();
if (name.isEmpty()) {
if (annotated instanceof AnnotatedField) {
name = ((AnnotatedField) annotated).getJavaMember().getName();
} else if (annotated instanceof AnnotatedMethod) {
name = ((AnnotatedMethod) annotated).getJavaMember().getName();
if (name.startsWith("get")) {
name = decapitalize(name.substring(3));
}
} else {
name = decapitalize(getRawType(annotated.getBaseType()).getSimpleName());
}
}
return new ExplicitCamelContextNameStrategy(name);
} else {
// Use a specific naming strategy for Camel CDI as the default one increments the suffix for each CDI proxy created
return new CdiCamelContextNameStrategy();
}
}
开发者ID:HydAu,项目名称:Camel,代码行数:25,代码来源:CamelContextProducer.java
示例6: nameStrategy
import org.apache.camel.impl.ExplicitCamelContextNameStrategy; //导入依赖的package包/类
private static CamelContextNameStrategy nameStrategy(Annotated annotated) {
if (annotated.isAnnotationPresent(ContextName.class)) {
return new ExplicitCamelContextNameStrategy(annotated.getAnnotation(ContextName.class).value());
} else if (annotated.isAnnotationPresent(Named.class)) {
// TODO: support stereotype with empty @Named annotation
String name = annotated.getAnnotation(Named.class).value();
if (name.isEmpty()) {
if (annotated instanceof AnnotatedField) {
name = ((AnnotatedField) annotated).getJavaMember().getName();
} else if (annotated instanceof AnnotatedMethod) {
name = ((AnnotatedMethod) annotated).getJavaMember().getName();
if (name.startsWith("get"))
name = decapitalize(name.substring(3));
} else {
name = decapitalize(getRawType(annotated.getBaseType()).getSimpleName());
}
}
return new ExplicitCamelContextNameStrategy(name);
} else {
// Use a specific naming strategy for Camel CDI as the default one increments the suffix for each CDI proxy created
return new CdiCamelContextNameStrategy();
}
}
开发者ID:astefanutti,项目名称:camel-cdi,代码行数:24,代码来源:CamelContextProducer.java
示例7: setup
import org.apache.camel.impl.ExplicitCamelContextNameStrategy; //导入依赖的package包/类
public void setup() throws Exception {
context = new DefaultCamelContext();
context.setNameStrategy(new ExplicitCamelContextNameStrategy("myCamelContextName"));
// Add a simple test route
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start")
.routeId("first-route")
.log(LoggingLevel.INFO, "First Route", "${body}")
.to("mock:result");
from("direct:startOther")
.routeId("other-route")
.log(LoggingLevel.INFO, "Other Route", "${body}")
.to("mock:resultOther");
}
});
}
开发者ID:CamelCookbook,项目名称:camel-cookbook-examples,代码行数:22,代码来源:JmxNamingContextCamelApplication.java
示例8: verifierContext
import org.apache.camel.impl.ExplicitCamelContextNameStrategy; //导入依赖的package包/类
@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
@Bean(name = "verifier-context", initMethod = "start", destroyMethod = "stop")
public static CamelContext verifierContext() {
CamelContext context = new DefaultCamelContext();
context.setNameStrategy(new ExplicitCamelContextNameStrategy("verifier-context"));
context.disableJMX();
return context;
}
开发者ID:syndesisio,项目名称:syndesis,代码行数:10,代码来源:Application.java
示例9: testEndpointStats
import org.apache.camel.impl.ExplicitCamelContextNameStrategy; //导入依赖的package包/类
@Test
public void testEndpointStats() throws Exception {
CamelContext context = new DefaultCamelContext();
context.setNameStrategy(new ExplicitCamelContextNameStrategy("foobar"));
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start").to("mock:result");
}
});
context.start();
context.createProducerTemplate().sendBody("direct:start", "Hello World");
CamelController controller = new DummyCamelController(context);
OutputStream os = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(os);
EndpointStatisticCommand command = new EndpointStatisticCommand("foobar", false, null);
command.execute(controller, ps, null);
String out = os.toString();
assertNotNull(out);
LOG.info("\n\n{}\n", out);
assertTrue(out.contains("direct://start"));
assertTrue(out.contains("mock://result"));
context.stop();
}
开发者ID:HydAu,项目名称:Camel,代码行数:32,代码来源:ContextListCommandTest.java
示例10: startup
import org.apache.camel.impl.ExplicitCamelContextNameStrategy; //导入依赖的package包/类
public void startup() {
try {
camelContext.setTracing(false);
camelContext.setNameStrategy(new ExplicitCamelContextNameStrategy("omakase-camel-context"));
registerInterceptorStrategy();
registerExecutorService();
camelQueueEndpoint.register(camelContext);
registerRoutes();
camelContext.start();
} catch (Exception e) {
LOGGER.error("Failed to start Omakase's Camel Context", e);
}
}
开发者ID:projectomakase,项目名称:omakase,代码行数:14,代码来源:CamelLifecycle.java
示例11: setup
import org.apache.camel.impl.ExplicitCamelContextNameStrategy; //导入依赖的package包/类
public void setup() throws Exception {
context = new DefaultCamelContext();
context.setNameStrategy(new ExplicitCamelContextNameStrategy("myCamelContextName"));
final ManagementStrategy managementStrategy = context.getManagementStrategy();
final ManagementAgent managementAgent = managementStrategy.getManagementAgent();
managementAgent.setMBeanServerDefaultDomain("org.apache.camel");
final ManagementNameStrategy managementNameStrategy = context.getManagementNameStrategy();
managementNameStrategy.setNamePattern("CustomName-#name#");
// Add a simple test route
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start")
.routeId("first-route")
.log(LoggingLevel.INFO, "First Route", "${body}")
.to("mock:result");
from("direct:startOther")
.routeId("other-route")
.log(LoggingLevel.INFO, "Other Route", "${body}")
.to("mock:resultOther");
}
});
}
开发者ID:CamelCookbook,项目名称:camel-cookbook-examples,代码行数:30,代码来源:JmxNamingPatternCamelApplication.java
示例12: route
import org.apache.camel.impl.ExplicitCamelContextNameStrategy; //导入依赖的package包/类
@Override
public RouteBuilder route() {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
getContext().setNameStrategy(new ExplicitCamelContextNameStrategy("javaConfigContext"));
from("direct:start").transform(body().prepend("Hello "));
}
};
}
开发者ID:wildfly-extras,项目名称:wildfly-camel,代码行数:11,代码来源:MyRouteConfiguration.java
示例13: configure
import org.apache.camel.impl.ExplicitCamelContextNameStrategy; //导入依赖的package包/类
@Override
public void configure() throws Exception {
getContext().setNameStrategy(new ExplicitCamelContextNameStrategy("secured-context"));
from("direct:start")
.policy(new DomainAuthorizationPolicy().roles("Role2"))
.transform(body().prepend("Hello "));
}
开发者ID:wildfly-extras,项目名称:wildfly-camel,代码行数:8,代码来源:SecureRouteBuilder.java
示例14: configure
import org.apache.camel.impl.ExplicitCamelContextNameStrategy; //导入依赖的package包/类
@Override
public void configure() throws Exception {
getContext().setNameStrategy(new ExplicitCamelContextNameStrategy("camel-mail-cdi-context"));
from("direct:start").to("smtp://localhost:10025?session=#mailSession");
from("pop3://[email protected]:10110?consumer.delay=30000&session=#mailSession&delete=true").to("mock:result");
}
开发者ID:wildfly-extras,项目名称:wildfly-camel,代码行数:7,代码来源:MailCdiRouteBuilder.java
示例15: configure
import org.apache.camel.impl.ExplicitCamelContextNameStrategy; //导入依赖的package包/类
@Override
public void configure() throws Exception {
getContext().setNameStrategy(new ExplicitCamelContextNameStrategy("camel-sql-cdi-context"));
from("sql:select name from information_schema.users?dataSource=wildFlyExampleDS")
.to("seda:end");
}
开发者ID:wildfly-extras,项目名称:wildfly-camel,代码行数:7,代码来源:CDIRouteBuilder.java
示例16: configure
import org.apache.camel.impl.ExplicitCamelContextNameStrategy; //导入依赖的package包/类
@Override
public void configure() throws Exception {
getContext().setNameStrategy(new ExplicitCamelContextNameStrategy("simple-camel-context"));
from("direct:start").bean("helloBean");
}
开发者ID:wildfly-extras,项目名称:wildfly-camel,代码行数:6,代码来源:SimpleRouteBuilder.java
注:本文中的org.apache.camel.impl.ExplicitCamelContextNameStrategy类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论