You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2007/08/02 16:56:07 UTC

svn commit: r562132 - in /activemq/activemq-cpp/trunk/src: main/activemq/core/ main/cms/ test/activemq/core/

Author: tabish
Date: Thu Aug  2 07:56:06 2007
New Revision: 562132

URL: http://svn.apache.org/viewvc?view=rev&rev=562132
Log:
https://issues.apache.org/activemq/browse/AMQCPP-124

Adding in start of ConnectionMetaData

Added:
    activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnectionMetaData.h
    activemq/activemq-cpp/trunk/src/main/cms/ConnectionMetaData.h
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/cms/Connection.h
    activemq/activemq-cpp/trunk/src/test/activemq/core/ActiveMQConnectionTest.cpp

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?view=diff&rev=562132&r1=562131&r2=562132
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.cpp Thu Aug  2 07:56:06 2007
@@ -76,6 +76,20 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
+const cms::ConnectionMetaData& ActiveMQConnection::getMetaData() const
+    throw ( cms::CMSException ) {
+
+    if( closed ) {
+        throw ActiveMQException(
+            __FILE__, __LINE__,
+            "ActiveMQConnection::getMetaData - "
+            "Can't get data on closed Connection" );
+    }
+
+    return connectionMetaData;
+}
+
+////////////////////////////////////////////////////////////////////////////////
 cms::Session* ActiveMQConnection::createSession() throw ( cms::CMSException )
 {
     try {

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?view=diff&rev=562132&r1=562131&r2=562132
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.h Thu Aug  2 07:56:06 2007
@@ -27,15 +27,16 @@
 #include <activemq/util/Properties.h>
 #include <activemq/util/Map.h>
 #include <activemq/util/Set.h>
+#include <activemq/core/ActiveMQConnectionMetaData.h>
 
 #include <string>
 
 namespace activemq{
-    
+
     namespace connector {
         class ConsumerInfo;
     }
-    
+
 namespace core{
 
     class cms::Session;
@@ -84,6 +85,11 @@
          */
         util::Set<ActiveMQSession*> activeSessions;
 
+        /**
+         * The Meta Data for this Connection
+         */
+        ActiveMQConnectionMetaData connectionMetaData;
+
     public:
 
         /**
@@ -100,14 +106,14 @@
          * @param session The session to be unregistered from this connection.
          */
         virtual void removeSession( ActiveMQSession* session ) throw ( cms::CMSException );
-        
+
         /**
          * Adds a dispatcher for a consumer.
          * @param consumer - The consumer for which to register a dispatcher.
          * @param dispatcher - The dispatcher to handle incoming messages for the consumer.
          */
         virtual void addDispatcher( connector::ConsumerInfo* consumer, Dispatcher* dispatcher );
-        
+
         /**
          * Removes the dispatcher for a consumer.
          * @param consumer - The consumer for which to remove the dispatcher.
@@ -115,6 +121,13 @@
         virtual void removeDispatcher( const connector::ConsumerInfo* consumer );
 
     public:   // Connection Interface Methods
+
+        /**
+         * @eturns the a ConnectionMata object for this connection
+         * @throws CMSException
+         */
+        virtual const cms::ConnectionMetaData& getMetaData() const
+            throw ( cms::CMSException );
 
         /**
          * Creates a new Session to work for this Connection

Added: 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?view=auto&rev=562132
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnectionMetaData.h (added)
+++ activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnectionMetaData.h Thu Aug  2 07:56:06 2007
@@ -0,0 +1,66 @@
+/*
+ * 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_CORE_ACTIVEMQCONNECTIONMETADATA_H_
+#define _ACTIVEMQ_CORE_ACTIVEMQCONNECTIONMETADATA_H_
+
+#include <cms/ConnectionMetaData.h>
+#include <activemq/util/Config.h>
+
+namespace activemq{
+namespace core{
+
+    class ActiveMQConnectionMetaData : public cms::ConnectionMetaData {
+    public:
+
+        ActiveMQConnectionMetaData() {}
+
+        virtual ~ActiveMQConnectionMetaData() {}
+
+        /**
+         * @returns the Major version number of CMS Supported
+         */
+        virtual int getCMSMajorVersion() const {
+            return 1;
+        }
+
+        /**
+         * @returns the Minor version number of CMS Supported
+         */
+        virtual int getCMSMinorVersion() const {
+            return 2;
+        }
+
+        /**
+         * @returns the CMS version supported as a string
+         */
+        virtual std::string getCMSVersion() const {
+            return "1.2";
+        }
+
+        /**
+         * @returns the name of the CMS provider Library
+         */
+        virtual std::string getCMSProviderName() const {
+            return "ActiveMQ-CPP";
+        }
+
+    };
+
+}}
+
+#endif /*_ACTIVEMQ_CORE_ACTIVEMQCONNECTIONMETADATA_H_*/

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?view=diff&rev=562132&r1=562131&r2=562132
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/cms/Connection.h (original)
+++ activemq/activemq-cpp/trunk/src/main/cms/Connection.h Thu Aug  2 07:56:06 2007
@@ -23,11 +23,12 @@
 #include <cms/Stoppable.h>
 #include <cms/Closeable.h>
 #include <cms/Session.h>
+#include <cms/ConnectionMetaData.h>
 
 namespace cms
 {
     class ExceptionListener;
-   
+
     class CMS_API Connection :
         public Startable,
         public Stoppable,
@@ -38,33 +39,40 @@
         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;
 
-		/**
+        /**
+         * @eturns the a ConnectionMata object for this connection
+         * @throws CMSException on failure to get ConnectionMetaData
+         */
+        virtual const ConnectionMetaData& getMetaData() const
+            throw ( cms::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 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

Added: activemq/activemq-cpp/trunk/src/main/cms/ConnectionMetaData.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/cms/ConnectionMetaData.h?view=auto&rev=562132
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/cms/ConnectionMetaData.h (added)
+++ activemq/activemq-cpp/trunk/src/main/cms/ConnectionMetaData.h Thu Aug  2 07:56:06 2007
@@ -0,0 +1,61 @@
+/*
+ * 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 _CMS_CONNECTIONMETADATA_H_
+#define _CMS_CONNECTIONMETADATA_H_
+
+#include <cms/Config.h>
+#include <cms/CMSException.h>
+#include <string>
+
+namespace cms{
+
+    /**
+     * A ConnectionMetaData object provides information describing the
+     * Connection object.
+     * @since 1.2
+     */
+    class CMS_API ConnectionMetaData {
+    public:
+
+        virtual ~ConnectionMetaData() {}
+
+        /**
+         * @returns the Major version number of CMS Supported
+         */
+        virtual int getCMSMajorVersion() const = 0;
+
+        /**
+         * @returns the Minor version number of CMS Supported
+         */
+        virtual int getCMSMinorVersion() const = 0;
+
+        /**
+         * @returns the CMS version supported as a string
+         */
+        virtual std::string getCMSVersion() const = 0;
+
+        /**
+         * @returns the name of the CMS provider Library
+         */
+        virtual std::string getCMSProviderName() const = 0;
+
+    };
+
+}
+
+#endif /*_CMS_CONNECTIONMETADATA_H_*/

Modified: activemq/activemq-cpp/trunk/src/test/activemq/core/ActiveMQConnectionTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/core/ActiveMQConnectionTest.cpp?view=diff&rev=562132&r1=562131&r2=562132
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/activemq/core/ActiveMQConnectionTest.cpp (original)
+++ activemq/activemq-cpp/trunk/src/test/activemq/core/ActiveMQConnectionTest.cpp Thu Aug  2 07:56:06 2007
@@ -283,6 +283,10 @@
             new ActiveMQConnectionData(
                 connector, transport, properties) );
 
+        CPPUNIT_ASSERT( connection.getMetaData().getCMSVersion() != "" );
+        CPPUNIT_ASSERT( connection.getMetaData().getCMSProviderName() != "" );
+
+
         connection.getClientID();
         connection.close();