camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cschnei...@apache.org
Subject svn commit: r1166352 - in /camel/trunk: ./ camel-core/src/main/java/org/apache/camel/ camel-core/src/main/java/org/apache/camel/component/direct/ camel-core/src/main/java/org/apache/camel/component/seda/ camel-core/src/main/java/org/apache/camel/impl/ ...
Date Wed, 07 Sep 2011 19:53:02 GMT
Author: cschneider
Date: Wed Sep  7 19:53:00 2011
New Revision: 1166352

URL: http://svn.apache.org/viewvc?rev=1166352&view=rev
Log:
CAMEL-4417 Move AsnycProcessorTypeConverter.convert method to util as we also need it in support
classes at a later refactoring. Introduce DelegateProcessor interface

Added:
    camel/trunk/camel-core/src/main/java/org/apache/camel/DelegateProcessor.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/util/AsyncProcessorConverterHelper.java
Modified:
    camel/trunk/   (props changed)
    camel/trunk/camel-core/src/main/java/org/apache/camel/component/direct/DirectProducer.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultConsumer.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/AsyncProcessorTypeConverter.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultManagementObjectStrategy.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/AsyncProcessorConverterHelper.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/ChoiceProcessor.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DefaultChannel.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DelegateAsyncProcessor.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DelegateProcessor.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Enricher.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/InterceptorToAsyncProcessorBridge.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RedeliveryErrorHandler.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/TryProcessor.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/idempotent/IdempotentConsumer.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/FailOverLoadBalancer.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/QueueLoadBalancer.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/TestSupport.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointPolicyTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/interceptor/TraceInterceptorFactoryCreatesHandlerTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/interceptor/TraceInterceptorSubclassFactory.java
    camel/trunk/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/seda/HazelcastSedaConsumer.java
    camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AbstractTransactionTest.java
    camel/trunk/components/camel-routebox/src/main/java/org/apache/camel/component/routebox/direct/RouteboxDirectConsumer.java
    camel/trunk/components/camel-routebox/src/main/java/org/apache/camel/component/routebox/direct/RouteboxDirectProducer.java
    camel/trunk/components/camel-routebox/src/main/java/org/apache/camel/component/routebox/seda/RouteboxSedaConsumer.java

Propchange: camel/trunk/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Sep  7 19:53:00 2011
@@ -1,2 +1,4 @@
 target
 *.i??
+.project
+.settings

Added: camel/trunk/camel-core/src/main/java/org/apache/camel/DelegateProcessor.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/DelegateProcessor.java?rev=1166352&view=auto
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/DelegateProcessor.java (added)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/DelegateProcessor.java Wed Sep 
7 19:53:00 2011
@@ -0,0 +1,29 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel;
+
+/**
+ * Interface to be used for processors that delegate to the real processor
+ */
+public interface DelegateProcessor extends Processor {
+
+    /**
+     * 
+     * @return the processor we delegate to
+     */
+    Processor getProcessor();
+}

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/direct/DirectProducer.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/direct/DirectProducer.java?rev=1166352&r1=1166351&r2=1166352&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/direct/DirectProducer.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/direct/DirectProducer.java
Wed Sep  7 19:53:00 2011
@@ -21,7 +21,7 @@ import org.apache.camel.AsyncProcessor;
 import org.apache.camel.CamelExchangeException;
 import org.apache.camel.Exchange;
 import org.apache.camel.impl.DefaultProducer;
-import org.apache.camel.processor.AsyncProcessorConverterHelper;
+import org.apache.camel.util.AsyncProcessorConverterHelper;
 import org.apache.camel.util.AsyncProcessorHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java?rev=1166352&r1=1166351&r2=1166352&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java
Wed Sep  7 19:53:00 2011
@@ -31,11 +31,11 @@ import org.apache.camel.Processor;
 import org.apache.camel.ShutdownRunningTask;
 import org.apache.camel.SuspendableService;
 import org.apache.camel.impl.LoggingExceptionHandler;
-import org.apache.camel.processor.AsyncProcessorConverterHelper;
 import org.apache.camel.processor.MulticastProcessor;
 import org.apache.camel.spi.ExceptionHandler;
 import org.apache.camel.spi.ShutdownAware;
 import org.apache.camel.support.ServiceSupport;
+import org.apache.camel.util.AsyncProcessorConverterHelper;
 import org.apache.camel.util.AsyncProcessorHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultConsumer.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultConsumer.java?rev=1166352&r1=1166351&r2=1166352&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultConsumer.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultConsumer.java Wed Sep
 7 19:53:00 2011
@@ -20,9 +20,9 @@ import org.apache.camel.AsyncProcessor;
 import org.apache.camel.Consumer;
 import org.apache.camel.Endpoint;
 import org.apache.camel.Processor;
-import org.apache.camel.processor.AsyncProcessorConverterHelper;
 import org.apache.camel.spi.ExceptionHandler;
 import org.apache.camel.support.ServiceSupport;
+import org.apache.camel.util.AsyncProcessorConverterHelper;
 import org.apache.camel.util.ServiceHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java?rev=1166352&r1=1166351&r2=1166352&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java Wed Sep
 7 19:53:00 2011
@@ -30,10 +30,10 @@ import org.apache.camel.Processor;
 import org.apache.camel.Producer;
 import org.apache.camel.ProducerCallback;
 import org.apache.camel.ServicePoolAware;
-import org.apache.camel.processor.AsyncProcessorConverterHelper;
 import org.apache.camel.processor.UnitOfWorkProducer;
 import org.apache.camel.spi.ServicePool;
 import org.apache.camel.support.ServiceSupport;
+import org.apache.camel.util.AsyncProcessorConverterHelper;
 import org.apache.camel.util.CamelContextHelper;
 import org.apache.camel.util.EventHelper;
 import org.apache.camel.util.LRUCache;

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/AsyncProcessorTypeConverter.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/AsyncProcessorTypeConverter.java?rev=1166352&r1=1166351&r2=1166352&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/AsyncProcessorTypeConverter.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/AsyncProcessorTypeConverter.java
Wed Sep  7 19:53:00 2011
@@ -21,7 +21,7 @@ import org.apache.camel.Exchange;
 import org.apache.camel.NoTypeConversionAvailableException;
 import org.apache.camel.Processor;
 import org.apache.camel.TypeConverter;
-import org.apache.camel.processor.AsyncProcessorConverterHelper;
+import org.apache.camel.util.AsyncProcessorConverterHelper;
 
 /**
  * A simple converter that can convert any {@link Processor} to an {@link AsyncProcessor}.

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultManagementObjectStrategy.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultManagementObjectStrategy.java?rev=1166352&r1=1166351&r2=1166352&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultManagementObjectStrategy.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultManagementObjectStrategy.java
Wed Sep  7 19:53:00 2011
@@ -21,6 +21,7 @@ import java.util.concurrent.ThreadPoolEx
 import org.apache.camel.CamelContext;
 import org.apache.camel.Component;
 import org.apache.camel.Consumer;
+import org.apache.camel.DelegateProcessor;
 import org.apache.camel.Endpoint;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
@@ -49,8 +50,6 @@ import org.apache.camel.management.mbean
 import org.apache.camel.management.mbean.ManagedThrottler;
 import org.apache.camel.model.ProcessorDefinition;
 import org.apache.camel.processor.Delayer;
-import org.apache.camel.processor.DelegateAsyncProcessor;
-import org.apache.camel.processor.DelegateProcessor;
 import org.apache.camel.processor.ErrorHandler;
 import org.apache.camel.processor.SendProcessor;
 import org.apache.camel.processor.Throttler;
@@ -190,8 +189,6 @@ public class DefaultManagementObjectStra
             // no answer yet, so unwrap any delegates and try again
             if (target instanceof DelegateProcessor) {
                 target = ((DelegateProcessor) target).getProcessor();
-            } else if (target instanceof DelegateAsyncProcessor) {
-                target = ((DelegateAsyncProcessor) target).getProcessor();
             } else {
                 // no delegate so we dont have any target to try next
                 break;

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/ChoiceProcessor.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/ChoiceProcessor.java?rev=1166352&r1=1166351&r2=1166352&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/ChoiceProcessor.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/ChoiceProcessor.java Wed
Sep  7 19:53:00 2011
@@ -26,6 +26,7 @@ import org.apache.camel.Navigate;
 import org.apache.camel.Predicate;
 import org.apache.camel.Processor;
 import org.apache.camel.support.ServiceSupport;
+import org.apache.camel.util.AsyncProcessorConverterHelper;
 import org.apache.camel.util.AsyncProcessorHelper;
 import org.apache.camel.util.ServiceHelper;
 import org.slf4j.Logger;

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DefaultChannel.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DefaultChannel.java?rev=1166352&r1=1166351&r2=1166352&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DefaultChannel.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DefaultChannel.java Wed
Sep  7 19:53:00 2011
@@ -38,6 +38,7 @@ import org.apache.camel.spi.InterceptStr
 import org.apache.camel.spi.LifecycleStrategy;
 import org.apache.camel.spi.RouteContext;
 import org.apache.camel.support.ServiceSupport;
+import org.apache.camel.util.AsyncProcessorConverterHelper;
 import org.apache.camel.util.AsyncProcessorHelper;
 import org.apache.camel.util.OrderedComparator;
 import org.apache.camel.util.ServiceHelper;

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DelegateAsyncProcessor.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DelegateAsyncProcessor.java?rev=1166352&r1=1166351&r2=1166352&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DelegateAsyncProcessor.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DelegateAsyncProcessor.java
Wed Sep  7 19:53:00 2011
@@ -21,10 +21,12 @@ import java.util.List;
 
 import org.apache.camel.AsyncCallback;
 import org.apache.camel.AsyncProcessor;
+import org.apache.camel.DelegateProcessor;
 import org.apache.camel.Exchange;
 import org.apache.camel.Navigate;
 import org.apache.camel.Processor;
 import org.apache.camel.support.ServiceSupport;
+import org.apache.camel.util.AsyncProcessorConverterHelper;
 import org.apache.camel.util.AsyncProcessorHelper;
 import org.apache.camel.util.ServiceHelper;
 
@@ -38,7 +40,7 @@ import org.apache.camel.util.ServiceHelp
  * @version 
  * @see org.apache.camel.processor.DelegateProcessor
  */
-public class DelegateAsyncProcessor extends ServiceSupport implements AsyncProcessor, Navigate<Processor>
{
+public class DelegateAsyncProcessor extends ServiceSupport implements DelegateProcessor,
AsyncProcessor, Navigate<Processor> {
     protected AsyncProcessor processor;
 
     public DelegateAsyncProcessor() {

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DelegateProcessor.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DelegateProcessor.java?rev=1166352&r1=1166351&r2=1166352&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DelegateProcessor.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DelegateProcessor.java
Wed Sep  7 19:53:00 2011
@@ -36,7 +36,7 @@ import org.apache.camel.util.ServiceHelp
  * @version 
  * @see org.apache.camel.processor.DelegateAsyncProcessor
  */
-public class DelegateProcessor extends ServiceSupport implements Processor, Navigate<Processor>
{
+public class DelegateProcessor extends ServiceSupport implements org.apache.camel.DelegateProcessor,
Processor, Navigate<Processor> {
     protected Processor processor;
 
     public DelegateProcessor() {

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Enricher.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Enricher.java?rev=1166352&r1=1166351&r2=1166352&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Enricher.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Enricher.java Wed Sep
 7 19:53:00 2011
@@ -24,6 +24,7 @@ import org.apache.camel.Producer;
 import org.apache.camel.impl.DefaultExchange;
 import org.apache.camel.processor.aggregate.AggregationStrategy;
 import org.apache.camel.support.ServiceSupport;
+import org.apache.camel.util.AsyncProcessorConverterHelper;
 import org.apache.camel.util.AsyncProcessorHelper;
 import org.apache.camel.util.ExchangeHelper;
 import org.apache.camel.util.ServiceHelper;

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/InterceptorToAsyncProcessorBridge.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/InterceptorToAsyncProcessorBridge.java?rev=1166352&r1=1166351&r2=1166352&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/InterceptorToAsyncProcessorBridge.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/InterceptorToAsyncProcessorBridge.java
Wed Sep  7 19:53:00 2011
@@ -21,6 +21,7 @@ import org.apache.camel.AsyncProcessor;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.support.ServiceSupport;
+import org.apache.camel.util.AsyncProcessorConverterHelper;
 import org.apache.camel.util.ServiceHelper;
 
 /**

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java?rev=1166352&r1=1166351&r2=1166352&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java
Wed Sep  7 19:53:00 2011
@@ -51,6 +51,7 @@ import org.apache.camel.spi.RouteContext
 import org.apache.camel.spi.TracedRouteNodes;
 import org.apache.camel.spi.UnitOfWork;
 import org.apache.camel.support.ServiceSupport;
+import org.apache.camel.util.AsyncProcessorConverterHelper;
 import org.apache.camel.util.AsyncProcessorHelper;
 import org.apache.camel.util.CastUtils;
 import org.apache.camel.util.EventHelper;

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java?rev=1166352&r1=1166351&r2=1166352&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java Wed Sep
 7 19:53:00 2011
@@ -25,6 +25,7 @@ import org.apache.camel.AsyncProcessor;
 import org.apache.camel.CamelContext;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
+import org.apache.camel.util.AsyncProcessorConverterHelper;
 import org.apache.camel.util.AsyncProcessorHelper;
 import org.apache.camel.util.ExchangeHelper;
 import org.slf4j.Logger;

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RedeliveryErrorHandler.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RedeliveryErrorHandler.java?rev=1166352&r1=1166351&r2=1166352&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RedeliveryErrorHandler.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RedeliveryErrorHandler.java
Wed Sep  7 19:53:00 2011
@@ -31,6 +31,7 @@ import org.apache.camel.Predicate;
 import org.apache.camel.Processor;
 import org.apache.camel.model.OnExceptionDefinition;
 import org.apache.camel.spi.SubUnitOfWorkCallback;
+import org.apache.camel.util.AsyncProcessorConverterHelper;
 import org.apache.camel.util.AsyncProcessorHelper;
 import org.apache.camel.util.CamelContextHelper;
 import org.apache.camel.util.CamelLogger;

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/TryProcessor.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/TryProcessor.java?rev=1166352&r1=1166351&r2=1166352&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/TryProcessor.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/TryProcessor.java Wed
Sep  7 19:53:00 2011
@@ -27,6 +27,7 @@ import org.apache.camel.Exchange;
 import org.apache.camel.Navigate;
 import org.apache.camel.Processor;
 import org.apache.camel.support.ServiceSupport;
+import org.apache.camel.util.AsyncProcessorConverterHelper;
 import org.apache.camel.util.AsyncProcessorHelper;
 import org.apache.camel.util.ExchangeHelper;
 import org.apache.camel.util.ServiceHelper;

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/idempotent/IdempotentConsumer.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/idempotent/IdempotentConsumer.java?rev=1166352&r1=1166351&r2=1166352&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/idempotent/IdempotentConsumer.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/idempotent/IdempotentConsumer.java
Wed Sep  7 19:53:00 2011
@@ -25,9 +25,9 @@ import org.apache.camel.Exchange;
 import org.apache.camel.Expression;
 import org.apache.camel.Navigate;
 import org.apache.camel.Processor;
-import org.apache.camel.processor.AsyncProcessorConverterHelper;
 import org.apache.camel.spi.IdempotentRepository;
 import org.apache.camel.support.ServiceSupport;
+import org.apache.camel.util.AsyncProcessorConverterHelper;
 import org.apache.camel.util.AsyncProcessorHelper;
 import org.apache.camel.util.ServiceHelper;
 import org.slf4j.Logger;

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/FailOverLoadBalancer.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/FailOverLoadBalancer.java?rev=1166352&r1=1166351&r2=1166352&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/FailOverLoadBalancer.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/FailOverLoadBalancer.java
Wed Sep  7 19:53:00 2011
@@ -23,8 +23,8 @@ import org.apache.camel.AsyncCallback;
 import org.apache.camel.AsyncProcessor;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
-import org.apache.camel.processor.AsyncProcessorConverterHelper;
 import org.apache.camel.processor.Traceable;
+import org.apache.camel.util.AsyncProcessorConverterHelper;
 import org.apache.camel.util.AsyncProcessorHelper;
 import org.apache.camel.util.ObjectHelper;
 

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/QueueLoadBalancer.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/QueueLoadBalancer.java?rev=1166352&r1=1166351&r2=1166352&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/QueueLoadBalancer.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/QueueLoadBalancer.java
Wed Sep  7 19:53:00 2011
@@ -22,7 +22,7 @@ import org.apache.camel.AsyncCallback;
 import org.apache.camel.AsyncProcessor;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
-import org.apache.camel.processor.AsyncProcessorConverterHelper;
+import org.apache.camel.util.AsyncProcessorConverterHelper;
 import org.apache.camel.util.AsyncProcessorHelper;
 
 /**

Added: camel/trunk/camel-core/src/main/java/org/apache/camel/util/AsyncProcessorConverterHelper.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/AsyncProcessorConverterHelper.java?rev=1166352&view=auto
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/util/AsyncProcessorConverterHelper.java
(added)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/util/AsyncProcessorConverterHelper.java
Wed Sep  7 19:53:00 2011
@@ -0,0 +1,125 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.util;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.camel.AsyncCallback;
+import org.apache.camel.AsyncProcessor;
+import org.apache.camel.DelegateProcessor;
+import org.apache.camel.Exchange;
+import org.apache.camel.Navigate;
+import org.apache.camel.Processor;
+import org.apache.camel.Service;
+
+/**
+ * A simple converter that can convert any {@link Processor} to an {@link AsyncProcessor}.
+ * Processing will still occur synchronously but it will provide the required
+ * notifications that the caller expects.
+ *
+ * @version 
+ */
+public final class AsyncProcessorConverterHelper {
+    
+    private AsyncProcessorConverterHelper() {
+        // Helper class
+    }
+
+    /**
+     * Creates a AsnycProcossor that delegates to the given processor.
+     * It is important that this implements DelegateProcessor
+     *
+     */
+    private static final class ProcessorToAsyncProcessorBridge implements DelegateProcessor,
AsyncProcessor, Navigate<Processor>, Service {
+        protected Processor processor;
+
+        private ProcessorToAsyncProcessorBridge(Processor processor) {
+            this.processor = processor;
+        }
+
+        public boolean process(Exchange exchange, AsyncCallback callback) {
+            if (processor == null) {
+                // no processor then we are done
+                callback.done(true);
+                return true;
+            }
+            try {
+                processor.process(exchange);
+            } catch (Throwable e) {
+                // must catch throwable so we catch all
+                exchange.setException(e);
+            } finally {
+                // we are bridging a sync processor as async so callback with true
+                callback.done(true);
+            }
+            return true;
+        }
+
+        @Override
+        public String toString() {
+            if (processor != null) {
+                return processor.toString();
+            } else {
+                return "Processor is null";
+            }
+        }
+        
+        public void process(Exchange exchange) throws Exception {
+            processNext(exchange);
+        }
+
+        protected void processNext(Exchange exchange) throws Exception {
+            if (processor != null) {
+                processor.process(exchange);
+            }
+        }
+
+        public void start() throws Exception {
+            ServiceHelper.startServices(processor);
+        }
+
+        public void stop() throws Exception {
+            ServiceHelper.stopServices(processor);
+        }
+
+        public boolean hasNext() {
+            return processor != null;
+        }
+
+        public List<Processor> next() {
+            if (!hasNext()) {
+                return null;
+            }
+            List<Processor> answer = new ArrayList<Processor>(1);
+            answer.add(processor);
+            return answer;
+        }
+
+        @Override
+        public Processor getProcessor() {
+            return processor;
+        }
+    }
+
+    public static AsyncProcessor convert(Processor value) {
+        if (value instanceof AsyncProcessor) {
+            return (AsyncProcessor)value;
+        }
+        return new ProcessorToAsyncProcessorBridge(value);
+    }
+}

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/TestSupport.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/TestSupport.java?rev=1166352&r1=1166351&r2=1166352&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/TestSupport.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/TestSupport.java Wed Sep  7 19:53:00
2011
@@ -27,8 +27,6 @@ import org.apache.camel.builder.RouteBui
 import org.apache.camel.builder.ValueBuilder;
 import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.camel.impl.DefaultExchange;
-import org.apache.camel.processor.DelegateAsyncProcessor;
-import org.apache.camel.processor.DelegateProcessor;
 import org.apache.camel.processor.ErrorHandlerSupport;
 import org.apache.camel.util.ExchangeHelper;
 import org.apache.camel.util.PredicateAssertHelper;
@@ -382,8 +380,6 @@ public abstract class TestSupport extend
         while (true) {
             if (processor instanceof DelegateProcessor) {
                 processor = ((DelegateProcessor) processor).getProcessor();
-            } else if (processor instanceof DelegateAsyncProcessor) {
-                processor = ((DelegateAsyncProcessor) processor).getProcessor();
             } else {
                 return processor;
             }
@@ -402,8 +398,6 @@ public abstract class TestSupport extend
                 return (Channel) processor;
             } else if (processor instanceof DelegateProcessor) {
                 processor = ((DelegateProcessor) processor).getProcessor();
-            } else if (processor instanceof DelegateAsyncProcessor) {
-                processor = ((DelegateAsyncProcessor) processor).getProcessor();
             } else if (processor instanceof ErrorHandlerSupport) {
                 processor = ((ErrorHandlerSupport) processor).getOutput();
             } else {

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java?rev=1166352&r1=1166351&r2=1166352&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java Wed
Sep  7 19:53:00 2011
@@ -21,6 +21,7 @@ import java.util.List;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.Channel;
+import org.apache.camel.DelegateProcessor;
 import org.apache.camel.Endpoint;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
@@ -31,7 +32,6 @@ import org.apache.camel.impl.DefaultCame
 import org.apache.camel.impl.EventDrivenConsumerRoute;
 import org.apache.camel.processor.ChoiceProcessor;
 import org.apache.camel.processor.DeadLetterChannel;
-import org.apache.camel.processor.DelegateProcessor;
 import org.apache.camel.processor.FilterProcessor;
 import org.apache.camel.processor.MulticastProcessor;
 import org.apache.camel.processor.Pipeline;
@@ -261,7 +261,7 @@ public class RouteBuilderTest extends Te
     }
 
     protected List<Route> buildRouteWithInterceptor() throws Exception {
-        interceptor1 = new DelegateProcessor() {
+        interceptor1 = new org.apache.camel.processor.DelegateProcessor() {
         };
 
         interceptor2 = new MyInterceptorProcessor();

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointPolicyTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointPolicyTest.java?rev=1166352&r1=1166351&r2=1166352&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointPolicyTest.java
(original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/async/AsyncEndpointPolicyTest.java
Wed Sep  7 19:53:00 2011
@@ -24,9 +24,9 @@ import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.impl.JndiRegistry;
 import org.apache.camel.model.ProcessorDefinition;
-import org.apache.camel.processor.AsyncProcessorConverterHelper;
 import org.apache.camel.spi.Policy;
 import org.apache.camel.spi.RouteContext;
+import org.apache.camel.util.AsyncProcessorConverterHelper;
 import org.apache.camel.util.AsyncProcessorHelper;
 
 /**

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/interceptor/TraceInterceptorFactoryCreatesHandlerTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/interceptor/TraceInterceptorFactoryCreatesHandlerTest.java?rev=1166352&r1=1166351&r2=1166352&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/interceptor/TraceInterceptorFactoryCreatesHandlerTest.java
(original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/interceptor/TraceInterceptorFactoryCreatesHandlerTest.java
Wed Sep  7 19:53:00 2011
@@ -20,9 +20,9 @@ import java.util.LinkedList;
 import java.util.List;
 
 import org.apache.camel.CamelContext;
+import org.apache.camel.DelegateProcessor;
 import org.apache.camel.Processor;
 import org.apache.camel.model.ProcessorDefinition;
-import org.apache.camel.processor.DelegateProcessor;
 import org.apache.camel.processor.WrapProcessor;
 
 public class TraceInterceptorFactoryCreatesHandlerTest extends TracingTestBase {
@@ -39,9 +39,6 @@ public class TraceInterceptorFactoryCrea
         public Processor createTraceInterceptor(ProcessorDefinition node, Processor target,
TraceFormatter formatter, Tracer tracer) {
             TraceInterceptor interceptor = new TraceInterceptor(node, target, formatter,
tracer);
 
-            if (target instanceof WrapProcessor) {
-                target = ((WrapProcessor) target).getProcessor();
-            }
             while (target instanceof DelegateProcessor) {
                 target = ((DelegateProcessor) target).getProcessor();
             }

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/interceptor/TraceInterceptorSubclassFactory.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/interceptor/TraceInterceptorSubclassFactory.java?rev=1166352&r1=1166351&r2=1166352&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/interceptor/TraceInterceptorSubclassFactory.java
(original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/interceptor/TraceInterceptorSubclassFactory.java
Wed Sep  7 19:53:00 2011
@@ -18,11 +18,10 @@ package org.apache.camel.processor.inter
 
 import java.util.List;
 
+import org.apache.camel.DelegateProcessor;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.model.ProcessorDefinition;
-import org.apache.camel.processor.DelegateProcessor;
-import org.apache.camel.processor.WrapProcessor;
 
 public class TraceInterceptorSubclassFactory implements TraceInterceptorFactory {
     private List<StringBuilder> eventMessages;
@@ -54,9 +53,6 @@ public class TraceInterceptorSubclassFac
             super(node, target, formatter, tracer);
             this.eventMessages = eventMessages;
             this.factory = factory;
-            if (target instanceof WrapProcessor) {
-                target = ((WrapProcessor) target).getProcessor();
-            }
             while (target instanceof DelegateProcessor) {
                 target = ((DelegateProcessor) target).getProcessor();
             }

Modified: camel/trunk/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/seda/HazelcastSedaConsumer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/seda/HazelcastSedaConsumer.java?rev=1166352&r1=1166351&r2=1166352&view=diff
==============================================================================
--- camel/trunk/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/seda/HazelcastSedaConsumer.java
(original)
+++ camel/trunk/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/seda/HazelcastSedaConsumer.java
Wed Sep  7 19:53:00 2011
@@ -28,7 +28,7 @@ import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.impl.DefaultConsumer;
 import org.apache.camel.impl.DefaultExchangeHolder;
-import org.apache.camel.processor.AsyncProcessorConverterHelper;
+import org.apache.camel.util.AsyncProcessorConverterHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 

Modified: camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AbstractTransactionTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AbstractTransactionTest.java?rev=1166352&r1=1166351&r2=1166352&view=diff
==============================================================================
--- camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AbstractTransactionTest.java
(original)
+++ camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AbstractTransactionTest.java
Wed Sep  7 19:53:00 2011
@@ -17,14 +17,13 @@
 package org.apache.camel.component.jms.tx;
 
 import org.apache.camel.Channel;
+import org.apache.camel.DelegateProcessor;
 import org.apache.camel.Processor;
 import org.apache.camel.Route;
 import org.apache.camel.builder.NotifyBuilder;
 import org.apache.camel.impl.EventDrivenConsumerRoute;
 import org.apache.camel.processor.DeadLetterChannel;
 import org.apache.camel.processor.DefaultErrorHandler;
-import org.apache.camel.processor.DelegateAsyncProcessor;
-import org.apache.camel.processor.DelegateProcessor;
 import org.apache.camel.processor.Pipeline;
 import org.apache.camel.spring.spi.TransactionErrorHandler;
 import org.apache.camel.test.junit4.CamelSpringTestSupport;
@@ -92,9 +91,6 @@ public abstract class AbstractTransactio
             } else if (processor instanceof DelegateProcessor) {
                 // TransactionInterceptor is a DelegateProcessor
                 processor = ((DelegateProcessor)processor).getProcessor();
-            } else if (processor instanceof DelegateAsyncProcessor) {
-                // TransactionInterceptor is a DelegateProcessor
-                processor = ((DelegateAsyncProcessor)processor).getProcessor();
             } else if (processor instanceof Pipeline) {
                 for (Processor p : ((Pipeline)processor).getProcessors()) {
                     p = findProcessorByClass(p, findClass);

Modified: camel/trunk/components/camel-routebox/src/main/java/org/apache/camel/component/routebox/direct/RouteboxDirectConsumer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-routebox/src/main/java/org/apache/camel/component/routebox/direct/RouteboxDirectConsumer.java?rev=1166352&r1=1166351&r2=1166352&view=diff
==============================================================================
--- camel/trunk/components/camel-routebox/src/main/java/org/apache/camel/component/routebox/direct/RouteboxDirectConsumer.java
(original)
+++ camel/trunk/components/camel-routebox/src/main/java/org/apache/camel/component/routebox/direct/RouteboxDirectConsumer.java
Wed Sep  7 19:53:00 2011
@@ -23,8 +23,8 @@ import org.apache.camel.ShutdownRunningT
 import org.apache.camel.SuspendableService;
 import org.apache.camel.component.routebox.RouteboxConsumer;
 import org.apache.camel.component.routebox.RouteboxServiceSupport;
-import org.apache.camel.processor.AsyncProcessorConverterHelper;
 import org.apache.camel.spi.ShutdownAware;
+import org.apache.camel.util.AsyncProcessorConverterHelper;
 
 public class RouteboxDirectConsumer extends RouteboxServiceSupport implements RouteboxConsumer,
ShutdownAware, SuspendableService {
     protected ProducerTemplate producer;

Modified: camel/trunk/components/camel-routebox/src/main/java/org/apache/camel/component/routebox/direct/RouteboxDirectProducer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-routebox/src/main/java/org/apache/camel/component/routebox/direct/RouteboxDirectProducer.java?rev=1166352&r1=1166351&r2=1166352&view=diff
==============================================================================
--- camel/trunk/components/camel-routebox/src/main/java/org/apache/camel/component/routebox/direct/RouteboxDirectProducer.java
(original)
+++ camel/trunk/components/camel-routebox/src/main/java/org/apache/camel/component/routebox/direct/RouteboxDirectProducer.java
Wed Sep  7 19:53:00 2011
@@ -26,7 +26,7 @@ import org.apache.camel.Producer;
 import org.apache.camel.ProducerTemplate;
 import org.apache.camel.component.routebox.RouteboxServiceSupport;
 import org.apache.camel.component.routebox.strategy.RouteboxDispatcher;
-import org.apache.camel.processor.AsyncProcessorConverterHelper;
+import org.apache.camel.util.AsyncProcessorConverterHelper;
 import org.apache.camel.util.AsyncProcessorHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;

Modified: camel/trunk/components/camel-routebox/src/main/java/org/apache/camel/component/routebox/seda/RouteboxSedaConsumer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-routebox/src/main/java/org/apache/camel/component/routebox/seda/RouteboxSedaConsumer.java?rev=1166352&r1=1166351&r2=1166352&view=diff
==============================================================================
--- camel/trunk/components/camel-routebox/src/main/java/org/apache/camel/component/routebox/seda/RouteboxSedaConsumer.java
(original)
+++ camel/trunk/components/camel-routebox/src/main/java/org/apache/camel/component/routebox/seda/RouteboxSedaConsumer.java
Wed Sep  7 19:53:00 2011
@@ -29,8 +29,8 @@ import org.apache.camel.ShutdownRunningT
 import org.apache.camel.component.routebox.RouteboxConsumer;
 import org.apache.camel.component.routebox.RouteboxServiceSupport;
 import org.apache.camel.component.routebox.strategy.RouteboxDispatcher;
-import org.apache.camel.processor.AsyncProcessorConverterHelper;
 import org.apache.camel.spi.ShutdownAware;
+import org.apache.camel.util.AsyncProcessorConverterHelper;
 import org.apache.camel.util.AsyncProcessorHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;



Mime
View raw message