Author: davsclaus
Date: Sun Dec 18 07:48:39 2011
New Revision: 1220345
URL: http://svn.apache.org/viewvc?rev=1220345&view=rev
Log:
CAMEL-4790: Polished javadoc to be more clear how to control route lifecycle
from client API.
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/Route.java
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultRoute.java
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/EventDrivenConsumerRoute.java
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/RoutePolicySupport.java
camel/trunk/camel-core/src/main/java/org/apache/camel/spi/RoutePolicy.java
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/Route.java
URL:
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/Route.java?rev=1220345&r1=1220344&r2=1220345&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/Route.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/Route.java Sun Dec 18
07:48:39 2011
@@ -25,6 +25,10 @@ import org.apache.camel.spi.RouteContext
* A <a href="http://camel.apache.org/routes.html">Route</a>
* defines the processing used on an inbound message exchange
* from a specific {@link org.apache.camel.Endpoint} within a {@link
org.apache.camel.CamelContext}
+ * <p/>
+ * Use the API from {@link org.apache.camel.CamelContext} to control the
lifecycle of a route,
+ * such as starting and stopping using the {@link
org.apache.camel.CamelContext#startRoute(String)}
+ * and {@link org.apache.camel.CamelContext#stopRoute(String)} methods.
*/
public interface Route {
@@ -41,16 +45,22 @@ public interface Route {
/**
* Gets the inbound endpoint
+ *
+ * @return the inbound endpoint
*/
Endpoint getEndpoint();
/**
* Gets the inbound {@link Consumer}
+ *
+ * @return the inbound consumer
*/
Consumer getConsumer();
/**
- * Whether or not the route supports suspension
+ * Whether or not the route supports suspension (suspend and resume)
+ *
+ * @return <tt>true</tt> if this route supports suspension
*/
boolean supportsSuspension();
@@ -78,6 +88,8 @@ public interface Route {
/**
* Returns the services for this particular route
+ *
+ * @return the services
*/
List<Service> getServices();
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultRoute.java
URL:
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultRoute.java?rev=1220345&r1=1220344&r2=1220345&view=diff
==============================================================================
---
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultRoute.java
(original)
+++
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultRoute.java
Sun Dec 18 07:48:39 2011
@@ -29,6 +29,10 @@ import org.apache.camel.support.ServiceS
/**
* Default implementation of {@link Route}.
+ * <p/>
+ * Use the API from {@link org.apache.camel.CamelContext} to control the
lifecycle of a route,
+ * such as starting and stopping using the {@link
org.apache.camel.CamelContext#startRoute(String)}
+ * and {@link org.apache.camel.CamelContext#stopRoute(String)} methods.
*
* @version
*/
@@ -85,6 +89,22 @@ public abstract class DefaultRoute exten
}
/**
+ * Do not invoke this method directly, use {@link
org.apache.camel.CamelContext#startRoute(String)} to start a route.
+ */
+ @Override
+ public void start() throws Exception {
+ super.start();
+ }
+
+ /**
+ * Do not invoke this method directly, use {@link
org.apache.camel.CamelContext#stopRoute(String)} to stop a route.
+ */
+ @Override
+ public void stop() throws Exception {
+ super.stop();
+ }
+
+ /**
* Strategy method to allow derived classes to lazily load services for
the route
*/
protected void addServices(List<Service> services) throws Exception {
@@ -98,5 +118,4 @@ public abstract class DefaultRoute exten
// clear services when stopping
services.clear();
}
-
}
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/EventDrivenConsumerRoute.java
URL:
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/EventDrivenConsumerRoute.java?rev=1220345&r1=1220344&r2=1220345&view=diff
==============================================================================
---
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/EventDrivenConsumerRoute.java
(original)
+++
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/EventDrivenConsumerRoute.java
Sun Dec 18 07:48:39 2011
@@ -30,6 +30,10 @@ import org.apache.camel.spi.RouteContext
/**
* A {@link DefaultRoute} which starts with an
* <a href="http://camel.apache.org/event-driven-consumer.html">Event Driven
Consumer</a>
+ * <p/>
+ * Use the API from {@link org.apache.camel.CamelContext} to control the
lifecycle of a route,
+ * such as starting and stopping using the {@link
org.apache.camel.CamelContext#startRoute(String)}
+ * and {@link org.apache.camel.CamelContext#stopRoute(String)} methods.
*
* @version
*/
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/RoutePolicySupport.java
URL:
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/RoutePolicySupport.java?rev=1220345&r1=1220344&r2=1220345&view=diff
==============================================================================
---
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/RoutePolicySupport.java
(original)
+++
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/RoutePolicySupport.java
Sun Dec 18 07:48:39 2011
@@ -35,6 +35,8 @@ import org.slf4j.LoggerFactory;
*/
public abstract class RoutePolicySupport extends ServiceSupport implements
RoutePolicy {
+ // TODO: Move to support package
+
protected final transient Logger log = LoggerFactory.getLogger(getClass());
private ExceptionHandler exceptionHandler;
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/spi/RoutePolicy.java
URL:
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/RoutePolicy.java?rev=1220345&r1=1220344&r2=1220345&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/spi/RoutePolicy.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/spi/RoutePolicy.java
Sun Dec 18 07:48:39 2011
@@ -24,8 +24,11 @@ import org.apache.camel.Route;
* <p/>
* For example using the {@link
org.apache.camel.impl.ThrottlingInflightRoutePolicy} to throttle the {@link
Route}
* at runtime where it suspends and resume the {@link
org.apache.camel.Route#getConsumer()}.
+ * <p/>
+ * See also {@link Route} class javadoc about controlling the lifecycle of a
{@link Route}
*
- * @version
+ * @version
+ * @see Route
*/
public interface RoutePolicy {