camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r620833 - in /activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component: list/ListEndpoint.java mock/MockEndpoint.java
Date Tue, 12 Feb 2008 15:55:50 GMT
Author: jstrachan
Date: Tue Feb 12 07:55:46 2008
New Revision: 620833

URL: http://svn.apache.org/viewvc?rev=620833&view=rev
Log:
minor patch so that the browsable endpoints can easily be used with the eclipse data binding
framework

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

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=620833&r1=620832&r2=620833&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 07:55:46 2008
@@ -20,6 +20,8 @@
 import java.util.List;
 import java.util.ArrayList;
 import java.util.concurrent.CopyOnWriteArrayList;
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
 
 import org.apache.camel.Exchange;
 import org.apache.camel.Consumer;
@@ -41,15 +43,18 @@
  * @version $Revision: 1.1 $
  */
 public class ListEndpoint extends DefaultEndpoint<Exchange> implements BrowsableEndpoint
{
-    private List<Exchange> exchanges = new ArrayList<Exchange>();
+    private List<Exchange> exchanges;
     private TopicLoadBalancer loadBalancer = new TopicLoadBalancer();
+    private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
 
     public ListEndpoint(String uri, CamelContext camelContext) {
         super(uri, camelContext);
+        reset();
     }
 
     public ListEndpoint(String uri, Component component) {
         super(uri, component);
+        reset();
     }
 
     public boolean isSingleton() {
@@ -64,6 +69,15 @@
         return loadBalancer;
     }
 
+
+    public void addPropertyChangeListener(PropertyChangeListener listener) {
+        propertyChangeSupport.addPropertyChangeListener(listener);
+    }
+
+    public void removePropertyChangeListener(PropertyChangeListener listener) {
+        propertyChangeSupport.removePropertyChangeListener(listener);
+    }
+
     public Producer<Exchange> createProducer() throws Exception {
         return new DefaultProducer<Exchange>(this) {
             public void process(Exchange exchange) throws Exception {
@@ -77,7 +91,11 @@
     }
 
     public void reset() {
-        exchanges = new CopyOnWriteArrayList<Exchange>();
+        exchanges = createExchangeList();
+    }
+
+    protected List<Exchange> createExchangeList() {
+        return new CopyOnWriteArrayList<Exchange>();
     }
 
     /**

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=620833&r1=620832&r2=620833&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 07:55:46 2008
@@ -24,6 +24,8 @@
 import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
+import java.beans.PropertyChangeSupport;
+import java.beans.PropertyChangeListener;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.Component;
@@ -63,6 +65,7 @@
     private int expectedMinimumCount;
     private List expectedBodyValues;
     private List actualBodyValues;
+    private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
 
     public MockEndpoint(String endpointUri, Component component) {
         super(endpointUri, component);
@@ -123,6 +126,14 @@
 
     public List<Exchange> getExchanges() {
         return getReceivedExchanges();
+    }
+
+    public void addPropertyChangeListener(PropertyChangeListener listener) {
+        propertyChangeSupport.addPropertyChangeListener(listener);
+    }
+
+    public void removePropertyChangeListener(PropertyChangeListener listener) {
+        propertyChangeSupport.removePropertyChangeListener(listener);
     }
 
     public Consumer<Exchange> createConsumer(Processor processor) throws Exception
{



Mime
View raw message