activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1334183 [3/4] - in /activemq/activemq-cpp/trunk/activemq-cpp/src: main/ main/activemq/commands/ main/activemq/core/ main/activemq/core/kernels/ main/activemq/state/ main/activemq/util/ main/cms/ main/decaf/lang/ main/decaf/util/ main/decaf...
Date Fri, 04 May 2012 21:04:54 GMT
Added: 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=1334183&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/AdvisorySupport.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/AdvisorySupport.cpp Fri May  4 21:04:52 2012
@@ -0,0 +1,927 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "AdvisorySupport.h"
+
+#include <activemq/commands/ActiveMQDestination.h>
+#include <activemq/commands/ActiveMQTopic.h>
+#include <activemq/util/ActiveMQMessageTransformation.h>
+#include <activemq/exceptions/ActiveMQException.h>
+
+#include <decaf/lang/exceptions/IllegalArgumentException.h>
+#include <decaf/util/ArrayList.h>
+
+using namespace activemq;
+using namespace activemq::util;
+using namespace activemq::commands;
+using namespace decaf::util;
+using namespace decaf::lang;
+using namespace decaf::lang::exceptions;
+
+////////////////////////////////////////////////////////////////////////////////
+const std::string AdvisorySupport::ADVISORY_TOPIC_PREFIX = "ActiveMQ.Advisory.";
+const std::string AdvisorySupport::PRODUCER_ADVISORY_TOPIC_PREFIX = ADVISORY_TOPIC_PREFIX + "Producer.";
+const std::string AdvisorySupport::QUEUE_PRODUCER_ADVISORY_TOPIC_PREFIX = PRODUCER_ADVISORY_TOPIC_PREFIX + "Queue.";
+const std::string AdvisorySupport::TOPIC_PRODUCER_ADVISORY_TOPIC_PREFIX = PRODUCER_ADVISORY_TOPIC_PREFIX + "Topic.";
+const std::string AdvisorySupport::CONSUMER_ADVISORY_TOPIC_PREFIX = ADVISORY_TOPIC_PREFIX + "Consumer.";
+const std::string AdvisorySupport::QUEUE_CONSUMER_ADVISORY_TOPIC_PREFIX = CONSUMER_ADVISORY_TOPIC_PREFIX + "Queue.";
+const std::string AdvisorySupport::TOPIC_CONSUMER_ADVISORY_TOPIC_PREFIX = CONSUMER_ADVISORY_TOPIC_PREFIX + "Topic.";
+const std::string AdvisorySupport::EXPIRED_TOPIC_MESSAGES_TOPIC_PREFIX = ADVISORY_TOPIC_PREFIX + "Expired.Topic.";
+const std::string AdvisorySupport::EXPIRED_QUEUE_MESSAGES_TOPIC_PREFIX = ADVISORY_TOPIC_PREFIX + "Expired.Queue.";
+const std::string AdvisorySupport::NO_TOPIC_CONSUMERS_TOPIC_PREFIX = ADVISORY_TOPIC_PREFIX + "NoConsumer.Topic.";
+const std::string AdvisorySupport::NO_QUEUE_CONSUMERS_TOPIC_PREFIX = ADVISORY_TOPIC_PREFIX + "NoConsumer.Queue.";
+const std::string AdvisorySupport::SLOW_CONSUMER_TOPIC_PREFIX = ADVISORY_TOPIC_PREFIX + "SlowConsumer.";
+const std::string AdvisorySupport::FAST_PRODUCER_TOPIC_PREFIX = ADVISORY_TOPIC_PREFIX + "FastProducer.";
+const std::string AdvisorySupport::MESSAGE_DISCAREDED_TOPIC_PREFIX = ADVISORY_TOPIC_PREFIX + "MessageDiscarded.";
+const std::string AdvisorySupport::FULL_TOPIC_PREFIX = ADVISORY_TOPIC_PREFIX + "FULL.";
+const std::string AdvisorySupport::MESSAGE_DELIVERED_TOPIC_PREFIX = ADVISORY_TOPIC_PREFIX + "MessageDelivered.";
+const std::string AdvisorySupport::MESSAGE_CONSUMED_TOPIC_PREFIX = ADVISORY_TOPIC_PREFIX + "MessageConsumed.";
+const std::string AdvisorySupport::MESSAGE_DLQ_TOPIC_PREFIX = ADVISORY_TOPIC_PREFIX + "MessageDLQd.";
+const std::string AdvisorySupport::MASTER_BROKER_TOPIC_PREFIX = ADVISORY_TOPIC_PREFIX + "MasterBroker";
+const std::string AdvisorySupport::NETWORK_BRIDGE_TOPIC_PREFIX = ADVISORY_TOPIC_PREFIX + "NetworkBridge";
+const std::string AdvisorySupport::AGENT_TOPIC = "ActiveMQ.Agent";
+const std::string AdvisorySupport::ADIVSORY_MESSAGE_TYPE = "Advisory";
+const std::string AdvisorySupport::MSG_PROPERTY_ORIGIN_BROKER_ID = "originBrokerId";
+const std::string AdvisorySupport::MSG_PROPERTY_ORIGIN_BROKER_NAME = "originBrokerName";
+const std::string AdvisorySupport::MSG_PROPERTY_ORIGIN_BROKER_URL = "originBrokerURL";
+const std::string AdvisorySupport::MSG_PROPERTY_USAGE_NAME = "usageName";
+const std::string AdvisorySupport::MSG_PROPERTY_CONSUMER_ID = "consumerId";
+const std::string AdvisorySupport::MSG_PROPERTY_PRODUCER_ID = "producerId";
+const std::string AdvisorySupport::MSG_PROPERTY_MESSAGE_ID = "orignalMessageId";
+const std::string AdvisorySupport::MSG_PROPERTY_CONSUMER_COUNT = "consumerCount";
+const std::string AdvisorySupport::MSG_PROPERTY_DISCARDED_COUNT = "discardedCount";
+
+////////////////////////////////////////////////////////////////////////////////
+AdvisorySupport::AdvisorySupport() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+AdvisorySupport::~AdvisorySupport() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQDestination* AdvisorySupport::getTempDestinationCompositeAdvisoryTopic() {
+
+    ActiveMQTopic queues(ADVISORY_TOPIC_PREFIX + "TempQueue");
+    ActiveMQTopic topics(ADVISORY_TOPIC_PREFIX + "TempTopic");
+
+    std::string name = queues.getPhysicalName() + "," + topics.getPhysicalName();
+    return new ActiveMQTopic(name);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQDestination* AdvisorySupport::getAllDestinationsCompositeAdvisoryTopic() {
+
+    ActiveMQTopic queues(ADVISORY_TOPIC_PREFIX + "Queue");
+    ActiveMQTopic topics(ADVISORY_TOPIC_PREFIX + "Topic");
+    ActiveMQTopic tempQueues(ADVISORY_TOPIC_PREFIX + "TempQueue");
+    ActiveMQTopic tempTopics(ADVISORY_TOPIC_PREFIX + "TempTopic");
+
+    std::string name = queues.getPhysicalName() + "," + topics.getPhysicalName() + "," +
+                       tempQueues.getPhysicalName() + "," + tempTopics.getPhysicalName();
+    return new ActiveMQTopic(name);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQDestination* AdvisorySupport::getConnectionAdvisoryTopic() {
+    return new ActiveMQTopic(ADVISORY_TOPIC_PREFIX + "Connection");
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQDestination* AdvisorySupport::getTopicAdvisoryTopic() {
+    return new ActiveMQTopic(ADVISORY_TOPIC_PREFIX + "Topic");
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQDestination* AdvisorySupport::getQueueAdvisoryTopic() {
+    return new ActiveMQTopic(ADVISORY_TOPIC_PREFIX + "Queue");
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQDestination* AdvisorySupport::getTempTopicAdvisoryTopic() {
+    return new ActiveMQTopic(ADVISORY_TOPIC_PREFIX + "TempTopic");
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQDestination* AdvisorySupport::getTempQueueAdvisoryTopic() {
+    return new ActiveMQTopic(ADVISORY_TOPIC_PREFIX + "TempQueue");
+}
+
+
+////////////////////////////////////////////////////////////////////////////////
+std::vector<ActiveMQDestination*> AdvisorySupport::getAllDestinationAdvisoryTopics(const cms::Destination* destination) {
+
+    const ActiveMQDestination* transformed = NULL;
+
+    bool doDelete = ActiveMQMessageTransformation::transformDestination(destination, &transformed);
+    std::vector<ActiveMQDestination*> destinations = getAllDestinationAdvisoryTopics(transformed);
+
+    if (doDelete) {
+        delete transformed;
+    }
+
+    return destinations;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::vector<ActiveMQDestination*> AdvisorySupport::getAllDestinationAdvisoryTopics(const ActiveMQDestination* destination) {
+
+    std::vector<ActiveMQDestination*> destinations;
+
+    destinations.push_back(getConsumerAdvisoryTopic(destination));
+    destinations.push_back(getProducerAdvisoryTopic(destination));
+    destinations.push_back(getExpiredMessageTopic(destination));
+    destinations.push_back(getNoConsumersAdvisoryTopic(destination));
+    destinations.push_back(getSlowConsumerAdvisoryTopic(destination));
+    destinations.push_back(getFastProducerAdvisoryTopic(destination));
+    destinations.push_back(getMessageDiscardedAdvisoryTopic(destination));
+    destinations.push_back(getMessageDeliveredAdvisoryTopic(destination));
+    destinations.push_back(getMessageConsumedAdvisoryTopic(destination));
+    destinations.push_back(getMessageDLQdAdvisoryTopic(destination));
+    destinations.push_back(getFullAdvisoryTopic(destination));
+
+    return destinations;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQDestination* AdvisorySupport::getConsumerAdvisoryTopic(const cms::Destination* destination) {
+
+    const ActiveMQDestination* transformed = NULL;
+
+    bool doDelete = ActiveMQMessageTransformation::transformDestination(destination, &transformed);
+    ActiveMQDestination* advisoryDest = getConsumerAdvisoryTopic(transformed);
+
+    if (doDelete) {
+        delete transformed;
+    }
+
+    return advisoryDest;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQDestination* AdvisorySupport::getConsumerAdvisoryTopic(const ActiveMQDestination* destination) {
+
+    if (destination->isQueue()) {
+        return new ActiveMQTopic(QUEUE_CONSUMER_ADVISORY_TOPIC_PREFIX + destination->getPhysicalName());
+    } else {
+        return new ActiveMQTopic(TOPIC_CONSUMER_ADVISORY_TOPIC_PREFIX + destination->getPhysicalName());
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQDestination* AdvisorySupport::getProducerAdvisoryTopic(const cms::Destination* destination) {
+
+    const ActiveMQDestination* transformed = NULL;
+
+    bool doDelete = ActiveMQMessageTransformation::transformDestination(destination, &transformed);
+    ActiveMQDestination* advisoryDest = getProducerAdvisoryTopic(transformed);
+
+    if (doDelete) {
+        delete transformed;
+    }
+
+    return advisoryDest;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQDestination* AdvisorySupport::getProducerAdvisoryTopic(const ActiveMQDestination* destination) {
+
+    if (destination->isQueue()) {
+        return new ActiveMQTopic(QUEUE_PRODUCER_ADVISORY_TOPIC_PREFIX + destination->getPhysicalName());
+    } else {
+        return new ActiveMQTopic(TOPIC_PRODUCER_ADVISORY_TOPIC_PREFIX + destination->getPhysicalName());
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQDestination* AdvisorySupport::getExpiredMessageTopic(const cms::Destination* destination) {
+
+    const ActiveMQDestination* transformed = NULL;
+
+    bool doDelete = ActiveMQMessageTransformation::transformDestination(destination, &transformed);
+    ActiveMQDestination* advisoryDest = getExpiredMessageTopic(transformed);
+
+    if (doDelete) {
+        delete transformed;
+    }
+
+    return advisoryDest;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQDestination* AdvisorySupport::getExpiredMessageTopic(const ActiveMQDestination* destination) {
+
+    if (destination->isQueue()) {
+        return getExpiredQueueMessageAdvisoryTopic(destination);
+    }
+
+    return getExpiredTopicMessageAdvisoryTopic(destination);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQDestination* AdvisorySupport::getExpiredTopicMessageAdvisoryTopic(const ActiveMQDestination* destination) {
+    return new ActiveMQTopic(EXPIRED_TOPIC_MESSAGES_TOPIC_PREFIX + destination->getPhysicalName());
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQDestination* AdvisorySupport::getExpiredQueueMessageAdvisoryTopic(const cms::Destination* destination) {
+
+    const ActiveMQDestination* transformed = NULL;
+
+    bool doDelete = ActiveMQMessageTransformation::transformDestination(destination, &transformed);
+    ActiveMQDestination* advisoryDest = getExpiredQueueMessageAdvisoryTopic(transformed);
+
+    if (doDelete) {
+        delete transformed;
+    }
+
+    return advisoryDest;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQDestination* AdvisorySupport::getExpiredQueueMessageAdvisoryTopic(const ActiveMQDestination* destination) {
+    return new ActiveMQTopic(EXPIRED_QUEUE_MESSAGES_TOPIC_PREFIX + destination->getPhysicalName());
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQDestination* AdvisorySupport::getNoConsumersAdvisoryTopic(const cms::Destination* destination) {
+
+    const ActiveMQDestination* transformed = NULL;
+
+    bool doDelete = ActiveMQMessageTransformation::transformDestination(destination, &transformed);
+    ActiveMQDestination* advisoryDest = getNoConsumersAdvisoryTopic(transformed);
+
+    if (doDelete) {
+        delete transformed;
+    }
+
+    return advisoryDest;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQDestination* AdvisorySupport::getNoConsumersAdvisoryTopic(const ActiveMQDestination* destination) {
+
+    if (destination->isQueue()) {
+        return getNoQueueConsumersAdvisoryTopic(destination);
+    }
+    return getNoTopicConsumersAdvisoryTopic(destination);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQDestination* AdvisorySupport::getNoTopicConsumersAdvisoryTopic(const cms::Destination* destination) {
+
+    const ActiveMQDestination* transformed = NULL;
+
+    bool doDelete = ActiveMQMessageTransformation::transformDestination(destination, &transformed);
+    ActiveMQDestination* advisoryDest = getNoTopicConsumersAdvisoryTopic(transformed);
+
+    if (doDelete) {
+        delete transformed;
+    }
+
+    return advisoryDest;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQDestination* AdvisorySupport::getNoTopicConsumersAdvisoryTopic(const ActiveMQDestination* destination) {
+    return new ActiveMQTopic(NO_TOPIC_CONSUMERS_TOPIC_PREFIX + destination->getPhysicalName());
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQDestination* AdvisorySupport::getNoQueueConsumersAdvisoryTopic(const cms::Destination* destination) {
+
+    const ActiveMQDestination* transformed = NULL;
+
+    bool doDelete = ActiveMQMessageTransformation::transformDestination(destination, &transformed);
+    ActiveMQDestination* advisoryDest = getNoQueueConsumersAdvisoryTopic(transformed);
+
+    if (doDelete) {
+        delete transformed;
+    }
+
+    return advisoryDest;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQDestination* AdvisorySupport::getNoQueueConsumersAdvisoryTopic(const ActiveMQDestination* destination) {
+    return new ActiveMQTopic(NO_QUEUE_CONSUMERS_TOPIC_PREFIX + destination->getPhysicalName());
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQDestination* AdvisorySupport::getSlowConsumerAdvisoryTopic(const cms::Destination* destination) {
+
+    const ActiveMQDestination* transformed = NULL;
+
+    bool doDelete = ActiveMQMessageTransformation::transformDestination(destination, &transformed);
+    ActiveMQDestination* advisoryDest = getSlowConsumerAdvisoryTopic(transformed);
+
+    if (doDelete) {
+        delete transformed;
+    }
+
+    return advisoryDest;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQDestination* AdvisorySupport::getSlowConsumerAdvisoryTopic(const ActiveMQDestination* destination) {
+    std::string name = SLOW_CONSUMER_TOPIC_PREFIX +
+        destination->getDestinationTypeAsString() + "." + destination->getPhysicalName();
+    return new ActiveMQTopic(name);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQDestination* AdvisorySupport::getFastProducerAdvisoryTopic(const cms::Destination* destination) {
+
+    const ActiveMQDestination* transformed = NULL;
+
+    bool doDelete = ActiveMQMessageTransformation::transformDestination(destination, &transformed);
+    ActiveMQDestination* advisoryDest = getFastProducerAdvisoryTopic(transformed);
+
+    if (doDelete) {
+        delete transformed;
+    }
+
+    return advisoryDest;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQDestination* AdvisorySupport::getFastProducerAdvisoryTopic(const ActiveMQDestination* destination) {
+    std::string name = FAST_PRODUCER_TOPIC_PREFIX +
+        destination->getDestinationTypeAsString() + "." + destination->getPhysicalName();
+    return new ActiveMQTopic(name);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQDestination* AdvisorySupport::getMessageDiscardedAdvisoryTopic(const cms::Destination* destination) {
+
+    const ActiveMQDestination* transformed = NULL;
+
+    bool doDelete = ActiveMQMessageTransformation::transformDestination(destination, &transformed);
+    ActiveMQDestination* advisoryDest = getMessageDiscardedAdvisoryTopic(transformed);
+
+    if (doDelete) {
+        delete transformed;
+    }
+
+    return advisoryDest;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQDestination* AdvisorySupport::getMessageDiscardedAdvisoryTopic(const ActiveMQDestination* destination) {
+    std::string name = MESSAGE_DISCAREDED_TOPIC_PREFIX +
+        destination->getDestinationTypeAsString() + "." + destination->getPhysicalName();
+    return new ActiveMQTopic(name);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQDestination* AdvisorySupport::getMessageDeliveredAdvisoryTopic(const cms::Destination* destination) {
+
+    const ActiveMQDestination* transformed = NULL;
+
+    bool doDelete = ActiveMQMessageTransformation::transformDestination(destination, &transformed);
+    ActiveMQDestination* advisoryDest = getMessageDeliveredAdvisoryTopic(transformed);
+
+    if (doDelete) {
+        delete transformed;
+    }
+
+    return advisoryDest;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQDestination* AdvisorySupport::getMessageDeliveredAdvisoryTopic(const ActiveMQDestination* destination) {
+    std::string name = MESSAGE_DELIVERED_TOPIC_PREFIX +
+        destination->getDestinationTypeAsString() + "." + destination->getPhysicalName();
+    return new ActiveMQTopic(name);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQDestination* AdvisorySupport::getMessageConsumedAdvisoryTopic(const cms::Destination* destination) {
+
+    const ActiveMQDestination* transformed = NULL;
+
+    bool doDelete = ActiveMQMessageTransformation::transformDestination(destination, &transformed);
+    ActiveMQDestination* advisoryDest = getMessageConsumedAdvisoryTopic(transformed);
+
+    if (doDelete) {
+        delete transformed;
+    }
+
+    return advisoryDest;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQDestination* AdvisorySupport::getMessageConsumedAdvisoryTopic(const ActiveMQDestination* destination) {
+    std::string name = MESSAGE_CONSUMED_TOPIC_PREFIX +
+        destination->getDestinationTypeAsString() + "." + destination->getPhysicalName();
+    return new ActiveMQTopic(name);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQDestination* AdvisorySupport::getMessageDLQdAdvisoryTopic(const ActiveMQDestination* destination) {
+    std::string name = MESSAGE_DLQ_TOPIC_PREFIX + destination->getDestinationTypeAsString() + "."
+            + destination->getPhysicalName();
+    return new ActiveMQTopic(name);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQDestination* AdvisorySupport::getMasterBrokerAdvisoryTopic() {
+    return new ActiveMQTopic(MASTER_BROKER_TOPIC_PREFIX);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQDestination* AdvisorySupport::getNetworkBridgeAdvisoryTopic() {
+    return new ActiveMQTopic(NETWORK_BRIDGE_TOPIC_PREFIX);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQDestination* AdvisorySupport::getFullAdvisoryTopic(const cms::Destination* destination) {
+
+    const ActiveMQDestination* transformed = NULL;
+
+    bool doDelete = ActiveMQMessageTransformation::transformDestination(destination, &transformed);
+    ActiveMQDestination* advisoryDest = getFullAdvisoryTopic(transformed);
+
+    if (doDelete) {
+        delete transformed;
+    }
+
+    return advisoryDest;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQDestination* AdvisorySupport::getFullAdvisoryTopic(const ActiveMQDestination* destination) {
+    std::string name = FULL_TOPIC_PREFIX +
+        destination->getDestinationTypeAsString() + "." + destination->getPhysicalName();
+    return new ActiveMQTopic(name);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQDestination* AdvisorySupport::getDestinationAdvisoryTopic(const cms::Destination* destination) {
+
+    const ActiveMQDestination* transformed = NULL;
+
+    bool doDelete = ActiveMQMessageTransformation::transformDestination(destination, &transformed);
+    ActiveMQDestination* advisoryDest = getDestinationAdvisoryTopic(transformed);
+
+    if (doDelete) {
+        delete transformed;
+    }
+
+    return advisoryDest;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQDestination* AdvisorySupport::getDestinationAdvisoryTopic(const ActiveMQDestination* destination) {
+
+    switch (destination->getDestinationType()) {
+        case cms::Destination::QUEUE:
+            return getQueueAdvisoryTopic();
+        case cms::Destination::TOPIC:
+            return getTopicAdvisoryTopic();
+        case cms::Destination::TEMPORARY_QUEUE:
+            return getTempQueueAdvisoryTopic();
+        case cms::Destination::TEMPORARY_TOPIC:
+            return getTempTopicAdvisoryTopic();
+        default:
+            throw new IllegalArgumentException(
+                __FILE__, __LINE__, "Unknown destination type: " + destination->getDestinationType());
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool AdvisorySupport::isDestinationAdvisoryTopic(const cms::Destination* destination) {
+
+    const ActiveMQDestination* transformed = NULL;
+
+    bool doDelete = ActiveMQMessageTransformation::transformDestination(destination, &transformed);
+    bool result = isDestinationAdvisoryTopic(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 (!isTempDestinationAdvisoryTopic(compositeDestinations.get(i).get())) {
+                return false;
+            }
+        }
+        return true;
+    } else {
+        std::string name = destination->getPhysicalName();
+        return name == ADVISORY_TOPIC_PREFIX + "TempQueue" || name == ADVISORY_TOPIC_PREFIX + "TempTopic";
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool AdvisorySupport::isDestinationAdvisoryTopic(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())) {
+                return false;
+            }
+        }
+        return false;
+    } 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";
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool AdvisorySupport::isAdvisoryTopic(const cms::Destination* destination) {
+
+    const ActiveMQDestination* transformed = NULL;
+
+    bool doDelete = ActiveMQMessageTransformation::transformDestination(destination, &transformed);
+    bool result = isAdvisoryTopic(transformed);
+
+    if (doDelete) {
+        delete transformed;
+    }
+
+    return result;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool AdvisorySupport::isAdvisoryTopic(const ActiveMQDestination* destination) {
+    if (destination != NULL) {
+        if (destination->isComposite()) {
+            ArrayList< Pointer<ActiveMQDestination> > compositeDestinations = destination->getCompositeDestinations();
+            for (int i = 0; i < compositeDestinations.size(); i++) {
+                if (isAdvisoryTopic(compositeDestinations.get(i).get())) {
+                    return true;
+                }
+            }
+            return false;
+        } else {
+            return destination->isTopic() &&
+                   destination->getPhysicalName().find(ADVISORY_TOPIC_PREFIX) == 0;
+        }
+    }
+    return false;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool AdvisorySupport::isConnectionAdvisoryTopic(const cms::Destination* destination) {
+
+    const ActiveMQDestination* transformed = NULL;
+
+    bool doDelete = ActiveMQMessageTransformation::transformDestination(destination, &transformed);
+    bool result = isConnectionAdvisoryTopic(transformed);
+
+    if (doDelete) {
+        delete transformed;
+    }
+
+    return result;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool AdvisorySupport::isConnectionAdvisoryTopic(const ActiveMQDestination* destination) {
+    if (destination->isComposite()) {
+        ArrayList< Pointer<ActiveMQDestination> > compositeDestinations = destination->getCompositeDestinations();
+        for (int i = 0; i < compositeDestinations.size(); i++) {
+            if (isConnectionAdvisoryTopic(compositeDestinations.get(i).get())) {
+                return true;
+            }
+        }
+        return false;
+    } else {
+        return destination->getPhysicalName() == ADVISORY_TOPIC_PREFIX + "Connection";
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool AdvisorySupport::isProducerAdvisoryTopic(const cms::Destination* destination) {
+
+    const ActiveMQDestination* transformed = NULL;
+
+    bool doDelete = ActiveMQMessageTransformation::transformDestination(destination, &transformed);
+    bool result = isProducerAdvisoryTopic(transformed);
+
+    if (doDelete) {
+        delete transformed;
+    }
+
+    return result;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool AdvisorySupport::isProducerAdvisoryTopic(const ActiveMQDestination* destination) {
+    if (destination->isComposite()) {
+        ArrayList< Pointer<ActiveMQDestination> > compositeDestinations = destination->getCompositeDestinations();
+        for (int i = 0; i < compositeDestinations.size(); i++) {
+            if (isProducerAdvisoryTopic(compositeDestinations.get(i).get())) {
+                return true;
+            }
+        }
+        return false;
+    } else {
+        return destination->isTopic() &&
+               destination->getPhysicalName().find(PRODUCER_ADVISORY_TOPIC_PREFIX) == 0;
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool AdvisorySupport::isConsumerAdvisoryTopic(const cms::Destination* destination) {
+
+    const ActiveMQDestination* transformed = NULL;
+
+    bool doDelete = ActiveMQMessageTransformation::transformDestination(destination, &transformed);
+    bool result = isConsumerAdvisoryTopic(transformed);
+
+    if (doDelete) {
+        delete transformed;
+    }
+
+    return result;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool AdvisorySupport::isConsumerAdvisoryTopic(const ActiveMQDestination* destination) {
+    if (destination->isComposite()) {
+        ArrayList< Pointer<ActiveMQDestination> > compositeDestinations = destination->getCompositeDestinations();
+        for (int i = 0; i < compositeDestinations.size(); i++) {
+            if (isConsumerAdvisoryTopic(compositeDestinations.get(i).get())) {
+                return true;
+            }
+        }
+        return false;
+    } else {
+        return destination->isTopic() &&
+               destination->getPhysicalName().find(CONSUMER_ADVISORY_TOPIC_PREFIX) == 0;
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool AdvisorySupport::isSlowConsumerAdvisoryTopic(const cms::Destination* destination) {
+
+    const ActiveMQDestination* transformed = NULL;
+
+    bool doDelete = ActiveMQMessageTransformation::transformDestination(destination, &transformed);
+    bool result = isSlowConsumerAdvisoryTopic(transformed);
+
+    if (doDelete) {
+        delete transformed;
+    }
+
+    return result;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool AdvisorySupport::isSlowConsumerAdvisoryTopic(const ActiveMQDestination* destination) {
+    if (destination->isComposite()) {
+        ArrayList< Pointer<ActiveMQDestination> > compositeDestinations = destination->getCompositeDestinations();
+        for (int i = 0; i < compositeDestinations.size(); i++) {
+            if (isSlowConsumerAdvisoryTopic(compositeDestinations.get(i).get())) {
+                return true;
+            }
+        }
+        return false;
+    } else {
+        return destination->isTopic() &&
+               destination->getPhysicalName().find(SLOW_CONSUMER_TOPIC_PREFIX) == 0;
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool AdvisorySupport::isFastProducerAdvisoryTopic(const cms::Destination* destination) {
+
+    const ActiveMQDestination* transformed = NULL;
+
+    bool doDelete = ActiveMQMessageTransformation::transformDestination(destination, &transformed);
+    bool result = isFastProducerAdvisoryTopic(transformed);
+
+    if (doDelete) {
+        delete transformed;
+    }
+
+    return result;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool AdvisorySupport::isFastProducerAdvisoryTopic(const ActiveMQDestination* destination) {
+    if (destination->isComposite()) {
+        ArrayList< Pointer<ActiveMQDestination> > compositeDestinations = destination->getCompositeDestinations();
+        for (int i = 0; i < compositeDestinations.size(); i++) {
+            if (isFastProducerAdvisoryTopic(compositeDestinations.get(i).get())) {
+                return true;
+            }
+        }
+        return false;
+    } else {
+        return destination->isTopic() &&
+               destination->getPhysicalName().find(FAST_PRODUCER_TOPIC_PREFIX) == 0;
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool AdvisorySupport::isMessageConsumedAdvisoryTopic(const cms::Destination* destination) {
+
+    const ActiveMQDestination* transformed = NULL;
+
+    bool doDelete = ActiveMQMessageTransformation::transformDestination(destination, &transformed);
+    bool result = isMessageConsumedAdvisoryTopic(transformed);
+
+    if (doDelete) {
+        delete transformed;
+    }
+
+    return result;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool AdvisorySupport::isMessageConsumedAdvisoryTopic(const ActiveMQDestination* destination) {
+    if (destination->isComposite()) {
+        ArrayList< Pointer<ActiveMQDestination> > compositeDestinations = destination->getCompositeDestinations();
+        for (int i = 0; i < compositeDestinations.size(); i++) {
+            if (isMessageConsumedAdvisoryTopic(compositeDestinations.get(i).get())) {
+                return true;
+            }
+        }
+        return false;
+    } else {
+        return destination->isTopic() &&
+               destination->getPhysicalName().find(MESSAGE_CONSUMED_TOPIC_PREFIX) == 0;
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool AdvisorySupport::isMasterBrokerAdvisoryTopic(const cms::Destination* destination) {
+
+    const ActiveMQDestination* transformed = NULL;
+
+    bool doDelete = ActiveMQMessageTransformation::transformDestination(destination, &transformed);
+    bool result = isMasterBrokerAdvisoryTopic(transformed);
+
+    if (doDelete) {
+        delete transformed;
+    }
+
+    return result;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool AdvisorySupport::isMasterBrokerAdvisoryTopic(const ActiveMQDestination* destination) {
+    if (destination->isComposite()) {
+        ArrayList< Pointer<ActiveMQDestination> > compositeDestinations = destination->getCompositeDestinations();
+        for (int i = 0; i < compositeDestinations.size(); i++) {
+            if (isMasterBrokerAdvisoryTopic(compositeDestinations.get(i).get())) {
+                return true;
+            }
+        }
+        return false;
+    } else {
+        return destination->isTopic() &&
+               destination->getPhysicalName().find(MASTER_BROKER_TOPIC_PREFIX) == 0;
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool AdvisorySupport::isMessageDeliveredAdvisoryTopic(const cms::Destination* destination) {
+
+    const ActiveMQDestination* transformed = NULL;
+
+    bool doDelete = ActiveMQMessageTransformation::transformDestination(destination, &transformed);
+    bool result = isMessageDeliveredAdvisoryTopic(transformed);
+
+    if (doDelete) {
+        delete transformed;
+    }
+
+    return result;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool AdvisorySupport::isMessageDeliveredAdvisoryTopic(const ActiveMQDestination* destination) {
+    if (destination->isComposite()) {
+        ArrayList< Pointer<ActiveMQDestination> > compositeDestinations = destination->getCompositeDestinations();
+        for (int i = 0; i < compositeDestinations.size(); i++) {
+            if (isMessageDeliveredAdvisoryTopic(compositeDestinations.get(i).get())) {
+                return true;
+            }
+        }
+        return false;
+    } else {
+        return destination->isTopic() &&
+               destination->getPhysicalName().find(MESSAGE_DELIVERED_TOPIC_PREFIX) == 0;
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool AdvisorySupport::isMessageDiscardedAdvisoryTopic(const cms::Destination* destination) {
+
+    const ActiveMQDestination* transformed = NULL;
+
+    bool doDelete = ActiveMQMessageTransformation::transformDestination(destination, &transformed);
+    bool result = isMessageDiscardedAdvisoryTopic(transformed);
+
+    if (doDelete) {
+        delete transformed;
+    }
+
+    return result;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool AdvisorySupport::isMessageDiscardedAdvisoryTopic(const ActiveMQDestination* destination) {
+    if (destination->isComposite()) {
+        ArrayList< Pointer<ActiveMQDestination> > compositeDestinations = destination->getCompositeDestinations();
+        for (int i = 0; i < compositeDestinations.size(); i++) {
+            if (isMessageDiscardedAdvisoryTopic(compositeDestinations.get(i).get())) {
+                return true;
+            }
+        }
+        return false;
+    } else {
+        return destination->isTopic() &&
+               destination->getPhysicalName().find(MESSAGE_DISCAREDED_TOPIC_PREFIX) == 0;
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool AdvisorySupport::isFullAdvisoryTopic(const cms::Destination* destination) {
+
+    const ActiveMQDestination* transformed = NULL;
+
+    bool doDelete = ActiveMQMessageTransformation::transformDestination(destination, &transformed);
+    bool result = isFullAdvisoryTopic(transformed);
+
+    if (doDelete) {
+        delete transformed;
+    }
+
+    return result;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool AdvisorySupport::isFullAdvisoryTopic(const ActiveMQDestination* destination) {
+    if (destination->isComposite()) {
+        ArrayList< Pointer<ActiveMQDestination> > compositeDestinations = destination->getCompositeDestinations();
+        for (int i = 0; i < compositeDestinations.size(); i++) {
+            if (isFullAdvisoryTopic(compositeDestinations.get(i).get())) {
+                return true;
+            }
+        }
+        return false;
+    } else {
+        return destination->isTopic() &&
+               destination->getPhysicalName().find(FULL_TOPIC_PREFIX) == 0;
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool AdvisorySupport::isNetworkBridgeAdvisoryTopic(const cms::Destination* destination) {
+
+    const ActiveMQDestination* transformed = NULL;
+
+    bool doDelete = ActiveMQMessageTransformation::transformDestination(destination, &transformed);
+    bool result = isNetworkBridgeAdvisoryTopic(transformed);
+
+    if (doDelete) {
+        delete transformed;
+    }
+
+    return result;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool AdvisorySupport::isNetworkBridgeAdvisoryTopic(const ActiveMQDestination* destination) {
+    if (destination->isComposite()) {
+        ArrayList< Pointer<ActiveMQDestination> > compositeDestinations = destination->getCompositeDestinations();
+        for (int i = 0; i < compositeDestinations.size(); i++) {
+            if (isNetworkBridgeAdvisoryTopic(compositeDestinations.get(i).get())) {
+                return true;
+            }
+        }
+        return false;
+    } else {
+        return destination->isTopic() &&
+               destination->getPhysicalName().find(NETWORK_BRIDGE_TOPIC_PREFIX) == 0;
+    }
+}
+

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/AdvisorySupport.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 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=1334183&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/AdvisorySupport.h (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/AdvisorySupport.h Fri May  4 21:04:52 2012
@@ -0,0 +1,544 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _ACTIVEMQ_UTIL_ADVISORYSUPPORT_H_
+#define _ACTIVEMQ_UTIL_ADVISORYSUPPORT_H_
+
+#include <activemq/util/Config.h>
+
+#include <string>
+#include <vector>
+
+namespace cms {
+    class Destination;
+}
+namespace activemq {
+namespace commands {
+    class ActiveMQDestination;
+}
+namespace util {
+
+    /**
+     * Support class that provides various static constants for use in constructing
+     * Destination names for the ActiveMQ advisory destinations.  Methods that can create
+     * Advisory Topic instances for commonly used Advisory messages are also provided
+     * here.
+     */
+    class AMQCPP_API AdvisorySupport {
+    private:
+
+        AdvisorySupport();
+
+    public:
+
+        static const std::string ADVISORY_TOPIC_PREFIX;
+        static const std::string PRODUCER_ADVISORY_TOPIC_PREFIX;
+        static const std::string QUEUE_PRODUCER_ADVISORY_TOPIC_PREFIX;
+        static const std::string TOPIC_PRODUCER_ADVISORY_TOPIC_PREFIX;
+        static const std::string CONSUMER_ADVISORY_TOPIC_PREFIX;
+        static const std::string QUEUE_CONSUMER_ADVISORY_TOPIC_PREFIX;
+        static const std::string TOPIC_CONSUMER_ADVISORY_TOPIC_PREFIX;
+        static const std::string EXPIRED_TOPIC_MESSAGES_TOPIC_PREFIX;
+        static const std::string EXPIRED_QUEUE_MESSAGES_TOPIC_PREFIX;
+        static const std::string NO_TOPIC_CONSUMERS_TOPIC_PREFIX;
+        static const std::string NO_QUEUE_CONSUMERS_TOPIC_PREFIX;
+        static const std::string SLOW_CONSUMER_TOPIC_PREFIX;
+        static const std::string FAST_PRODUCER_TOPIC_PREFIX;
+        static const std::string MESSAGE_DISCAREDED_TOPIC_PREFIX;
+        static const std::string FULL_TOPIC_PREFIX;
+        static const std::string MESSAGE_DELIVERED_TOPIC_PREFIX;
+        static const std::string MESSAGE_CONSUMED_TOPIC_PREFIX;
+        static const std::string MESSAGE_DLQ_TOPIC_PREFIX;
+        static const std::string MASTER_BROKER_TOPIC_PREFIX;
+        static const std::string NETWORK_BRIDGE_TOPIC_PREFIX;
+        static const std::string AGENT_TOPIC;
+        static const std::string ADIVSORY_MESSAGE_TYPE;
+        static const std::string MSG_PROPERTY_ORIGIN_BROKER_ID;
+        static const std::string MSG_PROPERTY_ORIGIN_BROKER_NAME;
+        static const std::string MSG_PROPERTY_ORIGIN_BROKER_URL;
+        static const std::string MSG_PROPERTY_USAGE_NAME;
+        static const std::string MSG_PROPERTY_CONSUMER_ID;
+        static const std::string MSG_PROPERTY_PRODUCER_ID;
+        static const std::string MSG_PROPERTY_MESSAGE_ID;
+        static const std::string MSG_PROPERTY_CONSUMER_COUNT;
+        static const std::string MSG_PROPERTY_DISCARDED_COUNT;
+
+    public:
+
+        ~AdvisorySupport();
+
+    public:
+
+        /**
+         * Returns a new Pointer to an Destination that will consume the advisory messages for both
+         * Temporary Topic and Temporary Queue creation on the broker.
+         *
+         * @return Pointer to the requested Advisory Topic destination.
+         */
+        static commands::ActiveMQDestination* getTempDestinationCompositeAdvisoryTopic();
+
+        /**
+         * Returns a new Pointer to an Destination that will consume the advisory messages for all
+         * Destinations created by the Broker, Queue, Topic, Temporary Queue and Temporary Topic.
+         *
+         * @return Pointer to the requested Advisory Topic destination.
+         */
+        static commands::ActiveMQDestination* getAllDestinationsCompositeAdvisoryTopic();
+
+        /**
+         * Returns a new vector that contains pointers to all the available advisory topics for the given
+         * destination.
+         *
+         * @return vector of all advisory topics that will receive events for the given destination..
+         */
+        static std::vector<commands::ActiveMQDestination*> getAllDestinationAdvisoryTopics(const cms::Destination* destination);
+
+        /**
+         * Returns a new vector that contains pointers to all the available advisory topics for the given
+         * destination.
+         *
+         * @return vector of all advisory topics that will receive events for the given destination..
+         */
+        static std::vector<commands::ActiveMQDestination*> getAllDestinationAdvisoryTopics(const commands::ActiveMQDestination* destination);
+
+        /**
+         * Returns a new Pointer to an Destination that will consume advisory messages for Connections.
+         *
+         * @return Pointer to the requested Advisory Topic destination.
+         */
+        static commands::ActiveMQDestination* getConnectionAdvisoryTopic();
+
+        /**
+         * Returns a new Pointer to an Destination that will consume advisory messages for Queues.
+         *
+         * @return Pointer to the requested Advisory Topic destination.
+         */
+        static commands::ActiveMQDestination* getQueueAdvisoryTopic();
+
+        /**
+         * Returns a new Pointer to an Destination that will consume advisory messages for Topics.
+         *
+         * @return Pointer to the requested Advisory Topic destination.
+         */
+        static commands::ActiveMQDestination* getTopicAdvisoryTopic();
+
+        /**
+         * Returns a new Pointer to an Destination that will consume advisory messages for Temporary Queues.
+         *
+         * @return Pointer to the requested Advisory Topic destination.
+         */
+        static commands::ActiveMQDestination* getTempQueueAdvisoryTopic();
+
+        /**
+         * Returns a new Pointer to an Destination that will consume advisory messages for Temporary Topics.
+         *
+         * @return Pointer to the requested Advisory Topic destination.
+         */
+        static commands::ActiveMQDestination* getTempTopicAdvisoryTopic();
+
+        /**
+         * Returns a new Pointer to an Destination that will consume advisory messages for Consumer events.
+         *
+         * @return Pointer to the requested Advisory Topic destination.
+         */
+        static commands::ActiveMQDestination* getConsumerAdvisoryTopic(const cms::Destination* destination);
+
+        /**
+         * Returns a new Pointer to an Destination that will consume advisory messages for Consumer events.
+         *
+         * @return Pointer to the requested Advisory Topic destination.
+         */
+        static commands::ActiveMQDestination* getConsumerAdvisoryTopic(const commands::ActiveMQDestination* destination);
+
+        /**
+         * Returns a new Pointer to an Destination that will consume advisory messages for Producer events.
+         *
+         * @return Pointer to the requested Advisory Topic destination.
+         */
+        static commands::ActiveMQDestination* getProducerAdvisoryTopic(const cms::Destination* destination);
+
+        /**
+         * Returns a new Pointer to an Destination that will consume advisory messages for Producer events.
+         *
+         * @return Pointer to the requested Advisory Topic destination.
+         */
+        static commands::ActiveMQDestination* getProducerAdvisoryTopic(const commands::ActiveMQDestination* 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* getExpiredMessageTopic(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* getExpiredMessageTopic(const commands::ActiveMQDestination* 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);
+
+        /**
+         * 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* getExpiredQueueMessageAdvisoryTopic(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* getExpiredQueueMessageAdvisoryTopic(const commands::ActiveMQDestination* destination);
+
+        /**
+         * Returns a new Pointer to an Destination that will consume advisory messages for no consumer events
+         * for messages on the specified destination.
+         *
+         * @return Pointer to the requested Advisory Topic destination.
+         */
+        static commands::ActiveMQDestination* getNoConsumersAdvisoryTopic(const cms::Destination* destination);
+
+        /**
+         * Returns a new Pointer to an Destination that will consume advisory messages for no consumer events
+         * for messages on the specified destination.
+         *
+         * @return Pointer to the requested Advisory Topic destination.
+         */
+        static commands::ActiveMQDestination* getNoConsumersAdvisoryTopic(const commands::ActiveMQDestination* destination);
+
+        /**
+         * Returns a new Pointer to an Destination that will consume advisory messages for no consumer events
+         * for messages on the specified destination.
+         *
+         * @return Pointer to the requested Advisory Topic destination.
+         */
+        static commands::ActiveMQDestination* getNoTopicConsumersAdvisoryTopic(const cms::Destination* destination);
+
+        /**
+         * Returns a new Pointer to an Destination that will consume advisory messages for no consumer events
+         * for messages on the specified destination.
+         *
+         * @return Pointer to the requested Advisory Topic destination.
+         */
+        static commands::ActiveMQDestination* getNoTopicConsumersAdvisoryTopic(const commands::ActiveMQDestination* destination);
+
+        /**
+         * Returns a new Pointer to an Destination that will consume advisory messages for no consumer events
+         * for messages on the specified destination.
+         *
+         * @return Pointer to the requested Advisory Topic destination.
+         */
+        static commands::ActiveMQDestination* getNoQueueConsumersAdvisoryTopic(const cms::Destination* destination);
+
+        /**
+         * Returns a new Pointer to an Destination that will consume advisory messages for no consumer events
+         * for messages on the specified destination.
+         *
+         * @return Pointer to the requested Advisory Topic destination.
+         */
+        static commands::ActiveMQDestination* getNoQueueConsumersAdvisoryTopic(const commands::ActiveMQDestination* destination);
+
+        /**
+         * Returns a new Pointer to an Destination that will consume advisory messages for slow consumers
+         * of messages on the specified destination.
+         *
+         * @return Pointer to the requested Advisory Topic destination.
+         */
+        static commands::ActiveMQDestination* getSlowConsumerAdvisoryTopic(const cms::Destination* destination);
+
+        /**
+         * Returns a new Pointer to an Destination that will consume advisory messages for slow consumers
+         * of messages on the specified destination.
+         *
+         * @return Pointer to the requested Advisory Topic destination.
+         */
+        static commands::ActiveMQDestination* getSlowConsumerAdvisoryTopic(const commands::ActiveMQDestination* destination);
+
+        /**
+         * Returns a new Pointer to an Destination that will consume advisory messages for fast producers
+         * of messages on the specified destination.
+         *
+         * @return Pointer to the requested Advisory Topic destination.
+         */
+        static commands::ActiveMQDestination* getFastProducerAdvisoryTopic(const cms::Destination* destination);
+
+        /**
+         * Returns a new Pointer to an Destination that will consume advisory messages for fast producers
+         * of messages on the specified destination.
+         *
+         * @return Pointer to the requested Advisory Topic destination.
+         */
+        static commands::ActiveMQDestination* getFastProducerAdvisoryTopic(const commands::ActiveMQDestination* destination);
+
+        /**
+         * Returns a new Pointer to an Destination that will consume advisory messages when a message is
+         * discarded on the specified destination
+         *
+         * @return Pointer to the requested Advisory Topic destination.
+         */
+        static commands::ActiveMQDestination* getMessageDiscardedAdvisoryTopic(const cms::Destination* destination);
+
+        /**
+         * Returns a new Pointer to an Destination that will consume advisory messages when a message is
+         * discarded on the specified destination
+         *
+         * @return Pointer to the requested Advisory Topic destination.
+         */
+        static commands::ActiveMQDestination* getMessageDiscardedAdvisoryTopic(const commands::ActiveMQDestination* destination);
+
+        /**
+         * Returns a new Pointer to an Destination that will consume advisory messages when a message is
+         * dispatched to the specified destination
+         *
+         * @return Pointer to the requested Advisory Topic destination.
+         */
+        static commands::ActiveMQDestination* getMessageDeliveredAdvisoryTopic(const cms::Destination* destination);
+
+        /**
+         * Returns a new Pointer to an Destination that will consume advisory messages when a message is
+         * dispatched to the specified destination
+         *
+         * @return Pointer to the requested Advisory Topic destination.
+         */
+        static commands::ActiveMQDestination* getMessageDeliveredAdvisoryTopic(const commands::ActiveMQDestination* destination);
+
+        /**
+         * Returns a new Pointer to an Destination that will consume advisory messages when a message is
+         * consumed from the specified destination
+         *
+         * @return Pointer to the requested Advisory Topic destination.
+         */
+        static commands::ActiveMQDestination* getMessageConsumedAdvisoryTopic(const cms::Destination* destination);
+
+        /**
+         * Returns a new Pointer to an Destination that will consume advisory messages when a message is
+         * consumed from the specified destination
+         *
+         * @return Pointer to the requested Advisory Topic destination.
+         */
+        static commands::ActiveMQDestination* getMessageConsumedAdvisoryTopic(const commands::ActiveMQDestination* destination);
+
+        /**
+         * Returns a new Pointer to an Destination that will consume advisory messages when a message is
+         * sent to the DLQ from the specified destination
+         *
+         * @return Pointer to the requested Advisory Topic destination.
+         */
+        static commands::ActiveMQDestination* getMessageDLQdAdvisoryTopic(const commands::ActiveMQDestination* destination);
+
+        /**
+         * Returns a new Pointer to an Destination that will consume advisory messages for Master Brokers.
+         *
+         * @return Pointer to the requested Advisory Topic destination.
+         */
+        static commands::ActiveMQDestination* getMasterBrokerAdvisoryTopic();
+
+        /**
+         * Returns a new Pointer to an Destination that will consume advisory messages for Network Bridges.
+         *
+         * @return Pointer to the requested Advisory Topic destination.
+         */
+        static commands::ActiveMQDestination* getNetworkBridgeAdvisoryTopic();
+
+        /**
+         * Returns a new Pointer to an Destination that will consume advisory messages when the given
+         * destination has become full and cannot receive more messages.
+         *
+         * @return Pointer to the requested Advisory Topic destination.
+         */
+        static commands::ActiveMQDestination* getFullAdvisoryTopic(const cms::Destination* destination);
+
+        /**
+         * Returns a new Pointer to an Destination that will consume advisory messages when the given
+         * destination has become full and cannot receive more messages.
+         *
+         * @return Pointer to the requested Advisory Topic destination.
+         */
+        static commands::ActiveMQDestination* getFullAdvisoryTopic(const commands::ActiveMQDestination* destination);
+
+        /**
+         * Returns a new Pointer to an Destination that will consume advisory messages for events related
+         * to Destination such as create and delete.
+         *
+         * @return Pointer to the requested Advisory Topic destination.
+         */
+        static commands::ActiveMQDestination* getDestinationAdvisoryTopic(const cms::Destination* destination);
+
+        /**
+         * Returns a new Pointer to an Destination that will consume advisory messages for events related
+         * to Destination such as create and delete.
+         *
+         * @return Pointer to the requested Advisory Topic destination.
+         */
+        static commands::ActiveMQDestination* getDestinationAdvisoryTopic(const commands::ActiveMQDestination* destination);
+
+    public:
+
+        /**
+         * @returns true if the specified destination is a Destination advisory topic.
+         */
+        static bool isDestinationAdvisoryTopic(const cms::Destination* destination);
+
+        /**
+         * @returns true if the specified destination is a Temporary Destination advisory topic.
+         */
+        static bool isTempDestinationAdvisoryTopic(const commands::ActiveMQDestination* 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 an advisory topic.
+         */
+        static bool isAdvisoryTopic(const cms::Destination* destination);
+
+        /**
+         * @returns true if the specified destination is an advisory topic.
+         */
+        static bool isAdvisoryTopic(const commands::ActiveMQDestination* destination);
+
+        /**
+         * @returns true if the specified destination is an Connection advisory topic.
+         */
+        static bool isConnectionAdvisoryTopic(const cms::Destination* destination);
+
+        /**
+         * @returns true if the specified destination is an Connection advisory topic.
+         */
+        static bool isConnectionAdvisoryTopic(const commands::ActiveMQDestination* destination);
+
+        /**
+         * @returns true if the specified destination is an Producer advisory topic.
+         */
+        static bool isProducerAdvisoryTopic(const cms::Destination* destination);
+
+        /**
+         * @returns true if the specified destination is an Producer advisory topic.
+         */
+        static bool isProducerAdvisoryTopic(const commands::ActiveMQDestination* destination);
+
+        /**
+         * @returns true if the specified destination is an Consumer advisory topic.
+         */
+        static bool isConsumerAdvisoryTopic(const cms::Destination* destination);
+
+        /**
+         * @returns true if the specified destination is an Consumer advisory topic.
+         */
+        static bool isConsumerAdvisoryTopic(const commands::ActiveMQDestination* destination);
+
+        /**
+         * @returns true if the specified destination is an Slow Consumer advisory topic.
+         */
+        static bool isSlowConsumerAdvisoryTopic(const cms::Destination* destination);
+
+        /**
+         * @returns true if the specified destination is an Slow Consumer advisory topic.
+         */
+        static bool isSlowConsumerAdvisoryTopic(const commands::ActiveMQDestination* destination);
+
+        /**
+         * @returns true if the specified destination is an Fast Producer advisory topic.
+         */
+        static bool isFastProducerAdvisoryTopic(const cms::Destination* destination);
+
+        /**
+         * @returns true if the specified destination is an Fast Producer advisory topic.
+         */
+        static bool isFastProducerAdvisoryTopic(const commands::ActiveMQDestination* destination);
+
+        /**
+         * @returns true if the specified destination is an Message Consumed advisory topic.
+         */
+        static bool isMessageConsumedAdvisoryTopic(const cms::Destination* destination);
+
+        /**
+         * @returns true if the specified destination is an Message Consumed advisory topic.
+         */
+        static bool isMessageConsumedAdvisoryTopic(const commands::ActiveMQDestination* destination);
+
+        /**
+         * @returns true if the specified destination is an Master Broker advisory topic.
+         */
+        static bool isMasterBrokerAdvisoryTopic(const cms::Destination* destination);
+
+        /**
+         * @returns true if the specified destination is an Master Broker Consumed advisory topic.
+         */
+        static bool isMasterBrokerAdvisoryTopic(const commands::ActiveMQDestination* destination);
+
+        /**
+         * @returns true if the specified destination is an Message Delivered advisory topic.
+         */
+        static bool isMessageDeliveredAdvisoryTopic(const cms::Destination* destination);
+
+        /**
+         * @returns true if the specified destination is an Message Delivered advisory topic.
+         */
+        static bool isMessageDeliveredAdvisoryTopic(const commands::ActiveMQDestination* destination);
+
+        /**
+         * @returns true if the specified destination is an Message Discarded advisory topic.
+         */
+        static bool isMessageDiscardedAdvisoryTopic(const cms::Destination* destination);
+
+        /**
+         * @returns true if the specified destination is an Message Discarded advisory topic.
+         */
+        static bool isMessageDiscardedAdvisoryTopic(const commands::ActiveMQDestination* destination);
+
+        /**
+         * @returns true if the specified destination is an Destination Full advisory topic.
+         */
+        static bool isFullAdvisoryTopic(const cms::Destination* destination);
+
+        /**
+         * @returns true if the specified destination is an Destination Full advisory topic.
+         */
+        static bool isFullAdvisoryTopic(const commands::ActiveMQDestination* destination);
+
+        /**
+         * @returns true if the specified destination is an Network Bridge advisory topic.
+         */
+        static bool isNetworkBridgeAdvisoryTopic(const cms::Destination* destination);
+
+        /**
+         * @returns true if the specified destination is an Network Bridge advisory topic.
+         */
+        static bool isNetworkBridgeAdvisoryTopic(const commands::ActiveMQDestination* destination);
+
+    };
+
+}}
+
+#endif /* _ACTIVEMQ_UTIL_ADVISORYSUPPORT_H_ */

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/AdvisorySupport.h
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/Message.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/Message.h?rev=1334183&r1=1334182&r2=1334183&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/Message.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/Message.h Fri May  4 21:04:52 2012
@@ -181,7 +181,7 @@ namespace cms{
          *
          * @throws CMSException - if an internal error occurs.
          */
-        virtual bool propertyExists( const std::string& name ) const = 0;
+        virtual bool propertyExists(const std::string& name) const = 0;
 
         /**
          * Gets a boolean property.
@@ -193,7 +193,7 @@ namespace cms{
          * @throws CMSException if the property does not exist.
          * @throws MessageFormatException - if this type conversion is invalid.
          */
-        virtual bool getBooleanProperty( const std::string& name ) const = 0;
+        virtual bool getBooleanProperty(const std::string& name) const = 0;
 
         /**
          * Gets a byte property.
@@ -205,7 +205,7 @@ namespace cms{
          * @throws CMSException if the property does not exist.
          * @throws MessageFormatException - if this type conversion is invalid.
          */
-        virtual unsigned char getByteProperty( const std::string& name ) const = 0;
+        virtual unsigned char getByteProperty(const std::string& name) const = 0;
 
         /**
          * Gets a double property.
@@ -217,7 +217,7 @@ namespace cms{
          * @throws CMSException if the property does not exist.
          * @throws MessageFormatException - if this type conversion is invalid.
          */
-        virtual double getDoubleProperty( const std::string& name ) const = 0;
+        virtual double getDoubleProperty(const std::string& name) const = 0;
 
         /**
          * Gets a float property.
@@ -229,7 +229,7 @@ namespace cms{
          * @throws CMSException if the property does not exist.
          * @throws MessageFormatException - if this type conversion is invalid.
          */
-        virtual float getFloatProperty( const std::string& name ) const = 0;
+        virtual float getFloatProperty(const std::string& name) const = 0;
 
         /**
          * Gets a int property.
@@ -241,7 +241,7 @@ namespace cms{
          * @throws CMSException if the property does not exist.
          * @throws MessageFormatException - if this type conversion is invalid.
          */
-        virtual int getIntProperty( const std::string& name ) const = 0;
+        virtual int getIntProperty(const std::string& name) const = 0;
 
         /**
          * Gets a long property.
@@ -253,7 +253,7 @@ namespace cms{
          * @throws CMSException if the property does not exist.
          * @throws MessageFormatException - if this type conversion is invalid.
          */
-        virtual long long getLongProperty( const std::string& name ) const = 0;
+        virtual long long getLongProperty(const std::string& name) const = 0;
 
         /**
          * Gets a short property.
@@ -265,7 +265,7 @@ namespace cms{
          * @throws CMSException if the property does not exist.
          * @throws MessageFormatException - if this type conversion is invalid.
          */
-        virtual short getShortProperty( const std::string& name ) const = 0;
+        virtual short getShortProperty(const std::string& name) const = 0;
 
         /**
          * Gets a string property.
@@ -277,7 +277,7 @@ namespace cms{
          * @throws CMSException if the property does not exist.
          * @throws MessageFormatException - if this type conversion is invalid.
          */
-        virtual std::string getStringProperty( const std::string& name ) const = 0;
+        virtual std::string getStringProperty(const std::string& name) const = 0;
 
         /**
          * Sets a boolean property.
@@ -484,7 +484,7 @@ namespace cms{
          *
          * @throws CMSException - if an internal error occurs.
          */
-        virtual void setCMSDestination( const Destination* destination ) = 0;
+        virtual void setCMSDestination(const Destination* destination) = 0;
 
         /**
          * Gets the message's expiration value.
@@ -524,7 +524,7 @@ namespace cms{
          *
          * @throws CMSException - if an internal error occurs.
          */
-        virtual void setCMSExpiration( long long expireTime ) = 0;
+        virtual void setCMSExpiration(long long expireTime) = 0;
 
         /**
          * The CMSMessageID header field contains a value that uniquely
@@ -570,7 +570,7 @@ namespace cms{
          *
          * @throws CMSException - if an internal error occurs.
          */
-        virtual void setCMSMessageID( const std::string& id ) = 0;
+        virtual void setCMSMessageID(const std::string& id) = 0;
 
         /**
          * Gets the message priority level.
@@ -601,7 +601,7 @@ namespace cms{
          *
          * @throws CMSException - if an internal error occurs.
          */
-        virtual void setCMSPriority( int priority ) = 0;
+        virtual void setCMSPriority(int priority) = 0;
 
         /**
          * Gets an indication of whether this message is being redelivered.
@@ -627,7 +627,7 @@ namespace cms{
          *
          * @throws CMSException - if an internal error occurs.
          */
-        virtual void setCMSRedelivered( bool redelivered ) = 0;
+        virtual void setCMSRedelivered(bool redelivered) = 0;
 
         /**
          * Gets the Destination object to which a reply to this message should
@@ -666,7 +666,7 @@ namespace cms{
          *
          * @throws CMSException - if an internal error occurs.
          */
-        virtual void setCMSReplyTo( const cms::Destination* destination ) = 0;
+        virtual void setCMSReplyTo(const cms::Destination* destination) = 0;
 
         /**
          * Gets the message timestamp.
@@ -708,7 +708,7 @@ namespace cms{
          *
          * @throws CMSException - if an internal error occurs.
          */
-        virtual void setCMSTimestamp( long long timeStamp ) = 0;
+        virtual void setCMSTimestamp(long long timeStamp) = 0;
 
         /**
          * Gets the message type identifier supplied by the client when the
@@ -751,7 +751,7 @@ namespace cms{
          *
          * @throws CMSException - if an internal error occurs.
          */
-        virtual void setCMSType( const std::string& type ) = 0;
+        virtual void setCMSType(const std::string& type) = 0;
 
     };
 }

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/Comparable.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/Comparable.h?rev=1334183&r1=1334182&r2=1334183&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/Comparable.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/Comparable.h Fri May  4 21:04:52 2012
@@ -63,19 +63,19 @@ namespace lang{
          * @returns a negative integer, zero, or a positive integer as this
          * object is less than, equal to, or greater than the specified object.
          */
-        virtual int compareTo( const T& value ) const = 0;
+        virtual int compareTo(const T& value) const = 0;
 
         /**
          * @return true if this value is considered equal to the passed value.
          */
-        virtual bool equals( const T& value ) const = 0;
+        virtual bool equals(const T& value) const = 0;
 
         /**
          * Compares equality between this object and the one passed.
          * @param value - the value to be compared to this one.
          * @return true if this object is equal to the one passed.
          */
-        virtual bool operator==( const T& value ) const = 0;
+        virtual bool operator==(const T& value) const = 0;
 
         /**
          * Compares this object to another and returns true if this object
@@ -83,7 +83,7 @@ namespace lang{
          * @param value - the value to be compared to this one.
          * @return true if this object is equal to the one passed.
          */
-        virtual bool operator<( const T& value ) const = 0;
+        virtual bool operator<(const T& value) const = 0;
 
     };
 

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/Pointer.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/Pointer.h?rev=1334183&r1=1334182&r2=1334183&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/Pointer.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/Pointer.h Fri May  4 21:04:52 2012
@@ -359,12 +359,12 @@ namespace lang {
 
         // Allows for operator less on types that implement Comparable or provide
         // a workable operator <
-        virtual bool operator() ( const Pointer<T,R>& left, const Pointer<T,R>& right ) const {
+        virtual bool operator() (const Pointer<T,R>& left, const Pointer<T,R>& right) const {
             return *left < *right;
         }
 
         // Requires that the type in the pointer is an instance of a Comparable.
-        virtual int compare( const Pointer<T,R>& left, const Pointer<T,R>& right ) const {
+        virtual int compare(const Pointer<T,R>& left, const Pointer<T,R>& right) const {
             return *left < *right ? -1 : *right < *left ? 1 : 0;
         }
 

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Comparator.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Comparator.h?rev=1334183&r1=1334182&r2=1334183&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Comparator.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Comparator.h Fri May  4 21:04:52 2012
@@ -53,7 +53,7 @@ namespace util{
          *
          * @return true if the vale of left is less than the value of right.
          */
-        virtual bool operator() ( const T& left, const T& right ) const = 0;
+        virtual bool operator() (const T& left, const T& right) const = 0;
 
         /**
          * Compares its two arguments for order. Returns a negative integer, zero,
@@ -85,7 +85,7 @@ namespace util{
          * @returns a negative integer, zero, or a positive integer as the first
          *          argument is less than, equal to, or greater than the second.
          */
-        virtual int compare( const T& o1, const T& o2 ) const = 0;
+        virtual int compare(const T& o1, const T& o2) const = 0;
 
     };
 

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ConcurrentStlMap.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ConcurrentStlMap.h?rev=1334183&r1=1334182&r2=1334183&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ConcurrentStlMap.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ConcurrentStlMap.h Fri May  4 21:04:52 2012
@@ -269,19 +269,17 @@ namespace concurrent{
         /**
          * {@inheritDoc}
          */
-        virtual V remove( const K& key ) {
+        virtual V remove(const K& key) {
 
-            V result;
+            V result = V();
 
-            synchronized( &mutex ) {
-                typename std::map<K,V,COMPARATOR>::iterator iter = valueMap.find( key );
-                if( iter == valueMap.end() ) {
-                    throw NoSuchElementException(
-                        __FILE__, __LINE__, "Key is not present in this Map." );
+            synchronized(&mutex) {
+                typename std::map<K, V, COMPARATOR>::iterator iter = valueMap.find(key);
+                if (iter == valueMap.end()) {
+                    return result;
                 }
-
                 result = iter->second;
-                valueMap.erase( iter );
+                valueMap.erase(iter);
             }
 
             return result;

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/Makefile.am
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/Makefile.am?rev=1334183&r1=1334182&r2=1334183&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/Makefile.am (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/Makefile.am Fri May  4 21:04:52 2012
@@ -55,6 +55,8 @@ cc_sources = \
     activemq/transport/failover/FailoverTransportTest.cpp \
     activemq/transport/inactivity/InactivityMonitorTest.cpp \
     activemq/transport/mock/MockTransportFactoryTest.cpp \
+    activemq/util/ActiveMQMessageTransformationTest.cpp \
+    activemq/util/AdvisorySupportTest.cpp \
     activemq/util/IdGeneratorTest.cpp \
     activemq/util/LongSequenceGeneratorTest.cpp \
     activemq/util/MarshallingSupportTest.cpp \
@@ -284,6 +286,8 @@ h_sources = \
     activemq/transport/failover/FailoverTransportTest.h \
     activemq/transport/inactivity/InactivityMonitorTest.h \
     activemq/transport/mock/MockTransportFactoryTest.h \
+    activemq/util/ActiveMQMessageTransformationTest.h \
+    activemq/util/AdvisorySupportTest.h \
     activemq/util/IdGeneratorTest.h \
     activemq/util/LongSequenceGeneratorTest.h \
     activemq/util/MarshallingSupportTest.h \

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQTempQueueTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQTempQueueTest.cpp?rev=1334183&r1=1334182&r2=1334183&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQTempQueueTest.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQTempQueueTest.cpp Fri May  4 21:04:52 2012
@@ -31,4 +31,22 @@ void ActiveMQTempQueueTest::test()
     ActiveMQTempQueue myQueue;
 
     CPPUNIT_ASSERT( myQueue.getDestinationType() == cms::Destination::TEMPORARY_QUEUE );
+
+    myQueue.setPhysicalName("ID:SomeValue:0:1");
+    std::string connectionId = myQueue.getConnectionId();
+
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("ConnectionId did not parse correctly",
+        std::string("ID:SomeValue:0"), myQueue.getConnectionId());
+
+    myQueue.setPhysicalName("");
+    myQueue.setPhysicalName("ID:SomeValue:0:A");
+    connectionId = myQueue.getConnectionId();
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("ConnectionId should not have parsed",
+        std::string("ID:SomeValue:0"), myQueue.getConnectionId());
+
+    myQueue.setPhysicalName("");
+    myQueue.setPhysicalName("SomeValueThatWillNotParse");
+    connectionId = myQueue.getConnectionId();
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("ConnectionId should not have parsed",
+        std::string(""), myQueue.getConnectionId());
 }

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQTempTopicTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQTempTopicTest.cpp?rev=1334183&r1=1334182&r2=1334183&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQTempTopicTest.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQTempTopicTest.cpp Fri May  4 21:04:52 2012
@@ -28,7 +28,25 @@ using namespace activemq::commands;
 ////////////////////////////////////////////////////////////////////////////////
 void ActiveMQTempTopicTest::test()
 {
-    ActiveMQTempTopic myQueue;
+    ActiveMQTempTopic myTopic;
 
-    CPPUNIT_ASSERT( myQueue.getDestinationType() == cms::Destination::TEMPORARY_TOPIC );
+    CPPUNIT_ASSERT( myTopic.getDestinationType() == cms::Destination::TEMPORARY_TOPIC );
+
+    myTopic.setPhysicalName("ID:SomeValue:0:1");
+    std::string connectionId = myTopic.getConnectionId();
+
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("ConnectionId did not parse correctly",
+        std::string("ID:SomeValue:0"), myTopic.getConnectionId());
+
+    myTopic.setPhysicalName("");
+    myTopic.setPhysicalName("ID:SomeValue:0:A");
+    connectionId = myTopic.getConnectionId();
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("ConnectionId should not have parsed",
+        std::string("ID:SomeValue:0"), myTopic.getConnectionId());
+
+    myTopic.setPhysicalName("");
+    myTopic.setPhysicalName("SomeValueThatWillNotParse");
+    connectionId = myTopic.getConnectionId();
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("ConnectionId should not have parsed",
+        std::string(""), myTopic.getConnectionId());
 }

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionFactoryTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionFactoryTest.cpp?rev=1334183&r1=1334182&r2=1334183&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionFactoryTest.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/core/ActiveMQConnectionFactoryTest.cpp Fri May  4 21:04:52 2012
@@ -275,29 +275,29 @@ void ActiveMQConnectionFactoryTest::test
 
     MyTransportListener listener;
 
-    ActiveMQConnectionFactory connectionFactory( URI );
+    ActiveMQConnectionFactory connectionFactory(URI);
 
     std::auto_ptr<cms::Connection> connection(
-        connectionFactory.createConnection() );
-    CPPUNIT_ASSERT( connection.get() != NULL );
+        connectionFactory.createConnection());
+    CPPUNIT_ASSERT(connection.get() != NULL);
 
     ActiveMQConnection* amqConnection =
         dynamic_cast< ActiveMQConnection* >( connection.get() );
 
-    amqConnection->addTransportListener( & listener );
+    amqConnection->addTransportListener(&listener);
 
-    std::auto_ptr<ActiveMQSession> session( dynamic_cast<ActiveMQSession*>(
-        amqConnection->createSession() ) );
+    std::auto_ptr<ActiveMQSession> session(
+        dynamic_cast<ActiveMQSession*> (amqConnection->createSession()));
 
-    std::auto_ptr<cms::Destination> destination( session->createTopic( "TEST" ) );
+    std::auto_ptr<cms::Destination> destination(session->createTopic("TEST"));
 
-    std::auto_ptr<ActiveMQProducer> producer( dynamic_cast<ActiveMQProducer*>(
-        session->createProducer( destination.get() ) ) );
+    std::auto_ptr<ActiveMQProducer> producer(
+        dynamic_cast<ActiveMQProducer*> (session->createProducer(destination.get())));
 
-    std::auto_ptr<cms::TextMessage> message( session->createTextMessage() );
-    producer->send( message.get() );
+    std::auto_ptr<cms::TextMessage> message(session->createTextMessage());
+    producer->send(message.get());
 
-    Thread::sleep( 2000 );
+    Thread::sleep(2000);
 
     CPPUNIT_ASSERT( listener.isInterrupted() );
     CPPUNIT_ASSERT( listener.isResumed() );

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/core/ActiveMQSessionTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/core/ActiveMQSessionTest.cpp?rev=1334183&r1=1334182&r2=1334183&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/core/ActiveMQSessionTest.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/core/ActiveMQSessionTest.cpp Fri May  4 21:04:52 2012
@@ -511,46 +511,42 @@ void ActiveMQSessionTest::testTransactio
 
     MyCMSMessageListener msgListener1;
 
-    CPPUNIT_ASSERT( connection.get() != NULL );
+    CPPUNIT_ASSERT(connection.get() != NULL);
 
     // Create an Transacted Session
-    std::auto_ptr<cms::Session> session(
-        connection->createSession( cms::Session::SESSION_TRANSACTED ) );
+    std::auto_ptr<cms::Session> session(connection->createSession(cms::Session::SESSION_TRANSACTED));
 
     // Create a Topic
-    std::auto_ptr<cms::Topic> topic1( session->createTopic( "TestTopic1" ) );
+    std::auto_ptr<cms::Topic> topic1(session->createTopic("TestTopic1"));
 
-    CPPUNIT_ASSERT( topic1.get() != NULL );
+    CPPUNIT_ASSERT(topic1.get() != NULL );
 
     // Create a consumer
     std::auto_ptr<ActiveMQConsumer> consumer1(
-        dynamic_cast<ActiveMQConsumer*>( session->createConsumer( topic1.get() ) ) );
+        dynamic_cast<ActiveMQConsumer*> (session->createConsumer(topic1.get())));
 
-    CPPUNIT_ASSERT( consumer1.get() != NULL );
+    CPPUNIT_ASSERT(consumer1.get() != NULL);
 
-    CPPUNIT_ASSERT( consumer1->getMessageSelector() == "" );
+    CPPUNIT_ASSERT(consumer1->getMessageSelector() == "");
 
-    CPPUNIT_ASSERT( consumer1->receiveNoWait() == NULL );
-    CPPUNIT_ASSERT( consumer1->receive( 5 ) == NULL );
+    CPPUNIT_ASSERT(consumer1->receiveNoWait() == NULL);
+    CPPUNIT_ASSERT(consumer1->receive( 5 ) == NULL);
 
-    consumer1->setMessageListener( &msgListener1 );
+    consumer1->setMessageListener(&msgListener1);
 
-    for( int i = 0; i < MSG_COUNT; ++i ) {
-        injectTextMessage( "This is a Test 1" , *topic1, *( consumer1->getConsumerId() ) );
+    for (int i = 0; i < MSG_COUNT; ++i) {
+        injectTextMessage("This is a Test 1", *topic1, *(consumer1->getConsumerId()));
     }
 
-    msgListener1.asyncWaitForMessages( MSG_COUNT );
+    msgListener1.asyncWaitForMessages(MSG_COUNT);
 
-    CPPUNIT_ASSERT_EQUAL( MSG_COUNT, (int)msgListener1.messages.size() );
+    CPPUNIT_ASSERT_EQUAL(MSG_COUNT, (int)msgListener1.messages.size());
 
     // This is what we are testing, since there was no commit, the session
     // will rollback the transaction when this are closed.
     // session->commit();
 
-    // TODO - We should be able to close the consumer but we don't have a way
-    // to keep the consumer alive if deleted after calling close so the session
-    // segfaults on attempting to rollback the transaction and visiting all its
-    // registered Synchronizations.
+    consumer1->close();
     session->close();
 }
 

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/state/ConnectionStateTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/state/ConnectionStateTest.cpp?rev=1334183&r1=1334182&r2=1334183&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/state/ConnectionStateTest.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/state/ConnectionStateTest.cpp Fri May  4 21:04:52 2012
@@ -32,22 +32,25 @@ using namespace decaf::lang;
 void ConnectionStateTest::test() {
 
     // Create a Session
-    Pointer<SessionId> sid( new SessionId );
-    sid->setConnectionId( "CONNECTION" );
-    sid->setValue( 42 );
-    Pointer<SessionInfo> sinfo( new SessionInfo );
-    sinfo->setSessionId( sid );
+    Pointer<SessionId> sid(new SessionId);
+    sid->setConnectionId("CONNECTION");
+    sid->setValue(42);
+    Pointer<SessionInfo> sinfo(new SessionInfo);
+    sinfo->setSessionId(sid);
 
-    Pointer<ConnectionInfo> info( new ConnectionInfo );
-    ConnectionState state( info );
+    Pointer<ConnectionId> connectionId(new ConnectionId());
+    connectionId->setValue("CONNECTION");
+    Pointer<ConnectionInfo> info(new ConnectionInfo);
+    info->setConnectionId(connectionId);
 
-    state.addSession( sinfo );
-    CPPUNIT_ASSERT( state.getSessionStates().size() == 1 );
-    state.removeSession( sinfo->getSessionId() );
-    CPPUNIT_ASSERT( state.getSessionStates().size() == 0 );
+    ConnectionState state(info);
 
-    state.addSession( sinfo );
-    state.addSession( sinfo );
+    state.addSession(sinfo);
+    CPPUNIT_ASSERT( state.getSessionStates().size() == 2 );
+    state.removeSession(sinfo->getSessionId());
     CPPUNIT_ASSERT( state.getSessionStates().size() == 1 );
 
+    state.addSession(sinfo);
+    state.addSession(sinfo);
+    CPPUNIT_ASSERT( state.getSessionStates().size() == 2 );
 }



Mime
View raw message