From 9c73ef7a5ac10acd6a50d5d52bd721fc2faa5919 Mon Sep 17 00:00:00 2001 From: Kim van der Riet Date: Thu, 28 Feb 2013 16:14:30 +0000 Subject: Update from trunk r1375509 through r1450773 git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/asyncstore@1451244 13f79535-47bb-0310-9956-ffa450edef68 --- java/jca/README-JBOSS-EAP6.txt | 183 ++++++++++++++++ java/jca/README-JBOSS.txt | 26 ++- java/jca/build.xml | 25 ++- .../rar/src/main/resources/META-INF/jboss-ra.xml | 33 +++ java/jca/rar/src/main/resources/META-INF/ra.xml | 230 +++++++++++++++++++++ .../qpid/ra/admin/QpidConnectionFactoryProxy.java | 73 ++++++- java/jca/src/main/resources/META-INF/jboss-ra.xml | 33 --- java/jca/src/main/resources/META-INF/ra.xml | 230 --------------------- 8 files changed, 539 insertions(+), 294 deletions(-) create mode 100644 java/jca/README-JBOSS-EAP6.txt create mode 100644 java/jca/rar/src/main/resources/META-INF/jboss-ra.xml create mode 100755 java/jca/rar/src/main/resources/META-INF/ra.xml delete mode 100644 java/jca/src/main/resources/META-INF/jboss-ra.xml delete mode 100755 java/jca/src/main/resources/META-INF/ra.xml (limited to 'java/jca') diff --git a/java/jca/README-JBOSS-EAP6.txt b/java/jca/README-JBOSS-EAP6.txt new file mode 100644 index 0000000000..219bfb6468 --- /dev/null +++ b/java/jca/README-JBOSS-EAP6.txt @@ -0,0 +1,183 @@ +Qpid JCA Resource Adapter + +JBoss EAP 6.x Installation and Configuration Instructions + +Overview +======== +The Qpid Resource Adapter is a JCA 1.5 compliant resource adapter that allows +for JEE integration between EE applications and AMQP 0.10 message brokers. + +The adapter provides both outbound and inbound connectivity and +exposes a variety of options to fine tune your messaging applications. +Currently the adapter only supports C++ based brokers and has only been tested with Apache Qpid C++ broker. + +The following document explains how to configure the resource adapter for deployment in JBoss EAP 6.x. + +Deployment +========== +To deploy the Qpid JCA adapter in the JBoss EAP 6 environment, copy the qpid-ra-.rar file +to your JBoss deployment directory. By default this can be found at + +JBOSS_ROOT//deployments + +where JBOSS_ROOT denotes the root directory of your JBoss EAP 6.x installation and denotes the +particular server configuration for your applicationd development. Currently, JBoss EAP 6 provides two configurations +by default standalone and domain. This documentation assumes the standalone server configuration, though the process +to configure and deploy the Qpid JCA adapter is largely the same between the two. Assuming the standalone configuration +the deployment location above would be + +JBOSS_ROOT/standalone/deployments + +Note, as opposed to prior versions of EAP, copying a RAR file to the deployment location does not automatically +start and deploy the adapter. A separate manual configuration step is required which is explained in the following +section. + +Configuration +============= +The EAP 6.x environment uses an XML based configuration scheme that is fundamentally different than prior versions +of EAP. As previously mentioned, EAP 6.x provides two server configuration types, standalone and domain. Each come with +a different set of configuration files that are tailored to varying types of server environments. Configuration locations +can be found at + +JBOSS_ROOT//configuration + +The varying XML files are named + +-full.xml +-full-ha.xml +.xml + +where each XML file denotes the capabilites of the server. This document assumes a minimal server configuration in +the standalone server environment. While each configuration file provides a variety of options, this document is +only concerned with the configuration of the JCA adapter. Please consult the EAP 6.x documentation for other +options and configuration scenarios. + +The EAP 6.x infrastructure is built upon the notion of varying subsystem where subsystem generally corresponds +to one particular piece of functionality. Typical examples are EJB, JAXR etc. In order to configure the Qpid JCA adapter +we need to modify the ejb and resource-adapters subsystems in order to tell EAP 6.x about our RAR deployment as well +as the RAR that will provide JMS provider functionality. + +Note, JCA in EAP 6.x involves two subsystems, jca and resource-adapters. The former subsytem provides capabilities for +all JCA deployments (the JCA runtime environment) where the resource-adapters subsystem is particular to an invidual JCA +deployment. Here we are only concerned with the latter. Please consult the EAP 6.x documentation for more general JCA +configuration options as well as other subsystems. + +Each subsystem is configured in an XML fragment and is versioned separately. Subsystem versions will change over +time so this document may not reflect the most current version, but the Qpid JCA configuration options remain +unchanged across subsystem regardless of version or release date. + +The following XML fragment replaces the default messaging provider in the EAP 6.x environment + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +The only real lines we are concerned with are + + + + + + +however, the complete fragment is provided for clarity. + +The following XML fragment provides a minimal example configuration in the EAP 6 environment. Here we are configuring +an XA aware ManagedConnectionFactory and two JMS destinations (queue and topic) + + + + + + qpid-ra-.rar + + + XATransaction + + + amqp://anonymous:passwd@client/test?brokerlist='tcp://localhost?sasl_mechs='PLAIN'' + + + org.apache.qpid.ra.tm.JBoss7TransactionManagerLocator + + + getTm + + + + + amqp://anonymous:passwd@client/test?brokerlist='tcp://localhost?sasl_mechs='PLAIN'' + + + javax.jms.Queue + + + + + + + amq.topic/hello.Topic + + + + + hello.Queue;{create:always, node:{type:queue, x-declare:{auto-delete:true}}} + + + + + + + + + +Note, while this document assumes that you are modifying the standalone.xml file directly, an alternative to this approach would be +to make a copy of the file, apply the modifications above and start the EAP instance with the new configuration + +JBOSS_HOME/bin/standalone.sh -c your-modified-config.xml + +Regardless of the approach that you use, once the modifications have been made you can start your EAP 6.x instance and the Qpid JCA +adapter will be deployed and ready for use. If property deployed and configured, you should see something in the log files or console +resembling the following: + +INFO [org.apache.qpid.ra.QpidResourceAdapter] (MSC service thread 1-4) Qpid resource adapter started + + +Notes +===== +While the differences between the EAP 5.x and 6.x environments may appear to be dramatic, the configuration options and functionality of the Qpid +JCA adapter are not. The README.txt file outlines general configuration options that remain unchanged between the respective EAP environments. + diff --git a/java/jca/README-JBOSS.txt b/java/jca/README-JBOSS.txt index 77bf91e6dd..e88643e0f2 100644 --- a/java/jca/README-JBOSS.txt +++ b/java/jca/README-JBOSS.txt @@ -61,7 +61,7 @@ XA ConnectionFactory qpid-ra-.rar org.apache.qpid.ra.QpidRAConnectionFactory - amqp://guest:guest@/test?brokerlist='tcp://localhost:5672?sasl_mechs='ANONYMOUS'' + amqp://guest:guest@/test?brokerlist='tcp://localhost:5672?sasl_mechs='PLAIN'' 20 @@ -79,11 +79,11 @@ Local ConnectionFactory ======================= QpidJMS - qpid-ra-0.10.rar + qpid-ra-.rar - true - amqp://anonymous:@client/test?brokerlist='tcp://localhost:5672?sasl_mechs='ANONYMOUS'' - org.apache.qpid.ra.QpidRAConnectionFactory + true + amqp://anonymous:@client/test?brokerlist='tcp://localhost:5672?sasl_mechs='PLAIN'' + org.apache.qpid.ra.QpidRAConnectionFactory 20 @@ -100,11 +100,10 @@ provides two such objects Hello - jboss.jca:service=RARDeployment,name='qpid-ra-0.10.rar' + jboss.jca:service=RARDeployment,name='qpid-ra-.rar' javax.jms.Destination - destinationType=QUEUE - destinationAddress=amq.direct + DestinationAddress=amq.direct @@ -113,16 +112,15 @@ The above XML defines a JMS Queue which is bound into JNDI as queue/HelloQueue This destination can be retrieved from JNDI and be used for the consumption or production of messages. The desinationAddress property -can be customized for your environment. Please see the Qpid Java Client documentation for specific configuration options. +can be customized for your environment. Please see the Qpid Java Client documentation for specific configuration options. HelloTopic - jboss.jca:service=RARDeployment,name='qpid-ra-0.10.rar' + jboss.jca:service=RARDeployment,name='qpid-ra-.rar' javax.jms.Destination - destinationType=TOPIC - destinationAddress=amq.topic + DestinationAddress=amq.topic @@ -138,10 +136,10 @@ can be customized for your environment. Please see the Qpid Java Client document QpidConnectionFactory - jboss.jca:service=RARDeployment,name='qpid-ra-0.10.rar' + jboss.jca:service=RARDeployment,name='qpid-ra-.rar' javax.jms.ConnectionFactory - connectionURL=amqp://anonymous:@client/test?brokerlist='tcp://localhost:5672?sasl_mechs='ANONYMOUS'' + ConnectionURL=amqp://anonymous:@client/test?brokerlist='tcp://localhost:5672?sasl_mechs='PLAIN'' diff --git a/java/jca/build.xml b/java/jca/build.xml index 934514aa52..42a19ff83a 100644 --- a/java/jca/build.xml +++ b/java/jca/build.xml @@ -22,18 +22,26 @@ + + + + + + + + + + + - - - - - + - + @@ -67,6 +75,9 @@ - + + + diff --git a/java/jca/rar/src/main/resources/META-INF/jboss-ra.xml b/java/jca/rar/src/main/resources/META-INF/jboss-ra.xml new file mode 100644 index 0000000000..f459b1efc1 --- /dev/null +++ b/java/jca/rar/src/main/resources/META-INF/jboss-ra.xml @@ -0,0 +1,33 @@ + + + + + TransactionManagerLocatorClass + java.lang.String + org.apache.qpid.ra.tm.JBossTransactionManagerLocator + + + TransactionManagerLocatorMethod + java.lang.String + getTm + + diff --git a/java/jca/rar/src/main/resources/META-INF/ra.xml b/java/jca/rar/src/main/resources/META-INF/ra.xml new file mode 100755 index 0000000000..a9374f52d7 --- /dev/null +++ b/java/jca/rar/src/main/resources/META-INF/ra.xml @@ -0,0 +1,230 @@ + + + + + + QPID Resource Adapter + QPID Resource Adapter + + Apache Software Foundation + JMS 1.1 Server + 1.0 + + + + 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. + + true + + + + org.apache.qpid.ra.QpidResourceAdapter + + Client ID for the connection + ClientId + java.lang.String + client_id + + + + Number of setup attempts before failing + SetupAttempts + java.lang.Integer + 5 + + + + Interval between setup attempts in milliseconds + SetupInterval + java.lang.Long + 5000 + + + + Use local transactions rather than XA + UseLocalTx + java.lang.Boolean + false + + + + Broker host + Host + java.lang.String + localhost + + + + Broker port + Port + java.lang.Integer + 5672 + + + + Virtual Path for Connection Factory + Path + java.lang.String + test + + + + Connection URL + ConnectionURL + java.lang.String + amqp://anonymous:passwd@client/test?brokerlist='tcp://localhost?sasl_mechs='PLAIN'' + + + + Use a JMS Connection per MessageHandler + UseConnectionPerHandler + java.lang.Boolean + true + + + + + org.apache.qpid.ra.QpidRAManagedConnectionFactory + + + Default session type + SessionDefaultType + java.lang.String + javax.jms.Queue + + + + Specify lock timeout in seconds + UseTryLock + java.lang.Integer + 0 + + + + Use local transactions rather than XA + UseLocalTx + java.lang.Boolean + false + + + + Client ID for the connection + ClientId + java.lang.String + client_id + + + + Connection URL + ConnectionURL + java.lang.String + + + + + Broker host + Host + java.lang.String + localhost + + + + Broker port + Port + java.lang.Integer + 5672 + + + + Virtual Path for Connection Factory + Path + java.lang.String + test + + + org.apache.qpid.ra.QpidRAConnectionFactory + org.apache.qpid.ra.QpidRAConnectionFactoryImpl + javax.jms.Session + org.apache.qpid.ra.QpidRASessionImpl + + XATransaction + + BasicPassword + javax.resource.spi.security.PasswordCredential + + false + + + + + javax.jms.MessageListener + + org.apache.qpid.ra.inflow.QpidActivationSpec + + destination + + + + + + + org.apache.qpid.ra.admin.QpidQueue + org.apache.qpid.ra.admin.QpidQueueImpl + + DestinationAddress + java.lang.String + + + + org.apache.qpid.ra.admin.QpidTopic + org.apache.qpid.ra.admin.QpidTopicImpl + + DestinationAddress + java.lang.String + + + + javax.jms.ConnectionFactory + org.apache.qpid.ra.admin.QpidConnectionFactoryProxy + + ConnectionURL + java.lang.String + + + + diff --git a/java/jca/src/main/java/org/apache/qpid/ra/admin/QpidConnectionFactoryProxy.java b/java/jca/src/main/java/org/apache/qpid/ra/admin/QpidConnectionFactoryProxy.java index a948948d6a..d7ca29e04a 100644 --- a/java/jca/src/main/java/org/apache/qpid/ra/admin/QpidConnectionFactoryProxy.java +++ b/java/jca/src/main/java/org/apache/qpid/ra/admin/QpidConnectionFactoryProxy.java @@ -27,13 +27,17 @@ import java.io.ObjectInput; import java.io.ObjectOutput; import java.io.Serializable; -import javax.jms.ConnectionFactory; import javax.jms.Connection; +import javax.jms.ConnectionFactory; import javax.jms.JMSException; import javax.naming.NamingException; +import javax.jms.QueueConnection; +import javax.jms.QueueConnectionFactory; import javax.naming.Reference; import javax.naming.Referenceable; import javax.naming.spi.ObjectFactory; +import javax.jms.TopicConnection; +import javax.jms.TopicConnectionFactory; import org.apache.qpid.client.AMQConnectionFactory; @@ -44,7 +48,7 @@ import org.slf4j.LoggerFactory; * * */ -public class QpidConnectionFactoryProxy implements Externalizable, Referenceable, ConnectionFactory, Serializable +public class QpidConnectionFactoryProxy implements QueueConnectionFactory, TopicConnectionFactory, Externalizable, Referenceable, Serializable { private static final Logger _log = LoggerFactory.getLogger(QpidDestinationProxy.class); @@ -100,13 +104,6 @@ public class QpidConnectionFactoryProxy implements Externalizable, Referenceable try { _delegate = new AMQConnectionFactory(getConnectionURL()); - /* - QpidResourceAdapter ra = new QpidResourceAdapter(); - QpidRAManagedConnectionFactory mcf = new QpidRAManagedConnectionFactory(); - mcf.setResourceAdapter(ra); - mcf.setConnectionURL(getConnectionURL()); - delegate = new QpidRAConnectionFactoryImpl(mcf, null); - */ return ((Referenceable) _delegate).getReference(); } catch(Exception e) @@ -162,7 +159,63 @@ public class QpidConnectionFactoryProxy implements Externalizable, Referenceable */ public Connection createConnection(final String userName, final String password) throws JMSException { - return _delegate.createConnection(userName, password); + try + { + if(_delegate == null) + { + getReference(); + } + + return _delegate.createConnection(userName, password); + } + catch(Exception e) + { + throw new JMSException(e.getMessage()); + } + } + + /** + * Create a queue connection + * @return The queue connection + * @exception JMSException Thrown if the operation fails + */ + public QueueConnection createQueueConnection() throws JMSException + { + return (QueueConnection)createConnection(); + } + + /** + * Create a queue connection + * @param userName The user name + * @param password The password + * @return The connection + * @exception JMSException Thrown if the operation fails + */ + public QueueConnection createQueueConnection(final String userName, final String password) throws JMSException + { + return (QueueConnection)createConnection(userName, password); + } + + /** + * Create a topic connection + * @return The topic connection + * @exception JMSException Thrown if the operation fails + */ + public TopicConnection createTopicConnection() throws JMSException + { + return (TopicConnection)createConnection(); + } + + /** + * Create a topic connection + * @param userName The user name + * @param password The password + * @return The topic connection + * @exception JMSException Thrown if the operation fails + */ + public TopicConnection createTopicConnection(final String userName, final String password) throws JMSException + { + return (TopicConnection)createConnection(userName, password); } } diff --git a/java/jca/src/main/resources/META-INF/jboss-ra.xml b/java/jca/src/main/resources/META-INF/jboss-ra.xml deleted file mode 100644 index f459b1efc1..0000000000 --- a/java/jca/src/main/resources/META-INF/jboss-ra.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - TransactionManagerLocatorClass - java.lang.String - org.apache.qpid.ra.tm.JBossTransactionManagerLocator - - - TransactionManagerLocatorMethod - java.lang.String - getTm - - diff --git a/java/jca/src/main/resources/META-INF/ra.xml b/java/jca/src/main/resources/META-INF/ra.xml deleted file mode 100755 index a9374f52d7..0000000000 --- a/java/jca/src/main/resources/META-INF/ra.xml +++ /dev/null @@ -1,230 +0,0 @@ - - - - - - QPID Resource Adapter - QPID Resource Adapter - - Apache Software Foundation - JMS 1.1 Server - 1.0 - - - - 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. - - true - - - - org.apache.qpid.ra.QpidResourceAdapter - - Client ID for the connection - ClientId - java.lang.String - client_id - - - - Number of setup attempts before failing - SetupAttempts - java.lang.Integer - 5 - - - - Interval between setup attempts in milliseconds - SetupInterval - java.lang.Long - 5000 - - - - Use local transactions rather than XA - UseLocalTx - java.lang.Boolean - false - - - - Broker host - Host - java.lang.String - localhost - - - - Broker port - Port - java.lang.Integer - 5672 - - - - Virtual Path for Connection Factory - Path - java.lang.String - test - - - - Connection URL - ConnectionURL - java.lang.String - amqp://anonymous:passwd@client/test?brokerlist='tcp://localhost?sasl_mechs='PLAIN'' - - - - Use a JMS Connection per MessageHandler - UseConnectionPerHandler - java.lang.Boolean - true - - - - - org.apache.qpid.ra.QpidRAManagedConnectionFactory - - - Default session type - SessionDefaultType - java.lang.String - javax.jms.Queue - - - - Specify lock timeout in seconds - UseTryLock - java.lang.Integer - 0 - - - - Use local transactions rather than XA - UseLocalTx - java.lang.Boolean - false - - - - Client ID for the connection - ClientId - java.lang.String - client_id - - - - Connection URL - ConnectionURL - java.lang.String - - - - - Broker host - Host - java.lang.String - localhost - - - - Broker port - Port - java.lang.Integer - 5672 - - - - Virtual Path for Connection Factory - Path - java.lang.String - test - - - org.apache.qpid.ra.QpidRAConnectionFactory - org.apache.qpid.ra.QpidRAConnectionFactoryImpl - javax.jms.Session - org.apache.qpid.ra.QpidRASessionImpl - - XATransaction - - BasicPassword - javax.resource.spi.security.PasswordCredential - - false - - - - - javax.jms.MessageListener - - org.apache.qpid.ra.inflow.QpidActivationSpec - - destination - - - - - - - org.apache.qpid.ra.admin.QpidQueue - org.apache.qpid.ra.admin.QpidQueueImpl - - DestinationAddress - java.lang.String - - - - org.apache.qpid.ra.admin.QpidTopic - org.apache.qpid.ra.admin.QpidTopicImpl - - DestinationAddress - java.lang.String - - - - javax.jms.ConnectionFactory - org.apache.qpid.ra.admin.QpidConnectionFactoryProxy - - ConnectionURL - java.lang.String - - - - -- cgit v1.2.1