Author: tabish
Date: Wed Nov 17 20:35:07 2010
New Revision: 1036207
URL: http://svn.apache.org/viewvc?rev=1036207&view=rev
Log:
https://issues.apache.org/activemq/browse/AMQCPP-329
Adds a static entry point in cms::XAConnectionFactory to create new instances
via the provider library. Allows a provider to throw an exception if the XA
API is not supported.
Modified:
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQXAConnectionFactory.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/XAConnectionFactory.h
Modified:
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQXAConnectionFactory.cpp
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQXAConnectionFactory.cpp?rev=1036207&r1=1036206&r2=1036207&view=diff
==============================================================================
---
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQXAConnectionFactory.cpp
(original)
+++
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQXAConnectionFactory.cpp
Wed Nov 17 20:35:07 2010
@@ -23,6 +23,11 @@ using namespace activemq;
using namespace activemq::core;
////////////////////////////////////////////////////////////////////////////////
+cms::XAConnectionFactory*
cms::XAConnectionFactory::createCMSXAConnectionFactory( const std::string&
brokerURI ) {
+ return new ActiveMQXAConnectionFactory( brokerURI );
+}
+
+////////////////////////////////////////////////////////////////////////////////
ActiveMQXAConnectionFactory::ActiveMQXAConnectionFactory() :
ActiveMQConnectionFactory() {
}
Modified:
activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/XAConnectionFactory.h
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/XAConnectionFactory.h?rev=1036207&r1=1036206&r2=1036207&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/XAConnectionFactory.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/XAConnectionFactory.h
Wed Nov 17 20:35:07 2010
@@ -75,6 +75,29 @@ namespace cms {
*/
virtual XAConnection* createXAConnection( const std::string& userName,
const std::string& password
) = 0;
+ public:
+
+ /**
+ * Static method that is used to create a provider specific XA
Connection
+ * factory. The provider implements this method in their library and
+ * returns an instance of a XAConnectionFactory derived object.
Clients can
+ * use this method to remain abstracted from the specific CMS
implementation
+ * being used.
+ *
+ * The XA interfaces are optional in CMS however if a provider chooses
to omit
+ * them it should still override this method and throw an
UnsupportedOperationException
+ * to indicate that it doesn't provide this functionality.
+ *
+ * @param brokerURI
+ * The remote address to use to connect to the Provider.
+ *
+ * @return A pointer to a provider specific implementation of the
XAConnectionFactory
+ * interface, the caller is responsible for deleting this
resource.
+ *
+ * @throws CMSException if an internal error occurs while creating the
XAConnectionFactory.
+ * @throws UnsupportedOperationException if the provider does not
support the XA API.
+ */
+ static XAConnectionFactory* createCMSXAConnectionFactory( const
std::string& brokerURI );
};