Author: jstrachan
Date: Tue Aug 19 05:05:58 2008
New Revision: 687034
URL: http://svn.apache.org/viewvc?rev=687034&view=rev
Log:
added some new MBean helper methods
Modified:
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/SubscriptionView.java
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/SubscriptionViewMBean.java
Modified:
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/SubscriptionView.java
URL:
http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/SubscriptionView.java?rev=687034&r1=687033&r2=687034&view=diff
==============================================================================
---
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/SubscriptionView.java
(original)
+++
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/SubscriptionView.java
Tue Aug 19 05:05:58 2008
@@ -21,6 +21,9 @@
import org.apache.activemq.broker.region.Subscription;
import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.command.ConsumerInfo;
+import org.apache.activemq.command.ActiveMQQueue;
+import org.apache.activemq.command.ActiveMQTopic;
+import org.apache.activemq.filter.DestinationFilter;
/**
* @version $Revision: 1.5 $
@@ -276,4 +279,30 @@
return subscription != null ? subscription.getPrefetchSize() : 0;
}
+ public boolean isMatchingQueue(String queueName) {
+ if (isDestinationQueue()) {
+ return matchesDestination(new ActiveMQQueue(queueName));
+ }
+ return false;
+ }
+
+ public boolean isMatchingTopic(String topicName) {
+ if (isDestinationTopic()) {
+ return matchesDestination(new ActiveMQTopic(topicName));
+ }
+ return false;
+ }
+
+ /**
+ * Return true if this subscription matches the given destination
+ *
+ * @param destination the destination to compare against
+ * @return true if this subscription matches the given destination
+ */
+ public boolean matchesDestination(ActiveMQDestination destination) {
+ ActiveMQDestination subscriptionDestination =
subscription.getActiveMQDestination();
+ DestinationFilter filter =
DestinationFilter.parseFilter(subscriptionDestination);
+ return filter.matches(destination);
+ }
+
}
Modified:
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/SubscriptionViewMBean.java
URL:
http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/SubscriptionViewMBean.java?rev=687034&r1=687033&r2=687034&view=diff
==============================================================================
---
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/SubscriptionViewMBean.java
(original)
+++
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/SubscriptionViewMBean.java
Tue Aug 19 05:05:58 2008
@@ -154,4 +154,20 @@
* consumers.
*/
String getSubcriptionName();
+
+ /**
+ * Returns true if this subscription (which may be using wildcards)
matches the given queue name
+ *
+ * @param queueName the JMS queue name to match against
+ * @return true if this subscription matches the given queue or false if
not
+ */
+ boolean isMatchingQueue(String queueName);
+
+ /**
+ * Returns true if this subscription (which may be using wildcards)
matches the given topic name
+ *
+ * @param topicName the JMS topic name to match against
+ * @return true if this subscription matches the given topic or false if
not
+ */
+ boolean isMatchingTopic(String topicName);
}