activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r734722 - in /activemq/activemq-cpp/trunk/src/main: activemq/core/ActiveMQConnection.cpp activemq/core/ActiveMQConnection.h activemq/core/ActiveMQConnectionMetaData.cpp activemq/core/ActiveMQConnectionMetaData.h cms/Connection.h
Date Thu, 15 Jan 2009 14:40:13 GMT
Author: tabish
Date: Thu Jan 15 06:40:12 2009
New Revision: 734722

URL: http://svn.apache.org/viewvc?rev=734722&view=rev
Log:
Add A ConnectionMetaData interface to CMS and implement it in ActiveMQConnection

Modified:
    activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.cpp
    activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.h
    activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnectionMetaData.cpp
    activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnectionMetaData.h
    activemq/activemq-cpp/trunk/src/main/cms/Connection.h

Modified: activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.cpp?rev=734722&r1=734721&r2=734722&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.cpp Thu Jan 15 06:40:12
2009
@@ -39,6 +39,7 @@
     this->started = false;
     this->closed = false;
     this->exceptionListener = NULL;
+    this->connectionMetaData.reset( new ActiveMQConnectionMetaData() );
 
     // Register for messages and exceptions from the connector.
     Connector* connector = connectionData->getConnector();

Modified: activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.h?rev=734722&r1=734721&r2=734722&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.h Thu Jan 15 06:40:12
2009
@@ -22,6 +22,7 @@
 #include <cms/ExceptionListener.h>
 #include <activemq/util/Config.h>
 #include <activemq/core/ActiveMQConnectionData.h>
+#include <activemq/core/ActiveMQConnectionMetaData.h>
 #include <activemq/core/ActiveMQMessage.h>
 #include <activemq/core/Dispatcher.h>
 #include <activemq/connector/ConsumerMessageListener.h>
@@ -34,6 +35,7 @@
 #include <decaf/lang/exceptions/IllegalStateException.h>
 
 #include <string>
+#include <memory>
 
 namespace activemq{
 
@@ -68,6 +70,11 @@
         ActiveMQConnectionData* connectionData;
 
         /**
+         * The instance of ConnectionMetaData to return to clients.
+         */
+        std::auto_ptr<cms::ConnectionMetaData> connectionMetaData;
+
+        /**
          * Indicates if this Connection is started
          */
         bool started;
@@ -164,6 +171,21 @@
     public:   // Connection Interface Methods
 
         /**
+         * Gets the metadata for this connection.
+         *
+         * @returns the connection MetaData pointer ( caller does not own it ).
+         *
+         * @throws CMSException
+         *         if the provider fails to get the connection metadata for this connection.
+         *
+         * @see ConnectionMetaData
+         * @since 2.0
+         */
+        virtual const cms::ConnectionMetaData* getMetaData() const throw( cms::CMSException
) {
+            return connectionMetaData.get();
+        }
+
+        /**
          * Creates a new Session to work for this Connection
          * @throws CMSException
          */

Modified: activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnectionMetaData.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnectionMetaData.cpp?rev=734722&r1=734721&r2=734722&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnectionMetaData.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnectionMetaData.cpp Thu
Jan 15 06:40:12 2009
@@ -28,3 +28,52 @@
 ////////////////////////////////////////////////////////////////////////////////
 ActiveMQConnectionMetaData::~ActiveMQConnectionMetaData() {
 }
+
+////////////////////////////////////////////////////////////////////////////////
+std::string ActiveMQConnectionMetaData::getCMSVersion() const throw( cms::CMSException )
{
+    return "2.0";
+}
+
+////////////////////////////////////////////////////////////////////////////////
+int ActiveMQConnectionMetaData::getCMSMajorVersion() const throw( cms::CMSException ) {
+    return 2;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+int ActiveMQConnectionMetaData::getCMSMinorVersion() const throw( cms::CMSException ) {
+    return 0;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::string ActiveMQConnectionMetaData::getCMSProviderName() const throw( cms::CMSException
) {
+    return "ActiveMQ-CPP";
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::string ActiveMQConnectionMetaData::getProviderVersion() const throw( cms::CMSException
) {
+    return "3.0";
+}
+
+////////////////////////////////////////////////////////////////////////////////
+int ActiveMQConnectionMetaData::getProviderMajorVersion() const throw( cms::CMSException
) {
+    return 3;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+int ActiveMQConnectionMetaData::getProviderMinorVersion() const throw( cms::CMSException
) {
+    return 0;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::vector<std::string> ActiveMQConnectionMetaData::getCMSXPropertyNames() const
+    throw( cms::CMSException ) {
+
+    std::vector<std::string> jmxProperties;
+
+    jmxProperties.push_back( "JMSXGroupID" );
+    jmxProperties.push_back( "JMSXGroupSeq" );
+    jmxProperties.push_back( "JMSXDeliveryCount" );
+    jmxProperties.push_back( "JMSXProducerTXID" );
+
+    return jmxProperties;
+}

Modified: activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnectionMetaData.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnectionMetaData.h?rev=734722&r1=734721&r2=734722&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnectionMetaData.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnectionMetaData.h Thu Jan
15 06:40:12 2009
@@ -28,6 +28,8 @@
     /**
      * This class houses all the various settings and information that is used
      * by an instance of an ActiveMQConnection class.
+     *
+     * @since 3.0
      */
     class AMQCPP_API ActiveMQConnectionMetaData : public cms::ConnectionMetaData {
     private:
@@ -47,9 +49,7 @@
          * @throw CMSException
          *        If the CMS Provider fails to retrieve the metadata due to some internal
error.
          */
-        virtual std::string getCMSVersion() const throw( cms::CMSException ) {
-            return "2.0";
-        }
+        virtual std::string getCMSVersion() const throw( cms::CMSException );
 
         /**
          * Gets the CMS major version number.
@@ -59,9 +59,7 @@
          * @throw CMSException
          *        If the CMS Provider fails to retrieve the metadata due to some internal
error.
          */
-        virtual int getCMSMajorVersion() const throw( cms::CMSException ) {
-            return 2;
-        }
+        virtual int getCMSMajorVersion() const throw( cms::CMSException );
 
         /**
          * Gets the CMS minor version number.
@@ -71,9 +69,7 @@
          * @throw CMSException
          *        If the CMS Provider fails to retrieve the metadata due to some internal
error.
          */
-        virtual int getCMSMinorVersion() const throw( cms::CMSException ) {
-            return 0;
-        }
+        virtual int getCMSMinorVersion() const throw( cms::CMSException );
 
         /**
          * Gets the CMS provider name.
@@ -83,9 +79,7 @@
          * @throw CMSException
          *        If the CMS Provider fails to retrieve the metadata due to some internal
error.
          */
-        virtual std::string getCMSProviderName() const throw( cms::CMSException ) {
-            return "ActiveMQ-CPP";
-        }
+        virtual std::string getCMSProviderName() const throw( cms::CMSException );
 
         /**
          * Gets the CMS provider version.
@@ -95,9 +89,7 @@
          * @throw CMSException
          *        If the CMS Provider fails to retrieve the metadata due to some internal
error.
          */
-        virtual std::string getProviderVersion() const throw( cms::CMSException ) {
-            return "3.0";
-        }
+        virtual std::string getProviderVersion() const throw( cms::CMSException );
 
         /**
          * Gets the CMS provider major version number.
@@ -107,9 +99,7 @@
          * @throw CMSException
          *        If the CMS Provider fails to retrieve the metadata due to some internal
error.
          */
-        virtual int getProviderMajorVersion() const throw( cms::CMSException ) {
-            return 3;
-        }
+        virtual int getProviderMajorVersion() const throw( cms::CMSException );
 
         /**
          * Gets the CMS provider minor version number.
@@ -119,9 +109,7 @@
          * @throw CMSException
          *        If the CMS Provider fails to retrieve the metadata due to some internal
error.
          */
-        virtual int getProviderMinorVersion() const throw( cms::CMSException ) {
-            return 0;
-        }
+        virtual int getProviderMinorVersion() const throw( cms::CMSException );
 
         /**
          * Gets an Vector of the CMSX property names.
@@ -131,9 +119,7 @@
          * @throw CMSException
          *        If the CMS Provider fails to retrieve the metadata due to some internal
error.
          */
-        virtual std::vector<std::string> getCMSXPropertyNames() const throw( cms::CMSException
) {
-            return std::vector<std::string>();
-        }
+        virtual std::vector<std::string> getCMSXPropertyNames() const throw( cms::CMSException
);
 
     };
 

Modified: activemq/activemq-cpp/trunk/src/main/cms/Connection.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/cms/Connection.h?rev=734722&r1=734721&r2=734722&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/cms/Connection.h (original)
+++ activemq/activemq-cpp/trunk/src/main/cms/Connection.h Thu Jan 15 06:40:12 2009
@@ -23,67 +23,80 @@
 #include <cms/Stoppable.h>
 #include <cms/Closeable.h>
 #include <cms/Session.h>
+#include <cms/ConnectionMetaData.h>
+
+namespace cms{
 
-namespace cms
-{
     class ExceptionListener;
-   
+
     /**
      * The client's connection to its provider.
      */
-    class CMS_API Connection :
-        public Startable,
-        public Stoppable,
-        public Closeable
+    class CMS_API Connection : public Startable,
+                               public Stoppable,
+                               public Closeable
     {
     public:
 
         virtual ~Connection() {}
 
         /**
-         * Closes this connection as well as any Sessions 
+         * Closes this connection as well as any Sessions
          * created from it (and those Sessions' consumers and
          * producers).
-         * 
+         *
          * @throws CMSException
          */
         virtual void close() throw( CMSException ) = 0;
 
+        /**
+         * Gets the metadata for this connection.
+         *
+         * @returns the connection MetaData pointer ( caller does not own it ).
+         *
+         * @throws CMSException
+         *         if the provider fails to get the connection metadata for this connection.
+         *
+         * @see ConnectionMetaData
+         * @since 2.0
+         */
+        virtual const ConnectionMetaData* getMetaData() const throw( CMSException ) = 0;
+
 		/**
          * Creates an AUTO_ACKNOWLEDGE Session.
-         * 
+         *
          * @throws CMSException
          */
         virtual Session* createSession() throw ( CMSException ) = 0;
-				
+
         /**
          * Creates a new Session to work for this Connection using the
          * specified acknowledgment mode
-         * 
+         *
          * @param ackMode
          *      the Acknowledgement Mode to use.
          * @throws CMSException
          */
-        virtual Session* createSession( Session::AcknowledgeMode ackMode ) 
+        virtual Session* createSession( Session::AcknowledgeMode ackMode )
             throw ( CMSException ) = 0;
 
         /**
          * Get the Client Id for this session
-         * 
+         *
          * @return Client Id String
          */
-        virtual std::string getClientID() const = 0;      
+        virtual std::string getClientID() const = 0;
 
         /**
          * Gets the registered Exception Listener for this connection
-         * 
+         *
          * @return pointer to an exception listnener or NULL
          */
         virtual ExceptionListener* getExceptionListener() const = 0;
 
         /**
          * Sets the registed Exception Listener for this connection
-         * 
+         *
          * @param listener
          *      pointer to and <code>ExceptionListener</code>
          */



Mime
View raw message