activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r419629 - in /incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker: BrokerFilter.java EmptyBroker.java ErrorBroker.java MutableBrokerFilter.java region/AbstractRegion.java region/Region.java region/RegionBroker.java
Date Thu, 06 Jul 2006 17:50:57 GMT
Author: jstrachan
Date: Thu Jul  6 10:50:56 2006
New Revision: 419629

URL: http://svn.apache.org/viewvc?rev=419629&view=rev
Log:
added a helper method so a BrokerFilter can lookup all the active destinations for a specific
wildcard which can be useful for implementing things like AMQ-452 to support virtual destinations

Modified:
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerFilter.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/EmptyBroker.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/ErrorBroker.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/MutableBrokerFilter.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractRegion.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Region.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/RegionBroker.java

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerFilter.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerFilter.java?rev=419629&r1=419628&r2=419629&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerFilter.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerFilter.java
Thu Jul  6 10:50:56 2006
@@ -16,8 +16,6 @@
  */
 package org.apache.activemq.broker;
 
-import java.util.Map;
-import java.util.Set;
 import org.apache.activemq.broker.region.Destination;
 import org.apache.activemq.broker.region.Subscription;
 import org.apache.activemq.command.ActiveMQDestination;
@@ -35,6 +33,9 @@
 import org.apache.activemq.command.SessionInfo;
 import org.apache.activemq.command.TransactionId;
 
+import java.util.Map;
+import java.util.Set;
+
 /**
  * Allows you to intercept broker operation so that features such as security can be 
  * implemented as a pluggable filter.
@@ -48,7 +49,6 @@
     public BrokerFilter(Broker next) {
         this.next=next;
     }
-    
    
     public Broker getAdaptor(Class type){
         if (type.isInstance(this)){
@@ -59,6 +59,10 @@
 
     public Map getDestinationMap() {
         return next.getDestinationMap();
+    }
+
+    public Set getDestinations(ActiveMQDestination destination) {
+        return next.getDestinations(destination);
     }
 
     public void acknowledge(ConnectionContext context, MessageAck ack) throws Exception {

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/EmptyBroker.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/EmptyBroker.java?rev=419629&r1=419628&r2=419629&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/EmptyBroker.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/EmptyBroker.java
Thu Jul  6 10:50:56 2006
@@ -16,9 +16,6 @@
  */
 package org.apache.activemq.broker;
 
-import java.util.Collections;
-import java.util.Map;
-import java.util.Set;
 import org.apache.activemq.broker.region.Destination;
 import org.apache.activemq.broker.region.Subscription;
 import org.apache.activemq.command.ActiveMQDestination;
@@ -36,6 +33,10 @@
 import org.apache.activemq.command.SessionInfo;
 import org.apache.activemq.command.TransactionId;
 
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+
 /**
  * Dumb implementation - used to be overriden by listeners
  * 
@@ -60,6 +61,10 @@
 
     public Map getDestinationMap() {
         return Collections.EMPTY_MAP;
+    }
+
+    public Set getDestinations(ActiveMQDestination destination) {
+        return Collections.EMPTY_SET;
     }
 
     public void addConnection(ConnectionContext context,ConnectionInfo info) throws Exception{

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/ErrorBroker.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/ErrorBroker.java?rev=419629&r1=419628&r2=419629&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/ErrorBroker.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/ErrorBroker.java
Thu Jul  6 10:50:56 2006
@@ -54,6 +54,10 @@
         return Collections.EMPTY_MAP;
     }
 
+    public Set getDestinations(ActiveMQDestination destination) {
+        return Collections.EMPTY_SET;
+    }
+
     public Broker getAdaptor(Class type){
         if (type.isInstance(this)){
             return this;

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/MutableBrokerFilter.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/MutableBrokerFilter.java?rev=419629&r1=419628&r2=419629&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/MutableBrokerFilter.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/MutableBrokerFilter.java
Thu Jul  6 10:50:56 2006
@@ -16,8 +16,6 @@
  */
 package org.apache.activemq.broker;
 
-import java.util.Map;
-import java.util.Set;
 import org.apache.activemq.broker.region.Destination;
 import org.apache.activemq.broker.region.Subscription;
 import org.apache.activemq.command.ActiveMQDestination;
@@ -35,6 +33,9 @@
 import org.apache.activemq.command.SessionInfo;
 import org.apache.activemq.command.TransactionId;
 
+import java.util.Map;
+import java.util.Set;
+
 /**
  * Like a BrokerFilter but it allows you to switch the getNext().broker.  This has more 
  * overhead than a BrokerFilter since access to the getNext().broker has to synchronized
@@ -72,6 +73,10 @@
         
     public Map getDestinationMap() {
         return getNext().getDestinationMap();
+    }
+
+    public Set getDestinations(ActiveMQDestination destination) {
+        return getNext().getDestinations(destination);
     }
 
     public void acknowledge(ConnectionContext context, MessageAck ack) throws Exception {

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractRegion.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractRegion.java?rev=419629&r1=419628&r2=419629&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractRegion.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractRegion.java
Thu Jul  6 10:50:56 2006
@@ -134,6 +134,17 @@
         }
     }
     
+    /**
+     * Provide an exact or wildcard lookup of destinations in the region
+     * 
+     * @return a set of matching destination objects.
+     */
+    public Set getDestinations(ActiveMQDestination destination) {
+        synchronized(destinationsMutex){
+            return destinationMap.get(destination);
+        }
+    }
+    
     public Map getDestinationMap() {
         synchronized(destinationsMutex){
             return new HashMap(destinations);

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Region.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Region.java?rev=419629&r1=419628&r2=419629&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Region.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Region.java
Thu Jul  6 10:50:56 2006
@@ -26,6 +26,7 @@
 import org.apache.activemq.command.RemoveSubscriptionInfo;
 
 import java.util.Map;
+import java.util.Set;
 
 /**
  * A Region is used to implement the different QOS options available to 
@@ -114,5 +115,12 @@
     public void processDispatchNotification(MessageDispatchNotification messageDispatchNotification)
throws Exception;
 
     public void gc();
+
+    /**
+     * Provide an exact or wildcard lookup of destinations in the region
+     * 
+     * @return a set of matching destination objects.
+     */
+    public Set getDestinations(ActiveMQDestination destination);
     
 }

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/RegionBroker.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/RegionBroker.java?rev=419629&r1=419628&r2=419629&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/RegionBroker.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/RegionBroker.java
Thu Jul  6 10:50:56 2006
@@ -103,6 +103,21 @@
         return answer;
     }
 
+    public Set getDestinations(ActiveMQDestination destination) {
+        switch(destination.getDestinationType()) {
+        case ActiveMQDestination.QUEUE_TYPE:
+            return queueRegion.getDestinations(destination);
+        case ActiveMQDestination.TOPIC_TYPE:
+            return topicRegion.getDestinations(destination);
+        case ActiveMQDestination.TEMP_QUEUE_TYPE:
+            return tempQueueRegion.getDestinations(destination);
+        case ActiveMQDestination.TEMP_TOPIC_TYPE:
+            return tempTopicRegion.getDestinations(destination);
+        default:
+            return Collections.EMPTY_SET;
+        }
+    }
+
     public Broker getAdaptor(Class type){
         if (type.isInstance(this)){
             return this;



Mime
View raw message