Java 类org.apache.camel.spi.ManagementNameStrategy 实例源码

项目:Camel    文件:DefaultManagementLifecycleStrategy.java   
private String findFreeName(Object mc, ManagementNameStrategy strategy, String name) throws MalformedObjectNameException {
    // we cannot find a free name for fixed named strategies
    if (strategy.isFixedName()) {
        return null;
    }

    // okay try to find a free name
    boolean done = false;
    String newName = null;
    while (!done) {
        // compute the next name
        newName = strategy.getNextName();
        ObjectName on = getManagementStrategy().getManagementNamingStrategy().getObjectNameForCamelContext(newName, name);
        done = !getManagementStrategy().isManaged(mc, on);
        if (LOG.isTraceEnabled()) {
            LOG.trace("Using name: {} in ObjectName[{}] exists? {}", new Object[]{name, on, done});
        }
    }
    return newName;
}
项目:camel-cookbook-examples    文件:JmxNamingPatternCamelApplication.java   
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");
        }
    });
}
项目:Camel    文件:DefaultCamelContext.java   
public ManagementNameStrategy getManagementNameStrategy() {
    return managementNameStrategy;
}
项目:Camel    文件:DefaultCamelContext.java   
public void setManagementNameStrategy(ManagementNameStrategy managementNameStrategy) {
    this.managementNameStrategy = managementNameStrategy;
}
项目:microservice-bundle    文件:ManagedCamelContext.java   
@Override
public ManagementNameStrategy getManagementNameStrategy() {
  return context.getManagementNameStrategy();
}
项目:microservice-bundle    文件:ManagedCamelContext.java   
@Override
public void setManagementNameStrategy(ManagementNameStrategy nameStrategy) {
  context.setManagementNameStrategy(nameStrategy);
}
项目:dropwizard-camel    文件:ManagedCamelContext.java   
@Override
public ManagementNameStrategy getManagementNameStrategy() {
    return context.getManagementNameStrategy();
}
项目:dropwizard-camel    文件:ManagedCamelContext.java   
@Override
public void setManagementNameStrategy(ManagementNameStrategy nameStrategy) {
    context.setManagementNameStrategy(nameStrategy);
}
项目:Camel    文件:CamelContext.java   
/**
 * Gets the current management name strategy
 *
 * @return management name strategy
 */
ManagementNameStrategy getManagementNameStrategy();
项目:Camel    文件:CamelContext.java   
/**
 * Sets a custom management name strategy
 *
 * @param nameStrategy name strategy
 */
void setManagementNameStrategy(ManagementNameStrategy nameStrategy);