activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r380688 - in /incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region: AbstractSubscription.java QueueBrowserSubscription.java QueueSubscription.java Subscription.java
Date Fri, 24 Feb 2006 15:24:38 GMT
Author: jstrachan
Date: Fri Feb 24 07:24:36 2006
New Revision: 380688

URL: http://svn.apache.org/viewcvs?rev=380688&view=rev
Log:
refactor of the message-level security implementation so that it works with any QoS, not just
queues. Also fixed bug in Message Groups where not setting the sequence ID broke the message
groups

Modified:
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractSubscription.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/QueueBrowserSubscription.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/QueueSubscription.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Subscription.java

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractSubscription.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractSubscription.java?rev=380688&r1=380687&r2=380688&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractSubscription.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractSubscription.java
Fri Feb 24 07:24:36 2006
@@ -19,6 +19,8 @@
 import javax.jms.InvalidSelectorException;
 import javax.jms.JMSException;
 
+import java.io.IOException;
+
 import org.apache.activemq.broker.Broker;
 import org.apache.activemq.broker.ConnectionContext;
 import org.apache.activemq.command.ActiveMQDestination;
@@ -77,14 +79,14 @@
         return rc;
     }
 
-    public boolean matches(MessageReference node, MessageEvaluationContext context) {
+    public boolean matches(MessageReference node, MessageEvaluationContext context) throws
IOException {
         ConsumerId targetConsumerId = node.getTargetConsumerId();
         if ( targetConsumerId!=null) {
             if( !targetConsumerId.equals(info.getConsumerId()) )
                 return false;
         }
         try {
-            return selector == null || selector.matches(context);
+            return (selector == null || selector.matches(context)) && this.context.isAllowedToConsume(node);
         } catch (JMSException e) {
             log.info("Selector failed to evaluate: " + e.getMessage(), e);
             return false;

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/QueueBrowserSubscription.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/QueueBrowserSubscription.java?rev=380688&r1=380687&r2=380688&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/QueueBrowserSubscription.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/QueueBrowserSubscription.java
Fri Feb 24 07:24:36 2006
@@ -18,6 +18,8 @@
 
 import javax.jms.InvalidSelectorException;
 
+import java.io.IOException;
+
 import org.apache.activemq.broker.Broker;
 import org.apache.activemq.broker.ConnectionContext;
 import org.apache.activemq.command.ConsumerInfo;
@@ -63,7 +65,7 @@
             return super.createMessageDispatch(node, message);
         }
     }
-    public boolean matches(MessageReference node, MessageEvaluationContext context) {
+    public boolean matches(MessageReference node, MessageEvaluationContext context) throws
IOException {
         return !browseDone && super.matches(node, context);
     }
 }

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/QueueSubscription.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/QueueSubscription.java?rev=380688&r1=380687&r2=380688&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/QueueSubscription.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/QueueSubscription.java
Fri Feb 24 07:24:36 2006
@@ -72,11 +72,6 @@
         if( node.isAcked() )
             return false;
         
-        // allow user-level security
-        if (!context.isAllowedToConsume(n)) {
-            return false;
-        }
-            
         // Keep message groups together.
         String groupId = node.getGroupID();
         int sequence = node.getGroupSequence();
@@ -85,7 +80,7 @@
             MessageGroupMap messageGroupOwners = ((Queue)node.getRegionDestination()).getMessageGroupOwners();
           
             
             // If we can own the first, then no-one else should own the rest.
-            if( sequence==0 ) {
+            if( sequence == 1 ) {
                 if( node.lock(this) ) {
                     messageGroupOwners.put(groupId, info.getConsumerId());
                     return true;

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Subscription.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Subscription.java?rev=380688&r1=380687&r2=380688&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Subscription.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Subscription.java
Fri Feb 24 07:24:36 2006
@@ -51,8 +51,9 @@
      * @param node 
      * @param context
      * @return
+     * @throws IOException 
      */
-    boolean matches(MessageReference node, MessageEvaluationContext context);
+    boolean matches(MessageReference node, MessageEvaluationContext context) throws IOException;
     
     /**
      * Is the subscription interested in messages in the destination?



Mime
View raw message