camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r620780 - in /activemq/camel/trunk/camel-core/src: main/java/org/apache/camel/component/list/ main/java/org/apache/camel/component/mock/ main/java/org/apache/camel/component/pojo/ main/java/org/apache/camel/component/seda/ main/java/org/apa...
Date Tue, 12 Feb 2008 12:37:40 GMT
Author: jstrachan
Date: Tue Feb 12 04:37:38 2008
New Revision: 620780

URL: http://svn.apache.org/viewvc?rev=620780&view=rev
Log:
added a BrowseableEndpoint interface to support : https://issues.apache.org/activemq/browse/CAMEL-285

Added:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/BrowsableEndpoint.java
  (with props)
Removed:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/
Modified:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/list/ListEndpoint.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java
    activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/list/ListTest.java

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/list/ListEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/list/ListEndpoint.java?rev=620780&r1=620779&r2=620780&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/list/ListEndpoint.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/list/ListEndpoint.java
Tue Feb 12 04:37:38 2008
@@ -27,6 +27,7 @@
 import org.apache.camel.Producer;
 import org.apache.camel.CamelContext;
 import org.apache.camel.Component;
+import org.apache.camel.spi.BrowsableEndpoint;
 import org.apache.camel.processor.loadbalancer.LoadBalancerConsumer;
 import org.apache.camel.processor.loadbalancer.TopicLoadBalancer;
 import org.apache.camel.component.seda.CollectionProducer;
@@ -39,7 +40,7 @@
  *
  * @version $Revision: 1.1 $
  */
-public class ListEndpoint extends DefaultEndpoint<Exchange> {
+public class ListEndpoint extends DefaultEndpoint<Exchange> implements BrowsableEndpoint
{
     private List<Exchange> exchanges = new ArrayList<Exchange>();
     private TopicLoadBalancer loadBalancer = new TopicLoadBalancer();
 

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java?rev=620780&r1=620779&r2=620780&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java
Tue Feb 12 04:37:38 2008
@@ -34,6 +34,7 @@
 import org.apache.camel.Message;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
+import org.apache.camel.spi.BrowsableEndpoint;
 import org.apache.camel.impl.DefaultEndpoint;
 import org.apache.camel.impl.DefaultProducer;
 import org.apache.camel.util.ExpressionComparator;
@@ -47,7 +48,7 @@
  * 
  * @version $Revision: 1.1 $
  */
-public class MockEndpoint extends DefaultEndpoint<Exchange> {
+public class MockEndpoint extends DefaultEndpoint<Exchange> implements BrowsableEndpoint
{
     private static final transient Log LOG = LogFactory.getLog(MockEndpoint.class);
     private int expectedCount;
     private int counter;
@@ -118,6 +119,10 @@
         for (MockEndpoint endpoint : endpoints) {
             endpoint.expectsMessageCount(count);
         }
+    }
+
+    public List<Exchange> getExchanges() {
+        return getReceivedExchanges();
     }
 
     public Consumer<Exchange> createConsumer(Processor processor) throws Exception
{

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=620780&r1=620779&r2=620780&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
Tue Feb 12 04:37:38 2008
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.component.seda;
 
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Map;
 import java.util.concurrent.BlockingQueue;
 
@@ -25,15 +27,16 @@
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
 import org.apache.camel.impl.DefaultEndpoint;
+import org.apache.camel.spi.BrowsableEndpoint;
 
 /**
  * An implementation of the <a
  * href="http://activemq.apache.org/camel/queue.html">Queue components</a> for
  * asynchronous SEDA exchanges on a {@link BlockingQueue} within a CamelContext
- * 
+ *
  * @version $Revision: 519973 $
  */
-public class SedaEndpoint extends DefaultEndpoint<Exchange> {
+public class SedaEndpoint extends DefaultEndpoint<Exchange> implements BrowsableEndpoint
{
     private BlockingQueue<Exchange> queue;
 
     public SedaEndpoint(String endpointUri, Component component, BlockingQueue<Exchange>
queue) {
@@ -61,4 +64,7 @@
         return true;
     }
 
+    public List<Exchange> getExchanges() {
+        return new ArrayList<Exchange>(getQueue());
+    }
 }

Added: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/BrowsableEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/BrowsableEndpoint.java?rev=620780&view=auto
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/BrowsableEndpoint.java
(added)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/BrowsableEndpoint.java
Tue Feb 12 04:37:38 2008
@@ -0,0 +1,38 @@
+/**
+ *
+ * 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.spi;
+
+import java.util.List;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+
+/**
+ * An optional interface an {@link Endpoint} may choose to implement which allows it to expose
a way of browsing
+ * the exchanges available.
+ *
+ * @version $Revision: 1.1 $
+ */
+public interface BrowsableEndpoint extends Endpoint<Exchange> {
+    /**
+     * Return the exchanges available on this endpoint
+     *
+     * @return the exchanges on this endpoint
+     */
+    List<Exchange> getExchanges();
+}

Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/BrowsableEndpoint.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/list/ListTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/list/ListTest.java?rev=620780&r1=620779&r2=620780&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/list/ListTest.java
(original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/list/ListTest.java
Tue Feb 12 04:37:38 2008
@@ -21,6 +21,7 @@
 
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.Exchange;
+import org.apache.camel.spi.BrowsableEndpoint;
 import org.apache.camel.util.CamelContextHelper;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.commons.logging.Log;
@@ -39,10 +40,10 @@
         template.sendBody("list:foo", body1);
         template.sendBody("list:foo", body2);
 
-        List<ListEndpoint> list = CamelContextHelper.getSingletonEndpoints(context,
ListEndpoint.class);
+        List<BrowsableEndpoint> list = CamelContextHelper.getSingletonEndpoints(context,
BrowsableEndpoint.class);
         assertEquals("number of endpoints", 2, list.size());
 
-        for (ListEndpoint endpoint : list) {
+        for (BrowsableEndpoint endpoint : list) {
             List<Exchange> exchanges = endpoint.getExchanges();
 
             LOG.debug(">>>> " + endpoint + " has: " + exchanges);



Mime
View raw message