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; }
@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); } }
public ManagedRestRegistry(CamelContext context, RestRegistry registry) { super(context, registry); this.registry = registry; }
public RestRegistry getRegistry() { return registry; }
@Override public List<RestRegistry.RestService> listAllRestServices() { return new ArrayList<RestService>(registry.values()); }
public RestRegistry getRestRegistry() { return restRegistry; }
public void setRestRegistry(RestRegistry restRegistry) { this.restRegistry = restRegistry; }
@Override public RestRegistry getRestRegistry() { return context.getRestRegistry(); }
@Override public void setRestRegistry(RestRegistry restRegistry) { context.setRestRegistry(restRegistry); }
/** * Gets the {@link org.apache.camel.spi.RestRegistry} to use */ RestRegistry getRestRegistry();
/** * Sets a custom {@link org.apache.camel.spi.RestRegistry} to use. */ void setRestRegistry(RestRegistry restRegistry);