activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r379540 - in /incubator/activemq/trunk/activemq-core/src: main/java/org/apache/activemq/command/ main/java/org/apache/activemq/network/ test/java/org/apache/activemq/xbean/ test/resources/org/apache/activemq/xbean/
Date Tue, 21 Feb 2006 17:24:28 GMT
Author: chirino
Date: Tue Feb 21 09:24:27 2006
New Revision: 379540

URL: http://svn.apache.org/viewcvs?rev=379540&view=rev
Log:
Allow configuration of the included and exluded destinations in the network connector.

Modified:
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQQueue.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQTopic.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/NetworkConnector.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/xbean/ConnectorXBeanConfigTest.java
    incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/xbean/connector-test.xml

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQQueue.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQQueue.java?rev=379540&r1=379539&r2=379540&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQQueue.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQQueue.java
Tue Feb 21 09:24:27 2006
@@ -20,6 +20,9 @@
 import javax.jms.Queue;
 
 /**
+ * 
+ * @org.apache.xbean.XBean element="queue" description="An ActiveMQ Queue Destination"
+ *                  
  * @openwire:marshaller code="100"
  * @version $Revision: 1.5 $
  */

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQTopic.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQTopic.java?rev=379540&r1=379539&r2=379540&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQTopic.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQTopic.java
Tue Feb 21 09:24:27 2006
@@ -20,6 +20,9 @@
 import javax.jms.Topic;
 
 /**
+ * 
+ * @org.apache.xbean.XBean element="topic" description="An ActiveMQ Topic Destination"
+ *                  
  * @openwire:marshaller code="101"
  * @version $Revision: 1.5 $
  */

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/NetworkConnector.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/NetworkConnector.java?rev=379540&r1=379539&r2=379540&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/NetworkConnector.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/NetworkConnector.java
Tue Feb 21 09:24:27 2006
@@ -20,10 +20,10 @@
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Set;
 
 import org.apache.activemq.Service;
-import org.apache.activemq.broker.BrokerService;
 import org.apache.activemq.command.ActiveMQDestination;
 import org.apache.activemq.command.DiscoveryEvent;
 import org.apache.activemq.transport.Transport;
@@ -36,6 +36,7 @@
 import org.apache.commons.logging.LogFactory;
 
 import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap;
+import edu.emory.mathcs.backport.java.util.concurrent.CopyOnWriteArrayList;
 
 /**
  * @org.apache.xbean.XBean
@@ -52,9 +53,9 @@
     private ConcurrentHashMap bridges = new ConcurrentHashMap();
     private Set durableDestinations;
     private boolean failover=true;
-    private ActiveMQDestination[] excludedDestinations;
-    private ActiveMQDestination[] dynamicallyIncludedDestinations;
-    private ActiveMQDestination[] staticallyIncludedDestinations;
+    private List excludedDestinations = new CopyOnWriteArrayList();
+    private List dynamicallyIncludedDestinations = new CopyOnWriteArrayList();
+    private List staticallyIncludedDestinations = new CopyOnWriteArrayList();
     private boolean dynamicOnly = false;
     private boolean conduitSubscriptions = true;
     private boolean decreaseNetworkConsumerPriority;
@@ -239,21 +240,6 @@
     }
 
 
-    /**
-     * @return Returns the dynamicallyIncludedDestinations.
-     */
-    public ActiveMQDestination[] getDynamicallyIncludedDestinations(){
-        return dynamicallyIncludedDestinations;
-    }
-
-
-    /**
-     * @param dynamicallyIncludedDestinations The dynamicallyIncludedDestinations to set.
-     */
-    public void setDynamicallyIncludedDestinations(ActiveMQDestination[] dynamicallyIncludedDestinations){
-        this.dynamicallyIncludedDestinations=dynamicallyIncludedDestinations;
-    }
-
 
     /**
      * @return Returns the dynamicOnly.
@@ -317,35 +303,52 @@
     /**
      * @return Returns the excludedDestinations.
      */
-    public ActiveMQDestination[] getExcludedDestinations(){
+    public List getExcludedDestinations(){
         return excludedDestinations;
     }
-
-
     /**
      * @param excludedDestinations The excludedDestinations to set.
      */
-    public void setExcludedDestinations(ActiveMQDestination[] exludedDestinations){
+    public void setExcludedDestinations(List exludedDestinations){
         this.excludedDestinations=exludedDestinations;
+    }    
+    public void addExcludedDestination(ActiveMQDestination destiantion) {
+        this.excludedDestinations.add(destiantion);
     }
 
 
     /**
      * @return Returns the staticallyIncludedDestinations.
      */
-    public ActiveMQDestination[] getStaticallyIncludedDestinations(){
+    public List getStaticallyIncludedDestinations(){
         return staticallyIncludedDestinations;
     }
-
-
     /**
      * @param staticallyIncludedDestinations The staticallyIncludedDestinations to set.
      */
-    public void setStaticallyIncludedDestinations(ActiveMQDestination[] staticallyIncludedDestinations){
+    public void setStaticallyIncludedDestinations(List staticallyIncludedDestinations){
         this.staticallyIncludedDestinations=staticallyIncludedDestinations;
     }
+    public void addStaticallyIncludedDestination(ActiveMQDestination destiantion) {
+        this.staticallyIncludedDestinations.add(destiantion);
+    }
     
    
+    /**
+     * @return Returns the dynamicallyIncludedDestinations.
+     */
+    public List getDynamicallyIncludedDestinations(){
+        return dynamicallyIncludedDestinations;
+    }
+    /**
+     * @param dynamicallyIncludedDestinations The dynamicallyIncludedDestinations to set.
+     */
+    public void setDynamicallyIncludedDestinations(List dynamicallyIncludedDestinations){
+        this.dynamicallyIncludedDestinations = dynamicallyIncludedDestinations;
+    }
+    public void addDynamicallyIncludedDestination(ActiveMQDestination destiantion) {
+        this.dynamicallyIncludedDestinations.add(destiantion);
+    }
 
     
     // Implementation methods
@@ -391,9 +394,19 @@
         result.setLocalBrokerName(brokerName);
         result.setNetworkTTL(getNetworkTTL());
         result.setDecreaseNetworkConsumerPriority(isDecreaseNetworkConsumerPriority());
-        result.setDynamicallyIncludedDestinations(getDynamicallyIncludedDestinations());
-        result.setExcludedDestinations(getExcludedDestinations());
-        result.setStaticallyIncludedDestinations(getStaticallyIncludedDestinations());
+        
+        List destsList = getDynamicallyIncludedDestinations();
+        ActiveMQDestination dests[] = (ActiveMQDestination[]) destsList.toArray(new ActiveMQDestination[destsList.size()]);
       
+        result.setDynamicallyIncludedDestinations(dests);
+        
+        destsList = getExcludedDestinations();
+        dests = (ActiveMQDestination[]) destsList.toArray(new ActiveMQDestination[destsList.size()]);
       
+        result.setExcludedDestinations(dests);
+
+        destsList = getStaticallyIncludedDestinations();
+        dests = (ActiveMQDestination[]) destsList.toArray(new ActiveMQDestination[destsList.size()]);
       
+        result.setStaticallyIncludedDestinations(dests);
+        
         if (durableDestinations != null){
             ActiveMQDestination[] dest = new ActiveMQDestination[durableDestinations.size()];
             dest = (ActiveMQDestination[]) durableDestinations.toArray(dest);

Modified: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/xbean/ConnectorXBeanConfigTest.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/xbean/ConnectorXBeanConfigTest.java?rev=379540&r1=379539&r2=379540&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/xbean/ConnectorXBeanConfigTest.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/xbean/ConnectorXBeanConfigTest.java
Tue Feb 21 09:24:27 2006
@@ -17,12 +17,16 @@
 package org.apache.activemq.xbean;
 
 import java.net.URI;
+import java.util.List;
 
 import junit.framework.TestCase;
 
 import org.apache.activemq.broker.BrokerFactory;
 import org.apache.activemq.broker.BrokerService;
 import org.apache.activemq.broker.TransportConnector;
+import org.apache.activemq.command.ActiveMQQueue;
+import org.apache.activemq.command.ActiveMQTopic;
+import org.apache.activemq.network.NetworkConnector;
 
 /**
  * 
@@ -38,6 +42,17 @@
         
         assertEquals( new URI("tcp://localhost:61636"), connector.getUri() );
         assertTrue( connector.getTaskRunnerFactory() == brokerService.getTaskRunnerFactory()
);
+        
+        
+        NetworkConnector netConnector = (NetworkConnector) brokerService.getNetworkConnectors().get(0);
+        List excludedDestinations = netConnector.getExcludedDestinations();
+        assertEquals(new ActiveMQQueue("exclude.test.foo"), excludedDestinations.get(0));
+        assertEquals(new ActiveMQTopic("exclude.test.bar"), excludedDestinations.get(1));
+        
+        List dynamicallyIncludedDestinations = netConnector.getDynamicallyIncludedDestinations();
+        assertEquals(new ActiveMQQueue("include.test.foo"), dynamicallyIncludedDestinations.get(0));
+        assertEquals(new ActiveMQTopic("include.test.bar"), dynamicallyIncludedDestinations.get(1));
+        
     }
 
     protected void setUp() throws Exception {

Modified: incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/xbean/connector-test.xml
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/xbean/connector-test.xml?rev=379540&r1=379539&r2=379540&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/xbean/connector-test.xml
(original)
+++ incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/xbean/connector-test.xml
Tue Feb 21 09:24:27 2006
@@ -25,6 +25,20 @@
       <transportConnector uri="tcp://localhost:61636" />
     </transportConnectors>
 
+    <networkConnectors>
+      <networkConnector uri="static://(tcp://localhost:61616)">
+      	<excludedDestinations>
+      		<queue physicalName="exclude.test.foo"/>
+      		<topic physicalName="exclude.test.bar"/>
+      	</excludedDestinations>
+      	<dynamicallyIncludedDestinations>
+      		<queue physicalName="include.test.foo"/>
+      		<topic physicalName="include.test.bar"/>
+      	</dynamicallyIncludedDestinations>
+      </networkConnector>
+    </networkConnectors>
+	
+
   </broker>
 
 </beans>



Mime
View raw message