activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r520942 - /activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java
Date Wed, 21 Mar 2007 16:38:25 GMT
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() {



Mime
View raw message