camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r620520 - in /activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda: CollectionProducer.java SedaConsumer.java SedaEndpoint.java
Date Mon, 11 Feb 2008 16:35:44 GMT
Author: jstrachan
Date: Mon Feb 11 08:35:39 2008
New Revision: 620520

URL: http://svn.apache.org/viewvc?rev=620520&view=rev
Log:
minor refactor to make things a bit easier to reuse

Added:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/CollectionProducer.java
  (with props)
Modified:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java

Added: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/CollectionProducer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/CollectionProducer.java?rev=620520&view=auto
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/CollectionProducer.java
(added)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/CollectionProducer.java
Mon Feb 11 08:35:39 2008
@@ -0,0 +1,51 @@
+/**
+ *
+ * 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.component.seda;
+
+import java.util.Collection;
+
+import org.apache.camel.AsyncCallback;
+import org.apache.camel.AsyncProcessor;
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+import org.apache.camel.Producer;
+import org.apache.camel.impl.DefaultProducer;
+
+/**
+ * A simple {@link Producer} which just appends to a {@link Collection} the {@link Exchange}
object.
+ *
+ * @version $Revision: 1.1 $
+ */
+final class CollectionProducer extends DefaultProducer implements AsyncProcessor {
+    private final Collection<Exchange> queue;
+
+    public CollectionProducer(Endpoint endpoint, Collection<Exchange> queue) {
+        super(endpoint);
+        this.queue = queue;
+    }
+
+    public void process(Exchange exchange) {
+        queue.add(exchange.copy());
+    }
+
+    public boolean process(Exchange exchange, AsyncCallback callback) {
+        queue.add(exchange.copy());
+        callback.done(true);
+        return true;
+    }
+}

Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/CollectionProducer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java?rev=620520&r1=620519&r2=620520&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java
Mon Feb 11 08:35:39 2008
@@ -33,8 +33,6 @@
  * @version $Revision$
  */
 public class SedaConsumer extends ServiceSupport implements Consumer, Runnable {
-    private static final Log LOG = LogFactory.getLog(SedaConsumer.class);
-
     private SedaEndpoint endpoint;
     private AsyncProcessor processor;
     private Thread thread;

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java?rev=620520&r1=620519&r2=620520&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java
Mon Feb 11 08:35:39 2008
@@ -19,16 +19,12 @@
 import java.util.Map;
 import java.util.concurrent.BlockingQueue;
 
-import org.apache.camel.AsyncCallback;
-import org.apache.camel.AsyncProcessor;
 import org.apache.camel.Component;
 import org.apache.camel.Consumer;
-import org.apache.camel.Endpoint;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
 import org.apache.camel.impl.DefaultEndpoint;
-import org.apache.camel.impl.DefaultProducer;
 
 /**
  * An implementation of the <a
@@ -38,21 +34,6 @@
  * @version $Revision: 519973 $
  */
 public class SedaEndpoint extends DefaultEndpoint<Exchange> {
-        
-    private final class SedaProducer extends DefaultProducer implements AsyncProcessor {
-        private SedaProducer(Endpoint endpoint) {
-            super(endpoint);
-        }
-        public void process(Exchange exchange) {
-            queue.add(exchange.copy());
-        }
-        public boolean process(Exchange exchange, AsyncCallback callback) {
-            queue.add(exchange.copy());
-            callback.done(true);
-            return true;
-        }
-    }
-
     private BlockingQueue<Exchange> queue;
 
     public SedaEndpoint(String endpointUri, Component component, BlockingQueue<Exchange>
queue) {
@@ -65,7 +46,7 @@
     }
 
     public Producer createProducer() throws Exception {
-        return new SedaProducer(this);
+        return new CollectionProducer(this, getQueue());
     }
 
     public Consumer createConsumer(Processor processor) throws Exception {



Mime
View raw message