You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2009/09/08 13:03:41 UTC

svn commit: r812460 - in /camel/trunk: camel-core/src/main/java/org/apache/camel/builder/ camel-core/src/main/java/org/apache/camel/management/ components/camel-spring/src/main/java/org/apache/camel/spring/spi/

Author: davsclaus
Date: Tue Sep  8 11:03:40 2009
New Revision: 812460

URL: http://svn.apache.org/viewvc?rev=812460&view=rev
Log:
CAMEL-1996: Managed error handler for transacted error handlers also works now.

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ErrorHandlerBuilderRef.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java
    camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringTransactionPolicy.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ErrorHandlerBuilderRef.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ErrorHandlerBuilderRef.java?rev=812460&r1=812459&r2=812460&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ErrorHandlerBuilderRef.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ErrorHandlerBuilderRef.java Tue Sep  8 11:03:40 2009
@@ -101,6 +101,19 @@
         return answer;
     }
 
+    /**
+     * Returns whether a specific error handler builder has been configured or not.
+     * <p/>
+     * Can be used to test if none has been configured and then install a custom error handler builder
+     * replacing the default error handler (that would have been used as fallback otherwise).
+     * <br/>
+     * This is for instance used by the transacted policy to setup a TransactedErrorHandlerBuilder
+     * in camel-spring.
+     */
+    public static boolean isErrorHandlerBuilderConfigured(String ref) {
+        return !DEFAULT_ERROR_HANDLER_BUILDER.equals(ref);
+    }
+
     public String getRef() {
         return ref;
     }
@@ -123,19 +136,6 @@
         return handler;
     }
 
-    /**
-     * Returns whether a specific error handler builder has been configured or not.
-     * <p/>
-     * Can be used to test if none has been configured and then install a custom error handler builder
-     * replacing the default error handler (that would have been used as fallback otherwise).
-     * <br/>
-     * This is for instance used by the transacted policy to setup a TransactedErrorHandlerBuilder
-     * in camel-spring.
-     */
-    private static boolean isErrorHandlerBuilderConfigured(String ref) {
-        return !DEFAULT_ERROR_HANDLER_BUILDER.equals(ref);
-    }
-
     @Override
     public String toString() {
         return "ErrorHandlerBuilderRef[" + ref + "]";

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java?rev=812460&r1=812459&r2=812460&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java Tue Sep  8 11:03:40 2009
@@ -54,9 +54,11 @@
 import org.apache.camel.model.InterceptDefinition;
 import org.apache.camel.model.OnCompletionDefinition;
 import org.apache.camel.model.OnExceptionDefinition;
+import org.apache.camel.model.PolicyDefinition;
 import org.apache.camel.model.ProcessorDefinition;
 import org.apache.camel.model.RouteDefinition;
 import org.apache.camel.processor.Delayer;
+import org.apache.camel.processor.ErrorHandler;
 import org.apache.camel.processor.SendProcessor;
 import org.apache.camel.processor.Throttler;
 import org.apache.camel.processor.interceptor.Tracer;
@@ -308,6 +310,10 @@
 
     private Object createManagedObjectForProcessor(CamelContext context, Processor processor,
                                                    ProcessorDefinition definition, Route route) {
+        // skip error handlers
+        if (processor instanceof ErrorHandler) {
+            return false;
+        }
 
         ManagedProcessor answer = null;
         if (processor instanceof Delayer) {
@@ -469,6 +475,10 @@
         if (processor instanceof AOPDefinition) {
             return false;
         }
+        // skip policy
+        if (processor instanceof PolicyDefinition) {
+            return false;
+        }
 
         // only if custom id assigned
         if (getStrategy().isOnlyManageProcessorWithCustomId()) {

Modified: camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringTransactionPolicy.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringTransactionPolicy.java?rev=812460&r1=812459&r2=812460&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringTransactionPolicy.java (original)
+++ camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringTransactionPolicy.java Tue Sep  8 11:03:40 2009
@@ -72,7 +72,7 @@
             // only lookup if there was explicit an error handler builder configured
             // otherwise its just the "default" that has not explicit been configured
             // and if so then we can safely replace that with our transacted error handler
-            if (ErrorHandlerBuilderRef.isErrorHandlerBuilderConfigued(ref)) {
+            if (ErrorHandlerBuilderRef.isErrorHandlerBuilderConfigured(ref)) {
                 if (LOG.isDebugEnabled()) {
                     LOG.debug("Looking up ErrorHandlerBuilder with ref: " + ref);
                 }