summaryrefslogtreecommitdiff
path: root/qpid/java/jca/example
diff options
context:
space:
mode:
Diffstat (limited to 'qpid/java/jca/example')
-rw-r--r--qpid/java/jca/example/.gitignore23
-rw-r--r--qpid/java/jca/example/README-EXAMPLE.txt258
-rw-r--r--qpid/java/jca/example/README-GERONIMO.txt87
-rw-r--r--qpid/java/jca/example/README-GLASSFISH.txt102
-rw-r--r--qpid/java/jca/example/README-JBOSS.txt125
-rw-r--r--qpid/java/jca/example/README-JBOSS7.txt147
-rw-r--r--qpid/java/jca/example/build-geronimo-properties.xml196
-rw-r--r--qpid/java/jca/example/build-glassfish-properties.xml137
-rw-r--r--qpid/java/jca/example/build-jboss-properties.xml122
-rw-r--r--qpid/java/jca/example/build-jboss7-properties.xml132
-rw-r--r--qpid/java/jca/example/build-properties.xml.temp24
-rw-r--r--qpid/java/jca/example/build.xml206
-rw-r--r--qpid/java/jca/example/conf/application.xml37
-rw-r--r--qpid/java/jca/example/conf/ejb-jar.xml40
-rw-r--r--qpid/java/jca/example/conf/geronimo-application.xml121
-rw-r--r--qpid/java/jca/example/conf/geronimo-ra.xml141
-rw-r--r--qpid/java/jca/example/conf/glassfish-ejb-jar.xml90
-rw-r--r--qpid/java/jca/example/conf/glassfish-resources.xml94
-rw-r--r--qpid/java/jca/example/conf/glassfish-web.xml46
-rw-r--r--qpid/java/jca/example/conf/jboss-ejb-client.properties12
-rw-r--r--qpid/java/jca/example/conf/jboss-web.xml39
-rw-r--r--qpid/java/jca/example/conf/jboss.xml52
-rw-r--r--qpid/java/jca/example/conf/log4j.properties36
-rw-r--r--qpid/java/jca/example/conf/qpid-jca-ds.xml126
-rw-r--r--qpid/java/jca/example/conf/qpid-standalone.xml422
-rw-r--r--qpid/java/jca/example/conf/web.xml50
-rw-r--r--qpid/java/jca/example/qpid-jca-example-properties.xml84
-rw-r--r--qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/client/QpidRequestResponseClient.java159
-rw-r--r--qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/client/QpidTestClient.java134
-rw-r--r--qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/client/QpidTestUtil.java52
-rw-r--r--qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/ejb/QpidGoodByeListenerBean.java65
-rw-r--r--qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/ejb/QpidGoodByeSubscriberBean.java66
-rw-r--r--qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/ejb/QpidHelloListenerBean.java98
-rw-r--r--qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/ejb/QpidHelloSubscriberBean.java99
-rw-r--r--qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/ejb/QpidJMSResponderBean.java104
-rw-r--r--qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/ejb/QpidTest.java30
-rw-r--r--qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/ejb/QpidTestBean.java104
-rw-r--r--qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/ejb/QpidTestLocal.java29
-rw-r--r--qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/ejb/QpidTestRemote.java29
-rw-r--r--qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/ejb/QpidUtil.java90
-rw-r--r--qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/web/QpidRequestResponseServlet.java283
-rw-r--r--qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/web/QpidTestServlet.java229
42 files changed, 4520 insertions, 0 deletions
diff --git a/qpid/java/jca/example/.gitignore b/qpid/java/jca/example/.gitignore
new file mode 100644
index 0000000000..624fd61581
--- /dev/null
+++ b/qpid/java/jca/example/.gitignore
@@ -0,0 +1,23 @@
+#
+# 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.
+#
+
+build/*
+lib/*
+*.swp
+build-properties.xml
diff --git a/qpid/java/jca/example/README-EXAMPLE.txt b/qpid/java/jca/example/README-EXAMPLE.txt
new file mode 100644
index 0000000000..7ff331116c
--- /dev/null
+++ b/qpid/java/jca/example/README-EXAMPLE.txt
@@ -0,0 +1,258 @@
+#
+# 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.
+#
+Qpid JCA Example
+
+Overview
+========
+The Qpid JCA example provides a sample JEE application that demonstrates how to
+configure, install and run applications using the Qpid JCA adapter for JEE
+connectivity and the Apache Qpid C++ Broker. This example code can be used as a
+convenient starting point for your own development and deployment
+efforts.
+
+Example Components
+===================
+Currently the example application consists of the following components:
+
+Destinations
+============
+Any messaging application relies on destinations (queues or topics )
+in order to produce or consume messages.The Qpid JCA example provides
+the following destinations:
+
+ HelloTopic
+ GoodByeTopic
+ HelloQueue
+ GoodByeQueue
+ QpidRequestQueue
+ QpidResponseQueue
+
+Each destination is configured for the respective application server in which
+the examples will be run. Generally the example application allows for sending
+messages to a Hello<DestinationType>. Depending on a configuration option, once
+a message is received by the Hello component, the Hello component can also be
+sent to a GoodBye<DestinationType> component.
+
+The QpidRequest/Response destinations provide the destinations for the
+request/reponse messaging pattern.
+
+
+ConnectionFactories
+===================
+Similar to destinations, ConnectionFactories are a core component of both JMS
+and JCA. ConnectionFactories provide the necessary starting point to make a
+connection, establish a session and produce or consume (or both) messages from
+your JMS provider.
+
+The Qpid JCA example provides three connection factories by default:
+
+ QpidJMSXA
+ QpidJMS
+ QpidConnectionFactory
+
+Each of these ConnectionFactories varies in their capabilities and the context in which
+they should be used. By default, the Qpid JCA examples use the QpidJMSXA connection factory
+which provides for full XA transaction support. The QpidJMS connection factory provides a
+local JMS transaction CF and is currently deprecated, though it has been maintained for
+backwards compatibility. The QpidConnectionFactory is a specialized ConnectionFactory designed
+to be used outside of a JEE application server. This CF has been provided to support non-managed
+clients that want to use the JNDI facilities of JEE.
+
+The deployment configuration for destinations, and ConnectionFactories varies by JEE platform.
+Please see the application server specific documentation for specific instructions.
+
+EJB 3.x
+
+There are a six EJB 3.x components provided as part of the example.
+
+ QpidHelloSubscriberBean - MessageDrivenBean (MDB)
+ QpidGoodByeSubscriberBean - (MDB)
+ QpidHelloListenerBean - (MDB)
+ QpidGoodByeListenerBean - (MDB)
+ QpidJMSResponderBean - (MDB)
+ QpidTestBean - Stateless Session Bean (SLSB)
+
+Generally, the name of the EJB component corresponds to the aforementioned destinations
+listed above in the consumption of messages.
+
+QpidTestServlet
+A sample EE 2.5 servlet is provided allowing testing from a browser versus a RMI or JMS
+based client.
+
+QpidTestClient
+A Java based client allowing for both RMI or JMS access to the sample application. RMI or
+JMS access is based on configuration options.
+
+QpidRequestResponseClient
+A Java based client allowing for a request/response application.
+
+EE EAR archive
+ An EAR wrapper for the ejb and web components.
+
+A build.xml file
+ An ant build.xml file to configure, install and deploy the aforementioned components.
+
+Requirements
+============
+Apache Qpid Broker
+To run the sample it is assumed you have an Apache Qpid C++ broker configured and running.
+The example code assumes that the broker will run at localhost on port 5672. The broker
+address can be modified in the build-properties.xml file.
+
+Examples
+===============
+Using the Qpid JCA examples is the same regardless of preferred JEE application server.
+The provided clients and supported options are listed below.
+
+QpidTestClient
+==============
+As previously mentioned, the Qpid JCA example provides an RMI/JMS Java client to test
+the application. Executing the command
+
+ant-run client
+
+will execute the QpidTestClient client with the default options.
+
+QpidTestClient Options
+
+client.use.ejb (build.xml)
+Setting this value to false will result in the QpidTestClient using JMS to send messages to
+the configured destination.
+Default:true
+
+client.message
+The text content of the JMS message sent to the configured destination.
+Default: Hello Qpid World!
+
+client.message.count
+The number of messages that will be sent to the configured destionation.
+Default: 1
+
+client.use.topic
+Setting this value to true will send messages to HelloTopic versus HelloQueue.
+Default:false
+
+client.say.goodbye
+Setting this value to true will cause the listener on the Hello Queue/Topic to send a
+message to the GoodBye Queue/Topic
+Default:false
+
+
+QpidRequestResponseClient
+=========================
+Similar to the QpidTestClient, the QpidRequestResponseClient is a Java based application that allows for
+sending messages to a destination. The QpidRequestResponseClient also provides the capability for the
+application to listen for a response. Executing the command
+
+ant run-reqresp
+
+will run the application with the default options.
+
+QpidRequestResponseClient Options
+
+QpidTestServlet
+===============
+Similar to the QpidTestClient application, the Qpid JCA examples also provides a JEE Servlet to test and run the
+application. This Servlet can be used as an alternative, or in conjunction with the Java application. The Servlet
+can be reached via the following URL:
+
+http://<server-host-name>:<server-port>/qpid-jca-web/qpid
+
+where server-host and server-port are the host and port where you are running your application server.
+
+QpidTestServlet Options
+
+The QpidTestServlet options can be configured by appending certain values to the above URL. These values are
+listed below and generally correspond, both in name and purpose, to the Java application configuration options.
+
+message
+The text content of the JMS message sent to the configured destination.
+Default: Hello World!
+
+useEJB
+Setting this value to true will result in the QpidTestServlet using the QpidTestBean SLSB to
+send the message to the configured destination. By default the QpidTestServlet uses JMS.
+Default:false
+
+count
+The number of messages that will be sent to the configured destionation.
+Default: 1
+
+useTopic
+Setting this value to true will send messages to HelloTopic versus HelloQueue.
+Default:false
+
+sayGoodBye
+Setting this value to true will cause the listener on the Hello Queue/Topic to send a
+message to the GoodBye Queue/Topic
+Default:false
+
+useXA
+Setting this value to true will cause the QpidTestServlet to do all activity within the
+context of an XA transaction.
+Default:false
+
+useTX
+Setting this value to true will cause the QpidTestServlet to do all activity within the
+context of a JMS transation.
+Default:false
+
+
+Note, the useXA and useTX are mutually exclusive. Setting both to true, the QpidTestServlet
+will choose XA over a JMS transaction.
+
+QpidRequestResponseServlet
+==========================
+Similar to the QpidRequestResponseClient application, the Qpid JCA examples also provides a JEE Servlet
+to execute the request/response type messaging pattern. The Servlet can be reached via the following url:
+
+http://<server-host-name>:<server-port>/qpid-jca-web/qpid-reqresp
+
+where server-host and server-port are the host and port where you are running your application server.
+
+QpidRequestResponseServlet Options
+
+message
+The text content of the JMS message sent to the configured destination.
+Default: Hello World!
+
+count
+The number of messages that will be sent to the configured destionation.
+Default: 1
+
+useXA
+Setting this value to true will cause the QpidTestServlet to do all activity within the
+context of an XA transaction.
+Default:false
+
+Summary
+=======
+While conceptually simple, the Qpid JCA examples provide a majority of the component types and messaging patterns
+you are most likely to use your development efforts. With the Web and EJB components, you can experiment with
+various aspects of JCA as well as EE development in general using the Qpid Broker as your messaging provider.
+While this documentation highlights the major components and steps needed to take to get the example running,
+the possiblities for modifcation are numerous. You are encouraged to experiment with the example as you work
+to develop your own messaging applications.
+
+***Note***
+Due to the way Ant handle XML escape characters in the Copy task, if you are attempting to deploy the
+examples to a clustered broker configuration, you will need to modify the resultant XML configuration
+file to remove the '&' character and replace it with the &amp; character. This file varies by app
+server. Please see the app server specific documentation for your platform for further details.
+
diff --git a/qpid/java/jca/example/README-GERONIMO.txt b/qpid/java/jca/example/README-GERONIMO.txt
new file mode 100644
index 0000000000..51cf2c4e9c
--- /dev/null
+++ b/qpid/java/jca/example/README-GERONIMO.txt
@@ -0,0 +1,87 @@
+#
+# 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.
+#
+Qpid JCA Example - Apache Geronimo 2.x
+
+Overview
+========
+This document explains the steps required to configure and
+deploy the Qpid JCA examples for the Apache Geronimo environment.
+General information can be found in the README.txt file.
+
+The Apache Geronimo environment provides two methods for deploying
+JEE application components: the web-based administration console and the
+command line based deployment environment. This document only explains
+the command line environment. Please see the Apache Geronimo 2.x
+documentation for the web-based console.
+
+Requirements
+============
+In order to deploy the Qpid JCA adapter, as well as the example application,
+the GERONIMO_HOME environemnt variable must be set. The environment variable
+should point to the root of your Apache Geronimo 2.x install directory.
+
+In order to automatically deploy the Qpid JCA Adapter, the QPID_JCA_HOME
+environment variable needs to be set. The environment variable should point
+to the directory which contains the Qpid JCA Adapter. If building from the
+source tree, by default this can be found at
+
+QPID_ROOT/java/build/lib
+
+If installing from RPM or other binary distribution, this can vary by platform.
+
+Prior to deploying any application component, the Apache Geronimo application
+should be started and available for requests.
+
+
+Deploy the Qpid JCA Adapter
+==============================
+Once the above requirements are satisfied the command
+
+ant deploy-rar
+
+will attempt to use the Apache Geronimo deployer to install the Qpid JCA
+adapter into the Apache Geronimo environment. Any errors will be reported
+back to the client for further examination. Once the above command executes
+successfully, the Qpid JCA adapter has been deployed, configured and is ready
+for use.
+
+
+Deploy the Qpid JCA Examples
+============================
+After the Qpid JCA adapter is deployed, executing the command
+
+ant deploy-ear
+
+will attempt to use the Apache Geronimo deploy to install the Qpid JCA
+example EAR into the Apache Geronimo environment. Any errors will be reported
+back to the client for further examination. Once the above command executes
+successfully, the Qpid JCA example application is deployed, configured and ready
+for use.
+
+The build-geronimo-properties.xml file contain Apache Geronimo specific values
+and Ant targets that can be used to suit your development requirements.
+
+The README.txt file in this directory provides the necessary instructions for using the Qpid JCA
+adapter and example application.
+
+
+
+
+
+
diff --git a/qpid/java/jca/example/README-GLASSFISH.txt b/qpid/java/jca/example/README-GLASSFISH.txt
new file mode 100644
index 0000000000..ccbc257c04
--- /dev/null
+++ b/qpid/java/jca/example/README-GLASSFISH.txt
@@ -0,0 +1,102 @@
+#
+# 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.
+#
+Qpid JCA Example - Glassfish 3.x
+
+Overview
+========
+This document explains the steps required to configure and
+deploy the Qpid JCA examples for the Glassfish 3.x environment.
+
+The Glassfish environment provides two methods for deploying
+JEE application components: the web-based administration console
+and the asadmin command line utility. This document only explains
+the command line utility. Please see the Glassfish 3.x
+documentation for the web-based console approach.
+
+Requirements
+============
+In order to deploy the Qpid JCA adapter, as well as the example application,
+the GLASSFISH_HOME environemnt variable must be set. The environment variable
+should point to the root of your Glassfish installation.
+
+In order to automatically deploy the Qpid JCA Adapter from the build system,
+the QPID_JCA_HOME environment variable needs to be set.
+The environment variable should point to the directory which contains the
+Qpid JCA Adapter. If building from the source tree, by default this can be found at
+
+QPID_ROOT/java/build/lib
+
+If installing from RPM or other binary distribution, this can vary by OS platform.
+
+The Qpid JCA examples assume the Apache Geronimo application server as the default
+target platform. This can be modified in two ways:
+
+1) Modify the build.xml file and change the target.platform property:
+
+Example:
+
+ <!-- Valid target platforms are currently geronimo, jboss, jboss7, glassfish -->
+ <property name="target.platform" value="glassfish"/>
+
+2) Set the target.platform property via the command line:
+
+Example:
+
+ant -Dtarget.platform=glassfish <target>
+
+Note, if you choose the second method, all command line invocations must include
+the target.platform variable. For the remainder of this document, we will assume
+the second approach.
+
+Prior to deploying any application component, the Glassfish application server
+should be started and available for requests.
+
+
+Deploy and configure the Qpid JCA Adapter
+==============================
+Once the above requirements are satisfied the command
+
+ant -Dtarget.platform=glassfish deploy-rar
+
+will attempt to invoke the asadmin utility to deploy and configure the
+Qpid JCA adapter. Once this step completes succesfully the Qpid JCA adapter
+is deployed, configured and ready for use.
+
+
+Deploy the Qpid JCA Examples
+============================
+After the Qpid JCA adapter is deployed, executing the command
+
+ant -Dtarget.platform=glassfish deploy-ear
+
+will attempt to deploy the Qpid JCA example EAR into the Glassfish environment.
+Once the above command executes successfully, the Qpid JCA example application
+is deployed, configured and ready for use.
+
+The build-glassfish-properties.xml file contains Glassfish specific configuration options
+and Ant targets that can be used to suit your development requirements. Executing
+
+ant -Dtarget.platform=glassfish -p
+
+will list the appropriate targets and provide a simple description for each.
+
+The README.txt file in this directory provides the necessary instructions for using
+the Qpid JCA adapter and example application which is consistent across all supported
+JEE platforms.
+
diff --git a/qpid/java/jca/example/README-JBOSS.txt b/qpid/java/jca/example/README-JBOSS.txt
new file mode 100644
index 0000000000..ffc750a078
--- /dev/null
+++ b/qpid/java/jca/example/README-JBOSS.txt
@@ -0,0 +1,125 @@
+#
+# 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.
+#
+Qpid JCA Example - JBoss EAP 5.x, JBoss 5.x, 6.x
+
+Overview
+========
+This document explains the steps required to configure and
+deploy the Qpid JCA examples for both the JBoss EAP 5.x
+environment as well as the JBoss 5.x/6.x community edition
+(herafter simply referred to as JBoss). General information
+can be found in the README.txt file.
+
+Requirements
+============
+In order to deploy the Qpid JCA adapter, as well as the example application,
+the JBOSS_HOME environemnt variable must be set. The environment variable
+should point to the root of your JBoss installation.
+
+In order to automatically deploy the Qpid JCA Adapter from the build system,
+the QPID_JCA_HOME environment variable needs to be set.
+The environment variable should point to the directory which contains the
+Qpid JCA Adapter. If building from the source tree, by default this can be found at
+
+QPID_ROOT/java/build/lib
+
+If installing from RPM or other binary distribution, this can vary by platform.
+
+If you do not want to use the build system to deploy the Qpid JCA adapter, you
+can simply copy the qpid-ra-0.<version>.rar file to the
+
+JBOSS_HOME/server/<server-name>/deploy
+
+directory. By default, the example assumes the JBoss 'default' server profile will
+be used. This can be modified in the build-jboss-properties.xml file.
+
+The Qpid JCA examples assume the Apache Geronimo application server as the default
+target platform. This can be modified in two ways:
+
+1) Modify the build.xml file and change the target.platform property:
+
+Example:
+
+ <!-- Valid target platforms are currently geronimo, jboss, jboss7, glassfish -->
+ <property name="target.platform" value="jboss"/>
+
+2) Set the target.platform property via the command line:
+
+Example:
+
+ant -Dtarget.platform=jboss <target>
+
+Note, if you choose the second method, all command line invocations must include
+the target.platform. For the remainder of this document, we will assume the second
+approach.
+
+Prior to deploying any application component, the JBoss application server
+should be started and available for requests.
+
+
+
+
+Deploy and configure the Qpid JCA Adapter
+==============================
+Once the above requirements are satisfied the command
+
+ant -Dtarget.platform= jboss deploy-rar
+
+will copy the Qpid JCA adapter to JBoss server deploy directory.
+
+To configure JCA resources in the JBoss environment, the *-ds.xml configuration file
+is used. The command
+
+ant -Dtarget.platform=jboss deploy-ds
+
+will accomplish this task using the defaults provided. Any errors will be reported
+in the
+
+JBOSS_HOME/server/<server-name>/log/server.log
+
+file or on the console.
+
+Once the above commands execute successfully, the Qpid JCA adapter is deployed, configured
+and ready for use.
+
+
+Deploy the Qpid JCA Examples
+============================
+After the Qpid JCA adapter is deployed, executing the command
+
+ant -Dtarget.platform=jboss deploy-ear
+
+will attempt to deploy the Qpid JCA example EAR into the JBoss environment.
+Once the above command executes successfully, the Qpid JCA example application is deployed,
+configured and ready for use.
+
+Note, if making modifications to either the Qpid JCA adapter or *-ds.xml configuration, the
+EAR archive will need to be redeployed. This is a JBoss JCA issue and not due to the Qpid JCA
+adapter.
+
+The build-jboss-properties.xml file contains JBoss specific configuration options
+and Ant targets that can be used to suit your development requirements.
+
+The README.txt file in this directory provides the necessary instructions for using the Qpid JCA
+adapter and example application which is consistent across all supported JEE platforms.
+
+
+
+
+
diff --git a/qpid/java/jca/example/README-JBOSS7.txt b/qpid/java/jca/example/README-JBOSS7.txt
new file mode 100644
index 0000000000..ae12078cd0
--- /dev/null
+++ b/qpid/java/jca/example/README-JBOSS7.txt
@@ -0,0 +1,147 @@
+#
+# 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.
+#
+Qpid JCA Example - JBoss AS 7
+
+Overview
+========
+This document explains the steps required to configure and
+deploy the Qpid JCA examples for the JBoss AS 7 environment.
+General information about the example can be found in the
+README-EXAMPLE.txt file.
+
+Requirements
+============
+In order to deploy the Qpid JCA adapter, as well as the example application,
+the JBOSS_HOME environemnt variable must be set. The environment variable
+should point to the root of your JBoss installation.
+
+In order to automatically deploy the Qpid JCA Adapter from the build system,
+the QPID_JCA_HOME environment variable needs to be set.
+The environment variable should point to the directory which contains the
+Qpid JCA Adapter. If building from the source tree, by default this can be found at
+
+QPID_ROOT/java/build/lib
+
+If installing from RPM or other binary distribution, this can vary by platform.
+
+If you do not want to use the build system to deploy the Qpid JCA adapter, you
+can simply copy the qpid-ra-0.<version>.rar file to the
+
+JBOSS_HOME/<server-profile>/deployments
+
+directory. By default, the example assumes the JBoss 'standalone' server profile will
+be used. This can be modified in the build-jboss7-properties.xml file.
+
+The Qpid JCA examples assume the Apache Geronimo application server as the default
+target platform. This can be modified in two ways:
+
+1) Modify the build.xml file and change the target.platform property:
+
+Example:
+
+ <!-- Valid target platforms are currently geronimo, jboss, jboss7, glassfish -->
+ <property name="target.platform" value="jboss7"/>
+
+2) Set the target.platform property via the command line:
+
+Example:
+
+ant -Dtarget.platform=jboss7 <target>
+
+Note, if you choose the second method, all command line invocations must include
+the target.platform. For the remainder of this document, we will assume the second
+approach.
+
+As opposed to earlier versions of JBoss AS, JBoss AS 7 uses a different approach for
+configuring JCA resources. JBoss AS 7 provides support for different server profiles
+each configured through an XML based configuration file. In order to configure the
+Qpid JCA adapter for the JBoss AS 7 environment, a complete XML configuration has been
+provided in the conf/ directory as conf/qpid-standalone.xml. In order to configure this
+file execute the following command:
+
+ant -Dtarget.platform=jboss7 generate
+
+The result of this command will produce a file build/gen/qpid-standalone.xml file. To
+deploy this file copy the file to:
+
+JBOSS_HOME/standalone/configuration
+
+Prior to deploying any application component, the JBoss application server
+should be started and available for requests. In order to use the qpid-standalone.xml
+file generated in the previous step, when starting JBoss AS 7 invoke the following:
+
+./standalone.sh -c qpid-standalone.xml
+
+
+Note, the above method completely replaces the default messaging provider in JBoss AS 7.
+Currently there is no way to have two separate messaging providers deployed within the same
+server. It assumed that this will be addressed in a later version of JBoss AS 7.
+
+
+Deploy the Qpid JCA Adapter
+==============================
+Once the above requirements are satisfied the command
+
+ant -Dtarget.platform=jboss7 deploy-rar
+
+will copy the Qpid JCA adapter to JBoss AS 7 server deploy directory.
+
+Once the above commands execute successfully, the Qpid JCA adapter is deployed, configured
+and ready for use.
+
+
+Deploy the Qpid JCA Examples
+============================
+After the Qpid JCA adapter is deployed, executing the command
+
+ant -Dtarget.platform=jboss7 deploy-ear
+
+will attempt to deploy the Qpid JCA example EAR into the JBoss AS 7 environment.
+Once the above command executes successfully, the Qpid JCA example application is
+deployed, configured and ready for use.
+
+If you choose to use the standalone 'thin' EJB3 client example, you will need to configure
+the security realm for your application. Please see
+
+http://www.mastertheboss.com/jboss-as-7/jboss-as-7-remote-ejb-client-tutorial
+
+on instructions for how to do this in the JBoss7 environment. Once this is done you
+will need to change the conf/jboss-ejb-client.properties file to use your recently
+configured username/password for your application:
+
+remote.connection.default.username=CHANGEME
+remote.connection.default.password=CHANGEME
+
+Modify these properties to use the username/password you configured in the
+above step.
+
+Currently there is an issue with 'hot-deployment' in the JBoss AS 7 environment.
+If you need to re-deploy the EAR file, restarting JBoss AS 7 is required.
+
+The build-jboss7-properties.xml file contains JBoss AS 7 specific configuration options
+and Apache Ant targets that can be used to suit your development requirements.
+
+The README.txt file in this directory provides the necessary instructions for using the Qpid JCA
+adapter and example application which is consistent across all supported JEE platforms.
+
+
+
+
+
+
diff --git a/qpid/java/jca/example/build-geronimo-properties.xml b/qpid/java/jca/example/build-geronimo-properties.xml
new file mode 100644
index 0000000000..3c84b7634a
--- /dev/null
+++ b/qpid/java/jca/example/build-geronimo-properties.xml
@@ -0,0 +1,196 @@
+<!--
+ -
+ - 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.
+ -
+ -->
+<project name="qpid-jca-example-geronimo-properties" basedir="." default="">
+
+ <property name="jndi.scheme" value="name"/>
+
+ <property name="qpid.xacf.jndi.name" value="QpidJMSXA"/>
+
+ <property name="jndi.prefix" value="jca:/qpid.jca/QpidJCAAdapter/JCAAdminObject/"/>
+
+
+ <property name="qpid.hello.queue.jndi.name" value="HelloQueue"/>
+ <property name="qpid.goodbye.queue.jndi.name" value="GoodByeQueue"/>
+ <property name="qpid.hello.topic.jndi.name" value="HelloTopic"/>
+ <property name="qpid.goodbye.topic.jndi.name" value="GoodByeTopic"/>
+ <property name="qpid.request.queue.jndi.name" value="RequestQueue"/>
+ <property name="qpid.response.queue.jndi.name" value="ResponseQueue"/>
+
+ <!--
+ <property name="qpid.cf.jndi.name" value="jca:/qpid.jca/QpidJCAAdapter/JCAAdminObject/QpidConnectionFactory"/>
+ <property name="qpid.hello.queue.jndi.name" value="jca:/qpid.jca/QpidJCAAdapter/JCAAdminObject/HelloQueue"/>
+ <property name="qpid.goodbye.queue.jndi.name" value="jca:/qpid.jca/QpidJCAAdapter/JCAAdminObject/GoodByeQueue"/>
+ <property name="qpid.hello.topic.jndi.name" value="jca:/qpid.jca/QpidJCAAdapter/JCAAdminObject/HelloTopic"/>
+ <property name="qpid.goodbye.topic.jndi.name" value="jca:/qpid.jca/QpidJCAAdapter/JCAAdminObject/GoodByeTopic"/>
+ <property name="qpid.request.queue.jndi.name" value="jca:/qpid.jca/QpidJCAAdapter/JCAAdminObject/RequestQueue"/>
+ <property name="qpid.response.queue.jndi.name" value="jca:/qpid.jca/QpidJCAAdapter/JCAAdminObject/ResponseQueue"/>
+ -->
+ <property name="qpid.ejb.jndi.name" value="name=&quot;QpidTestEJB&quot;"/>
+ <property name="qpid.ejb.name" value="QpidTestBeanRemote"/>
+ <property name="qpid.client.cf.jndi.name" value="${jndi.prefix}/QpidConnectionFactory"/>
+ <property name="qpid.client.dest.jndi.name" value="${jndi.prefix}/${qpid.hello.queue.jndi.name}"/>
+
+ <property name="jndi.context" value="org.openejb.client.RemoteInitialContextFactory"/>
+ <property name="server.host" value="ejbd://localhost:4201"/>
+ <property name="geronimo.home" location="${env.GERONIMO_HOME}"/>
+ <property name="geronimo.user" value="system"/>
+ <property name="geronimo.password" value="manager"/>
+
+ <property name="geronimo.rar.group.id" value="qpid.jca"/>
+ <property name="geronimo.rar.artifact.id" value="QpidJCAAdapter"/>
+ <property name="geronimo.rar.version" value="1.0"/>
+ <property name="geronimo.rar.type" value="rar"/>
+ <property name="geronimo.rar.id" value="${geronimo.rar.group.id}/${geronimo.rar.artifact.id}/${geronimo.rar.version}/${geronimo.rar.type}"/>
+
+ <property name="geronimo.ejb.group.id" value="qpid.jca.example"/>
+ <property name="geronimo.ejb.artifact.id" value="QpidJCAEJBExample"/>
+ <property name="geronimo.ejb.version" value="1.0"/>
+ <property name="geronimo.ejb.type" value="car"/>
+ <property name="geronimo.ejb.id" value="${geronimo.ejb.group.id}/${geronimo.ejb.artifact.id}/${geronimo.ejb.version}/${geronimo.ejb.type}"/>
+
+ <property name="geronimo.war.group.id" value="qpid.jca.example"/>
+ <property name="geronimo.war.artifact.id" value="QpidJCAWebExample"/>
+ <property name="geronimo.war.version" value="1.0"/>
+ <property name="geronimo.war.type" value="war"/>
+ <property name="geronimo.war.id" value="${geronimo.war.group.id}/${geronimo.war.artifact.id}/${geronimo.war.version}/${geronimo.war.type}"/>
+
+ <property name="geronimo.ear.group.id" value="qpid.jca.example"/>
+ <property name="geronimo.ear.artifact.id" value="QpidJCAEARExample"/>
+ <property name="geronimo.ear.version" value="1.0"/>
+ <property name="geronimo.ear.type" value="ear"/>
+ <property name="geronimo.ear.id" value="${geronimo.ear.group.id}/${geronimo.ear.artifact.id}/${geronimo.ear.version}/${geronimo.ear.type}"/>
+
+ <property name="geronimo.rar.plan" value="${gen.dir}/geronimo-ra.xml"/>
+ <property name="geronimo.ear.plan" value="${gen.dir}/geronimo-application.xml"/>
+
+ <available file="${geronimo.home}/bin/deploy" value="deploy" property="geronimo.deploy.exec"/>
+ <property name="geronimo.deploy.exec" value="deploy.sh"/>
+
+ <path id="compile.classpath">
+ <fileset dir="${geronimo.home}/repository/org/apache/geronimo/specs">
+ <include name="geronimo-jms_1.1_spec/1.1.1/geronimo-jms_1.1_spec-1.1.1.jar"/>
+ <include name="geronimo-ejb_3.0_spec/1.0.1/geronimo-ejb_3.0_spec-1.0.1.jar"/>
+ <include name="geronimo-jta_1.1_spec/1.1.1/geronimo-jta_1.1_spec-1.1.1.jar"/>
+
+ <!--Geronimo 3.x-->
+ <include name="geronimo-servlet_3.0_spec/1.0/geronimo-servlet_3.0_spec-1.0.jar"/>
+ <include name="geronimo-ejb_3.1_spec/1.0.2/geronimo-ejb_3.1_spec-1.0.2.jar"/>
+ </fileset>
+
+ <fileset dir="${qpid.jca.dir}">
+ <include name="slf4j-api-*.jar"/>
+ </fileset>
+
+ </path>
+
+ <path id="run.classpath">
+ <fileset dir="${lib.dir}">
+ <include name="qpid-jca-*.jar"/>
+ <include name="qpid-client-*.jar"/>
+ <include name="qpid-common-*.jar"/>
+ <!-- Old jar, for examples compatibility -->
+ <include name="qpid-ra-*.jar"/>
+ </fileset>
+ <fileset dir="${geronimo.home}/repository/org/apache/geronimo/specs">
+ <include name="geronimo-j2ee-connector_1.5_spec/2.0.0/geronimo-j2ee-connector_1.5_spec-2.0.0.jar"/>
+ <include name="geronimo-jms_1.1_spec/1.1.1/geronimo-jms_1.1_spec-1.1.1.jar"/>
+ <include name="geronimo-servlet_3.0_spec/1.0/geronimo-servlet_3.0_spec-1.0.jar"/>
+ <include name="geronimo-ejb_3.0_spec/1.0.1/geronimo-ejb_3.0_spec-1.0.1.jar"/>
+ <include name="geronimo-jta_1.1_spec/1.1.1/geronimo-jta_1.1_spec-1.1.1.jar"/>
+ </fileset>
+ <fileset dir="${geronimo.home}/lib/">
+ <include name="slf4j-api-*.jar"/>
+ <include name="slf4j-log4j*-*.jar"/>
+ <include name="log4j-*.jar"/>
+ </fileset>
+ <fileset dir="${geronimo.home}/repository/org/apache/openejb/openejb-client/3.1.4/"/>
+ </path>
+
+ <filterset id="extra.filterset">
+ <filter token="geronimo.ejb.group.id" value="${geronimo.ejb.group.id}"/>
+ <filter token="geronimo.ejb.artifact.id" value="${geronimo.ejb.artifact.id}"/>
+ <filter token="geronimo.ejb.version" value="${geronimo.ejb.version}"/>
+ <filter token="geronimo.ejb.type" value="${geronimo.ejb.type}"/>
+ <filter token="geronimo.war.group.id" value="${geronimo.war.group.id}"/>
+ <filter token="geronimo.war.artifact.id" value="${geronimo.war.artifact.id}"/>
+ <filter token="geronimo.war.version" value="${geronimo.war.version}"/>
+ <filter token="geronimo.war.type" value="${geronimo.war.type}"/>
+ <filter token="geronimo.ear.group.id" value="${geronimo.ear.group.id}"/>
+ <filter token="geronimo.ear.artifact.id" value="${geronimo.ear.artifact.id}"/>
+ <filter token="geronimo.ear.version" value="${geronimo.ear.version}"/>
+ <filter token="geronimo.ear.type" value="${geronimo.ear.type}"/>
+ </filterset>
+
+ <macrodef name="geronimo">
+ <attribute name="user" default="${geronimo.user}"/>
+ <attribute name="password" default="${geronimo.password}"/>
+ <attribute name="action" default="list-modules"/>
+ <attribute name="module"/>
+ <attribute name="plan" default=""/>
+ <sequential>
+ <exec executable="${geronimo.home}/bin/${geronimo.deploy.exec}">
+ <arg line="-u @{user} -p @{password} @{action} @{module} @{plan}"/>
+ </exec>
+ </sequential>
+ </macrodef>
+
+ <!-- Deployment is target specific so is included here -->
+ <target name="deploy-rar" depends="generate" description="Deploy the RAR file.">
+ <geronimo action="deploy" module="${qpid.jca.dir}/${rar.name}" plan="${geronimo.rar.plan}"/>
+ </target>
+
+ <target name="undeploy-rar" description="Undeploys the RAR deployment.">
+ <geronimo action="undeploy" module="${geronimo.rar.id}"/>
+ </target>
+
+ <target name="start-rar" description="Starts the RAR deployment in the Geronimo environment.">
+ <geronimo action="start" module="${geronimo.rar.id}"/>
+ </target>
+
+ <target name="stop-rar" description="Stops the RAR deployment in the Geronimo environment.">
+ <geronimo action="stop" module="${geronimo.rar.id}"/>
+ </target>
+
+ <target name="restart-rar" description="Restarts the RAR deployment in the Geronimo environment.">
+ <geronimo action="restart" module="${geronimo.rar.id}"/>
+ </target>
+
+ <target name="deploy-ear" depends="package-ear" description="Deploys the EAR archive.">
+ <geronimo action="deploy" module="${build.dir}/${ear.name}" plan="${geronimo.ear.plan}"/>
+ </target>
+
+ <target name="undeploy-ear" description="Undeployes the EAR archive.">
+ <geronimo action="undeploy" module="${geronimo.ear.id}"/>
+ </target>
+
+ <target name="start-ear" description="Starts the EAR deployment in the Geronimo environment.">
+ <geronimo action="start" module="${geronimo.ear.id}"/>
+ </target>
+
+ <target name="stop-ear" description="Stops the EAR deployment in the Geronimo environment.">
+ <geronimo action="stop" module="${geronimo.ear.id}"/>
+ </target>
+
+ <target name="restart-ear" description="Restarts the EAR deployment in the Geronimo environment.">
+ <geronimo action="restart" module="${geronimo.ear.id}"/>
+ </target>
+
+</project>
diff --git a/qpid/java/jca/example/build-glassfish-properties.xml b/qpid/java/jca/example/build-glassfish-properties.xml
new file mode 100644
index 0000000000..90561e70cf
--- /dev/null
+++ b/qpid/java/jca/example/build-glassfish-properties.xml
@@ -0,0 +1,137 @@
+<!--
+ -
+ - 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.
+ -
+-->
+<project name="qpid-jca-example-glassfish-properties" basedir="." default="">
+
+ <property name="jndi.scheme" value="name"/>
+ <property name="jndi.prefix" value=""/>
+
+ <property name="qpid.xacf.jndi.name" value="QpidJMSXA"/>
+ <property name="qpid.hello.topic.jndi.name" value="HelloTopic"/>
+ <property name="qpid.goodbye.topic.jndi.name" value="GoodByeTopic"/>
+ <property name="qpid.hello.queue.jndi.name" value="HelloQueue"/>
+ <property name="qpid.goodbye.queue.jndi.name" value="GoodByeQueue"/>
+ <property name="qpid.request.queue.jndi.name" value="QpidRequestQueue"/>
+ <property name="qpid.response.queue.jndi.name" value="QpidResponseQueue"/>
+ <property name="qpid.ejb.jndi.name" value="mappedName=&quot;QpidTestEJB&quot;"/>
+ <property name="qpid.ejb.ref.name" value="QpidTestBean/local"/>
+ <property name="qpid.ejb.name" value="QpidTestBean#org.apache.qpid.jca.example.ejb.QpidTestRemote"/>
+ <property name="qpid.client.cf.jndi.name" value="QpidConnectionFactory"/>
+ <property name="qpid.client.dest.jndi.name" value="${qpid.hello.queue.jndi.name}"/>
+
+ <property name="jndi.context" value="com.sun.enterprise.naming.SerialInitContextFactory"/>
+ <property name="server.host" value="iiop://localhost:3700"/>
+ <property name="glassfish.home" value="${env.GLASSFISH_HOME}"/>
+ <property name="glassfish.domain" value="domain1"/>
+ <property name="glassfish.user" value=""/>
+ <property name="glassfish.password" value=""/>
+
+ <path id="compile.classpath">
+ <fileset dir="${glassfish.home}/glassfish/modules">
+ <include name="javax.ejb.jar"/>
+ <include name="javax.transaction.jar"/>
+ <include name="javax.jms.jar"/>
+ <include name="javax.resource.jar"/>
+ <include name="javax.servlet.jar"/>
+ </fileset>
+
+ <fileset dir="${glassfish.home}/glassfish/domains/${glassfish.domain}/lib/ext">
+ <include name="slf4j-api-*.jar"/>
+ </fileset>
+ </path>
+
+ <path id="run.classpath">
+ <fileset dir="${lib.dir}">
+ <include name="qpid-jca-*.jar"/>
+ <include name="qpid-client-*.jar"/>
+ <include name="qpid-common-*.jar"/>
+ <!-- Old jar, for examples compatibility -->
+ <include name="qpid-ra-*.jar"/>
+ </fileset>
+
+ <fileset dir="${glassfish.home}/glassfish/lib/">
+ <include name="gf-client.jar"/>
+ </fileset>
+
+ <fileset dir="${glassfish.home}/glassfish/modules">
+ <include name="javax.ejb.jar"/>
+ <include name="javax.transaction.jar"/>
+ <include name="javax.jms.jar"/>
+ <include name="javax.resource.jar"/>
+ <include name="javax.servlet.jar"/>
+ </fileset>
+ <fileset dir="${glassfish.home}/glassfish/domains/${glassfish.domain}/lib/ext">
+ <include name="slf4j-api-*.jar"/>
+ </fileset>
+ </path>
+
+ <filterset id="extra.filterset">
+ <filter token="rar.ver" value="${qpid.ver}"/>
+ </filterset>
+
+ <macrodef name="glassfish">
+ <attribute name="user" default="${glassfish.user}"/>
+ <attribute name="password" default="${glassfish.password}"/>
+ <attribute name="action" default="list-applications"/>
+ <attribute name="module"/>
+ <attribute name="plan" default=""/>
+ <sequential>
+ <exec executable="${glassfish.home}/bin/asadmin">
+ <arg line="@{action} @{module} @{plan}"/>
+ </exec>
+ </sequential>
+ </macrodef>
+
+ <target name="package-rar" depends="compile">
+ <jar destfile="${build.dir}/${rar.name}"/>
+ </target>
+
+ <target name="deploy-rar" depends="package-rar" description="Deploy the RAR file.">
+ <glassfish action="deploy" module="${qpid.jca.dir}/${rar.name}"/>
+ <glassfish action="add-resources" module="${gen.dir}/glassfish-resources.xml"/>
+ </target>
+
+
+ <target name="undeploy-resources">
+ <glassfish action="delete-admin-object" module="${qpid.hello.topic.jndi.name}"/>
+ <glassfish action="delete-admin-object" module="${qpid.goodbye.topic.jndi.name}"/>
+ <glassfish action="delete-admin-object" module="${qpid.hello.queue.jndi.name}"/>
+ <glassfish action="delete-admin-object" module="${qpid.goodbye.queue.jndi.name}"/>
+ <glassfish action="delete-admin-object" module="${qpid.request.queue.jndi.name}"/>
+ <glassfish action="delete-admin-object" module="${qpid.response.queue.jndi.name}"/>
+ <glassfish action="delete-connector-connection-pool" module="--cascade true QpidJMSXAPool"/>
+ <glassfish action="delete-connector-connection-pool" module="--cascade true QpidJMSPool"/>
+ <glassfish action="delete-resource-adapter-config" module="QpidResourceAdapter"/>
+ </target>
+
+ <target name="undeploy-rar" description="Deploy the RAR file.">
+ <glassfish action="undeploy" module="--cascade true qpid-ra-${qpid.ver}"/>
+ </target>
+
+ <target name="deploy-ear" description="Deploy the EAR file." depends="package-ear">
+ <glassfish action="deploy" module="${build.dir}/${ear.name}"/>
+ </target>
+
+ <target name="undeploy-ear" description="Undeploy the EAR file.">
+ <glassfish action="undeploy" module="qpid-jcaex"/>
+ </target>
+</project>
+
+
diff --git a/qpid/java/jca/example/build-jboss-properties.xml b/qpid/java/jca/example/build-jboss-properties.xml
new file mode 100644
index 0000000000..f79793d9c4
--- /dev/null
+++ b/qpid/java/jca/example/build-jboss-properties.xml
@@ -0,0 +1,122 @@
+<!--
+ -
+ - 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.
+ -
+-->
+<project name="qpid-jca-example-jboss-properties" basedir="." default="">
+
+ <property name="jndi.scheme" value="mappedName"/>
+ <property name="jndi.prefix" value=""/>
+
+ <property name="qpid.xacf.jndi.name" value="java:QpidJMSXA"/>
+ <property name="qpid.cf.jndi.name" value="QpidConnectionFactory"/>
+ <property name="qpid.hello.topic.jndi.name" value="HelloTopic"/>
+ <property name="qpid.goodbye.topic.jndi.name" value="GoodByeTopic"/>
+ <property name="qpid.hello.queue.jndi.name" value="HelloQueue"/>
+ <property name="qpid.goodbye.queue.jndi.name" value="GoodByeQueue"/>
+ <property name="qpid.request.queue.jndi.name" value="QpidRequestQueue"/>
+ <property name="qpid.response.queue.jndi.name" value="QpidResponseQueue"/>
+ <property name="qpid.ejb.jndi.name" value="mappedName=&quot;QpidTestEJB&quot;"/>
+ <property name="qpid.ejb.ref.name" value="QpidTestBean/local"/>
+ <property name="qpid.ejb.name" value="qpid-jcaex/QpidTestBean/remote"/>
+ <property name="qpid.client.cf.jndi.name" value="${jndi.prefix}/QpidConnectionFactory"/>
+ <property name="qpid.client.dest.jndi.name" value="${jndi.prefix}/${qpid.hello.queue.jndi.name}"/>
+
+ <property name="jndi.context" value="org.jnp.interfaces.NamingContextFactory"/>
+ <property name="server.host" value="jnp://localhost:1099"/>
+
+ <property name="jboss.home" location="${env.JBOSS_HOME}"/>
+ <property name="jboss.server" value="default"/>
+ <property name="jboss.deploy" location="${jboss.home}/server/${jboss.server}/deploy"/>
+ <property name="jboss.client" location="${jboss.home}/client"/>
+
+ <path id="compile.classpath">
+ <fileset dir="${jboss.client}">
+ <!-- JBoss 5-->
+ <include name="jboss-javaee.jar"/>
+
+ <!-- JBoss 6 -->
+ <include name="jboss-servlet-api_3.0_spec.jar"/>
+ <include name="jboss-jms-api_1.1_spec.jar"/>
+ <include name="jboss-ejb-api_3.1_spec.jar"/>
+ <include name="jboss-transaction-api_1.1_spec.jar"/>
+
+ <!-- Common to JBoss 5/6 -->
+ <include name="slf4j-api.jar"/>
+ </fileset>
+
+ <!-- JBoss 5 -->
+ <fileset dir="${jboss.home}/common/lib">
+ <include name="servlet-api.jar"/>
+ </fileset>
+ </path>
+
+ <path id="run.classpath">
+ <fileset dir="${lib.dir}">
+ <include name="qpid-jca-*.jar"/>
+ <include name="qpid-client-*.jar"/>
+ <include name="qpid-common-*.jar"/>
+ <!-- Old jar, for examples compatibility -->
+ <include name="qpid-ra-*.jar"/>
+ </fileset>
+ <fileset dir="${jboss.client}">
+ <!-- Shortcut to get it working!-->
+ <include name="jbossall-client.jar"/>
+ </fileset>
+ </path>
+
+ <filterset id="extra.filterset"/>
+
+ <!-- Deployment is target specific so is included here -->
+ <target name="deploy-rar" description="Deploy the RAR file.">
+ <copy todir="${jboss.deploy}" overwrite="true">
+ <fileset dir="${qpid.jca.dir}">
+ <include name="${rar.name}"/>
+ </fileset>
+ </copy>
+ </target>
+
+ <target name="undeploy-rar" description="Undeploys the RAR deployment.">
+ <delete file="${jboss.deploy}/${rar.name}"/>
+ </target>
+
+ <target name="deploy-ear" depends="package-ear" description="Deploys the EAR archive.">
+ <copy todir="${jboss.deploy}" overwrite="true">
+ <fileset dir="${build.dir}">
+ <include name="${ear.name}"/>
+ </fileset>
+ </copy>
+ </target>
+
+ <target name="undeploy-ear" description="Undeploys the EAR archive.">
+ <delete file="${jboss.deploy}/${ear.name}"/>
+ </target>
+
+ <target name="deploy-ds" depends="generate" description="Deploys the ds.xml file to the JBoss environment.">
+ <copy todir="${jboss.deploy}" overwrite="true">
+ <fileset dir="${gen.dir}">
+ <include name="qpid-jca-ds.xml"/>
+ </fileset>
+ </copy>
+ </target>
+
+ <target name="undeploy-ds" description="Undeploys the ds.xml file from the JBoss environment.">
+ <delete file="${jboss.deploy}/qpid-jca-ds.xml"/>
+ </target>
+
+</project>
diff --git a/qpid/java/jca/example/build-jboss7-properties.xml b/qpid/java/jca/example/build-jboss7-properties.xml
new file mode 100644
index 0000000000..e24719ba8e
--- /dev/null
+++ b/qpid/java/jca/example/build-jboss7-properties.xml
@@ -0,0 +1,132 @@
+<!--
+ -
+ - 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.
+ -
+-->
+<project name="qpid-jca-example-jboss7-properties" basedir="." default="">
+
+ <property name="jndi.scheme" value="name"/>
+ <property name="jndi.prefix" value=""/>
+
+ <property name="qpid.xacf.jndi.name" value="java:/QpidJMSXA"/>
+ <property name="qpid.cf.jndi.name" value="QpidConnectionFactory"/>
+ <property name="qpid.hello.topic.jndi.name" value="java:jboss/exported/HelloTopic"/>
+ <property name="qpid.goodbye.topic.jndi.name" value="java:jboss/exported/GoodByeTopic"/>
+ <property name="qpid.hello.queue.jndi.name" value="java:jboss/exported/HelloQueue"/>
+ <property name="qpid.goodbye.queue.jndi.name" value="java:jboss/exported/GoodByeQueue"/>
+ <property name="qpid.request.queue.jndi.name" value="java:jboss/exported/QpidRequestQueue"/>
+ <property name="qpid.response.queue.jndi.name" value="java:jboss/exported/QpidResponseQueue"/>
+
+ <property name="qpid.ejb.jndi.name" value="mappedName=&quot;QpidTestEJB&quot;"/>
+ <property name="qpid.ejb.ref.name" value="QpidTestBean/local"/>
+ <property name="qpid.ejb.name" value="ejb:qpid-jcaex/qpid-jcaex-ejb/QpidTestBean!org.apache.qpid.jca.example.ejb.QpidTestRemote"/>
+
+ <property name="qpid.client.cf.jndi.name" value="${jndi.prefix}/QpidConnectionFactory"/>
+ <property name="qpid.client.dest.jndi.name" value="${jndi.prefix}/HelloQueue"/>
+ <property name="jndi.context" value="org.jboss.naming.remote.client.InitialContextFactory"/>
+ <property name="server.host" value="remote://localhost:4447"/>
+
+
+ <property name="jboss.server.config" value="standalone"/>
+
+ <property name="jboss.home" location="${env.JBOSS_HOME}"/>
+ <property name="jboss.server" value="${jboss.server.config}"/>
+ <property name="jboss.deploy" location="${jboss.home}/${jboss.server}/deployments"/>
+ <property name="jboss.modules" location="${jboss.home}/modules"/>
+ <property name="jboss.config.dir" location="${jboss.home}/${jboss.server}/configuration/"/>
+ <property name="jboss.client" location="${jboss.home}/bin/client"/>
+
+ <path id="compile.classpath">
+ <fileset dir="${jboss.modules}/javax/jms/api/main">
+ <include name="jboss-jms-api_1.1_spec-*.Final.jar"/>
+ </fileset>
+ <fileset dir="${jboss.modules}/javax/ejb/api/main">
+ <include name="jboss-ejb-api_3.1_spec-*.Final.jar"/>
+ </fileset>
+ <fileset dir="${jboss.modules}/javax/servlet/api/main">
+ <include name="jboss-servlet-api_3.0_spec-*.Final.jar"/>
+ </fileset>
+ <fileset dir="${jboss.modules}/javax/transaction/api/main">
+ <include name="jboss-transaction-api_1.1_spec-*.Final.jar"/>
+ </fileset>
+ <fileset dir="${jboss.modules}/org/slf4j/main">
+ <include name="slf4j-api-*.jar"/>
+ </fileset>
+ </path>
+
+ <path id="run.classpath">
+ <fileset dir="${jboss.client}">
+ <include name="jboss-client.jar"/>
+ </fileset>
+ <fileset dir="${lib.dir}">
+ <include name="qpid-jca-*.jar"/>
+ <include name="qpid-client-*.jar"/>
+ <include name="qpid-common-*.jar"/>
+ <!-- Old jar, for examples compatibility -->
+ <include name="qpid-ra-*.jar"/>
+ </fileset>
+ <fileset dir="${jboss.modules}/org/slf4j/main">
+ <include name="slf4j-api-1.6.1.jar"/>
+ </fileset>
+ <fileset dir="../../build/lib">
+ <include name="slf4j*.jar"/>
+ <include name="log4j*.jar"/>
+ </fileset>
+ <fileset dir="${jboss.modules}/org/jboss/ejb-client/main/">
+ <include name="jboss-ejb-client-1.0.6.CR1.jar"/>
+ </fileset>
+
+ </path>
+
+ <filterset id="extra.filterset"/>
+
+ <!-- Deployment is target specific so is included here -->
+ <target name="deploy-rar" description="Deploy the RAR file.">
+ <copy todir="${jboss.deploy}" overwrite="true">
+ <fileset dir="${qpid.jca.dir}">
+ <include name="${rar.name}"/>
+ </fileset>
+ </copy>
+ </target>
+
+ <target name="undeploy-rar" description="Undeploys the RAR deployment.">
+ <delete file="${jboss.deploy}/${rar.name}"/>
+ </target>
+
+ <target name="deploy-ear" depends="package-ear" description="Deploys the EAR archive.">
+ <copy todir="${jboss.deploy}" overwrite="true">
+ <fileset dir="${build.dir}">
+ <include name="${ear.name}"/>
+ </fileset>
+ </copy>
+ </target>
+
+ <target name="undeploy-ear" description="Undeploys the EAR archive.">
+ <delete file="${jboss.deploy}/${ear.name}"/>
+ </target>
+
+ <target name="deploy-config" depends="generate" description="Deploys the standalone file to the JBoss environment.">
+ <copy todir="${jboss.config.dir}" overwrite="true">
+ <fileset dir="${gen.dir}">
+ <include name="qpid-${jboss.server.config}.xml"/>
+ </fileset>
+ </copy>
+ </target>
+
+
+</project>
diff --git a/qpid/java/jca/example/build-properties.xml.temp b/qpid/java/jca/example/build-properties.xml.temp
new file mode 100644
index 0000000000..1d62db9af5
--- /dev/null
+++ b/qpid/java/jca/example/build-properties.xml.temp
@@ -0,0 +1,24 @@
+<!--
+ -
+ - 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.
+ -
+ -->
+<project name="qpid-jca-example-build-properties" basedir="." default="">
+ <property name="qpid.ver" value="@project.version@"/>
+ <property name="broker.address" value="localhost"/>
+</project>
diff --git a/qpid/java/jca/example/build.xml b/qpid/java/jca/example/build.xml
new file mode 100644
index 0000000000..7a75f9abc6
--- /dev/null
+++ b/qpid/java/jca/example/build.xml
@@ -0,0 +1,206 @@
+<!--
+ -
+ - 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.
+ -
+ -->
+<project name="qpid-jca-example" default="help" basedir="">
+
+ <!-- Valid target platforms are currently geronimo, jboss, jboss7, glassfish -->
+ <property name="target.platform" value="geronimo"/>
+
+ <!-- Change to BURL for older syntax support -->
+ <property name="qpid.dest_syntax" value="ADDR"/>
+
+ <!-- Properties controlling running sample standalone client -->
+ <property name="client.use.ejb" value="true"/> <!-- uses JNDI/JMS or JNDI/RMI -->
+ <property name="client.message" value="Hello Qpid World"/>
+ <property name="client.message.count" value="1"/>
+ <property name="client.use.topic" value="false"/> <!-- Use topic/queue -->
+ <property name="client.say.goodbye" value="false"/>
+
+ <!-- Pull in environment vars as properties -->
+ <property environment="env"/>
+
+ <!-- QPID version property -->
+ <import file="${basedir}/build-properties.xml"/>
+
+ <import file="${basedir}/qpid-jca-example-properties.xml"/>
+
+ <!-- Target specific properties/targets -->
+ <import file="${basedir}/build-${target.platform}-properties.xml"/>
+
+ <macrodef name="compile">
+ <attribute name="classpath"/>
+ <sequential>
+ <javac srcdir="${gen.dir}"
+ destdir="${build.classes.dir}"
+ classpathref="@{classpath}"
+ debug="true" optimize="false"/>
+ </sequential>
+ </macrodef>
+
+ <echo message="Using Qpid version ${qpid.ver}"/>
+ <echo message="Building for platform ${target.platform}"/>
+ <echo message="Broker url is currently set to ${broker.url}"/>
+ <echo message="Qpid Destination Syntax is ${qpid.dest_syntax}"/>
+
+ <target name="init">
+ <mkdir dir="${build.classes.dir}"/>
+ <mkdir dir="${gen.dir}"/>
+ <mkdir dir="${log.dir}"/>
+ </target>
+
+ <target name="generate" depends="init">
+ <copy todir="${gen.dir}" overwrite="true">
+ <fileset dir="${conf.dir}"/>
+ <filterset>
+ <filter token="rar.name" value="${rar.name}"/>
+ <filter token="ejb.name" value="${ejb.name}"/>
+ <filter token="war.name" value="${war.name}"/>
+ <filter token="broker.url" value="${broker.url}"/>
+
+ <filter token="qpid.hello.topic.dest.address" value="${qpid.hello.topic.dest.address}"/>
+ <filter token="qpid.goodbye.topic.dest.address" value="${qpid.goodbye.topic.dest.address}"/>
+ <filter token="qpid.hellogoodbye.topic.dest.address" value="${qpid.hellogoodbye.topic.dest.address}"/>
+ <filter token="qpid.hello.queue.dest.address" value="${qpid.hello.queue.dest.address}"/>
+ <filter token="qpid.goodbye.queue.dest.address" value="${qpid.goodbye.queue.dest.address}"/>
+ <filter token="qpid.request.queue.dest.address" value="${qpid.request.queue.dest.address}"/>
+ <filter token="qpid.response.queue.dest.address" value="${qpid.response.queue.dest.address}"/>
+
+ </filterset>
+ <filterset refid="extra.filterset"/>
+ </copy>
+ <copy todir="${gen.dir}">
+ <fileset dir="${src.dir}"/>
+ <filterset>
+ <filter token="rar.name" value="${rar.name}"/>
+ <filter token="broker.url" value="${broker.url}"/>
+ <filter token="jndi.scheme" value="${jndi.scheme}"/>
+ <filter token="jndi.prefix" value="${jndi.prefix}"/>
+ <filter token="qpid.xacf.jndi.name" value="${qpid.xacf.jndi.name}"/>
+ <filter token="qpid.hello.topic.jndi.name" value="${qpid.hello.topic.jndi.name}"/>
+ <filter token="qpid.goodbye.topic.jndi.name" value="${qpid.goodbye.topic.jndi.name}"/>
+ <filter token="qpid.hello.queue.jndi.name" value="${qpid.hello.queue.jndi.name}"/>
+ <filter token="qpid.goodbye.queue.jndi.name" value="${qpid.goodbye.queue.jndi.name}"/>
+ <filter token="qpid.request.queue.jndi.name" value="${qpid.request.queue.jndi.name}"/>
+ <filter token="qpid.response.queue.jndi.name" value="${qpid.response.queue.jndi.name}"/>
+ <filter token="qpid.ejb.jndi.name" value="${qpid.ejb.jndi.name}"/>
+ </filterset>
+ </copy>
+ </target>
+
+ <target name="compile" depends="generate" description="Compiles the source files for the Qpid JCA example">
+ <compile classpath="compile.classpath"/>
+ </target>
+
+ <target name="package-war" depends="compile" description="Packages the WAR file for deployment.">
+ <war destfile="${build.dir}/${war.name}" webxml="${gen.dir}/web.xml">
+ <classes dir="${build.classes.dir}">
+ <include name="org/apache/qpid/jca/example/web/**"/>
+ </classes>
+ <metainf dir="${gen.dir}">
+ <include name="glassfish-web.xml"/>
+ </metainf>
+ </war>
+ </target>
+
+ <target name="package-ejb" depends="compile" description="Packages the EJB archive for deployment.">
+ <jar destfile="${build.dir}/${ejb.name}" basedir="${build.classes.dir}">
+ <include name="org/apache/qpid/jca/example/ejb/**/*.class"/>
+ <metainf dir="${gen.dir}">
+ <include name="jboss.xml"/>
+ <include name="glassfish-ejb-jar.xml"/>
+ </metainf>
+ </jar>
+ </target>
+
+ <target name="package-ear" depends="generate, package-war, package-ejb" description="Packages the EAR archive for deployment.">
+ <jar destfile="${build.dir}/${ear.name}" basedir="${build.dir}">
+ <include name="*.war"/>
+ <include name="*.jar"/>
+ <metainf dir="${gen.dir}">
+ <include name="application.xml"/>
+ </metainf>
+ </jar>
+ </target>
+
+ <target name="run-client" depends="compile" description="Runs the RMI client.">
+ <java classname="org.apache.qpid.jca.example.client.QpidTestClient">
+ <classpath>
+ <pathelement path="${build.classes.dir}"/>
+ <path refid="run.classpath"/>
+ </classpath>
+ <sysproperty key="java.naming.factory.initial" value="${jndi.context}"/>
+ <sysproperty key="java.naming.provider.url" value="${server.host}"/>
+ <sysproperty key="java.naming.factory.url.pkgs" value="org.jboss.ejb.client.naming"/>
+ <sysproperty key="jboss.ejb.client.properties.file.path" value="${conf.dir}/jboss-ejb-client.properties"/>
+
+ <sysproperty key="qpid.ejb.name" value="${qpid.ejb.name}"/>
+ <sysproperty key="qpid.cf.name" value="${qpid.client.cf.jndi.name}"/>
+ <sysproperty key="qpid.dest.name" value="${qpid.client.dest.jndi.name}"/>
+ <sysproperty key="qpid.dest_syntax" value="${qpid.dest_syntax}"/>
+ <sysproperty key="log4j.configuration" value="file://${conf.dir}/log4j.properties"/>
+
+ <sysproperty key="qpid.message" value="${client.message}"/>
+ <sysproperty key="message.count" value="${client.message.count}"/>
+ <sysproperty key="use.topic" value="${client.use.topic}"/>
+ <sysproperty key="use.ejb" value="${client.use.ejb}"/>
+ <sysproperty key="say.goodbye" value="${client.say.goodbye}"/>
+ </java>
+ </target>
+
+ <target name="run-reqresp" depends="compile">
+ <java classname="org.apache.qpid.jca.example.client.QpidRequestResponseClient">
+ <classpath>
+ <pathelement path="${build.classes.dir}"/>
+ <path refid="run.classpath"/>
+ </classpath>
+ <sysproperty key="java.naming.factory.initial" value="${jndi.context}"/>
+ <sysproperty key="java.naming.provider.url" value="${server.host}"/>
+ <sysproperty key="qpid.message" value="Hello, World"/>
+ <sysproperty key="message.count" value="1"/>
+ <sysproperty key="thread.count" value="5"/>
+ <sysproperty key="qpid.cf.name" value="${qpid.client.cf.jndi.name}"/>
+ <sysproperty key="qpid.dest.name" value="${qpid.client.dest.jndi.name}"/>
+ <sysproperty key="log4j.configuration" value="file://${conf.dir}/log4j.properties"/>
+ <sysproperty key="qpid.dest_syntax" value="${qpid.dest_syntax}"/>
+ </java>
+ </target>
+
+ <target name="clean" description="Deletes the build directory and all related files.">
+ <delete dir="${build.dir}"/>
+ </target>
+
+ <target name="help">
+ <echo>
+
+ ant compile
+ This will compile all the source code for the Qpid JCA example project to the ${build.classes.dir} directory.
+
+ ant deploy-rar deploy-ear
+ Deploys a particular component which could be rar, ear (or ds for JBoss)
+
+ ant undeploy-ear undeploy-rar
+ Undeploys a particular component which could be rar, ear (or ds for JBoss)
+
+ ant run-client run-reqresp
+ Runs the RMI/thin client or the request-response client example
+ </echo>
+ </target>
+
+</project>
diff --git a/qpid/java/jca/example/conf/application.xml b/qpid/java/jca/example/conf/application.xml
new file mode 100644
index 0000000000..d181bcda67
--- /dev/null
+++ b/qpid/java/jca/example/conf/application.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ -
+ - 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.
+ -
+ -->
+<application xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="5"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd">
+
+ <module>
+ <ejb>@ejb.name@</ejb>
+ </module>
+
+ <module>
+ <web>
+ <web-uri>@war.name@</web-uri>
+ <context-root>/qpid-jca-web</context-root>
+ </web>
+ </module>
+
+</application>
+
diff --git a/qpid/java/jca/example/conf/ejb-jar.xml b/qpid/java/jca/example/conf/ejb-jar.xml
new file mode 100644
index 0000000000..a1aa859d96
--- /dev/null
+++ b/qpid/java/jca/example/conf/ejb-jar.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ -
+ - 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.
+ -
+ -->
+<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" version="3.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd">
+
+ <enterprise-beans>
+ <message-driven>
+ <ejb-name>QpidHelloListenerBean</ejb-name>
+ </message-driven>
+ <message-driven>
+ <ejb-name>QpidHelloSubscriberBean</ejb-name>
+ </message-driven>
+ <message-driven>
+ <ejb-name>QpidJMSResponderBean</ejb-name>
+ </message-driven>
+ </enterprise-beans>
+
+
+</ejb-jar>
diff --git a/qpid/java/jca/example/conf/geronimo-application.xml b/qpid/java/jca/example/conf/geronimo-application.xml
new file mode 100644
index 0000000000..384f6b2e75
--- /dev/null
+++ b/qpid/java/jca/example/conf/geronimo-application.xml
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ -
+ - 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.
+ -
+ -->
+<application xmlns="http://geronimo.apache.org/xml/ns/j2ee/application-2.0"
+ xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2"
+ xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2"
+ application-name="QpidJCAExampleApplication">
+
+ <sys:environment>
+ <sys:moduleId>
+ <sys:groupId>@geronimo.ear.group.id@</sys:groupId>
+ <sys:artifactId>@geronimo.ear.artifact.id@</sys:artifactId>
+ <sys:version>@geronimo.ear.version@</sys:version>
+ <sys:type>@geronimo.ear.type@</sys:type>
+ </sys:moduleId>
+ </sys:environment>
+
+ <!-- Plan for embedded WAR -->
+ <module>
+ <web>qpid-jcaex-web.war</web>
+ <web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1">
+
+ <sys:environment>
+ <sys:moduleId>
+ <sys:groupId>@geronimo.war.group.id@</sys:groupId>
+ <sys:artifactId>@geronimo.war.artifact.id@</sys:artifactId>
+ <sys:version>@geronimo.war.version@</sys:version>
+ <sys:type>@geronimo.war.type@</sys:type>
+ </sys:moduleId>
+
+ <sys:dependencies>
+ <sys:dependency>
+ <sys:groupId>qpid.jca</sys:groupId>
+ <sys:artifactId>QpidJCAAdapter</sys:artifactId>
+ <sys:version>1.0</sys:version>
+ <sys:type>rar</sys:type>
+ </sys:dependency>
+ </sys:dependencies>
+ </sys:environment>
+
+ <context-root>/qpid-jca-web</context-root>
+
+ </web-app>
+ </module>
+
+ <!-- Plan for embedded EJBs -->
+ <module>
+ <ejb>qpid-jcaex-ejb.jar</ejb>
+ <openejb-jar xmlns="http://www.openejb.org/xml/ns/openejb-jar-2.1">
+
+ <sys:environment>
+ <sys:moduleId>
+ <sys:groupId>@geronimo.ejb.group.id@</sys:groupId>
+ <sys:artifactId>@geronimo.ejb.artifact.id@</sys:artifactId>
+ <sys:version>@geronimo.ejb.version@</sys:version>
+ <sys:type>@geronimo.ejb.type@</sys:type>
+ </sys:moduleId>
+
+ <sys:dependencies>
+ <sys:dependency>
+ <sys:groupId>qpid.jca</sys:groupId>
+ <sys:artifactId>QpidJCAAdapter</sys:artifactId>
+ <sys:version>1.0</sys:version>
+ <sys:type>rar</sys:type>
+ </sys:dependency>
+ </sys:dependencies>
+ </sys:environment>
+
+ <enterprise-beans>
+ <message-driven>
+ <ejb-name>QpidHelloListenerBean</ejb-name>
+ <resource-adapter>
+ <resource-link>QpidResourceAdapter</resource-link>
+ </resource-adapter>
+ </message-driven>
+ <message-driven>
+ <ejb-name>QpidGoodByeListenerBean</ejb-name>
+ <resource-adapter>
+ <resource-link>QpidResourceAdapter</resource-link>
+ </resource-adapter>
+ </message-driven>
+ <message-driven>
+ <ejb-name>QpidHelloSubscriberBean</ejb-name>
+ <resource-adapter>
+ <resource-link>QpidResourceAdapter</resource-link>
+ </resource-adapter>
+ </message-driven>
+ <message-driven>
+ <ejb-name>QpidGoodByeSubscriberBean</ejb-name>
+ <resource-adapter>
+ <resource-link>QpidResourceAdapter</resource-link>
+ </resource-adapter>
+ </message-driven>
+ <message-driven>
+ <ejb-name>QpidJMSResponderBean</ejb-name>
+ <resource-adapter>
+ <resource-link>QpidResourceAdapter</resource-link>
+ </resource-adapter>
+ </message-driven>
+ </enterprise-beans>
+ </openejb-jar>
+ </module>
+</application>
diff --git a/qpid/java/jca/example/conf/geronimo-ra.xml b/qpid/java/jca/example/conf/geronimo-ra.xml
new file mode 100644
index 0000000000..a7511f647f
--- /dev/null
+++ b/qpid/java/jca/example/conf/geronimo-ra.xml
@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ -
+ - 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.
+ -
+ -->
+<connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2">
+ <dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
+ <dep:moduleId>
+ <dep:groupId>qpid.jca</dep:groupId>
+ <dep:artifactId>QpidJCAAdapter</dep:artifactId>
+ <dep:version>1.0</dep:version>
+ <dep:type>rar</dep:type>
+ </dep:moduleId>
+ </dep:environment>
+ <resourceadapter>
+ <resourceadapter-instance>
+ <resourceadapter-name>QpidResourceAdapter</resourceadapter-name>
+ <config-property-setting name="ClientId">client_id</config-property-setting>
+ <config-property-setting name="TransactionManagerLocatorClass">org.apache.qpid.ra.tm.GeronimoTransactionManagerLocator</config-property-setting>
+ <config-property-setting name="TransactionManagerLocatorMethod">getTransactionManager</config-property-setting>
+ <!-- Note, currently there is a bug with end/suspend and Geronimo. For now use local transactions-->
+ <config-property-setting name="UseLocalTx">true</config-property-setting>
+ <workmanager>
+ <gbean-link>DefaultWorkManager</gbean-link>
+ </workmanager>
+ </resourceadapter-instance>
+ <outbound-resourceadapter>
+ <connection-definition>
+ <connectionfactory-interface>org.apache.qpid.ra.QpidRAConnectionFactory</connectionfactory-interface>
+ <connectiondefinition-instance>
+ <name>QpidJMSXA</name>
+ <implemented-interface>javax.jms.QueueConnectionFactory</implemented-interface>
+ <implemented-interface>javax.jms.TopicConnectionFactory</implemented-interface>
+ <config-property-setting name="ConnectionURL">@broker.url@</config-property-setting>
+ <connectionmanager>
+ <!-- Note, currently there is a bug with end/suspend and Geronimo. For now use no transactions outbound -->
+ <no-transaction/>
+ <single-pool>
+ <max-size>20</max-size>
+ <min-size>0</min-size>
+ <match-one/>
+ </single-pool>
+ </connectionmanager>
+ </connectiondefinition-instance>
+ </connection-definition>
+ </outbound-resourceadapter>
+ <!-- Note, do not remove this admin object. There appears to be a bug in Geronimo's deployer that does not correctly create JNDI references
+ if an extra admin object is not present -->
+ <adminobject>
+ <adminobject-interface>org.apache.qpid.ra.admin.QpidTopic</adminobject-interface>
+ <adminobject-class>org.apache.qpid.ra.admin.QpidTopicImpl</adminobject-class>
+ <adminobject-instance>
+ <message-destination-name>Dummy</message-destination-name>
+ <config-property-setting name="DestinationAddress">amq.topic</config-property-setting>
+ </adminobject-instance>
+ </adminobject>
+ <adminobject>
+ <adminobject-interface>org.apache.qpid.ra.admin.QpidTopic</adminobject-interface>
+ <adminobject-class>org.apache.qpid.ra.admin.QpidTopicImpl</adminobject-class>
+ <adminobject-instance>
+ <message-destination-name>HelloTopic</message-destination-name>
+ <config-property-setting name="DestinationAddress">@qpid.hello.topic.dest.address@</config-property-setting>
+ </adminobject-instance>
+ </adminobject>
+ <adminobject>
+ <adminobject-interface>org.apache.qpid.ra.admin.QpidTopic</adminobject-interface>
+ <adminobject-class>org.apache.qpid.ra.admin.QpidTopicImpl</adminobject-class>
+ <adminobject-instance>
+ <message-destination-name>GoodByeTopic</message-destination-name>
+ <config-property-setting name="DestinationAddress">@qpid.goodbye.topic.dest.address@</config-property-setting>
+ </adminobject-instance>
+ </adminobject>
+ <!--
+ <adminobject>
+ <adminobject-interface>org.apache.qpid.ra.admin.QpidTopic</adminobject-interface>
+ <adminobject-class>org.apache.qpid.ra.admin.QpidTopicImpl</adminobject-class>
+ <adminobject-instance>
+ <message-destination-name>jms/HelloGoodByeTopic</message-destination-name>
+ <config-property-setting name="DestinationAddress">@qpid.hellogoodbye.topic.dest.address@</config-property-setting>
+ </adminobject-instance>
+ </adminobject>
+ -->
+ <adminobject>
+ <adminobject-interface>org.apache.qpid.ra.admin.QpidQueue</adminobject-interface>
+ <adminobject-class>org.apache.qpid.ra.admin.QpidQueueImpl</adminobject-class>
+ <adminobject-instance>
+ <message-destination-name>HelloQueue</message-destination-name>
+ <config-property-setting name="DestinationAddress">@qpid.hello.queue.dest.address@</config-property-setting>
+ </adminobject-instance>
+ </adminobject>
+ <adminobject>
+ <adminobject-interface>org.apache.qpid.ra.admin.QpidQueue</adminobject-interface>
+ <adminobject-class>org.apache.qpid.ra.admin.QpidQueueImpl</adminobject-class>
+ <adminobject-instance>
+ <message-destination-name>GoodByeQueue</message-destination-name>
+ <config-property-setting name="DestinationAddress">@qpid.goodbye.queue.dest.address@</config-property-setting>
+ </adminobject-instance>
+ </adminobject>
+ <adminobject>
+ <adminobject-interface>org.apache.qpid.ra.admin.QpidQueue</adminobject-interface>
+ <adminobject-class>org.apache.qpid.ra.admin.QpidQueueImpl</adminobject-class>
+ <adminobject-instance>
+ <message-destination-name>RequestQueue</message-destination-name>
+ <config-property-setting name="DestinationAddress">@qpid.request.queue.dest.address@</config-property-setting>
+ </adminobject-instance>
+ </adminobject>
+ <adminobject>
+ <adminobject-interface>org.apache.qpid.ra.admin.QpidQueue</adminobject-interface>
+ <adminobject-class>org.apache.qpid.ra.admin.QpidQueueImpl</adminobject-class>
+ <adminobject-instance>
+ <message-destination-name>ResponseQueue</message-destination-name>
+ <config-property-setting name="DestinationAddress">@qpid.response.queue.dest.address@</config-property-setting>
+ </adminobject-instance>
+ </adminobject>
+ <adminobject>
+ <adminobject-interface>javax.jms.ConnectionFactory</adminobject-interface>
+ <adminobject-class>org.apache.qpid.ra.admin.QpidConnectionFactoryProxy</adminobject-class>
+ <adminobject-instance>
+ <message-destination-name>QpidConnectionFactory</message-destination-name>
+ <config-property-setting name="ConnectionURL">@broker.url@</config-property-setting>
+ </adminobject-instance>
+ </adminobject>
+ </resourceadapter>
+</connector>
+
diff --git a/qpid/java/jca/example/conf/glassfish-ejb-jar.xml b/qpid/java/jca/example/conf/glassfish-ejb-jar.xml
new file mode 100644
index 0000000000..3416e2b4ae
--- /dev/null
+++ b/qpid/java/jca/example/conf/glassfish-ejb-jar.xml
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ -
+ - 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.
+ -
+ -->
+<!DOCTYPE glassfish-ejb-jar PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 EJB 3.1//EN" "http://glassfish.org/dtds/glassfish-ejb-jar_3_1-1.dtd">
+<glassfish-ejb-jar>
+ <enterprise-beans>
+ <ejb>
+ <ejb-name>QpidHelloListenerBean</ejb-name>
+ <jndi-name>HelloQueue</jndi-name>
+ <mdb-resource-adapter>
+ <resource-adapter-mid>qpid-ra-@rar.ver@</resource-adapter-mid>
+ </mdb-resource-adapter>
+ <resource-ref>
+ <res-ref-name>QpidJMSXA</res-ref-name>
+ <jndi-name>QpidJMSXA</jndi-name>
+ </resource-ref>
+ </ejb>
+ <ejb>
+ <ejb-name>QpidGoodByeListenerBean</ejb-name>
+ <jndi-name>GoodByeQueue</jndi-name>
+ <mdb-resource-adapter>
+ <resource-adapter-mid>qpid-ra-@rar.ver@</resource-adapter-mid>
+ </mdb-resource-adapter>
+ <resource-ref>
+ <res-ref-name>QpidJMSXA</res-ref-name>
+ <jndi-name>QpidJMSXA</jndi-name>
+ </resource-ref>
+ </ejb>
+ <ejb>
+ <ejb-name>QpidHelloSubscriberBean</ejb-name>
+ <jndi-name>HelloTopic</jndi-name>
+ <mdb-resource-adapter>
+ <resource-adapter-mid>qpid-ra-@rar.ver@</resource-adapter-mid>
+ </mdb-resource-adapter>
+ <resource-ref>
+ <res-ref-name>QpidJMSXA</res-ref-name>
+ <jndi-name>QpidJMSXA</jndi-name>
+ </resource-ref>
+ </ejb>
+ <ejb>
+ <ejb-name>QpidGoodByeSubscriberBean</ejb-name>
+ <jndi-name>GoodByeTopic</jndi-name>
+ <mdb-resource-adapter>
+ <resource-adapter-mid>qpid-ra-@rar.ver@</resource-adapter-mid>
+ </mdb-resource-adapter>
+ <resource-ref>
+ <res-ref-name>QpidJMSXA</res-ref-name>
+ <jndi-name>QpidJMSXA</jndi-name>
+ </resource-ref>
+ </ejb>
+ <ejb>
+ <ejb-name>QpidJMSResponderBean</ejb-name>
+ <jndi-name>QpidResponderQueue</jndi-name>
+ <mdb-resource-adapter>
+ <resource-adapter-mid>qpid-ra-@rar.ver@</resource-adapter-mid>
+ </mdb-resource-adapter>
+ <resource-ref>
+ <res-ref-name>QpidJMSXA</res-ref-name>
+ <jndi-name>QpidJMSXA</jndi-name>
+ </resource-ref>
+ </ejb>
+ <ejb>
+ <ejb-name>QpidTestBean</ejb-name>
+ <jndi-name>QpidTestBean</jndi-name>
+ <resource-ref>
+ <res-ref-name>QpidJMSXA</res-ref-name>
+ <jndi-name>QpidJMSXA</jndi-name>
+ </resource-ref>
+ </ejb>
+ </enterprise-beans>
+</glassfish-ejb-jar>
+
diff --git a/qpid/java/jca/example/conf/glassfish-resources.xml b/qpid/java/jca/example/conf/glassfish-resources.xml
new file mode 100644
index 0000000000..ce1fc5b764
--- /dev/null
+++ b/qpid/java/jca/example/conf/glassfish-resources.xml
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ -
+ - 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.
+ -
+ -->
+<!DOCTYPE resources PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Resource Definitions//EN" "http://glassfish.org/dtds/glassfish-resources_1_5.dtd">
+<resources>
+
+
+ <resource-adapter-config name="QpidResourceAdapter" resource-adapter-name="qpid-ra-@rar.ver@" thread-pool-ids="thread-pool-1">
+ <property name="TransactionManagerLocatorClass" value="org.apache.qpid.ra.tm.GlassfishTransactionManagerLocator"/>
+ <property name="TransactionManagerLocatorMethod" value="getTm"/>
+ </resource-adapter-config>
+
+ <!--XAConnectionFactory-->
+ <connector-connection-pool
+ name="QpidJMSXAPool"
+ resource-adapter-name="qpid-ra-@rar.ver@"
+ connection-definition-name="org.apache.qpid.ra.QpidRAConnectionFactory"
+ transaction-support="XATransaction"
+ ping="true">
+ <property name="connectionURL" value="@broker.url@"/>
+ <property name="SessionDefaultType" value="javax.jms.Queue"/>
+ </connector-connection-pool>
+
+ <connector-resource jndi-name="QpidJMSXA" pool-name="QpidJMSXAPool"/>
+
+ <!--LocalTransaction ConnectionFactory
+ <connector-connection-pool
+ name="QpidJMSPool"
+ resource-adapter-name="qpid-ra-@rar.ver@"
+ connection-definition-name="org.apache.qpid.ra.QpidRAConnectionFactory"
+ transaction-support="LocalTransaction"
+ ping="true">
+ <property name="connectionURL" value="@broker.url@"/>
+ <property name="SessionDefaultType" value="javax.jms.Queue"/>
+ <property name="UseLocalTx" value="true"/>
+ </connector-connection-pool>
+
+
+ <connector-resource jndi-name="QpidJMS" pool-name="QpidJMSPool"/>
+
+ -->
+ <!--Destinations-->
+ <admin-object-resource jndi-name="HelloQueue" res-adapter="qpid-ra-@rar.ver@" res-type="org.apache.qpid.ra.admin.QpidQueue" class-name="org.apache.qpid.ra.admin.QpidQueueImpl">
+ <property name="DestinationAddress" value="@qpid.hello.queue.dest.address@"/>
+ </admin-object-resource>
+
+ <admin-object-resource jndi-name="GoodByeQueue" res-adapter="qpid-ra-@rar.ver@" res-type="org.apache.qpid.ra.admin.QpidQueue" class-name="org.apache.qpid.ra.admin.QpidQueueImpl">
+ <property name="DestinationAddress" value="@qpid.goodbye.queue.dest.address@"/>
+ </admin-object-resource>
+
+ <admin-object-resource jndi-name="HelloTopic" res-adapter="qpid-ra-@rar.ver@" res-type="org.apache.qpid.ra.admin.QpidTopic" class-name="org.apache.qpid.ra.admin.QpidTopicImpl">
+ <property name="DestinationAddress" value="@qpid.hello.topic.dest.address@"/>
+ </admin-object-resource>
+
+ <admin-object-resource jndi-name="GoodByeTopic" res-adapter="qpid-ra-@rar.ver@" res-type="org.apache.qpid.ra.admin.QpidTopic" class-name="org.apache.qpid.ra.admin.QpidTopicImpl">
+ <property name="DestinationAddress" value="@qpid.goodbye.topic.dest.address@"/>
+ </admin-object-resource>
+
+ <!--
+ <admin-object-resource jndi-name="HelloGoodByeTopic" res-adapter="qpid-ra-@rar.ver@" res-type="org.apache.qpid.ra.admin.QpidTopic" class-name="org.apache.qpid.ra.admin.QpidTopicImpl">
+ <property name="DestinationAddress" value="@qpid.hellogoodbye.topic.dest.address@"/>
+ </admin-object-resource>
+ -->
+ <admin-object-resource jndi-name="QpidRequestQueue" res-adapter="qpid-ra-@rar.ver@" res-type="org.apache.qpid.ra.admin.QpidQueue" class-name="org.apache.qpid.ra.admin.QpidQueueImpl">
+ <property name="DestinationAddress" value="@qpid.request.queue.dest.address@"/>
+ </admin-object-resource>
+
+ <admin-object-resource jndi-name="QpidResponseQueue" res-adapter="qpid-ra-@rar.ver@" res-type="org.apache.qpid.ra.admin.QpidQueue" class-name="org.apache.qpid.ra.admin.QpidQueueImpl">
+ <property name="DestinationAddress" value="@qpid.response.queue.dest.address@"/>
+ </admin-object-resource>
+
+ <admin-object-resource jndi-name="QpidConnectionFactory" res-adapter="qpid-ra-@rar.ver@" res-type="javax.jms.ConnectionFactory" class-name="org.apache.qpid.ra.admin.QpidConnectionFactoryProxy">
+ <property name="ConnectionURL" value="@broker.url@"/>
+ </admin-object-resource>
+
+</resources>
diff --git a/qpid/java/jca/example/conf/glassfish-web.xml b/qpid/java/jca/example/conf/glassfish-web.xml
new file mode 100644
index 0000000000..3aa49c01b1
--- /dev/null
+++ b/qpid/java/jca/example/conf/glassfish-web.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ -
+ - 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.
+ -
+ -->
+<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
+<glassfish-web-app>
+
+ <context-root>qpid-jca-web</context-root>
+
+ <ejb-ref>
+ <ejb-ref-name>QpidTestBean</ejb-ref-name>
+ <jndi-name>QpidTestBean</jndi-name>
+ </ejb-ref>
+
+ <resource-ref>
+ <res-ref-name>QpidJMSXA</res-ref-name>
+ <jndi-name>QpidJMSXA</jndi-name>
+ </resource-ref>
+ <resource-env-ref>
+ <res-env-ref-name>HelloQueue</res-env-ref-name>
+ <jndi-name>HelloQueue</jndi-name>
+ </resource-env-ref>
+ <resource-ref>
+ <res-ref-name>HelloTopic</res-ref-name>
+ <jndi-name>HelloTopic</jndi-name>
+ </resource-ref>
+
+
+</glassfish-web-app>
diff --git a/qpid/java/jca/example/conf/jboss-ejb-client.properties b/qpid/java/jca/example/conf/jboss-ejb-client.properties
new file mode 100644
index 0000000000..9b62e6794c
--- /dev/null
+++ b/qpid/java/jca/example/conf/jboss-ejb-client.properties
@@ -0,0 +1,12 @@
+endpoint.name=client-endpoint
+remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false
+
+remote.connections=default
+
+remote.connection.default.host=localhost
+remote.connection.default.port = 4447
+remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
+
+remote.connection.default.username=CHANGEME
+remote.connection.default.password=CHANGEME
+
diff --git a/qpid/java/jca/example/conf/jboss-web.xml b/qpid/java/jca/example/conf/jboss-web.xml
new file mode 100644
index 0000000000..32a97d1c35
--- /dev/null
+++ b/qpid/java/jca/example/conf/jboss-web.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ -
+ - 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.
+ -
+ -->
+<jboss-web>
+ <resource-ref>
+ <res-ref-name>QpidJMSXA</res-ref-name>
+ <res-type>javax.jms.ConnectionFactory</res-type>
+ <jndi-name>java:/QpidJMSXA</jndi-name>
+ </resource-ref>
+ <resource-ref>
+ <res-ref-name>QpidJMS</res-ref-name>
+ <res-type>javax.jms.ConnectionFactory</res-type>
+ <jndi-name>java:/QpidJMS</jndi-name>
+ </resource-ref>
+ <ejb-local-ref>
+ <ejb-ref-name>QpidTestBean</ejb-ref-name>
+ <jndi-name>qpid-jcaex/QpidTestBean/local</jndi-name>
+ </ejb-local-ref>
+ <context-root>qpid-jca-web</context-root>
+</jboss-web>
+
diff --git a/qpid/java/jca/example/conf/jboss.xml b/qpid/java/jca/example/conf/jboss.xml
new file mode 100644
index 0000000000..0f22797789
--- /dev/null
+++ b/qpid/java/jca/example/conf/jboss.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0"?>
+<!--
+ -
+ - 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.
+ -
+ -->
+<jboss
+ xmlns="http://www.jboss.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee
+ http://www.jboss.org/j2ee/schema/jboss_5_0.xsd"
+ version="3.0">
+
+ <enterprise-beans>
+ <message-driven>
+ <ejb-name>QpidHelloListenerBean</ejb-name>
+ <resource-adapter-name>@rar.name@</resource-adapter-name>
+ </message-driven>
+ <message-driven>
+ <ejb-name>QpidGoodByeListenerBean</ejb-name>
+ <resource-adapter-name>@rar.name@</resource-adapter-name>
+ </message-driven>
+ <message-driven>
+ <ejb-name>QpidHelloSubscriberBean</ejb-name>
+ <resource-adapter-name>@rar.name@</resource-adapter-name>
+ </message-driven>
+ <message-driven>
+ <ejb-name>QpidGoodByeSubscriberBean</ejb-name>
+ <resource-adapter-name>@rar.name@</resource-adapter-name>
+ </message-driven>
+ <message-driven>
+ <ejb-name>QpidJMSResponderBean</ejb-name>
+ <resource-adapter-name>@rar.name@</resource-adapter-name>
+ </message-driven>
+ </enterprise-beans>
+
+</jboss>
diff --git a/qpid/java/jca/example/conf/log4j.properties b/qpid/java/jca/example/conf/log4j.properties
new file mode 100644
index 0000000000..1139ab9e85
--- /dev/null
+++ b/qpid/java/jca/example/conf/log4j.properties
@@ -0,0 +1,36 @@
+#
+# 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.
+#
+log4j.rootLogger=DEBUG, CONSOLE, FILE
+
+#Console Appender
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
+
+#File Appender
+log4j.appender.FILE=org.apache.log4j.FileAppender
+log4j.appender.FILE.File=./build/log/qpid-jca-example.log
+log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
+log4j.appender.FILE.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
+
+log4j.logger.org.jboss=WARN
+log4j.logger.org.jnp.interfaces=WARN
+log4j.logger.org.apache.qpid=ERROR
+log4j.logger.org.apache.qpid.jca.example=DEBUG
+
diff --git a/qpid/java/jca/example/conf/qpid-jca-ds.xml b/qpid/java/jca/example/conf/qpid-jca-ds.xml
new file mode 100644
index 0000000000..ad75876808
--- /dev/null
+++ b/qpid/java/jca/example/conf/qpid-jca-ds.xml
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ -
+ - 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.
+ -
+ -->
+<connection-factories>
+
+ <mbean code="org.jboss.resource.deployment.AdminObject"
+ name="qpid.jca:name=HelloTopic">
+ <attribute name="JNDIName">HelloTopic</attribute>
+ <depends optional-attribute-name="RARName">jboss.jca:service=RARDeployment,name='@rar.name@'</depends>
+ <attribute name="Type">org.apache.qpid.ra.admin.QpidTopic</attribute>
+ <attribute name="Properties">
+ DestinationAddress=@qpid.hello.topic.dest.address@
+ </attribute>
+ </mbean>
+
+ <mbean code="org.jboss.resource.deployment.AdminObject"
+ name="qpid.jca:name=GoodByeTopic">
+ <attribute name="JNDIName">GoodByeTopic</attribute>
+ <depends optional-attribute-name="RARName">jboss.jca:service=RARDeployment,name='@rar.name@'</depends>
+ <attribute name="Type">org.apache.qpid.ra.admin.QpidTopic</attribute>
+ <attribute name="Properties">
+ DestinationAddress=@qpid.goodbye.topic.dest.address@
+ </attribute>
+ </mbean>
+
+ <mbean code="org.jboss.resource.deployment.AdminObject"
+ name="qpid.jca:name=HelloGoodByeTopic">
+ <attribute name="JNDIName">HelloGoodByeTopic</attribute>
+ <depends optional-attribute-name="RARName">jboss.jca:service=RARDeployment,name='@rar.name@'</depends>
+ <attribute name="Type">org.apache.qpid.ra.admin.QpidTopic</attribute>
+ <attribute name="Properties">
+ DestinationAddress=@qpid.hellogoodbye.topic.dest.address@
+ </attribute>
+ </mbean>
+
+ <mbean code="org.jboss.resource.deployment.AdminObject"
+ name="qpid.jca:name=HelloQueue">
+ <attribute name="JNDIName">HelloQueue</attribute>
+ <depends optional-attribute-name="RARName">jboss.jca:service=RARDeployment,name='@rar.name@'</depends>
+ <attribute name="Type">org.apache.qpid.ra.admin.QpidQueue</attribute>
+ <attribute name="Properties">
+ DestinationAddress=@qpid.hello.queue.dest.address@
+ </attribute>
+ </mbean>
+
+ <mbean code="org.jboss.resource.deployment.AdminObject"
+ name="qpid.jca:name=GoodByeQueue">
+ <attribute name="JNDIName">GoodByeQueue</attribute>
+ <depends optional-attribute-name="RARName">jboss.jca:service=RARDeployment,name='@rar.name@'</depends>
+ <attribute name="Type">org.apache.qpid.ra.admin.QpidQueue</attribute>
+ <attribute name="Properties">
+ DestinationAddress=@qpid.goodbye.queue.dest.address@
+ </attribute>
+ </mbean>
+
+ <mbean code="org.jboss.resource.deployment.AdminObject"
+ name="qpid.jca:name=QpidRequestQueue">
+ <attribute name="JNDIName">QpidRequestQueue</attribute>
+ <depends optional-attribute-name="RARName">jboss.jca:service=RARDeployment,name='@rar.name@'</depends>
+ <attribute name="Type">org.apache.qpid.ra.admin.QpidQueue</attribute>
+ <attribute name="Properties">
+ DestinationAddress=@qpid.request.queue.dest.address@
+ </attribute>
+ </mbean>
+
+ <mbean code="org.jboss.resource.deployment.AdminObject"
+ name="qpid.jca:name=QpidResponseQueue">
+ <attribute name="JNDIName">QpidResponseQueue</attribute>
+ <depends optional-attribute-name="RARName">jboss.jca:service=RARDeployment,name='@rar.name@'</depends>
+ <attribute name="Type">org.apache.qpid.ra.admin.QpidQueue</attribute>
+ <attribute name="Properties">
+ DestinationAddress=@qpid.response.queue.dest.address@
+ </attribute>
+ </mbean>
+ <mbean code="org.jboss.resource.deployment.AdminObject"
+ name="qpid.jca:name=QpidConnectionFactory">
+ <attribute name="JNDIName">QpidConnectionFactory</attribute>
+ <depends optional-attribute-name="RARName">jboss.jca:service=RARDeployment,name='@rar.name@'</depends>
+ <attribute name="Type">javax.jms.ConnectionFactory</attribute>
+ <attribute name="Properties">
+ ConnectionURL=@broker.url@
+ </attribute>
+ </mbean>
+
+ <!-- Non XA connection factory. Can be used when running adapter against clustered Brokers -->
+ <tx-connection-factory>
+ <jndi-name>QpidJMS</jndi-name>
+ <rar-name>@rar.name@</rar-name>
+ <local-transaction/>
+ <config-property name="useLocalTx" type="java.lang.Boolean">true</config-property>
+ <config-property name="connectionURL">@broker.url@</config-property>
+ <config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Queue</config-property>
+ <connection-definition>org.apache.qpid.ra.QpidRAConnectionFactory</connection-definition>
+ <max-pool-size>20</max-pool-size>
+ </tx-connection-factory>
+
+ <!--XA ConnectionFactory-->
+ <tx-connection-factory>
+ <jndi-name>QpidJMSXA</jndi-name>
+ <xa-transaction/>
+ <rar-name>@rar.name@</rar-name>
+ <config-property name="connectionURL">@broker.url@</config-property>
+ <config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Queue</config-property>
+ <connection-definition>org.apache.qpid.ra.QpidRAConnectionFactory</connection-definition>
+ <max-pool-size>20</max-pool-size>
+ </tx-connection-factory>
+
+</connection-factories>
diff --git a/qpid/java/jca/example/conf/qpid-standalone.xml b/qpid/java/jca/example/conf/qpid-standalone.xml
new file mode 100644
index 0000000000..2e22bd3f99
--- /dev/null
+++ b/qpid/java/jca/example/conf/qpid-standalone.xml
@@ -0,0 +1,422 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--
+ -
+ - 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.
+ -
+-->
+
+<server xmlns="urn:jboss:domain:1.1" xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance">
+
+ <extensions>
+ <extension module="org.jboss.as.clustering.infinispan"/>
+ <extension module="org.jboss.as.connector"/>
+ <extension module="org.jboss.as.configadmin"/>
+ <extension module="org.jboss.as.deployment-scanner"/>
+ <extension module="org.jboss.as.ee"/>
+ <extension module="org.jboss.as.ejb3"/>
+ <extension module="org.jboss.as.jaxr"/>
+ <extension module="org.jboss.as.jaxrs"/>
+ <extension module="org.jboss.as.jdr"/>
+ <extension module="org.jboss.as.jmx"/>
+ <extension module="org.jboss.as.jpa"/>
+ <extension module="org.jboss.as.logging"/>
+ <extension module="org.jboss.as.mail"/>
+ <extension module="org.jboss.as.naming"/>
+ <extension module="org.jboss.as.osgi"/>
+ <extension module="org.jboss.as.pojo"/>
+ <extension module="org.jboss.as.remoting"/>
+ <extension module="org.jboss.as.sar"/>
+ <extension module="org.jboss.as.security"/>
+ <extension module="org.jboss.as.threads"/>
+ <extension module="org.jboss.as.transactions"/>
+ <extension module="org.jboss.as.web"/>
+ <extension module="org.jboss.as.webservices"/>
+ <extension module="org.jboss.as.weld"/>
+ </extensions>
+
+ <management>
+ <security-realms>
+ <security-realm name="ManagementRealm">
+ <authentication>
+ <properties path="mgmt-users.properties" relative-to="jboss.server.config.dir"/>
+ </authentication>
+ </security-realm>
+ </security-realms>
+ <management-interfaces>
+ <native-interface security-realm="ManagementRealm">
+ <socket-binding native="management-native"/>
+ </native-interface>
+ <http-interface security-realm="ManagementRealm">
+ <socket-binding http="management-http"/>
+ </http-interface>
+ </management-interfaces>
+ </management>
+
+ <profile>
+ <subsystem xmlns="urn:jboss:domain:logging:1.1">
+ <console-handler name="CONSOLE">
+ <level name="INFO"/>
+ <formatter>
+ <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
+ </formatter>
+ </console-handler>
+ <periodic-rotating-file-handler name="FILE">
+ <formatter>
+ <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
+ </formatter>
+ <file relative-to="jboss.server.log.dir" path="server.log"/>
+ <suffix value=".yyyy-MM-dd"/>
+ <append value="true"/>
+ </periodic-rotating-file-handler>
+ <logger category="com.arjuna">
+ <level name="WARN"/>
+ </logger>
+ <logger category="org.apache.tomcat.util.modeler">
+ <level name="WARN"/>
+ </logger>
+ <logger category="sun.rmi">
+ <level name="WARN"/>
+ </logger>
+ <logger category="jacorb">
+ <level name="WARN"/>
+ </logger>
+ <logger category="jacorb.config">
+ <level name="ERROR"/>
+ </logger>
+ <root-logger>
+ <level name="DEBUG"/>
+ <handlers>
+ <handler name="CONSOLE"/>
+ <handler name="FILE"/>
+ </handlers>
+ </root-logger>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:configadmin:1.0"/>
+ <subsystem xmlns="urn:jboss:domain:datasources:1.0">
+ <datasources>
+ <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
+ <connection-url>
+ jdbc:h2:mem:test;DB_CLOSE_DELAY=-1
+ </connection-url>
+ <driver>
+ h2
+ </driver>
+ <security>
+ <user-name>
+ sa
+ </user-name>
+ <password>
+ sa
+ </password>
+ </security>
+ </datasource>
+ <drivers>
+ <driver name="h2" module="com.h2database.h2">
+ <xa-datasource-class>
+ org.h2.jdbcx.JdbcDataSource
+ </xa-datasource-class>
+ </driver>
+ </drivers>
+ </datasources>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:deployment-scanner:1.1">
+ <deployment-scanner name="default" path="deployments" scan-interval="5000" relative-to="jboss.server.base.dir"/>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:ee:1.0"/>
+ <subsystem xmlns="urn:jboss:domain:ejb3:1.2">
+ <session-bean>
+ <stateless>
+ <bean-instance-pool-ref pool-name="slsb-strict-max-pool"/>
+ </stateless>
+ <stateful default-access-timeout="5000" cache-ref="simple"/>
+ <singleton default-access-timeout="5000"/>
+ </session-bean>
+ <mdb>
+ <resource-adapter-ref resource-adapter-name="@rar.name@"/>
+ <bean-instance-pool-ref pool-name="mdb-strict-max-pool"/>
+ </mdb>
+ <pools>
+ <bean-instance-pools>
+ <strict-max-pool name="slsb-strict-max-pool" max-pool-size="20" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/>
+ <strict-max-pool name="mdb-strict-max-pool" max-pool-size="20" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/>
+ </bean-instance-pools>
+ </pools>
+ <caches>
+ <cache name="simple" aliases="NoPassivationCache"/>
+ <cache name="passivating" passivation-store-ref="file" aliases="SimpleStatefulCache"/>
+ </caches>
+ <passivation-stores>
+ <file-passivation-store name="file"/>
+ </passivation-stores>
+ <async thread-pool-name="default"/>
+ <timer-service thread-pool-name="default">
+ <data-store path="timer-service-data" relative-to="jboss.server.data.dir"/>
+ </timer-service>
+ <remote connector-ref="remoting-connector" thread-pool-name="default"/>
+ <thread-pools>
+ <thread-pool name="default">
+ <max-threads count="10"/>
+ <keepalive-time time="100" unit="milliseconds"/>
+ </thread-pool>
+ </thread-pools>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:infinispan:1.1" default-cache-container="hibernate">
+ <cache-container name="hibernate" default-cache="local-query">
+ <local-cache name="entity">
+ <transaction mode="NON_XA"/>
+ <eviction strategy="LRU" max-entries="10000"/>
+ <expiration max-idle="100000"/>
+ </local-cache>
+ <local-cache name="local-query">
+ <transaction mode="NONE"/>
+ <eviction strategy="LRU" max-entries="10000"/>
+ <expiration max-idle="100000"/>
+ </local-cache>
+ <local-cache name="timestamps">
+ <transaction mode="NONE"/>
+ <eviction strategy="NONE"/>
+ </local-cache>
+ </cache-container>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:jaxr:1.0">
+ <connection-factory jndi-name="java:jboss/jaxr/ConnectionFactory"/>
+ <juddi-server publish-url="http://localhost:8080/juddi/publish" query-url="http://localhost:8080/juddi/query"/>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:jaxrs:1.0"/>
+ <subsystem xmlns="urn:jboss:domain:jca:1.1">
+ <archive-validation enabled="false"/>
+ <bean-validation enabled="false"/>
+ <default-workmanager>
+ <short-running-threads>
+ <core-threads count="50"/>
+ <queue-length count="50"/>
+ <max-threads count="50"/>
+ <keepalive-time time="10" unit="seconds"/>
+ </short-running-threads>
+ <long-running-threads>
+ <core-threads count="50"/>
+ <queue-length count="50"/>
+ <max-threads count="50"/>
+ <keepalive-time time="10" unit="seconds"/>
+ </long-running-threads>
+ </default-workmanager>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:jdr:1.0"/>
+ <subsystem xmlns="urn:jboss:domain:jmx:1.1">
+ <show-model value="true"/>
+ <remoting-connector/>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:jpa:1.0">
+ <jpa default-datasource=""/>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:mail:1.0">
+ <mail-session jndi-name="java:jboss/mail/Default">
+ <smtp-server outbound-socket-binding-ref="mail-smtp"/>
+ </mail-session>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:naming:1.1"/>
+ <subsystem xmlns="urn:jboss:domain:osgi:1.2" activation="lazy">
+ <properties>
+ <property name="org.osgi.framework.startlevel.beginning">
+ 1
+ </property>
+ </properties>
+ <capabilities>
+ <capability name="javax.servlet.api"/>
+ <capability name="javax.transaction.api"/>
+ <capability name="org.apache.felix.log" startlevel="1"/>
+ <capability name="org.jboss.osgi.logging" startlevel="1"/>
+ <capability name="org.apache.felix.configadmin" startlevel="1"/>
+ <capability name="org.jboss.as.osgi.configadmin" startlevel="1"/>
+ <capability name="org.jboss.osgi.repository" startlevel="1"/>
+ </capabilities>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:pojo:1.0"/>
+ <subsystem xmlns="urn:jboss:domain:remoting:1.1">
+ <connector name="remoting-connector" socket-binding="remoting"/>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:resource-adapters:1.0">
+ <resource-adapters>
+ <resource-adapter>
+ <archive>
+ @rar.name@
+ </archive>
+ <transaction-support>
+ XATransaction
+ </transaction-support>
+ <config-property name="connectionURL">
+ @broker.url@
+ </config-property>
+ <config-property name="TransactionManagerLocatorClass">
+ org.apache.qpid.ra.tm.JBoss7TransactionManagerLocator
+ </config-property>
+ <config-property name="TransactionManagerLocatorMethod">
+ getTm
+ </config-property>
+ <connection-definitions>
+ <connection-definition class-name="org.apache.qpid.ra.QpidRAManagedConnectionFactory" jndi-name="QpidJMSXA" pool-name="QpidJMSXA">
+ <config-property name="connectionURL">
+ @broker.url@
+ </config-property>
+ <config-property name="SessionDefaultType">
+ javax.jms.Queue
+ </config-property>
+ </connection-definition>
+ </connection-definitions>
+ <admin-objects>
+ <admin-object class-name="org.apache.qpid.ra.admin.QpidConnectionFactoryProxy" jndi-name="java:jboss/exported/QpidConnectionFactory" use-java-context="false">
+ <config-property name="ConnectionURL">
+ @broker.url@
+ </config-property>
+ </admin-object>
+ <admin-object class-name="org.apache.qpid.ra.admin.QpidTopicImpl" jndi-name="java:jboss/exported/GoodByeTopic" use-java-context="false" pool-name="GoodByeTopic">
+ <config-property name="DestinationAddress">
+ @qpid.hello.topic.dest.address@
+ </config-property>
+ </admin-object>
+ <admin-object class-name="org.apache.qpid.ra.admin.QpidTopicImpl" jndi-name="java:jboss/exported/HelloTopic" use-java-context="false" pool-name="HelloTopic">
+ <config-property name="DestinationAddress">
+ @qpid.goodbye.topic.dest.address@
+ </config-property>
+ </admin-object>
+ <admin-object class-name="org.apache.qpid.ra.admin.QpidQueueImpl" jndi-name="java:jboss/exported/GoodByeQueue" use-java-context="false" pool-name="GoodByeQueue">
+ <config-property name="DestinationAddress">
+ @qpid.goodbye.queue.dest.address@
+ </config-property>
+ </admin-object>
+ <admin-object class-name="org.apache.qpid.ra.admin.QpidQueueImpl" jndi-name="java:jboss/exported/HelloQueue" use-java-context="false" pool-name="HelloQueue">
+ <config-property name="DestinationAddress">
+ @qpid.hello.queue.dest.address@
+ </config-property>
+ </admin-object>
+ <admin-object class-name="org.apache.qpid.ra.admin.QpidQueueImpl" jndi-name="java:jboss/exported/QpidRequestQueue" use-java-context="false" pool-name="QpidRequestQueue">
+ <config-property name="DestinationAddress">
+ @qpid.request.queue.dest.address@
+ </config-property>
+ </admin-object>
+ <admin-object class-name="org.apache.qpid.ra.admin.QpidQueueImpl" jndi-name="java:jboss/exported/QpidResponseQueue" use-java-context="false" pool-name="QpidResponseQueue">
+ <config-property name="DestinationAddress">
+ @qpid.response.queue.dest.address@
+ </config-property>
+ </admin-object>
+ </admin-objects>
+ </resource-adapter>
+ </resource-adapters>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:sar:1.0"/>
+ <subsystem xmlns="urn:jboss:domain:security:1.1">
+ <security-domains>
+ <security-domain name="other" cache-type="default">
+ <authentication>
+ <login-module code="UsersRoles" flag="required"/>
+ </authentication>
+ </security-domain>
+ <security-domain name="jboss-web-policy" cache-type="default">
+ <authorization>
+ <policy-module code="Delegating" flag="required"/>
+ </authorization>
+ </security-domain>
+ <security-domain name="jboss-ejb-policy" cache-type="default">
+ <authorization>
+ <policy-module code="Delegating" flag="required"/>
+ </authorization>
+ </security-domain>
+ </security-domains>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:threads:1.1"/>
+ <subsystem xmlns="urn:jboss:domain:transactions:1.1">
+ <core-environment>
+ <process-id>
+ <uuid/>
+ </process-id>
+ </core-environment>
+ <recovery-environment socket-binding="txn-recovery-environment" status-socket-binding="txn-status-manager"/>
+ <coordinator-environment default-timeout="300"/>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host">
+ <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
+ <virtual-server name="default-host" enable-welcome-root="true">
+ <alias name="localhost"/>
+ <alias name="example.com"/>
+ </virtual-server>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:webservices:1.0" xmlns:javaee="http://java.sun.com/xml/ns/javaee" xmlns:jaxwsconfig="urn:jboss:jbossws-jaxws-config:4.0">
+ <modify-wsdl-address>
+ true
+ </modify-wsdl-address>
+ <wsdl-host>
+ ${jboss.bind.address:127.0.0.1}
+ </wsdl-host>
+ <endpoint-config>
+ <jaxwsconfig:config-name>
+ Standard-Endpoint-Config
+ </jaxwsconfig:config-name>
+ </endpoint-config>
+ <endpoint-config>
+ <jaxwsconfig:config-name>
+ Recording-Endpoint-Config
+ </jaxwsconfig:config-name>
+ <jaxwsconfig:pre-handler-chains>
+ <javaee:handler-chain id="recording-handlers">
+ <javaee:protocol-bindings>
+ ##SOAP11_HTTP ##SOAP11_HTTP_MTOM ##SOAP12_HTTP ##SOAP12_HTTP_MTOM
+ </javaee:protocol-bindings>
+ <javaee:handler>
+ <javaee:handler-name>
+ RecordingHandler
+ </javaee:handler-name>
+ <javaee:handler-class>
+ org.jboss.ws.common.invocation.RecordingServerHandler
+ </javaee:handler-class>
+ </javaee:handler>
+ </javaee:handler-chain>
+ </jaxwsconfig:pre-handler-chains>
+ </endpoint-config>
+ </subsystem>
+ <subsystem xmlns="urn:jboss:domain:weld:1.0"/>
+ </profile>
+
+ <interfaces>
+ <interface name="management">
+ <inet-address value="${jboss.bind.address.management:127.0.0.1}"/>
+ </interface>
+ <interface name="public">
+ <inet-address value="${jboss.bind.address:127.0.0.1}"/>
+ </interface>
+ </interfaces>
+
+ <socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
+ <socket-binding name="http" port="8080"/>
+ <socket-binding name="https" port="8443"/>
+ <socket-binding name="jacorb" port="3528"/>
+ <socket-binding name="jacorb-ssl" port="3529"/>
+ <socket-binding name="management-native" interface="management" port="${jboss.management.native.port:9999}"/>
+ <socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/>
+ <socket-binding name="messaging" port="5445"/>
+ <socket-binding name="messaging-throughput" port="5455"/>
+ <socket-binding name="osgi-http" interface="management" port="8090"/>
+ <socket-binding name="remoting" port="4447"/>
+ <socket-binding name="txn-recovery-environment" port="4712"/>
+ <socket-binding name="txn-status-manager" port="4713"/>
+ <outbound-socket-binding name="mail-smtp">
+ <remote-destination host="localhost" port="25"/>
+ </outbound-socket-binding>
+ </socket-binding-group>
+
+
+</server>
diff --git a/qpid/java/jca/example/conf/web.xml b/qpid/java/jca/example/conf/web.xml
new file mode 100644
index 0000000000..6e53d7beba
--- /dev/null
+++ b/qpid/java/jca/example/conf/web.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ -
+ - 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.
+ -
+ -->
+<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+
+ <servlet>
+ <display-name>QpidTestServlet</display-name>
+ <servlet-name>QpidTestServlet</servlet-name>
+ <servlet-class>org.apache.qpid.jca.example.web.QpidTestServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet>
+ <display-name>QpidRequestResponseServlet</display-name>
+ <servlet-name>QpidRequestResponseServlet</servlet-name>
+ <servlet-class>org.apache.qpid.jca.example.web.QpidRequestResponseServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>QpidTestServlet</servlet-name>
+ <url-pattern>/qpid</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>QpidRequestResponseServlet</servlet-name>
+ <url-pattern>/qpid-reqresp</url-pattern>
+ </servlet-mapping>
+
+</web-app>
+
diff --git a/qpid/java/jca/example/qpid-jca-example-properties.xml b/qpid/java/jca/example/qpid-jca-example-properties.xml
new file mode 100644
index 0000000000..ab0f6267ba
--- /dev/null
+++ b/qpid/java/jca/example/qpid-jca-example-properties.xml
@@ -0,0 +1,84 @@
+<!--
+ -
+ - 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.
+ -
+ -->
+<project name="qpid-jca-example-properties" basedir="." default="">
+
+ <property name="src.dir" location="${basedir}/src/main/java"/>
+ <property name="lib.dir" location="${basedir}/lib"/>
+ <property name="conf.dir" location="${basedir}/conf"/>
+ <property name="build.dir" location="${basedir}/build"/>
+ <property name="build.classes.dir" location="${build.dir}/classes"/>
+ <property name="gen.dir" location="${build.dir}/gen"/>
+ <property name="log.dir" location="${build.dir}/log"/>
+ <property name="qpid.jca.dir" location="${env.QPID_JCA_HOME}"/>
+
+ <property name="ejb.name" value="qpid-jcaex-ejb.jar"/>
+ <property name="war.name" value="qpid-jcaex-web.war"/>
+ <property name="ear.name" value="qpid-jcaex.ear"/>
+
+ <property name="rar.ver" value="${qpid.ver}"/>
+ <property name="rar.name" value="qpid-ra-${rar.ver}.rar"/>
+
+ <property name="broker.url" value="amqp://anonymous:passwd@client/test?brokerlist='tcp://${broker.address}?sasl_mechs='PLAIN''"/>
+
+ <property name="qpid.hello.topic.dest.address.ADDR" value="amq.topic/hello.Topic"/>
+ <property name="qpid.goodbye.topic.dest.address.ADDR" value="amq.topic/goodbye.Topic"/>
+ <property name="qpid.hellogoodbye.topic.dest.address.ADDR" value="amq.topic/goodbye.Topic"/>
+ <property name="qpid.hello.queue.dest.address.ADDR"
+ value="hello.Queue;{create:always, node:{type:queue, x-declare:{auto-delete:true}}}"/>
+ <property name="qpid.goodbye.queue.dest.address.ADDR"
+ value="goodbye.Queue;{create:always, node:{type:queue, x-declare:{auto-delete:true}}}"/>
+ <property name="qpid.request.queue.dest.address.ADDR"
+ value="request.Queue;{create:always, node:{type:queue, x-declare:{auto-delete:true}}}"/>
+ <property name="qpid.response.queue.dest.address.ADDR"
+ value="response.Queue;{create:always, node:{type:queue, x-declare:{auto-delete:false}}}"/>
+
+ <property name="qpid.hello.topic.dest.address.BURL"
+ value="BURL:topic://amq.topic//hello.jcaTopic?routingKey='hello.jcaTopic',autodelete='true'"/>
+ <property name="qpid.goodbye.topic.dest.address.BURL"
+ value="BURL:topic://amq.topic//goodbye.jcaTopic?routingKey='goodbye.jcaTopic',autodelete='true'"/>
+ <property name="qpid.hellogoodbye.topic.dest.address.BURL"
+ value="BURL:topic://amq.topic//#.jcaTopic"/>
+ <property name="qpid.hello.queue.dest.address.BURL"
+ value="BURL:direct://amq.direct//hello.Queue?routingkey='hello.Queue'"/>
+ <property name="qpid.goodbye.queue.dest.address.BURL"
+ value="BURL:direct://amq.direct//goodbye.Queue?routingkey='goodbye.Queue'"/>
+ <property name="qpid.request.queue.dest.address.BURL"
+ value="BURL:direct://amq.direct//request.Queue?routingkey='request.Queue'"/>
+ <property name="qpid.response.queue.dest.address.BURL"
+ value="BURL:direct://amq.direct//response.Queue?routingkey='response.Queue'"/>
+
+ <!-- This macro allows us to construct a property name which contains a property expansion -->
+ <macrodef name="set-address-property">
+ <attribute name="name"/>
+ <attribute name="syntax"/>
+ <sequential>
+ <property name="@{name}" value="${@{name}.@{syntax}}"/>
+ </sequential>
+ </macrodef>
+
+ <set-address-property name="qpid.hello.topic.dest.address" syntax="${qpid.dest_syntax}"/>
+ <set-address-property name="qpid.goodbye.topic.dest.address" syntax="${qpid.dest_syntax}"/>
+ <set-address-property name="qpid.hellogoodbye.topic.dest.address" syntax="${qpid.dest_syntax}"/>
+ <set-address-property name="qpid.hello.queue.dest.address" syntax="${qpid.dest_syntax}"/>
+ <set-address-property name="qpid.goodbye.queue.dest.address" syntax="${qpid.dest_syntax}"/>
+ <set-address-property name="qpid.request.queue.dest.address" syntax="${qpid.dest_syntax}"/>
+ <set-address-property name="qpid.response.queue.dest.address" syntax="${qpid.dest_syntax}"/>
+</project>
diff --git a/qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/client/QpidRequestResponseClient.java b/qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/client/QpidRequestResponseClient.java
new file mode 100644
index 0000000000..fd5b3efff0
--- /dev/null
+++ b/qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/client/QpidRequestResponseClient.java
@@ -0,0 +1,159 @@
+/*
+ *
+ * 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.
+ *
+ */
+package org.apache.qpid.jca.example.client;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.Destination;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+
+import org.apache.qpid.jca.example.ejb.QpidUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class QpidRequestResponseClient implements MessageListener, Runnable
+{
+ private static final Logger _log = LoggerFactory.getLogger(QpidRequestResponseClient.class);
+
+ private static final String DEFAULT_CF_JNDI = "QpidConnectionFactory";
+ private static final String DEFAULT_DESTINATION_JNDI = "QpidRequestQueue";
+ private static final String DEFAULT_MESSAGE = "Hello, World!";
+ private static final int DEFAULT_MESSAGE_COUNT = 1;
+ private static final int DEFAULT_THREAD_COUNT = 1;
+ private static CountDownLatch THREAD_LATCH;
+ private static InitialContext CONTEXT;
+
+ private ConnectionFactory _connectionFactory;
+ private Connection _connection;
+ private Session _session;
+ private CountDownLatch _latch = null;
+ private int _count = DEFAULT_MESSAGE_COUNT;
+
+ /**
+ * @param args
+ */
+ public static void main(String[] args) throws Exception
+ {
+ int threadCount = (System.getProperty("thread.count") == null)
+ ? DEFAULT_THREAD_COUNT : Integer.valueOf(System.getProperty("thread.count"));
+
+ _log.debug("Creating " + threadCount + " threads for execution.");
+
+ THREAD_LATCH = new CountDownLatch(threadCount);
+
+ CONTEXT = new InitialContext();
+
+ for(int i = 0; i < threadCount; i++)
+ {
+ new Thread(new QpidRequestResponseClient()).start();
+ }
+
+ _log.debug("Waiting for " + threadCount + " to finish.");
+ THREAD_LATCH.await(10, TimeUnit.SECONDS);
+
+ QpidUtil.closeResources(CONTEXT);
+ }
+
+ @Override
+ public void onMessage(Message message)
+ {
+ _latch.countDown();
+
+ if(message instanceof TextMessage)
+ {
+ try
+ {
+ _log.debug("Thread " + Thread.currentThread().getId() + " received response message with content " + ((TextMessage)message).getText());
+ }
+ catch(Exception e)
+ {
+ _log.error(e.getMessage(), e);
+ }
+ }
+
+ if(_latch.getCount() == _count)
+ {
+ QpidUtil.closeResources(_session, _connection);
+ }
+
+ THREAD_LATCH.countDown();
+
+ }
+
+ public void run()
+ {
+ MessageProducer producer = null;
+ Destination requestQueue = null;
+ Destination responseQueue = null;
+
+ String cfName = (System.getProperty("qpid.cf.name") == null) ? DEFAULT_CF_JNDI : System.getProperty("qpid.cf.name");
+ String destName = (System.getProperty("qpid.dest.name") == null) ? DEFAULT_DESTINATION_JNDI : System.getProperty("qpid.dest.name");
+
+ try
+ {
+ _count = (System.getProperty("message.count") == null) ? DEFAULT_MESSAGE_COUNT : Integer.valueOf(System.getProperty("message.count"));
+ _latch = new CountDownLatch(_count);
+
+ _connectionFactory = (ConnectionFactory)QpidTestUtil.getFromJNDI(CONTEXT, cfName);
+ requestQueue = (Destination)QpidTestUtil.getFromJNDI(CONTEXT, destName);
+ _connection = _connectionFactory.createConnection();
+ _session = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ producer = _session.createProducer(requestQueue);
+ responseQueue = _session.createTemporaryQueue();
+ _session.createConsumer(responseQueue).setMessageListener(this);
+
+
+ _connection.start();
+
+ String content = (System.getProperty("qpid.message") == null) ? DEFAULT_MESSAGE : System.getProperty("qpid.message");
+
+ for(int i = 0; i < _count; i++)
+ {
+ TextMessage message = _session.createTextMessage();
+ message.setText(content);
+ message.setJMSReplyTo(responseQueue);
+ producer.send(message);
+
+ }
+
+ _latch.await();
+
+ }
+ catch(Exception e)
+ {
+ _log.error(e.getMessage(), e);
+ }
+ finally
+ {
+ QpidUtil.closeResources(producer);
+ }
+
+ }
+
+}
diff --git a/qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/client/QpidTestClient.java b/qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/client/QpidTestClient.java
new file mode 100644
index 0000000000..f21b8ea07d
--- /dev/null
+++ b/qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/client/QpidTestClient.java
@@ -0,0 +1,134 @@
+/*
+ *
+ * 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.
+ *
+ */
+package org.apache.qpid.jca.example.client;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.Destination;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+import org.apache.qpid.jca.example.ejb.QpidTest;
+import org.apache.qpid.jca.example.ejb.QpidUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class QpidTestClient
+{
+ private static final Logger _log = LoggerFactory.getLogger(QpidTestClient.class);
+
+ private static final String DEFAULT_EJB_JNDI = "QpidTestBean/remote";
+ private static final String DEFAULT_CF_JNDI = "QpidConnectionFactory";
+ private static final String DEFAULT_MESSAGE = "Hello,World!";
+ private static final int DEFAULT_MESSAGE_COUNT = 1;
+ private static final boolean DEFAULT_USE_TOPIC = false;
+ private static final boolean DEFAULT_USE_EJB = true;
+ private static final String DEFAULT_DESTINATION_JNDI = "HelloQueue";
+ private static final boolean DEFAULT_SAY_GOODBYE = false;
+
+ public static void main(String[] args) throws Exception
+ {
+ String content = (System.getProperty("qpid.message") == null) ? DEFAULT_MESSAGE : System.getProperty("qpid.message");
+ boolean useEJB = (System.getProperty("use.ejb") == null) ? DEFAULT_USE_EJB : Boolean.valueOf(System.getProperty("use.ejb"));
+ int total = (System.getProperty("message.count") == null) ? DEFAULT_MESSAGE_COUNT : Integer.valueOf(System.getProperty("message.count"));
+ boolean useTopic = (System.getProperty("use.topic") == null) ? DEFAULT_USE_TOPIC : Boolean.valueOf(System.getProperty("use.topic"));
+ String destType = (useTopic) ? "Topic" : "Queue";
+ boolean goodbye = (System.getProperty("say.goodbye") == null) ? DEFAULT_SAY_GOODBYE : Boolean.valueOf(System.getProperty("say.goodbye"));
+
+ _log.debug("Environment: ");
+ _log.debug("JNDI IntialContectFactory: " + System.getProperty("java.naming.factory.initial"));
+ _log.debug("JNDI Provider: " + System.getProperty("java.naming.provider.url"));
+ _log.debug("Message content: " + content);
+ _log.debug("Message count:" + total);
+ _log.debug("Protocol: " + ((useEJB) ? "EJB" : "JMS"));
+ _log.debug("Destination Type: " + destType);
+ _log.debug("Say GoodBye : " + goodbye);
+
+ Context context = new InitialContext();
+
+ if(useEJB)
+ {
+
+ String ejbName = (System.getProperty("qpid.ejb.name") == null) ? DEFAULT_EJB_JNDI : System.getProperty("qpid.ejb.name");
+
+ QpidTest ejb = (QpidTest)QpidTestUtil.getFromJNDI(context, ejbName);
+
+ _log.debug("Found SLSB " + ejbName + "in JNDI");
+ ejb.testQpidAdapter(content, total, useTopic, false, goodbye);
+
+ }
+ else
+ {
+ ConnectionFactory connectionFactory = null;
+ Connection connection = null;
+ Session session = null;
+ MessageProducer messageProducer = null;
+ Destination destination = null;
+ int count = 0;
+
+ String cfName = (System.getProperty("qpid.cf.name") == null) ? DEFAULT_CF_JNDI : System.getProperty("qpid.cf.name");
+ String destName = (System.getProperty("qpid.dest.name") == null) ? DEFAULT_DESTINATION_JNDI : System.getProperty("qpid.dest.name");
+
+ _log.debug("Using JMS with CF name " + cfName + " and Destination name " + destName + " to send " + total + " message(s) with content " + content);
+
+ try
+ {
+ _log.debug("Using JNDI at " + System.getProperty("java.naming.provider.url"));
+
+ connectionFactory = (ConnectionFactory)QpidTestUtil.getFromJNDI(context, cfName);
+ destination = (Destination)QpidTestUtil.getFromJNDI(context, destName);
+
+ _log.debug("Using CF: " + connectionFactory);
+ _log.debug("Destination " + destination);
+
+ connection = connectionFactory.createConnection();
+ session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ messageProducer = session.createProducer(destination);
+
+ _log.debug("Sending " + total + " message(s) with content: " + content + " to destination " + destName);
+
+ for(int i = 0; i < total; i++)
+ {
+ TextMessage message = session.createTextMessage(content);
+ message.setBooleanProperty("say.goodbye", goodbye);
+ messageProducer.send(message);
+ count++;
+ }
+
+
+ }
+ catch(Exception e)
+ {
+ _log.error(e.getMessage(),e);
+ }
+ finally
+ {
+ QpidUtil.closeResources(session, connection, context);
+ }
+
+ _log.debug(count + " message(s) sent successfully");
+ }
+
+ }
+}
diff --git a/qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/client/QpidTestUtil.java b/qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/client/QpidTestUtil.java
new file mode 100644
index 0000000000..7a53335d79
--- /dev/null
+++ b/qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/client/QpidTestUtil.java
@@ -0,0 +1,52 @@
+/*
+ *
+ * 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.
+ *
+ */
+package org.apache.qpid.jca.example.client;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.naming.Reference;
+import javax.naming.spi.NamingManager;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class QpidTestUtil {
+ private static final Logger _log = LoggerFactory.getLogger(QpidTestUtil.class);
+
+ /*
+ * Encapsulate looking up in JNDI and working around a seeming bug in OpenEJB which returns a
+ * Reference when it should just return an object constructed from it
+ */
+ static Object getFromJNDI(Context context, String name) throws NamingException, Exception
+ {
+ Object o = context.lookup(name);
+ if (o instanceof Reference)
+ {
+ _log.debug("Got a Reference back from JNDI for " + name + " - working around");
+ return NamingManager.getObjectInstance(o, null, null, null);
+ }
+ else
+ {
+ return o;
+ }
+ }
+
+}
diff --git a/qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/ejb/QpidGoodByeListenerBean.java b/qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/ejb/QpidGoodByeListenerBean.java
new file mode 100644
index 0000000000..bdb722a87b
--- /dev/null
+++ b/qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/ejb/QpidGoodByeListenerBean.java
@@ -0,0 +1,65 @@
+/*
+ *
+ * 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.
+ *
+ */
+package org.apache.qpid.jca.example.ejb;
+
+import java.util.Date;
+
+import javax.ejb.ActivationConfigProperty;
+import javax.ejb.MessageDriven;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.TextMessage;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@MessageDriven(activationConfig = {
+ @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
+ @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
+ @ActivationConfigProperty(propertyName = "destination", propertyValue = "@jndi.prefix@@qpid.goodbye.queue.jndi.name@"),
+ @ActivationConfigProperty(propertyName = "connectionURL", propertyValue = "@broker.url@"),
+ @ActivationConfigProperty(propertyName = "useLocalTx", propertyValue = "false"),
+ @ActivationConfigProperty(propertyName = "maxSession", propertyValue = "10")
+})
+public class QpidGoodByeListenerBean implements MessageListener
+{
+ private static final Logger _log = LoggerFactory.getLogger(QpidGoodByeListenerBean.class);
+
+ @Override
+ public void onMessage(Message message)
+ {
+ try
+ {
+ if(message instanceof TextMessage)
+ {
+ String content = ((TextMessage)message).getText();
+
+ _log.info("Received text message with contents: [" + content + "] at " + new Date());
+ }
+ }
+ catch(Exception e)
+ {
+ _log.error(e.getMessage(), e);
+ }
+
+ }
+
+}
diff --git a/qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/ejb/QpidGoodByeSubscriberBean.java b/qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/ejb/QpidGoodByeSubscriberBean.java
new file mode 100644
index 0000000000..f2e4d6aaa5
--- /dev/null
+++ b/qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/ejb/QpidGoodByeSubscriberBean.java
@@ -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.
+ *
+ */
+package org.apache.qpid.jca.example.ejb;
+
+import java.util.Date;
+
+import javax.ejb.ActivationConfigProperty;
+import javax.ejb.MessageDriven;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.TextMessage;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@MessageDriven(activationConfig = {
+ @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
+ @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Topic"),
+ @ActivationConfigProperty(propertyName = "destination", propertyValue = "@jndi.prefix@@qpid.goodbye.topic.jndi.name@"),
+ @ActivationConfigProperty(propertyName = "connectionURL", propertyValue = "@broker.url@"),
+ @ActivationConfigProperty(propertyName = "subscriptionDurability", propertyValue = "NotDurable"),
+ @ActivationConfigProperty(propertyName = "maxSession", propertyValue = "10")
+})
+
+public class QpidGoodByeSubscriberBean implements MessageListener
+{
+ private static final Logger _log = LoggerFactory.getLogger(QpidGoodByeSubscriberBean.class);
+
+ @Override
+ public void onMessage(Message message)
+ {
+ try
+ {
+ if(message instanceof TextMessage)
+ {
+ String content = ((TextMessage)message).getText();
+
+ _log.info("Received text message with contents: [" + content + "] at " + new Date());
+ }
+ }
+ catch(Exception e)
+ {
+ _log.error(e.getMessage(), e);
+ }
+
+ }
+
+}
diff --git a/qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/ejb/QpidHelloListenerBean.java b/qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/ejb/QpidHelloListenerBean.java
new file mode 100644
index 0000000000..75e0acab79
--- /dev/null
+++ b/qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/ejb/QpidHelloListenerBean.java
@@ -0,0 +1,98 @@
+/*
+ *
+ * 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.
+ *
+ */
+package org.apache.qpid.jca.example.ejb;
+
+import java.util.Date;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.Resource;
+import javax.ejb.ActivationConfigProperty;
+import javax.ejb.MessageDriven;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.Destination;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@MessageDriven(activationConfig = {
+ @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
+ @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
+ @ActivationConfigProperty(propertyName = "destination", propertyValue = "@jndi.prefix@@qpid.hello.queue.jndi.name@"),
+ @ActivationConfigProperty(propertyName = "connectionURL", propertyValue = "@broker.url@"),
+ @ActivationConfigProperty(propertyName = "maxSession", propertyValue = "10")
+})
+public class QpidHelloListenerBean implements MessageListener
+{
+ private static final Logger _log = LoggerFactory.getLogger(QpidHelloListenerBean.class);
+
+ @Resource(@jndi.scheme@="@qpid.xacf.jndi.name@")
+ private ConnectionFactory _connectionFactory;
+
+ @Resource(@jndi.scheme@="@qpid.goodbye.queue.jndi.name@")
+ private Destination _queue;
+
+ @Override
+ public void onMessage(Message message)
+ {
+ Connection connection = null;
+ Session session = null;
+ MessageProducer messageProducer = null;
+ TextMessage response = null;
+
+ try
+ {
+ if(message instanceof TextMessage)
+ {
+ String content = ((TextMessage)message).getText();
+
+ _log.info("Received text message with contents: [" + content + "] at " + new Date());
+
+ StringBuffer temp = new StringBuffer();
+ temp.append("QpidHelloListenerBean received message with content: [" + content);
+ temp.append("] at " + new Date());
+
+ if(message.propertyExists("say.goodbye") && message.getBooleanProperty("say.goodbye"))
+ {
+ connection = _connectionFactory.createConnection();
+ session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ messageProducer = session.createProducer(_queue);
+ response = session.createTextMessage(temp.toString());
+ messageProducer.send(response);
+ }
+ }
+ }
+ catch(Exception e)
+ {
+ _log.error(e.getMessage(), e);
+ }
+ finally
+ {
+ QpidUtil.closeResources(session, connection);
+ }
+ }
+}
diff --git a/qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/ejb/QpidHelloSubscriberBean.java b/qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/ejb/QpidHelloSubscriberBean.java
new file mode 100644
index 0000000000..882c85fa18
--- /dev/null
+++ b/qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/ejb/QpidHelloSubscriberBean.java
@@ -0,0 +1,99 @@
+/*
+ *
+ * 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.
+ *
+ */
+package org.apache.qpid.jca.example.ejb;
+
+import java.util.Date;
+
+import javax.annotation.Resource;
+import javax.ejb.ActivationConfigProperty;
+import javax.ejb.MessageDriven;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.Destination;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+@MessageDriven(activationConfig = {
+ @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
+ @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Topic"),
+ @ActivationConfigProperty(propertyName = "destination", propertyValue = "@jndi.prefix@@qpid.hello.topic.jndi.name@"),
+ @ActivationConfigProperty(propertyName = "connectionURL", propertyValue = "@broker.url@"),
+ @ActivationConfigProperty(propertyName = "subscriptionDurability", propertyValue = "NotDurable"),
+ @ActivationConfigProperty(propertyName = "maxSession", propertyValue = "10")
+})
+public class QpidHelloSubscriberBean implements MessageListener
+{
+ private static final Logger _log = LoggerFactory.getLogger(QpidHelloSubscriberBean.class);
+
+ @Resource(@jndi.scheme@="@qpid.xacf.jndi.name@")
+ private ConnectionFactory _connectionFactory;
+
+ @Resource(@jndi.scheme@="@qpid.goodbye.topic.jndi.name@")
+ private Destination _topic;
+
+ @Override
+ public void onMessage(Message message)
+ {
+ Connection connection = null;
+ Session session = null;
+ MessageProducer messageProducer = null;
+ TextMessage response = null;
+
+ try
+ {
+ if(message instanceof TextMessage)
+ {
+ String content = ((TextMessage)message).getText();
+
+ _log.info("Received text message with contents: [" + content + "] at " + new Date());
+
+ StringBuffer temp = new StringBuffer();
+ temp.append("QpidHelloSubscriberBean received message with content: [" + content);
+ temp.append("] at " + new Date());
+
+ if(message.propertyExists("say.goodbye") && message.getBooleanProperty("say.goodbye"))
+ {
+ connection = _connectionFactory.createConnection();
+ session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ messageProducer = session.createProducer(_topic);
+ response = session.createTextMessage(temp.toString());
+ messageProducer.send(response);
+ }
+ }
+ }
+ catch(Exception e)
+ {
+ _log.error(e.getMessage(), e);
+ }
+ finally
+ {
+ QpidUtil.closeResources(session, connection);
+ }
+ }
+}
diff --git a/qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/ejb/QpidJMSResponderBean.java b/qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/ejb/QpidJMSResponderBean.java
new file mode 100644
index 0000000000..6e99d4fe7f
--- /dev/null
+++ b/qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/ejb/QpidJMSResponderBean.java
@@ -0,0 +1,104 @@
+/*
+ *
+ * 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.
+ *
+ */
+package org.apache.qpid.jca.example.ejb;
+
+import java.util.Date;
+
+import javax.annotation.Resource;
+import javax.ejb.ActivationConfigProperty;
+import javax.ejb.MessageDriven;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.Destination;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@MessageDriven(activationConfig = {
+ @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
+ @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
+ @ActivationConfigProperty(propertyName = "destination", propertyValue = "@jndi.prefix@@qpid.request.queue.jndi.name@"),
+ @ActivationConfigProperty(propertyName = "connectionURL", propertyValue = "@broker.url@"),
+ @ActivationConfigProperty(propertyName = "maxSession", propertyValue = "10")
+})
+public class QpidJMSResponderBean implements MessageListener
+{
+
+ private static final Logger _log = LoggerFactory.getLogger(QpidJMSResponderBean.class);
+
+ @Resource(@jndi.scheme@="@qpid.xacf.jndi.name@")
+ private ConnectionFactory _connectionFactory;
+
+ @Override
+ public void onMessage(Message message)
+ {
+ Connection connection = null;
+ Session session = null;
+ MessageProducer messageProducer = null;
+ TextMessage response = null;
+
+ try
+ {
+ if(message instanceof TextMessage)
+ {
+ String content = ((TextMessage)message).getText();
+
+ _log.info("Received text message with contents: [" + content + "] at " + new Date());
+
+ StringBuffer temp = new StringBuffer();
+ temp.append("QpidJMSResponderBean received message with content: [" + content);
+ temp.append("] at " + new Date());
+
+ connection = _connectionFactory.createConnection();
+ session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ if(message.getJMSReplyTo() != null)
+ {
+ _log.info("Sending response via JMSReplyTo");
+ messageProducer = session.createProducer(message.getJMSReplyTo());
+ response = session.createTextMessage();
+ response.setText(temp.toString());
+ messageProducer.send(response);
+ }
+ else
+ {
+ _log.info("JMSReplyTo is null. Will not respond to message.");
+ }
+
+
+ }
+ }
+ catch(Exception e)
+ {
+ _log.error(e.getMessage(), e);
+ }
+ finally
+ {
+ QpidUtil.closeResources(session, connection);
+ }
+ }
+}
diff --git a/qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/ejb/QpidTest.java b/qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/ejb/QpidTest.java
new file mode 100644
index 0000000000..14488fda53
--- /dev/null
+++ b/qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/ejb/QpidTest.java
@@ -0,0 +1,30 @@
+/*
+ *
+ * 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.
+ *
+ */
+
+package org.apache.qpid.jca.example.ejb;
+
+public interface QpidTest
+{
+ public void testQpidAdapter(String content) throws Exception;
+ public void testQpidAdapter(String content, int count) throws Exception;
+ public void testQpidAdapter(String content, int count, boolean useTopic) throws Exception;
+ public void testQpidAdapter(String content, int count, boolean useTopic, boolean respond, boolean sayGoodbye) throws Exception;
+}
diff --git a/qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/ejb/QpidTestBean.java b/qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/ejb/QpidTestBean.java
new file mode 100644
index 0000000000..a5f4770257
--- /dev/null
+++ b/qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/ejb/QpidTestBean.java
@@ -0,0 +1,104 @@
+/*
+ *
+ * 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.
+ *
+ */
+package org.apache.qpid.jca.example.ejb;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.Resource;
+import javax.ejb.Stateless;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.Destination;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@Stateless
+public class QpidTestBean implements QpidTestRemote, QpidTestLocal
+{
+
+ private static final Logger _log = LoggerFactory.getLogger(QpidTestBean.class);
+
+ @Resource(@jndi.scheme@="@qpid.xacf.jndi.name@")
+ private ConnectionFactory _connectionFactory;
+
+ @Resource(@jndi.scheme@="@qpid.hello.queue.jndi.name@")
+ private Destination _queue;
+
+ @Resource(@jndi.scheme@="@qpid.hello.topic.jndi.name@")
+ private Destination _topic;
+
+ @Override
+ public void testQpidAdapter(String content) throws Exception
+ {
+ testQpidAdapter(content, 1);
+ }
+
+ @Override
+ public void testQpidAdapter(String content, int count) throws Exception
+ {
+ testQpidAdapter(content, count, false);
+ }
+
+ public void testQpidAdapter(final String content, int count, boolean useTopic) throws Exception
+ {
+ testQpidAdapter(content, count, useTopic, false, false);
+ }
+
+ @Override
+ public void testQpidAdapter(String content, int count, boolean useTopic,
+ boolean respond, boolean sayGoodbye) throws Exception
+ {
+ Connection connection = null;
+ Session session = null;
+ MessageProducer messageProducer = null;
+
+ _log.info("Sending " + count + " message(s) to MDB with content " + content);
+
+ try
+ {
+ connection = _connectionFactory.createConnection();
+ session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ messageProducer = (useTopic) ? session.createProducer(_topic) : session.createProducer(_queue);
+
+ for(int i = 0; i < count; i++)
+ {
+ TextMessage message = session.createTextMessage(content);
+ message.setBooleanProperty("say.goodbye", sayGoodbye);
+ messageProducer.send(message);
+ }
+
+ }
+ catch(Exception e)
+ {
+ _log.error(e.getMessage(), e);
+ throw e;
+ }
+ finally
+ {
+ QpidUtil.closeResources(messageProducer, session, connection);
+ }
+ }
+
+}
diff --git a/qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/ejb/QpidTestLocal.java b/qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/ejb/QpidTestLocal.java
new file mode 100644
index 0000000000..73a0de08c2
--- /dev/null
+++ b/qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/ejb/QpidTestLocal.java
@@ -0,0 +1,29 @@
+/*
+ *
+ * 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.
+ *
+ */
+
+package org.apache.qpid.jca.example.ejb;
+
+import javax.ejb.Local;
+
+@Local
+public interface QpidTestLocal extends QpidTest
+{
+}
diff --git a/qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/ejb/QpidTestRemote.java b/qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/ejb/QpidTestRemote.java
new file mode 100644
index 0000000000..2abb4d71f5
--- /dev/null
+++ b/qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/ejb/QpidTestRemote.java
@@ -0,0 +1,29 @@
+/*
+ *
+ * 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.
+ *
+ */
+
+package org.apache.qpid.jca.example.ejb;
+
+import javax.ejb.Remote;
+
+@Remote
+public interface QpidTestRemote extends QpidTest
+{
+}
diff --git a/qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/ejb/QpidUtil.java b/qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/ejb/QpidUtil.java
new file mode 100644
index 0000000000..d96a4e8163
--- /dev/null
+++ b/qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/ejb/QpidUtil.java
@@ -0,0 +1,90 @@
+/*
+ *
+ * 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.
+ *
+ */
+package org.apache.qpid.jca.example.ejb;
+
+import java.lang.reflect.Method;
+import java.util.Enumeration;
+
+import javax.jms.Message;
+import javax.jms.TextMessage;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class QpidUtil
+{
+ private static final Logger _log = LoggerFactory.getLogger(QpidTestBean.class);
+
+ public static void handleMessage(String beanName, final Message message) throws Exception
+ {
+ if(message instanceof TextMessage)
+ {
+ String content = ((TextMessage)message).getText();
+ _log.debug(beanName + ": Received text message with contents " + content);
+
+ if(content.contains("PrintEnv"))
+ {
+ printJMSHeaders(message);
+ printProperties(message);
+ }
+ }
+ }
+
+ @SuppressWarnings("rawtypes")
+ public static void printProperties(final Message message) throws Exception
+ {
+ _log.debug("Priting Message Properties:");
+
+ Enumeration e = message.getPropertyNames();
+
+ while(e.hasMoreElements())
+ {
+ _log.debug(e + ":" + message.getObjectProperty(e.toString()));
+ }
+ }
+
+ public static void printJMSHeaders(final Message message) throws Exception
+ {
+ _log.debug("JMSCorrelationID:" + message.getJMSCorrelationID());
+ _log.debug("JMSDeliveryMode:" + message.getJMSDeliveryMode());
+ _log.debug("JMSExpires:" + message.getJMSExpiration());
+ _log.debug("JMSMessageID:" + message.getJMSMessageID());
+ _log.debug("JMSPriority:" + message.getJMSPriority());
+ _log.debug("JMSTimestamp:" + message.getJMSTimestamp());
+ _log.debug("JMSType:" + message.getJMSType());
+ _log.debug("JMSReplyTo:" + message.getJMSReplyTo());
+ }
+
+ public static void closeResources(Object...objects)
+ {
+ try
+ {
+ for(Object object: objects)
+ {
+ Method close = object.getClass().getMethod("close", new Class[]{});
+ close.invoke(object, new Object[]{});
+ }
+ }
+ catch(Exception ignore)
+ {
+ }
+ }
+}
diff --git a/qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/web/QpidRequestResponseServlet.java b/qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/web/QpidRequestResponseServlet.java
new file mode 100644
index 0000000000..d069a0c943
--- /dev/null
+++ b/qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/web/QpidRequestResponseServlet.java
@@ -0,0 +1,283 @@
+/*
+ *
+ * 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.
+ *
+ */
+
+package org.apache.qpid.jca.example.web;
+import java.io.IOException;
+import java.lang.Thread;
+
+import javax.annotation.Resource;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.Destination;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.transaction.UserTransaction;
+
+import org.apache.qpid.jca.example.ejb.QpidTest;
+import org.apache.qpid.jca.example.ejb.QpidUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@SuppressWarnings("serial")
+public class QpidRequestResponseServlet extends HttpServlet
+{
+ private static final Logger _log = LoggerFactory.getLogger(QpidTestServlet.class);
+
+ private static final String DEFAULT_MESSAGE = "Hello, World!";
+ private static final int DEFAULT_COUNT = 1;
+ private static final boolean DEFAULT_XA = false;
+ private static final boolean DEFAULT_TX = false;
+ private static final boolean USE_TMP_QUEUE = false;
+
+ @Resource(@jndi.scheme@="@qpid.xacf.jndi.name@")
+ private ConnectionFactory _connectionFactory;
+
+ @Resource(@jndi.scheme@="@qpid.request.queue.jndi.name@")
+ private Destination _queue;
+
+ @Resource(@jndi.scheme@="@qpid.response.queue.jndi.name@")
+ private Destination _responseQueue;
+
+
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
+ {
+ doPost(req, resp);
+ }
+
+ @Override
+ protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
+ {
+ InitialContext ctx = null;
+ Connection connection = null;
+ Session session = null;
+ MessageProducer messageProducer = null;
+ UserTransaction ut = null;
+ boolean useXA = false;
+ boolean rollback = false;
+ boolean useTx = false;
+ MessageConsumer messageConsumer = null;
+ long startTime = 0;
+
+ try
+ {
+ String content = (req.getParameter("message") == null) ? DEFAULT_MESSAGE : req.getParameter("message");
+ int count = (req.getParameter("count") == null) ? DEFAULT_COUNT : Integer.valueOf(req.getParameter("count"));
+ useXA = (req.getParameter("useXA") == null) ? DEFAULT_XA : Boolean.valueOf(req.getParameter("useXA"));
+ useTx = (req.getParameter("useTx") == null) ? DEFAULT_TX : Boolean.valueOf(req.getParameter("useTx"));
+
+ ctx = new InitialContext();
+
+ _log.debug("Environment: ");
+ _log.debug("Message content: " + content);
+ _log.debug("Message count:" + count);
+ _log.debug("Using XA: " + useXA);
+
+ resp.getOutputStream().println("Environment: ");
+ resp.getOutputStream().println("Message content: " + content);
+ resp.getOutputStream().println("Message count:" + count);
+ resp.getOutputStream().println("Using XA: " + useXA);
+
+ try
+ {
+
+ connection = _connectionFactory.createConnection();
+
+ if(useXA)
+ {
+ ut = (UserTransaction)ctx.lookup("java:comp/UserTransaction");
+ ut.begin();
+ useTx = false;
+ }
+
+ session = (useXA) ? connection.createSession(false, Session.AUTO_ACKNOWLEDGE) : connection.createSession(useTx, Session.AUTO_ACKNOWLEDGE);
+ messageProducer = session.createProducer(_queue);
+
+ startTime = System.currentTimeMillis();
+
+ for(int i = 0; i < count; i++)
+ {
+ TextMessage message = session.createTextMessage(content);
+ message.setJMSReplyTo(_responseQueue);
+ messageProducer.send(message);
+ }
+
+ }
+ catch(Exception e)
+ {
+ rollback = true;
+
+ if(useXA && ut != null)
+ {
+ try
+ {
+ ut.setRollbackOnly();
+ }
+ catch(Exception ex)
+ {
+ _log.error(ex.getMessage(), ex);
+ throw new ServletException(ex.getMessage(), ex);
+ }
+ }
+ }
+ finally
+ {
+ try
+ {
+ if(useXA && ut != null)
+ {
+ if(rollback)
+ {
+ ut.rollback();
+ }
+ else
+ {
+ ut.commit();
+ }
+ }
+ if(useTx && !useXA)
+ {
+ if(rollback)
+ {
+ session.rollback();
+ }
+ else
+ {
+ session.commit();
+ }
+ }
+ }
+ catch(Exception e)
+ {
+ _log.error(e.getMessage(), e);
+ throw new ServletException(e.getMessage(), e);
+ }
+
+ QpidUtil.closeResources(messageProducer, session);
+ }
+
+ resp.getOutputStream().println("Sent " + count + " messages with content '" + content + "'");
+ resp.getOutputStream().flush();
+
+ int ackMode = Session.AUTO_ACKNOWLEDGE;
+ rollback = false;
+
+ if(useXA)
+ {
+ ut.begin();
+ }
+
+ session = (useXA) ? connection.createSession(false, Session.AUTO_ACKNOWLEDGE) : connection.createSession(useTx, Session.AUTO_ACKNOWLEDGE);
+ messageConsumer = session.createConsumer(_responseQueue);
+ connection.start();
+
+ for(int i = 0; i < count; i++)
+ {
+ TextMessage message = (TextMessage)messageConsumer.receive(5000);
+
+ if(message != null)
+ {
+ message.acknowledge();
+ content = message.getText();
+
+ }
+ }
+
+ startTime = System.currentTimeMillis() - startTime;
+ resp.getOutputStream().println("Received " + count + " messages with content '" + content + "'");
+ resp.getOutputStream().println("Total process time " + startTime);
+ }
+ catch(Exception e)
+ {
+ rollback = true;
+
+ if(useXA && ut != null)
+ {
+ try
+ {
+ ut.setRollbackOnly();
+ }
+ catch(Exception ex)
+ {
+ _log.error(ex.getMessage(), ex);
+ throw new ServletException(ex.getMessage(), ex);
+ }
+ }
+ }
+ finally
+ {
+ if(useXA && ut != null)
+ {
+ try
+ {
+ if(rollback)
+ {
+ ut.rollback();
+ }
+ else
+ {
+ ut.commit();
+ }
+ }
+ catch(Exception e)
+ {
+ _log.error(e.getMessage(), e);
+ throw new ServletException(e.getMessage(), e);
+
+ }
+ }
+
+ if(useTx && !useXA)
+ {
+ try
+ {
+ if(rollback)
+ {
+ session.rollback();
+ }
+ else
+ {
+ session.commit();
+ }
+ }
+ catch(Exception e)
+ {
+ _log.error(e.getMessage(), e);
+ throw new ServletException(e.getMessage(), e);
+ }
+ }
+
+ QpidUtil.closeResources(messageProducer, session);
+ }
+ }
+
+}
+
+
diff --git a/qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/web/QpidTestServlet.java b/qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/web/QpidTestServlet.java
new file mode 100644
index 0000000000..7526daa83d
--- /dev/null
+++ b/qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/web/QpidTestServlet.java
@@ -0,0 +1,229 @@
+/*
+ *
+ * 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.
+ *
+ */
+
+package org.apache.qpid.jca.example.web;
+import java.io.IOException;
+
+import javax.annotation.Resource;
+import javax.ejb.EJB;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.Destination;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.transaction.UserTransaction;
+
+import org.apache.qpid.jca.example.ejb.QpidTestLocal;
+import org.apache.qpid.jca.example.ejb.QpidUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@SuppressWarnings("serial")
+public class QpidTestServlet extends HttpServlet
+{
+ private static final Logger _log = LoggerFactory.getLogger(QpidTestServlet.class);
+
+ private static final String DEFAULT_MESSAGE = "Hello, World!";
+ private static final int DEFAULT_COUNT = 1;
+ private static final boolean DEFAULT_TOPIC = false;
+ private static final boolean DEFAULT_XA = false;
+ private static final boolean DEFAULT_TX = false;
+ private static final boolean DEFAULT_SAY_GOODBYE = true;
+
+ @Resource(@jndi.scheme@="@qpid.xacf.jndi.name@")
+ private ConnectionFactory _connectionFactory;
+
+ @Resource(@jndi.scheme@="@qpid.hello.queue.jndi.name@")
+ private Destination _queue;
+
+ @Resource(@jndi.scheme@="@qpid.hello.topic.jndi.name@")
+ private Destination _topic;
+
+ @EJB
+ private QpidTestLocal ejb;
+
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
+ {
+ doPost(req, resp);
+ }
+
+ @Override
+ protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
+ {
+ InitialContext ctx = null;
+ Connection connection = null;
+ Session session = null;
+ MessageProducer messageProducer = null;
+ UserTransaction ut = null;
+ boolean useXA = false;
+ boolean rollback = false;
+ boolean useTX = false;
+
+ try
+ {
+ String content = (req.getParameter("message") == null) ? DEFAULT_MESSAGE : req.getParameter("message");
+ boolean useEJB = (req.getParameter("useEJB") == null) ? false : Boolean.valueOf(req.getParameter("useEJB"));
+ int count = (req.getParameter("count") == null) ? DEFAULT_COUNT : Integer.valueOf(req.getParameter("count"));
+ boolean useTopic = (req.getParameter("useTopic") == null) ? DEFAULT_TOPIC : Boolean.valueOf(req.getParameter("useTopic"));
+ useXA = (req.getParameter("useXA") == null) ? DEFAULT_XA : Boolean.valueOf(req.getParameter("useXA"));
+ useTX = (req.getParameter("useTX") == null) ? DEFAULT_TX : Boolean.valueOf(req.getParameter("useTX"));
+ ctx = new InitialContext();
+ boolean sayGoodBye = (req.getParameter("sayGoodBye") == null) ? DEFAULT_SAY_GOODBYE : Boolean.valueOf(req.getParameter("sayGoodBye"));
+ useTX = (req.getParameter("useTX") == null) ? DEFAULT_TOPIC : Boolean.valueOf(req.getParameter("DEFAULT_TX"));
+
+ _log.debug("Environment: ");
+ _log.debug("Message content: " + content);
+ _log.debug("Message count:" + count);
+ _log.debug("Protocol: " + ((useEJB) ? "EJB" : "JMS"));
+ _log.debug("Destination Type: " + ((useTopic) ? "Topic" : "Queue"));
+ _log.debug("Using XA: " + useXA);
+ _log.debug("Say GoodBye: ", sayGoodBye);
+
+ resp.getOutputStream().println("Environment: ");
+ resp.getOutputStream().println("Message content: " + content);
+ resp.getOutputStream().println("Message count:" + count);
+ resp.getOutputStream().println("Protocol: " + ((useEJB) ? "EJB" : "JMS"));
+ resp.getOutputStream().println("Destination Type: " + ((useTopic) ? "Topic" : "Queue"));
+ resp.getOutputStream().println("Using XA: " + useXA);
+ resp.getOutputStream().println("Say GoodBye: " + sayGoodBye);
+
+ if(useEJB)
+ {
+ ejb.testQpidAdapter(content, count, useTopic, false, sayGoodBye);
+ }
+ else
+ {
+ if(useXA)
+ {
+ ut = (UserTransaction)ctx.lookup("java:comp/UserTransaction");
+ ut.begin();
+ }
+
+ connection = _connectionFactory.createConnection();
+ session = connection.createSession(useTX, Session.AUTO_ACKNOWLEDGE);
+ messageProducer = (useTopic) ? session.createProducer(_topic) : session.createProducer(_queue);
+
+ for(int i = 0; i < count; i++)
+ {
+ TextMessage message = session.createTextMessage(content);
+ message.setBooleanProperty("say.goodbye", sayGoodBye);
+ messageProducer.send(message);
+ }
+
+ }
+
+ resp.getOutputStream().println("Sent " + count + " messages with content '" + content + "'");
+ resp.getOutputStream().flush();
+
+ }
+ catch(Exception e)
+ {
+
+ if(useXA && ut != null)
+ {
+ try
+ {
+ rollback = true;
+ ut.setRollbackOnly();
+ }
+ catch(Exception ex)
+ {
+ _log.error(ex.getMessage(), ex);
+ throw new ServletException(ex.getMessage(), ex);
+ }
+ }
+
+ if(useTX)
+ {
+ try
+ {
+ session.rollback();
+ }
+ catch(Exception ex)
+ {
+ _log.error(ex.getMessage(), ex);
+ throw new ServletException(ex.getMessage(), ex);
+ }
+ }
+
+ _log.error(e.getMessage(), e);
+ throw new ServletException(e.getMessage(), e);
+ }
+ finally
+ {
+ if(useXA && ut != null)
+ {
+ try
+ {
+ if(rollback)
+ {
+ ut.rollback();
+ }
+ else
+ {
+ ut.commit();
+ }
+ }
+ catch(Exception e)
+ {
+ _log.error(e.getMessage(), e);
+ throw new ServletException(e.getMessage(), e);
+
+ }
+ }
+
+ if(useTX && !useXA)
+ {
+ try
+ {
+
+ if(rollback)
+ {
+ session.rollback();
+ }
+ else
+ {
+ session.commit();
+ }
+ }
+ catch(Exception e)
+ {
+
+ _log.error(e.getMessage(), e);
+ throw new ServletException(e.getMessage(), e);
+ }
+ }
+
+ QpidUtil.closeResources(session, connection, ctx);
+ }
+ }
+
+}
+
+