activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1334227 - in /activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util: AdvisorySupport.cpp AdvisorySupport.h
Date Fri, 04 May 2012 22:13:37 GMT
Author: tabish
Date: Fri May  4 22:13:37 2012
New Revision: 1334227

URL: http://svn.apache.org/viewvc?rev=1334227&view=rev
Log:
Add a couple missing methods to make the API more complete.

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/AdvisorySupport.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/AdvisorySupport.h

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/AdvisorySupport.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/AdvisorySupport.cpp?rev=1334227&r1=1334226&r2=1334227&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/AdvisorySupport.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/AdvisorySupport.cpp Fri
May  4 22:13:37 2012
@@ -233,6 +233,21 @@ ActiveMQDestination* AdvisorySupport::ge
 }
 
 ////////////////////////////////////////////////////////////////////////////////
+ActiveMQDestination* AdvisorySupport::getExpiredTopicMessageAdvisoryTopic(const cms::Destination*
destination) {
+
+    const ActiveMQDestination* transformed = NULL;
+
+    bool doDelete = ActiveMQMessageTransformation::transformDestination(destination, &transformed);
+    ActiveMQDestination* advisoryDest = getExpiredTopicMessageAdvisoryTopic(transformed);
+
+    if (doDelete) {
+        delete transformed;
+    }
+
+    return advisoryDest;
+}
+
+////////////////////////////////////////////////////////////////////////////////
 ActiveMQDestination* AdvisorySupport::getExpiredTopicMessageAdvisoryTopic(const ActiveMQDestination*
destination) {
     return new ActiveMQTopic(EXPIRED_TOPIC_MESSAGES_TOPIC_PREFIX + destination->getPhysicalName());
 }
@@ -519,35 +534,50 @@ bool AdvisorySupport::isDestinationAdvis
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-bool AdvisorySupport::isTempDestinationAdvisoryTopic(const ActiveMQDestination* destination)
{
+bool AdvisorySupport::isDestinationAdvisoryTopic(const ActiveMQDestination* destination)
{
     if (destination->isComposite()) {
         ArrayList< Pointer<ActiveMQDestination> > compositeDestinations = destination->getCompositeDestinations();
         for (int i = 0; i < compositeDestinations.size(); i++) {
-            if (!isTempDestinationAdvisoryTopic(compositeDestinations.get(i).get())) {
+            if (!isDestinationAdvisoryTopic(compositeDestinations.get(i).get())) {
                 return false;
             }
         }
-        return true;
+        return false;
     } else {
         std::string name = destination->getPhysicalName();
-        return name == ADVISORY_TOPIC_PREFIX + "TempQueue" || name == ADVISORY_TOPIC_PREFIX
+ "TempTopic";
+        return name == ADVISORY_TOPIC_PREFIX + "TempQueue" || name == ADVISORY_TOPIC_PREFIX
+ "TempTopic" ||
+               name == ADVISORY_TOPIC_PREFIX + "Queue" || name == ADVISORY_TOPIC_PREFIX +
"Topic";
     }
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-bool AdvisorySupport::isDestinationAdvisoryTopic(const ActiveMQDestination* destination)
{
+bool AdvisorySupport::isTempDestinationAdvisoryTopic(const cms::Destination* destination)
{
+
+    const ActiveMQDestination* transformed = NULL;
+
+    bool doDelete = ActiveMQMessageTransformation::transformDestination(destination, &transformed);
+    bool result = isTempDestinationAdvisoryTopic(transformed);
+
+    if (doDelete) {
+        delete transformed;
+    }
+
+    return result;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool AdvisorySupport::isTempDestinationAdvisoryTopic(const ActiveMQDestination* destination)
{
     if (destination->isComposite()) {
         ArrayList< Pointer<ActiveMQDestination> > compositeDestinations = destination->getCompositeDestinations();
         for (int i = 0; i < compositeDestinations.size(); i++) {
-            if (!isDestinationAdvisoryTopic(compositeDestinations.get(i).get())) {
+            if (!isTempDestinationAdvisoryTopic(compositeDestinations.get(i).get())) {
                 return false;
             }
         }
-        return false;
+        return true;
     } else {
         std::string name = destination->getPhysicalName();
-        return name == ADVISORY_TOPIC_PREFIX + "TempQueue" || name == ADVISORY_TOPIC_PREFIX
+ "TempTopic" ||
-               name == ADVISORY_TOPIC_PREFIX + "Queue" || name == ADVISORY_TOPIC_PREFIX +
"Topic";
+        return name == ADVISORY_TOPIC_PREFIX + "TempQueue" || name == ADVISORY_TOPIC_PREFIX
+ "TempTopic";
     }
 }
 
@@ -864,6 +894,37 @@ bool AdvisorySupport::isMessageDiscarded
 }
 
 ////////////////////////////////////////////////////////////////////////////////
+bool AdvisorySupport::isMessageDLQdAdvisoryTopic(const cms::Destination* destination) {
+
+    const ActiveMQDestination* transformed = NULL;
+
+    bool doDelete = ActiveMQMessageTransformation::transformDestination(destination, &transformed);
+    bool result = isMessageDLQdAdvisoryTopic(transformed);
+
+    if (doDelete) {
+        delete transformed;
+    }
+
+    return result;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool AdvisorySupport::isMessageDLQdAdvisoryTopic(const ActiveMQDestination* destination)
{
+    if (destination->isComposite()) {
+        ArrayList< Pointer<ActiveMQDestination> > compositeDestinations = destination->getCompositeDestinations();
+        for (int i = 0; i < compositeDestinations.size(); i++) {
+            if (isMessageDLQdAdvisoryTopic(compositeDestinations.get(i).get())) {
+                return true;
+            }
+        }
+        return false;
+    } else {
+        return destination->isTopic() &&
+               destination->getPhysicalName().find(MESSAGE_DLQ_TOPIC_PREFIX) == 0;
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
 bool AdvisorySupport::isFullAdvisoryTopic(const cms::Destination* destination) {
 
     const ActiveMQDestination* transformed = NULL;

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/AdvisorySupport.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/AdvisorySupport.h?rev=1334227&r1=1334226&r2=1334227&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/AdvisorySupport.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/AdvisorySupport.h Fri
May  4 22:13:37 2012
@@ -200,6 +200,14 @@ namespace util {
          *
          * @return Pointer to the requested Advisory Topic destination.
          */
+        static commands::ActiveMQDestination* getExpiredTopicMessageAdvisoryTopic(const cms::Destination*
destination);
+
+        /**
+         * Returns a new Pointer to an Destination that will consume advisory messages for
expiration events
+         * for messages on the specified destination.
+         *
+         * @return Pointer to the requested Advisory Topic destination.
+         */
         static commands::ActiveMQDestination* getExpiredTopicMessageAdvisoryTopic(const commands::ActiveMQDestination*
destination);
 
         /**
@@ -408,14 +416,19 @@ namespace util {
         static bool isDestinationAdvisoryTopic(const cms::Destination* destination);
 
         /**
+         * @returns true if the specified destination is a Destination advisory topic.
+         */
+        static bool isDestinationAdvisoryTopic(const commands::ActiveMQDestination* destination);
+
+        /**
          * @returns true if the specified destination is a Temporary Destination advisory
topic.
          */
-        static bool isTempDestinationAdvisoryTopic(const commands::ActiveMQDestination* destination);
+        static bool isTempDestinationAdvisoryTopic(const cms::Destination* destination);
 
         /**
-         * @returns true if the specified destination is a Destination advisory topic.
+         * @returns true if the specified destination is a Temporary Destination advisory
topic.
          */
-        static bool isDestinationAdvisoryTopic(const commands::ActiveMQDestination* destination);
+        static bool isTempDestinationAdvisoryTopic(const commands::ActiveMQDestination* destination);
 
         /**
          * @returns true if the specified destination is an advisory topic.
@@ -518,6 +531,16 @@ namespace util {
         static bool isMessageDiscardedAdvisoryTopic(const commands::ActiveMQDestination*
destination);
 
         /**
+         * @returns true if the specified destination is an Message DLQ'd advisory topic.
+         */
+        static bool isMessageDLQdAdvisoryTopic(const cms::Destination* destination);
+
+        /**
+         * @returns true if the specified destination is an Message DLQ'd advisory topic.
+         */
+        static bool isMessageDLQdAdvisoryTopic(const commands::ActiveMQDestination* destination);
+
+        /**
          * @returns true if the specified destination is an Destination Full advisory topic.
          */
         static bool isFullAdvisoryTopic(const cms::Destination* destination);



Mime
View raw message