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

项目:Camel    文件:AbstractLocalCamelController.java   
public List<Map<String, String>> getRestServices(String camelContextName) throws Exception {
    List<Map<String, String>> answer = new ArrayList<Map<String, String>>();

    if (camelContextName != null) {
        CamelContext context = this.getLocalCamelContext(camelContextName);
        if (context != null) {
            List<RestRegistry.RestService> services = new ArrayList<RestRegistry.RestService>(context.getRestRegistry().listAllRestServices());
            Collections.sort(services, new Comparator<RestRegistry.RestService>() {
                @Override
                public int compare(RestRegistry.RestService o1, RestRegistry.RestService o2) {
                    return o1.getUrl().compareTo(o2.getUrl());
                }
            });
            for (RestRegistry.RestService service : services) {
                Map<String, String> row = new LinkedHashMap<String, String>();
                row.put("basePath", service.getBasePath());
                row.put("baseUrl", service.getBaseUrl());
                row.put("consumes", service.getConsumes());
                row.put("description", service.getDescription());
                row.put("inType", service.getInType());
                row.put("method", service.getMethod());
                row.put("outType", service.getOutType());
                row.put("produces", service.getProduces());
                row.put("routeId", service.getRouteId());
                row.put("state", service.getState());
                row.put("uriTemplate", service.getUriTemplate());
                row.put("url", service.getUrl());
                answer.add(row);
            }
        }
    }
    return answer;
}
项目:Camel    文件:ManagedRestRegistry.java   
@Override
public TabularData listRestServices() {
    try {
        TabularData answer = new TabularDataSupport(CamelOpenMBeanTypes.listRestServicesTabularType());
        List<RestRegistry.RestService> services = registry.listAllRestServices();
        for (RestRegistry.RestService entry : services) {
            CompositeType ct = CamelOpenMBeanTypes.listRestServicesCompositeType();
            String url = entry.getUrl();
            String baseUrl = entry.getBaseUrl();
            String basePath = entry.getBasePath();
            String uriTemplate = entry.getUriTemplate();
            String method = entry.getMethod();
            String consumes = entry.getConsumes();
            String produces = entry.getProduces();
            String state = entry.getState();
            String inType = entry.getInType();
            String outType = entry.getOutType();
            String routeId = entry.getRouteId();
            String description = entry.getDescription();

            CompositeData data = new CompositeDataSupport(ct, new String[]
            {"url", "baseUrl", "basePath", "uriTemplate", "method", "consumes", "produces", "inType", "outType", "state", "routeId", "description"},
                    new Object[]{url, baseUrl, basePath, uriTemplate, method, consumes, produces, inType, outType, state, routeId, description});
            answer.put(data);
        }
        return answer;
    } catch (Exception e) {
        throw ObjectHelper.wrapRuntimeCamelException(e);
    }
}
项目:Camel    文件:ManagedRestRegistry.java   
public ManagedRestRegistry(CamelContext context, RestRegistry registry) {
    super(context, registry);
    this.registry = registry;
}
项目:Camel    文件:ManagedRestRegistry.java   
public RestRegistry getRegistry() {
    return registry;
}
项目:Camel    文件:DefaultRestRegistry.java   
@Override
public List<RestRegistry.RestService> listAllRestServices() {
    return new ArrayList<RestService>(registry.values());
}
项目:Camel    文件:DefaultCamelContext.java   
public RestRegistry getRestRegistry() {
    return restRegistry;
}
项目:Camel    文件:DefaultCamelContext.java   
public void setRestRegistry(RestRegistry restRegistry) {
    this.restRegistry = restRegistry;
}
项目:microservice-bundle    文件:ManagedCamelContext.java   
@Override
public RestRegistry getRestRegistry() {
  return context.getRestRegistry();
}
项目:microservice-bundle    文件:ManagedCamelContext.java   
@Override
public void setRestRegistry(RestRegistry restRegistry) {
  context.setRestRegistry(restRegistry);
}
项目:dropwizard-camel    文件:ManagedCamelContext.java   
@Override
public RestRegistry getRestRegistry() {
    return context.getRestRegistry();
}
项目:dropwizard-camel    文件:ManagedCamelContext.java   
@Override
public void setRestRegistry(RestRegistry restRegistry) {
    context.setRestRegistry(restRegistry);
}
项目:Camel    文件:CamelContext.java   
/**
 * Gets the {@link org.apache.camel.spi.RestRegistry} to use
 */
RestRegistry getRestRegistry();
项目:Camel    文件:CamelContext.java   
/**
 * Sets a custom {@link org.apache.camel.spi.RestRegistry} to use.
 */
void setRestRegistry(RestRegistry restRegistry);