You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by js...@apache.org on 2007/03/21 17:38:25 UTC
svn commit: r520942 -
/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java
Author: jstrachan
Date: Wed Mar 21 09:38:24 2007
New Revision: 520942
URL: http://svn.apache.org/viewvc?view=rev&rev=520942
Log:
added a helper method for easy addition of custom interceptors
Modified:
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java?view=diff&rev=520942&r1=520941&r2=520942
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java Wed Mar 21 09:38:24 2007
@@ -56,9 +56,9 @@
* Resolves the given URI to an endpoint
*/
public Endpoint<E> endpoint(String uri) {
- CamelContext<E> c = getContext();
- EndpointResolver<E> er = c.getEndpointResolver();
- return er.resolveEndpoint(c, uri);
+ CamelContext<E> c = getContext();
+ EndpointResolver<E> er = c.getEndpointResolver();
+ return er.resolveEndpoint(c, uri);
}
public FromBuilder<E> from(String uri) {
@@ -73,6 +73,7 @@
/**
* Installs the given error handler builder
+ *
* @param errorHandlerBuilder the error handler to be used by default for all child routes
* @return the current builder with the error handler configured
*/
@@ -92,7 +93,6 @@
return context;
}
-
/**
* Returns the routing map from inbound endpoints to processors
*/
@@ -109,7 +109,6 @@
return fromBuilders;
}
-
// Implementation methods
//-----------------------------------------------------------------------
protected void checkInitialized() {
@@ -120,14 +119,26 @@
}
protected void populateRouteMap(Map<Endpoint<E>, Processor<E>> routeMap) {
- for (FromBuilder<E> fromBuilder : fromBuilders) {
- Endpoint<E> from = fromBuilder.getFrom();
- Processor<E> processor = fromBuilder.createProcessor();
+ for (FromBuilder<E> builder : fromBuilders) {
+ Endpoint<E> from = builder.getFrom();
+ Processor<E> processor = makeProcessor(from, builder);
if (processor == null) {
- throw new IllegalArgumentException("No processor created for DestinationBuilder: " + fromBuilder);
+ throw new IllegalArgumentException("No processor created for DestinationBuilder: " + builder);
}
routeMap.put(from, processor);
}
+ }
+
+ /**
+ * Factory method to create the underlying {@link Processor} for the given builder applying any
+ * necessary interceptors.
+ *
+ * @param from the endpoint which starts the route
+ * @param builder the builder which is the factory of the processor
+ * @return
+ */
+ protected Processor<E> makeProcessor(Endpoint<E> from, FromBuilder<E> builder) {
+ return builder.createProcessor();
}
protected CamelContext<E> createContainer() {