camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r719343 - in /activemq/camel/branches/camel-1.x: ./ camel-core/src/main/java/org/apache/camel/model/ camel-core/src/main/java/org/apache/camel/processor/ camel-core/src/test/java/org/apache/camel/processor/
Date Thu, 20 Nov 2008 19:48:50 GMT
Author: davsclaus
Date: Thu Nov 20 11:48:50 2008
New Revision: 719343

URL: http://svn.apache.org/viewvc?rev=719343&view=rev
Log:
Merged revisions 719334 via svnmerge from 
https://svn.apache.org/repos/asf/activemq/camel/trunk

........
  r719334 | davsclaus | 2008-11-20 20:35:33 +0100 (to, 20 nov 2008) | 1 line
  
  CAMEL-1105: RedeliveryPolicyType added ref attribute to support lookup in registry so you
can reuse redelivery policy settings and if using spring DSL you can use standard spring beans
using property placeholders.
........

Modified:
    activemq/camel/branches/camel-1.x/   (props changed)
    activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/ExceptionType.java
    activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/RedeliveryPolicyType.java
    activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/processor/DeadLetterChannel.java
    activemq/camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/processor/ThroughPutLoggerTest.java

Propchange: activemq/camel/branches/camel-1.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Nov 20 11:48:50 2008
@@ -1 +1 @@
-/activemq/camel/trunk:709850,711200,711206,711219-711220,711523,711531,711756,711784,711859,711874,711962,711971,712064,712119,712148,712662,712692,712925,713013,713107,713136,713273,713290,713292,713295,713314,713475,713625,713932,713944,714032,717965,717989,718242,718273,718312-718515,719163-719184
+/activemq/camel/trunk:709850,711200,711206,711219-711220,711523,711531,711756,711784,711859,711874,711962,711971,712064,712119,712148,712662,712692,712925,713013,713107,713136,713273,713290,713292,713295,713314,713475,713625,713932,713944,714032,717965,717989,718242,718273,718312-718515,719163-719184,719334

Propchange: activemq/camel/branches/camel-1.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/ExceptionType.java
URL: http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/ExceptionType.java?rev=719343&r1=719342&r2=719343&view=diff
==============================================================================
--- activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/ExceptionType.java
(original)
+++ activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/ExceptionType.java
Thu Nov 20 11:48:50 2008
@@ -31,6 +31,7 @@
 import org.apache.camel.Predicate;
 import org.apache.camel.Processor;
 import org.apache.camel.Route;
+import org.apache.camel.CamelContext;
 import org.apache.camel.builder.ErrorHandlerBuilder;
 import org.apache.camel.language.constant.ConstantLanguage;
 import org.apache.camel.processor.CatchProcessor;
@@ -92,13 +93,14 @@
     
     /**
      * Allows an exception handler to create a new redelivery policy for this exception type
+     * @param context the camel context
      * @param parentPolicy the current redelivery policy
      * @return a newly created redelivery policy, or return the original policy if no customization
is required
      * for this exception handler.
      */
-    public RedeliveryPolicy createRedeliveryPolicy(RedeliveryPolicy parentPolicy) {
+    public RedeliveryPolicy createRedeliveryPolicy(CamelContext context, RedeliveryPolicy
parentPolicy) {
         if (redeliveryPolicy != null) {
-            return redeliveryPolicy.createRedeliveryPolicy(parentPolicy);
+            return redeliveryPolicy.createRedeliveryPolicy(context, parentPolicy);
         } else if (errorHandler != null) {
             // lets create a new error handler that has no retries
             RedeliveryPolicy answer = parentPolicy.copy();

Modified: activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/RedeliveryPolicyType.java
URL: http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/RedeliveryPolicyType.java?rev=719343&r1=719342&r2=719343&view=diff
==============================================================================
--- activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/RedeliveryPolicyType.java
(original)
+++ activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/RedeliveryPolicyType.java
Thu Nov 20 11:48:50 2008
@@ -21,7 +21,9 @@
 import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlRootElement;
 
+import org.apache.camel.CamelContext;
 import org.apache.camel.processor.RedeliveryPolicy;
+import org.apache.camel.util.CamelContextHelper;
 
 /**
  * Represents an XML <redeliveryPolicy/> element
@@ -31,6 +33,8 @@
 @XmlRootElement(name = "redeliveryPolicy")
 @XmlAccessorType(XmlAccessType.FIELD)
 public class RedeliveryPolicyType {
+    @XmlAttribute()
+    private String ref;
     @XmlAttribute
     private Integer maximumRedeliveries;
     @XmlAttribute
@@ -50,8 +54,13 @@
     @XmlAttribute
     private LoggingLevel retryAttemptedLogLevel;
 
-    public RedeliveryPolicy createRedeliveryPolicy(RedeliveryPolicy parentPolicy) {
-        RedeliveryPolicy answer =  parentPolicy.copy();
+    public RedeliveryPolicy createRedeliveryPolicy(CamelContext context, RedeliveryPolicy
parentPolicy) {
+        if (ref != null) {
+            // lookup in registry if ref provided
+            return CamelContextHelper.mandatoryLookup(context, ref, RedeliveryPolicy.class);
+        }
+
+        RedeliveryPolicy answer = parentPolicy.copy();
 
         // copy across the properties - if they are set
         if (maximumRedeliveries != null) {
@@ -140,6 +149,11 @@
         return this;
     }
 
+    public RedeliveryPolicyType ref(String ref) {
+        setRef(ref);
+        return this;
+    }
+
     // Properties
     //-------------------------------------------------------------------------
 
@@ -199,20 +213,27 @@
         this.maximumRedeliveryDelay = maximumRedeliveryDelay;
     }
 
-    private void setRetriesExhaustedLogLevel(LoggingLevel retriesExhaustedLogLevel) {
+    public void setRetriesExhaustedLogLevel(LoggingLevel retriesExhaustedLogLevel) {
         this.retriesExhaustedLogLevel = retriesExhaustedLogLevel;
     }
 
-    private LoggingLevel getRetriesExhaustedLogLevel() {
+    public LoggingLevel getRetriesExhaustedLogLevel() {
         return retriesExhaustedLogLevel;
     } 
 
-    private void setRetryAttemptedLogLevel(LoggingLevel retryAttemptedLogLevel) {
+    public void setRetryAttemptedLogLevel(LoggingLevel retryAttemptedLogLevel) {
         this.retryAttemptedLogLevel = retryAttemptedLogLevel;
     }
 
-    private LoggingLevel getRetryAttemptedLogLevel() {
+    public LoggingLevel getRetryAttemptedLogLevel() {
         return retryAttemptedLogLevel;
-    }     
-   
+    }
+
+    public String getRef() {
+        return ref;
+    }
+
+    public void setRef(String ref) {
+        this.ref = ref;
+    }
 }

Modified: activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/processor/DeadLetterChannel.java
URL: http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/processor/DeadLetterChannel.java?rev=719343&r1=719342&r2=719343&view=diff
==============================================================================
--- activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/processor/DeadLetterChannel.java
(original)
+++ activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/processor/DeadLetterChannel.java
Thu Nov 20 11:48:50 2008
@@ -124,7 +124,7 @@
                 // find the error handler to use (if any)
                 ExceptionType exceptionPolicy = getExceptionPolicy(exchange, e);
                 if (exceptionPolicy != null) {
-                    data.currentRedeliveryPolicy = exceptionPolicy.createRedeliveryPolicy(data.currentRedeliveryPolicy);
+                    data.currentRedeliveryPolicy = exceptionPolicy.createRedeliveryPolicy(exchange.getContext(),
data.currentRedeliveryPolicy);
                     data.handledPredicate = exceptionPolicy.getHandledPolicy();
                     Processor processor = exceptionPolicy.getErrorHandler();
                     if (processor != null) {

Modified: activemq/camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/processor/ThroughPutLoggerTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/processor/ThroughPutLoggerTest.java?rev=719343&r1=719342&r2=719343&view=diff
==============================================================================
--- activemq/camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/processor/ThroughPutLoggerTest.java
(original)
+++ activemq/camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/processor/ThroughPutLoggerTest.java
Thu Nov 20 11:48:50 2008
@@ -14,12 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.processor;
 
 import junit.framework.TestCase;
 
 public class ThroughPutLoggerTest extends TestCase {
+
     public void testLogStringDurationIsNotZero() throws Exception {
         ThroughputLogger underTest = new ThroughputLogger(10);
         for (int i=0; i<25; i++) {
@@ -27,6 +27,5 @@
         }
         String message = (String) underTest.logMessage(null);
         assertTrue("consumed 20 :" + message, message.contains("20"));
-        assertTrue("no 'took: 0' :" + message, !message.contains("took: 0"));
     }
 }



Mime
View raw message