camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r773945 - in /camel/trunk/camel-core/src: main/java/org/apache/camel/impl/ main/java/org/apache/camel/model/ main/java/org/apache/camel/processor/ test/java/org/apache/camel/processor/
Date Tue, 12 May 2009 15:40:59 GMT
Author: davsclaus
Date: Tue May 12 15:40:58 2009
New Revision: 773945

URL: http://svn.apache.org/viewvc?rev=773945&view=rev
Log:
Fixed potential unit test failure and polished code

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultLanguageResolver.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/model/EnrichDefinition.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/model/FilterDefinition.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/WireTapProcessor.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/DeadLetterChannelUseOriginalExchangeWithFileTest.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultLanguageResolver.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultLanguageResolver.java?rev=773945&r1=773944&r2=773945&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultLanguageResolver.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultLanguageResolver.java
Tue May 12 15:40:58 2009
@@ -72,7 +72,7 @@
             if (Language.class.isAssignableFrom(type)) {
                 return (Language)context.getInjector().newInstance(type);
             } else {
-                throw new IllegalArgumentException("Type is not a Language implementation.
Found: " + type.getName());
+                throw new IllegalArgumentException("Resolving language: " + name + " detected
type conflict: Not a Language implementation. Found: " + type.getName());
             }
         } else {
             // no specific language found then try fallback
@@ -88,14 +88,14 @@
         } catch (NoFactoryAvailableException e) {
             // ignore
         } catch (Exception e) {
-            throw new IllegalArgumentException("Invalid URI, no Language registered for scheme:
" + name, e);
+            throw new IllegalArgumentException("Invalid URI, no LanguageResolver registered
for scheme: " + name, e);
         }
         if (type != null) {
             if (LanguageResolver.class.isAssignableFrom(type)) {
                 LanguageResolver resolver = (LanguageResolver)context.getInjector().newInstance(type);
                 return resolver.resolveLanguage(name, context);
             } else {
-                throw new IllegalArgumentException("Type is not a LanguageResolver implementation.
Found: " + type.getName());
+                throw new IllegalArgumentException("Resolving language: " + name + " detected
type conflict: Not a LanguageResolver implementation. Found: " + type.getName());
             }
         }
         throw new NoSuchLanguageException(name);

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/EnrichDefinition.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/EnrichDefinition.java?rev=773945&r1=773944&r2=773945&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/EnrichDefinition.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/EnrichDefinition.java Tue
May 12 15:40:58 2009
@@ -29,6 +29,8 @@
 import org.apache.camel.spi.RouteContext;
 
 /**
+ * Represents an XML <enrich/> element
+ *
  * @see Enricher
  */
 @XmlRootElement(name = "enrich")

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/FilterDefinition.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/FilterDefinition.java?rev=773945&r1=773944&r2=773945&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/FilterDefinition.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/FilterDefinition.java Tue
May 12 15:40:58 2009
@@ -33,7 +33,7 @@
  */
 @XmlRootElement(name = "filter")
 @XmlAccessorType(XmlAccessType.FIELD)
-public class FilterDefinition extends ExpressionNode implements Block {
+public class FilterDefinition extends ExpressionNode {
 
     public FilterDefinition() {
     }

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/WireTapProcessor.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/WireTapProcessor.java?rev=773945&r1=773944&r2=773945&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/WireTapProcessor.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/WireTapProcessor.java
Tue May 12 15:40:58 2009
@@ -76,21 +76,29 @@
                 throw new IllegalStateException("No producer, this processor has not been
started!");
             }
         } else {
-            final Exchange wireTapExchange = configureExchange(exchange);
+            Exchange wireTapExchange = configureExchange(exchange);
+            procesWireTap(wireTapExchange);
+        }
+    }
 
-            // use submit instead of execute to force it to use a new thread, execute might
-            // decide to use current thread, so we must submit a new task
-            // as we dont care for the response we dont hold the future object and wait for
the result
-            getExecutorService().submit(new Callable<Object>() {
-                public Object call() throws Exception {
-                    if (LOG.isDebugEnabled()) {
-                        LOG.debug("Processing wiretap: " + wireTapExchange);
-                    }
-                    producer.process(wireTapExchange);
-                    return null;
+    /**
+     * Wiretaps the exchange.
+     *
+     * @param exchange  the exchange to wire tap
+     */
+    protected void procesWireTap(final Exchange exchange) {
+        // use submit instead of execute to force it to use a new thread, execute might
+        // decide to use current thread, so we must submit a new task
+        // as we dont care for the response we dont hold the future object and wait for the
result
+        getExecutorService().submit(new Callable<Exchange>() {
+            public Exchange call() throws Exception {
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("Processing wiretap: " + exchange);
                 }
-            });
-        }
+                producer.process(exchange);
+                return exchange;
+            }
+        });
     }
 
     @Override

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/DeadLetterChannelUseOriginalExchangeWithFileTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/DeadLetterChannelUseOriginalExchangeWithFileTest.java?rev=773945&r1=773944&r2=773945&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/DeadLetterChannelUseOriginalExchangeWithFileTest.java
(original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/DeadLetterChannelUseOriginalExchangeWithFileTest.java
Tue May 12 15:40:58 2009
@@ -52,7 +52,7 @@
             public void configure() throws Exception {
                 errorHandler(deadLetterChannel("mock:dead").disableRedelivery().logStackTrace(false).useOriginalExchange().handled(true));
 
-                from("file://target/originalexchange")
+                from("file://target/originalexchange?noop=true")
                     .transform(body().append(" World"))
                     .process(new MyThrowProcessor());
             }



Mime
View raw message