CAMEL-11580: Add JMX api RouteController and SupervisingRouteController

Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/43ca1388
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/43ca1388
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/43ca1388

Branch: refs/heads/master
Commit: 43ca138867997d4997dadd30db080aef7bc9ef2d
Parents: 2b832e9
Author: lburgazzoli <lburgazz...@gmail.com>
Authored: Mon Aug 7 17:08:44 2017 +0200
Committer: lburgazzoli <lburgazz...@gmail.com>
Committed: Tue Aug 8 13:29:29 2017 +0200

----------------------------------------------------------------------
 .../mbean/ManagedRouteControllerMBean.java      | 27 +++++++
 .../DefaultManagementLifecycleStrategy.java     | 22 ++++++
 .../DefaultManagementNamingStrategy.java        | 18 +++++
 .../DefaultManagementObjectStrategy.java        |  7 ++
 .../management/ManagedManagementStrategy.java   |  4 +
 .../mbean/ManagedRouteController.java           | 57 ++++++++++++++
 .../camel/spi/ManagementNamingStrategy.java     |  2 +
 .../camel/spi/ManagementObjectStrategy.java     |  2 +
 .../endpoint/CamelRouteControllerEndpoint.java  | 60 +++++++++++++++
 ...outeControllerEndpointAutoConfiguration.java | 49 ++++++++++++
 .../CamelRouteControllerMvcEndpoint.java        | 79 ++++++++++++++++++++
 .../main/resources/META-INF/spring.factories    |  1 +
 12 files changed, 328 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/43ca1388/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedRouteControllerMBean.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedRouteControllerMBean.java
 
b/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedRouteControllerMBean.java
new file mode 100644
index 0000000..4422ed8
--- /dev/null
+++ 
b/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedRouteControllerMBean.java
@@ -0,0 +1,27 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.api.management.mbean;
+
+import java.util.Collection;
+
+import org.apache.camel.api.management.ManagedAttribute;
+
+public interface ManagedRouteControllerMBean {
+
+    @ManagedAttribute(description = "Controlled Routes")
+    Collection<String> getControlledRoutes();
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/43ca1388/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java
 
b/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java
index 9a70390..3cf6f09 100644
--- 
a/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java
+++ 
b/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java
@@ -219,6 +219,17 @@ public class DefaultManagementLifecycleStrategy extends 
ServiceSupport implement
 
         // register any pre registered now that we are initialized
         enlistPreRegisteredServices();
+
+        try {
+            Object me = 
getManagementObjectStrategy().getManagedObjectForRouteController(camelContext);
+            if (me == null) {
+                // endpoint should not be managed
+                return;
+            }
+            manageObject(me);
+        } catch (Exception e) {
+            LOG.warn("Could not register RouteController MBean. This exception 
will be ignored.", e);
+        }
     }
 
     private String findFreeName(Object mc, ManagementNameStrategy strategy, 
String name) throws MalformedObjectNameException {
@@ -276,6 +287,17 @@ public class DefaultManagementLifecycleStrategy extends 
ServiceSupport implement
         if (!initialized) {
             return;
         }
+
+        try {
+            Object mc = 
getManagementObjectStrategy().getManagedObjectForRouteController(context);
+            // the context could have been removed already
+            if (getManagementStrategy().isManaged(mc, null)) {
+                unmanageObject(mc);
+            }
+        } catch (Exception e) {
+            LOG.warn("Could not unregister RouteController MBean", e);
+        }
+
         try {
             Object mc = 
getManagementObjectStrategy().getManagedObjectForCamelContext(context);
             // the context could have been removed already

http://git-wip-us.apache.org/repos/asf/camel/blob/43ca1388/camel-core/src/main/java/org/apache/camel/management/DefaultManagementNamingStrategy.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/main/java/org/apache/camel/management/DefaultManagementNamingStrategy.java
 
b/camel-core/src/main/java/org/apache/camel/management/DefaultManagementNamingStrategy.java
index 56b85c8..341b9e9 100644
--- 
a/camel-core/src/main/java/org/apache/camel/management/DefaultManagementNamingStrategy.java
+++ 
b/camel-core/src/main/java/org/apache/camel/management/DefaultManagementNamingStrategy.java
@@ -52,6 +52,7 @@ public class DefaultManagementNamingStrategy implements 
ManagementNamingStrategy
     public static final String KEY_TYPE = "type";
     public static final String KEY_CONTEXT = "context";
     public static final String TYPE_CONTEXT = "context";
+    public static final String TYPE_ROUTE_CONTROLLER= "routecontroller";
     public static final String TYPE_ENDPOINT = "endpoints";
     public static final String TYPE_DATAFORMAT = "dataformats";
     public static final String TYPE_PROCESSOR = "processors";
@@ -112,6 +113,23 @@ public class DefaultManagementNamingStrategy implements 
ManagementNamingStrategy
         return getObjectNameForCamelContext(managementName, name);
     }
 
+    @Override
+    public ObjectName getObjectNameForRouteController(CamelContext context) 
throws MalformedObjectNameException {
+        // prefer to use the given management name if previously assigned
+        String managementName = context.getManagementName();
+        if (managementName == null) {
+            managementName = context.getManagementNameStrategy().getName();
+        }
+
+        StringBuilder buffer = new StringBuilder();
+        buffer.append(domainName).append(":");
+        buffer.append(KEY_CONTEXT + 
"=").append(getContextId(managementName)).append(",");
+        buffer.append(KEY_TYPE + "=" + TYPE_ROUTE_CONTROLLER + ",");
+        buffer.append(KEY_NAME + 
"=").append(ObjectName.quote(context.getName()));
+
+        return createObjectName(buffer);
+    }
+
     public ObjectName getObjectNameForEndpoint(Endpoint endpoint) throws 
MalformedObjectNameException {
         StringBuilder buffer = new StringBuilder();
         buffer.append(domainName).append(":");

http://git-wip-us.apache.org/repos/asf/camel/blob/43ca1388/camel-core/src/main/java/org/apache/camel/management/DefaultManagementObjectStrategy.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/main/java/org/apache/camel/management/DefaultManagementObjectStrategy.java
 
b/camel-core/src/main/java/org/apache/camel/management/DefaultManagementObjectStrategy.java
index c53cffb..8e785f2 100644
--- 
a/camel-core/src/main/java/org/apache/camel/management/DefaultManagementObjectStrategy.java
+++ 
b/camel-core/src/main/java/org/apache/camel/management/DefaultManagementObjectStrategy.java
@@ -70,6 +70,7 @@ import org.apache.camel.management.mbean.ManagedResequencer;
 import org.apache.camel.management.mbean.ManagedRollback;
 import org.apache.camel.management.mbean.ManagedRoundRobinLoadBalancer;
 import org.apache.camel.management.mbean.ManagedRoute;
+import org.apache.camel.management.mbean.ManagedRouteController;
 import org.apache.camel.management.mbean.ManagedRoutingSlip;
 import org.apache.camel.management.mbean.ManagedSamplingThrottler;
 import org.apache.camel.management.mbean.ManagedScheduledPollConsumer;
@@ -220,6 +221,12 @@ public class DefaultManagementObjectStrategy implements 
ManagementObjectStrategy
         return me;
     }
 
+    public Object getManagedObjectForRouteController(CamelContext context) {
+        ManagedRouteController mrc = new 
ManagedRouteController((ModelCamelContext)context);
+        mrc.init(context.getManagementStrategy());
+        return mrc;
+    }
+
     public Object getManagedObjectForRoute(CamelContext context, Route route) {
         ManagedRoute mr;
         if (route.supportsSuspension()) {

http://git-wip-us.apache.org/repos/asf/camel/blob/43ca1388/camel-core/src/main/java/org/apache/camel/management/ManagedManagementStrategy.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/main/java/org/apache/camel/management/ManagedManagementStrategy.java
 
b/camel-core/src/main/java/org/apache/camel/management/ManagedManagementStrategy.java
index 58a6982..5754a50 100644
--- 
a/camel-core/src/main/java/org/apache/camel/management/ManagedManagementStrategy.java
+++ 
b/camel-core/src/main/java/org/apache/camel/management/ManagedManagementStrategy.java
@@ -32,6 +32,7 @@ import org.apache.camel.management.mbean.ManagedEventNotifier;
 import org.apache.camel.management.mbean.ManagedProcessor;
 import org.apache.camel.management.mbean.ManagedProducer;
 import org.apache.camel.management.mbean.ManagedRoute;
+import org.apache.camel.management.mbean.ManagedRouteController;
 import org.apache.camel.management.mbean.ManagedService;
 import org.apache.camel.management.mbean.ManagedThreadPool;
 import org.apache.camel.management.mbean.ManagedTracer;
@@ -89,6 +90,9 @@ public class ManagedManagementStrategy extends 
DefaultManagementStrategy {
         if (managedObject instanceof ManagedCamelContext) {
             ManagedCamelContext mcc = (ManagedCamelContext) managedObject;
             objectName = 
getManagementNamingStrategy().getObjectNameForCamelContext(mcc.getContext());
+        } else if (managedObject instanceof ManagedRouteController) {
+            ManagedRouteController mrc = (ManagedRouteController) 
managedObject;
+            objectName = 
getManagementNamingStrategy().getObjectNameForRouteController(mrc.getContext());
         } else if (managedObject instanceof ManagedComponent) {
             ManagedComponent mc = (ManagedComponent) managedObject;
             objectName = 
getManagementNamingStrategy().getObjectNameForComponent(mc.getComponent(), 
mc.getComponentName());

http://git-wip-us.apache.org/repos/asf/camel/blob/43ca1388/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedRouteController.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedRouteController.java
 
b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedRouteController.java
new file mode 100644
index 0000000..936f54c
--- /dev/null
+++ 
b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedRouteController.java
@@ -0,0 +1,57 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.management.mbean;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.stream.Collectors;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Route;
+import org.apache.camel.api.management.mbean.ManagedRouteControllerMBean;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.spi.ManagementStrategy;
+import org.apache.camel.spi.RouteController;
+
+public class ManagedRouteController implements ManagedRouteControllerMBean {
+    private final ModelCamelContext context;
+
+    public ManagedRouteController(ModelCamelContext context) {
+        this.context = context;
+    }
+
+    public void init(ManagementStrategy strategy) {
+        // do nothing
+    }
+
+    public CamelContext getContext() {
+        return context;
+    }
+
+    @Override
+    public Collection<String> getControlledRoutes() {
+        RouteController controller = context.getRouteController();
+
+        if (controller != null) {
+            return controller.getControlledRoutes().stream()
+                .map(Route::getId)
+                .collect(Collectors.toList());
+        }
+
+        return Collections.emptyList();
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/43ca1388/camel-core/src/main/java/org/apache/camel/spi/ManagementNamingStrategy.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/main/java/org/apache/camel/spi/ManagementNamingStrategy.java 
b/camel-core/src/main/java/org/apache/camel/spi/ManagementNamingStrategy.java
index f363567..72bb00a 100644
--- 
a/camel-core/src/main/java/org/apache/camel/spi/ManagementNamingStrategy.java
+++ 
b/camel-core/src/main/java/org/apache/camel/spi/ManagementNamingStrategy.java
@@ -44,6 +44,8 @@ public interface ManagementNamingStrategy {
 
     ObjectName getObjectNameForCamelContext(CamelContext context) throws 
MalformedObjectNameException;
 
+    ObjectName getObjectNameForRouteController(CamelContext context) throws 
MalformedObjectNameException;
+
     ObjectName getObjectNameForComponent(Component component, String name) 
throws MalformedObjectNameException;
 
     ObjectName getObjectNameForEndpoint(Endpoint endpoint) throws 
MalformedObjectNameException;

http://git-wip-us.apache.org/repos/asf/camel/blob/43ca1388/camel-core/src/main/java/org/apache/camel/spi/ManagementObjectStrategy.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/main/java/org/apache/camel/spi/ManagementObjectStrategy.java 
b/camel-core/src/main/java/org/apache/camel/spi/ManagementObjectStrategy.java
index b6acc7f..a11b2b1 100644
--- 
a/camel-core/src/main/java/org/apache/camel/spi/ManagementObjectStrategy.java
+++ 
b/camel-core/src/main/java/org/apache/camel/spi/ManagementObjectStrategy.java
@@ -45,6 +45,8 @@ public interface ManagementObjectStrategy {
     Object getManagedObjectForErrorHandler(CamelContext context, RouteContext 
routeContext,
                                            Processor errorHandler, 
ErrorHandlerFactory errorHandlerBuilder);
 
+    Object getManagedObjectForRouteController(CamelContext context);
+
     Object getManagedObjectForRoute(CamelContext context, Route route);
 
     Object getManagedObjectForConsumer(CamelContext context, Consumer 
consumer);

http://git-wip-us.apache.org/repos/asf/camel/blob/43ca1388/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/endpoint/CamelRouteControllerEndpoint.java
----------------------------------------------------------------------
diff --git 
a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/endpoint/CamelRouteControllerEndpoint.java
 
b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/endpoint/CamelRouteControllerEndpoint.java
new file mode 100644
index 0000000..357a8d0
--- /dev/null
+++ 
b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/endpoint/CamelRouteControllerEndpoint.java
@@ -0,0 +1,60 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.spring.boot.actuate.endpoint;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Route;
+import org.apache.camel.spi.RouteController;
+import org.springframework.boot.actuate.endpoint.AbstractEndpoint;
+import org.springframework.boot.actuate.endpoint.Endpoint;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * {@link Endpoint} to expose {@link RouteController} information.
+ */
+@ConfigurationProperties(prefix = "endpoints." + 
CamelRouteControllerEndpoint.ENDPOINT_ID)
+public class CamelRouteControllerEndpoint extends 
AbstractEndpoint<List<String>> {
+
+    public static final String ENDPOINT_ID = "camelroutecontroller";
+
+    private CamelContext camelContext;
+
+    public CamelRouteControllerEndpoint(CamelContext camelContext) {
+        super(ENDPOINT_ID);
+        this.camelContext = camelContext;
+        // is enabled by default
+        this.setEnabled(true);
+    }
+
+    @Override
+    public List<String> invoke() {
+        RouteController controller = camelContext.getRouteController();
+
+        if (controller != null) {
+            return controller.getControlledRoutes().stream()
+                .map(Route::getId)
+                .collect(Collectors.toList());
+        }
+
+        return Collections.emptyList();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/43ca1388/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/endpoint/CamelRouteControllerEndpointAutoConfiguration.java
----------------------------------------------------------------------
diff --git 
a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/endpoint/CamelRouteControllerEndpointAutoConfiguration.java
 
b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/endpoint/CamelRouteControllerEndpointAutoConfiguration.java
new file mode 100644
index 0000000..2c09427
--- /dev/null
+++ 
b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/endpoint/CamelRouteControllerEndpointAutoConfiguration.java
@@ -0,0 +1,49 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.spring.boot.actuate.endpoint;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.springframework.boot.autoconfigure.AutoConfigureAfter;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
+import 
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * Auto configuration for the {@link CamelRouteControllerEndpoint}.
+ */
+@Configuration
+@ConditionalOnClass({CamelRouteControllerEndpoint.class})
+@ConditionalOnBean(CamelAutoConfiguration.class)
+@AutoConfigureAfter(CamelAutoConfiguration.class)
+public class CamelRouteControllerEndpointAutoConfiguration {
+    @Bean
+    @ConditionalOnClass(CamelContext.class)
+    @ConditionalOnMissingBean
+    public CamelRouteControllerEndpoint routeControllerEndpoint(CamelContext 
camelContext) {
+        return new CamelRouteControllerEndpoint(camelContext);
+    }
+
+    @Bean
+    @ConditionalOnClass(CamelContext.class)
+    @ConditionalOnMissingBean
+    public CamelRouteControllerMvcEndpoint 
routeControllerMvcEndpoint(CamelRouteControllerEndpoint delegate) {
+        return new CamelRouteControllerMvcEndpoint(delegate);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/43ca1388/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/endpoint/CamelRouteControllerMvcEndpoint.java
----------------------------------------------------------------------
diff --git 
a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/endpoint/CamelRouteControllerMvcEndpoint.java
 
b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/endpoint/CamelRouteControllerMvcEndpoint.java
new file mode 100644
index 0000000..cbde49e
--- /dev/null
+++ 
b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/endpoint/CamelRouteControllerMvcEndpoint.java
@@ -0,0 +1,79 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.spring.boot.actuate.endpoint;
+
+import java.util.function.Supplier;
+
+import org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter;
+import org.springframework.boot.actuate.endpoint.mvc.MvcEndpoint;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.bind.annotation.ResponseStatus;
+
+/**
+ * Adapter to expose {@link CamelRouteControllerEndpoint} as an {@link 
MvcEndpoint}.
+ */
+@ConfigurationProperties(prefix = "endpoints." + 
CamelRouteControllerEndpoint.ENDPOINT_ID)
+public class CamelRouteControllerMvcEndpoint extends EndpointMvcAdapter {
+
+    /**
+     * Default path
+     */
+    public static final String PATH = "/camel/route-controller";
+
+    private final CamelRouteControllerEndpoint delegate;
+
+    public CamelRouteControllerMvcEndpoint(CamelRouteControllerEndpoint 
delegate) {
+        super(delegate);
+
+        this.setPath(PATH);
+        this.delegate = delegate;
+    }
+
+    // ********************************************
+    // Endpoints
+    // ********************************************
+
+    // ********************************************
+    // Helpers
+    // ********************************************
+
+    private Object doIfEnabled(Supplier<Object> supplier) {
+        if (!delegate.isEnabled()) {
+            return getDisabledResponse();
+        }
+
+        return supplier.get();
+    }
+
+    @SuppressWarnings("serial")
+    @ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
+    public static class GenericException extends RuntimeException {
+        public GenericException(String message, Throwable cause) {
+            super(message, cause);
+
+        }
+    }
+
+    @SuppressWarnings("serial")
+    @ResponseStatus(value = HttpStatus.NOT_FOUND, reason = "No such route")
+    public static class NoSuchRouteException extends RuntimeException {
+        public NoSuchRouteException(String message) {
+            super(message);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/43ca1388/components/camel-spring-boot/src/main/resources/META-INF/spring.factories
----------------------------------------------------------------------
diff --git 
a/components/camel-spring-boot/src/main/resources/META-INF/spring.factories 
b/components/camel-spring-boot/src/main/resources/META-INF/spring.factories
index 8550060..ac8c58e 100644
--- a/components/camel-spring-boot/src/main/resources/META-INF/spring.factories
+++ b/components/camel-spring-boot/src/main/resources/META-INF/spring.factories
@@ -19,6 +19,7 @@ 
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
 org.apache.camel.spring.boot.CamelAutoConfiguration,\
 org.apache.camel.spring.boot.SupervisingRouteControllerAutoConfiguration,\
 
org.apache.camel.spring.boot.actuate.endpoint.CamelRoutesEndpointAutoConfiguration,\
+org.apache.camel.spring.boot.actuate.endpoint.CamelRouteControllerEndpointAutoConfiguration,\
 org.apache.camel.spring.boot.actuate.health.CamelHealthAutoConfiguration,\
 org.apache.camel.spring.boot.cloud.CamelCloudAutoConfiguration,\
 
org.apache.camel.spring.boot.cloud.CamelCloudServiceCallConfigurationAutoConfiguration,\

Reply via email to