summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRajith Muditha Attapattu <rajith@apache.org>2012-02-01 23:56:28 +0000
committerRajith Muditha Attapattu <rajith@apache.org>2012-02-01 23:56:28 +0000
commit0dcfedb9a055a5ec9175a13cdce8667104cd799a (patch)
treed195069c3d429ef502f3514d8b1faf82eba0f651
parent08b3d439ce5cdcd127d14489ba4730ae3f2c7724 (diff)
downloadqpid-python-0dcfedb9a055a5ec9175a13cdce8667104cd799a.tar.gz
QPID-3734 Commiting patch by Weston Price.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1239411 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/java/jca/example/.gitignore2
-rw-r--r--qpid/java/jca/example/build-geronimo-properties.xml19
-rw-r--r--qpid/java/jca/example/build-jboss-properties.xml2
-rw-r--r--qpid/java/jca/example/build-properties.xml.temp1
-rw-r--r--qpid/java/jca/example/build.xml9
-rw-r--r--qpid/java/jca/example/conf/ejb-jar.xml27
-rw-r--r--qpid/java/jca/example/conf/geronimo-application.xml30
-rw-r--r--qpid/java/jca/example/conf/geronimo-ra.xml35
-rw-r--r--qpid/java/jca/example/conf/jboss.xml28
-rw-r--r--qpid/java/jca/example/conf/qpid-jca-ds.xml18
-rw-r--r--qpid/java/jca/example/conf/web.xml13
-rw-r--r--qpid/java/jca/example/qpid-jca-example-properties.xml2
-rw-r--r--qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/ejb/QpidGoodByeSubscriberBean.java42
-rw-r--r--qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/ejb/QpidHelloListenerBean.java26
-rw-r--r--qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/ejb/QpidHelloSubscriberBean.java29
-rw-r--r--qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/ejb/QpidJMSResponderBean.java45
-rw-r--r--qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/ejb/QpidTestBean.java27
-rw-r--r--qpid/java/jca/example/src/main/java/org/apache/qpid/jca/example/web/QpidTestServlet.java33
-rw-r--r--qpid/java/jca/src/main/java/org/apache/qpid/ra/QpidRAManagedConnectionFactory.java2
-rw-r--r--qpid/java/jca/src/main/java/org/apache/qpid/ra/Util.java29
-rw-r--r--qpid/java/jca/src/main/java/org/apache/qpid/ra/admin/AdminObjectFactory.java12
-rw-r--r--qpid/java/jca/src/main/java/org/apache/qpid/ra/admin/QpidDestinationProxy.java4
-rw-r--r--qpid/java/jca/src/main/java/org/apache/qpid/ra/admin/QpidQueue.java30
-rw-r--r--qpid/java/jca/src/main/java/org/apache/qpid/ra/admin/QpidQueueImpl.java119
-rw-r--r--qpid/java/jca/src/main/java/org/apache/qpid/ra/admin/QpidTopic.java30
-rw-r--r--qpid/java/jca/src/main/java/org/apache/qpid/ra/admin/QpidTopicImpl.java93
-rwxr-xr-xqpid/java/jca/src/main/resources/META-INF/ra.xml18
27 files changed, 371 insertions, 354 deletions
diff --git a/qpid/java/jca/example/.gitignore b/qpid/java/jca/example/.gitignore
index 597acff14b..54c810d4a0 100644
--- a/qpid/java/jca/example/.gitignore
+++ b/qpid/java/jca/example/.gitignore
@@ -1,2 +1,4 @@
build/*
lib/*
+*.swp
+build-properties.xml
diff --git a/qpid/java/jca/example/build-geronimo-properties.xml b/qpid/java/jca/example/build-geronimo-properties.xml
index 79cf5adc74..2251b7a2df 100644
--- a/qpid/java/jca/example/build-geronimo-properties.xml
+++ b/qpid/java/jca/example/build-geronimo-properties.xml
@@ -20,8 +20,12 @@
-->
<project name="qpid-jca-example-geronimo-properties" basedir="." default="">
- <property name="geronimo.jndi.scheme" value="name"/>
+ <property name="jndi.scheme" value="name"/>
+
+ <!--
<property name="qpid.xacf.jndi.name" value="jca:/qpid.jca/QpidJCAAdapter/JCAManagedConnectionFactory/QpidJMSXA"/>
+ -->
+ <property name="qpid.xacf.jndi.name" value="QpidJMSXA"/>
<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"/>
@@ -64,16 +68,25 @@
<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-servlet_2.5_spec/1.2/geronimo-servlet_2.5_spec-1.2.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="${geronimo.home}/lib/">
+
+ <fileset dir="${qpid.jca.dir}">
<include name="slf4j-api-*.jar"/>
</fileset>
+
</path>
<path id="run.classpath">
@@ -119,7 +132,7 @@
<attribute name="module"/>
<attribute name="plan" default=""/>
<sequential>
- <exec executable="${geronimo.home}/bin/deploy.sh">
+ <exec executable="${geronimo.home}/bin/${geronimo.deploy.exec}">
<arg line="-u @{user} -p @{password} @{action} @{module} @{plan}"/>
</exec>
</sequential>
diff --git a/qpid/java/jca/example/build-jboss-properties.xml b/qpid/java/jca/example/build-jboss-properties.xml
index 3554488d2d..5fc4053cf8 100644
--- a/qpid/java/jca/example/build-jboss-properties.xml
+++ b/qpid/java/jca/example/build-jboss-properties.xml
@@ -20,7 +20,7 @@
-->
<project name="qpid-jca-example-jboss-properties" basedir="." default="">
- <property name="jboss.jndi.scheme" value="mappedName"/>
+ <property name="jndi.scheme" value="mappedName"/>
<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"/>
diff --git a/qpid/java/jca/example/build-properties.xml.temp b/qpid/java/jca/example/build-properties.xml.temp
index 9eae869c27..1d62db9af5 100644
--- a/qpid/java/jca/example/build-properties.xml.temp
+++ b/qpid/java/jca/example/build-properties.xml.temp
@@ -20,4 +20,5 @@
-->
<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
index 9d0cfc887e..2717ce84d7 100644
--- a/qpid/java/jca/example/build.xml
+++ b/qpid/java/jca/example/build.xml
@@ -26,11 +26,8 @@
<!-- Change to BURL for older syntax support -->
<property name="qpid.dest_syntax" value="ADDR"/>
- <!-- Broker specific properties. By default in the adapter we use localhost here you an override this with host specific info-->
- <property name="broker.address" value="localhost"/>
-
<!-- Properties controlling running sample standalone client -->
- <property name="client.use.ejb" value="false"/> <!-- uses JNDI/JMS or JNDI/RMI -->
+ <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 -->
@@ -114,9 +111,6 @@
<classes dir="${build.classes.dir}">
<include name="org/apache/qpid/jca/example/web/**"/>
</classes>
- <webinf dir="${gen.dir}">
- <include name="jboss-web.xml"/>
- </webinf>
</war>
</target>
@@ -125,7 +119,6 @@
<include name="org/apache/qpid/jca/example/ejb/**/*.class"/>
<metainf dir="${gen.dir}">
<include name="jboss.xml"/>
- <include name="ejb-jar.xml"/>
</metainf>
</jar>
</target>
diff --git a/qpid/java/jca/example/conf/ejb-jar.xml b/qpid/java/jca/example/conf/ejb-jar.xml
index 2f513bd3f8..a1aa859d96 100644
--- a/qpid/java/jca/example/conf/ejb-jar.xml
+++ b/qpid/java/jca/example/conf/ejb-jar.xml
@@ -27,40 +27,13 @@
<enterprise-beans>
<message-driven>
<ejb-name>QpidHelloListenerBean</ejb-name>
- <resource-ref>
- <res-ref-name>QpidJMSXA</res-ref-name>
- <res-type>javax.jms.ConnectionFactory</res-type>
- <res-auth>Container</res-auth>
- <res-sharing-scope>Shareable</res-sharing-scope>
- </resource-ref>
</message-driven>
<message-driven>
<ejb-name>QpidHelloSubscriberBean</ejb-name>
- <resource-ref>
- <res-ref-name>QpidJMSXA</res-ref-name>
- <res-type>javax.jms.ConnectionFactory</res-type>
- <res-auth>Container</res-auth>
- <res-sharing-scope>Shareable</res-sharing-scope>
- </resource-ref>
</message-driven>
<message-driven>
<ejb-name>QpidJMSResponderBean</ejb-name>
- <resource-ref>
- <res-ref-name>QpidJMSXA</res-ref-name>
- <res-type>javax.jms.ConnectionFactory</res-type>
- <res-auth>Container</res-auth>
- <res-sharing-scope>Shareable</res-sharing-scope>
- </resource-ref>
</message-driven>
- <session>
- <ejb-name>QpidTestBean</ejb-name>
- <resource-ref>
- <res-ref-name>QpidJMSXA</res-ref-name>
- <res-type>javax.jms.ConnectionFactory</res-type>
- <res-auth>Container</res-auth>
- <res-sharing-scope>Shareable</res-sharing-scope>
- </resource-ref>
- </session>
</enterprise-beans>
diff --git a/qpid/java/jca/example/conf/geronimo-application.xml b/qpid/java/jca/example/conf/geronimo-application.xml
index 832496e76f..a855e0fae8 100644
--- a/qpid/java/jca/example/conf/geronimo-application.xml
+++ b/qpid/java/jca/example/conf/geronimo-application.xml
@@ -58,15 +58,6 @@
<context-root>/qpid-jca-web</context-root>
- <naming:ejb-local-ref>
- <naming:ref-name>QpidTestBean</naming:ref-name>
- <naming:ejb-link>QpidTestBean</naming:ejb-link>
- </naming:ejb-local-ref>
-
- <naming:resource-ref>
- <naming:ref-name>QpidJMSXA</naming:ref-name>
- <naming:resource-link>QpidJMSXA</naming:resource-link>
- </naming:resource-ref>
</web-app>
</module>
@@ -91,8 +82,6 @@
<sys:type>rar</sys:type>
</sys:dependency>
</sys:dependencies>
- <sys:hidden-classes/>
- <sys:non-overridable-classes/>
</sys:environment>
<enterprise-beans>
@@ -101,10 +90,6 @@
<resource-adapter>
<resource-link>QpidResourceAdapter</resource-link>
</resource-adapter>
- <naming:resource-ref>
- <naming:ref-name>QpidJMSXA</naming:ref-name>
- <naming:resource-link>QpidJMSXA</naming:resource-link>
- </naming:resource-ref>
</message-driven>
<message-driven>
<ejb-name>QpidGoodByeListenerBean</ejb-name>
@@ -117,10 +102,6 @@
<resource-adapter>
<resource-link>QpidResourceAdapter</resource-link>
</resource-adapter>
- <naming:resource-ref>
- <naming:ref-name>QpidJMSXA</naming:ref-name>
- <naming:resource-link>QpidJMSXA</naming:resource-link>
- </naming:resource-ref>
</message-driven>
<message-driven>
<ejb-name>QpidGoodByeSubscriberBean</ejb-name>
@@ -133,18 +114,7 @@
<resource-adapter>
<resource-link>QpidResourceAdapter</resource-link>
</resource-adapter>
- <naming:resource-ref>
- <naming:ref-name>QpidJMSXA</naming:ref-name>
- <naming:resource-link>QpidJMSXA</naming:resource-link>
- </naming:resource-ref>
</message-driven>
- <session>
- <ejb-name>QpidTestBean</ejb-name>
- <naming:resource-ref>
- <naming:ref-name>QpidJMSXA</naming:ref-name>
- <naming:resource-link>QpidJMSXA</naming:resource-link>
- </naming:resource-ref>
- </session>
</enterprise-beans>
</openejb-jar>
</module>
diff --git a/qpid/java/jca/example/conf/geronimo-ra.xml b/qpid/java/jca/example/conf/geronimo-ra.xml
index 2943ac0a58..e3e74ebc62 100644
--- a/qpid/java/jca/example/conf/geronimo-ra.xml
+++ b/qpid/java/jca/example/conf/geronimo-ra.xml
@@ -63,65 +63,58 @@
<!-- 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>javax.jms.Destination</adminobject-interface>
- <adminobject-class>org.apache.qpid.ra.admin.QpidDestinationProxy</adminobject-class>
+ <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="destinationType">TOPIC</config-property-setting>
<config-property-setting name="destinationAddress">amq.topic</config-property-setting>
</adminobject-instance>
</adminobject>
<adminobject>
- <adminobject-interface>javax.jms.Destination</adminobject-interface>
- <adminobject-class>org.apache.qpid.ra.admin.QpidDestinationProxy</adminobject-class>
+ <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="destinationType">TOPIC</config-property-setting>
<config-property-setting name="destinationAddress">@qpid.hello.topic.dest.address@</config-property-setting>
</adminobject-instance>
</adminobject>
<adminobject>
- <adminobject-interface>javax.jms.Destination</adminobject-interface>
- <adminobject-class>org.apache.qpid.ra.admin.QpidDestinationProxy</adminobject-class>
+ <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="destinationType">TOPIC</config-property-setting>
<config-property-setting name="destinationAddress">@qpid.goodbye.topic.dest.address@</config-property-setting>
</adminobject-instance>
</adminobject>
<adminobject>
- <adminobject-interface>javax.jms.Destination</adminobject-interface>
- <adminobject-class>org.apache.qpid.ra.admin.QpidDestinationProxy</adminobject-class>
+ <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>HelloGoodByeTopic</message-destination-name>
- <config-property-setting name="destinationType">TOPIC</config-property-setting>
<config-property-setting name="destinationAddress">@qpid.hellogoodbye.topic.dest.address@</config-property-setting>
</adminobject-instance>
</adminobject>
<adminobject>
- <adminobject-interface>javax.jms.Destination</adminobject-interface>
- <adminobject-class>org.apache.qpid.ra.admin.QpidDestinationProxy</adminobject-class>
+ <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="destinationType">QUEUE</config-property-setting>
<config-property-setting name="destinationAddress">@qpid.hello.queue.dest.address@</config-property-setting>
</adminobject-instance>
</adminobject>
<adminobject>
- <adminobject-interface>javax.jms.Destination</adminobject-interface>
- <adminobject-class>org.apache.qpid.ra.admin.QpidDestinationProxy</adminobject-class>
+ <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="destinationType">QUEUE</config-property-setting>
<config-property-setting name="destinationAddress">@qpid.goodbye.queue.dest.address@</config-property-setting>
</adminobject-instance>
</adminobject>
<adminobject>
- <adminobject-interface>javax.jms.Destination</adminobject-interface>
- <adminobject-class>org.apache.qpid.ra.admin.QpidDestinationProxy</adminobject-class>
+ <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>ResponderQueue</message-destination-name>
- <config-property-setting name="destinationType">QUEUE</config-property-setting>
<config-property-setting name="destinationAddress">@qpid.responder.queue.dest.address@</config-property-setting>
</adminobject-instance>
</adminobject>
diff --git a/qpid/java/jca/example/conf/jboss.xml b/qpid/java/jca/example/conf/jboss.xml
index 8b62ca73b0..0f22797789 100644
--- a/qpid/java/jca/example/conf/jboss.xml
+++ b/qpid/java/jca/example/conf/jboss.xml
@@ -30,11 +30,6 @@
<message-driven>
<ejb-name>QpidHelloListenerBean</ejb-name>
<resource-adapter-name>@rar.name@</resource-adapter-name>
- <resource-ref>
- <res-ref-name>QpidJMSXA</res-ref-name>
- <res-type>javax.sql.DataSource</res-type>
- <jndi-name>java:/QpidJMSXA</jndi-name>
- </resource-ref>
</message-driven>
<message-driven>
<ejb-name>QpidGoodByeListenerBean</ejb-name>
@@ -43,38 +38,15 @@
<message-driven>
<ejb-name>QpidHelloSubscriberBean</ejb-name>
<resource-adapter-name>@rar.name@</resource-adapter-name>
- <resource-ref>
- <res-ref-name>QpidJMSXA</res-ref-name>
- <res-type>javax.sql.DataSource</res-type>
- <jndi-name>java:/QpidJMSXA</jndi-name>
- </resource-ref>
</message-driven>
<message-driven>
<ejb-name>QpidGoodByeSubscriberBean</ejb-name>
<resource-adapter-name>@rar.name@</resource-adapter-name>
- <resource-ref>
- <res-ref-name>QpidJMSXA</res-ref-name>
- <res-type>javax.sql.DataSource</res-type>
- <jndi-name>java:/QpidJMSXA</jndi-name>
- </resource-ref>
</message-driven>
<message-driven>
<ejb-name>QpidJMSResponderBean</ejb-name>
<resource-adapter-name>@rar.name@</resource-adapter-name>
- <resource-ref>
- <res-ref-name>QpidJMSXA</res-ref-name>
- <res-type>javax.sql.DataSource</res-type>
- <jndi-name>java:/QpidJMSXA</jndi-name>
- </resource-ref>
</message-driven>
- <session>
- <ejb-name>QpidTestBean</ejb-name>
- <resource-ref>
- <res-ref-name>QpidJMSXA</res-ref-name>
- <res-type>javax.sql.DataSource</res-type>
- <jndi-name>java:/QpidJMSXA</jndi-name>
- </resource-ref>
- </session>
</enterprise-beans>
</jboss>
diff --git a/qpid/java/jca/example/conf/qpid-jca-ds.xml b/qpid/java/jca/example/conf/qpid-jca-ds.xml
index 9e589169e3..80fb828b55 100644
--- a/qpid/java/jca/example/conf/qpid-jca-ds.xml
+++ b/qpid/java/jca/example/conf/qpid-jca-ds.xml
@@ -25,9 +25,8 @@
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">javax.jms.Destination</attribute>
+ <attribute name="Type">org.apache.qpid.ra.admin.QpidTopic</attribute>
<attribute name="Properties">
- destinationType=TOPIC
destinationAddress=@qpid.hello.topic.dest.address@
</attribute>
</mbean>
@@ -36,9 +35,8 @@
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">javax.jms.Destination</attribute>
+ <attribute name="Type">org.apache.qpid.ra.admin.QpidTopic</attribute>
<attribute name="Properties">
- destinationType=TOPIC
destinationAddress=@qpid.goodbye.topic.dest.address@
</attribute>
</mbean>
@@ -47,9 +45,8 @@
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">javax.jms.Destination</attribute>
+ <attribute name="Type">org.apache.qpid.ra.admin.QpidTopic</attribute>
<attribute name="Properties">
- destinationType=TOPIC
destinationAddress=@qpid.hellogoodbye.topic.dest.address@
</attribute>
</mbean>
@@ -58,9 +55,8 @@
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">javax.jms.Destination</attribute>
+ <attribute name="Type">org.apache.qpid.ra.admin.QpidQueue</attribute>
<attribute name="Properties">
- destinationType=QUEUE
destinationAddress=@qpid.hello.queue.dest.address@
</attribute>
</mbean>
@@ -69,9 +65,8 @@
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">javax.jms.Destination</attribute>
+ <attribute name="Type">org.apache.qpid.ra.admin.QpidQueue</attribute>
<attribute name="Properties">
- destinationType=QUEUE
destinationAddress=@qpid.goodbye.queue.dest.address@
</attribute>
</mbean>
@@ -80,9 +75,8 @@
name="qpid.jca:name=QpidResponderQueue">
<attribute name="JNDIName">QpidResponderQueue</attribute>
<depends optional-attribute-name="RARName">jboss.jca:service=RARDeployment,name='@rar.name@'</depends>
- <attribute name="Type">javax.jms.Destination</attribute>
+ <attribute name="Type">org.apache.qpid.ra.admin.QpidQueue</attribute>
<attribute name="Properties">
- destinationType=QUEUE
destinationAddress=@qpid.responder.queue.dest.address@
</attribute>
</mbean>
diff --git a/qpid/java/jca/example/conf/web.xml b/qpid/java/jca/example/conf/web.xml
index 509612dc90..d87c578606 100644
--- a/qpid/java/jca/example/conf/web.xml
+++ b/qpid/java/jca/example/conf/web.xml
@@ -22,19 +22,6 @@
<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">
- <resource-ref>
- <res-ref-name>QpidJMSXA</res-ref-name>
- <res-type>javax.jms.ConnectionFactory</res-type>
- <res-auth>Container</res-auth>
- <res-sharing-scope>Shareable</res-sharing-scope>
- </resource-ref>
-
- <ejb-local-ref>
- <ejb-ref-name>QpidTestBean</ejb-ref-name>
- <ejb-ref-type>Session</ejb-ref-type>
- <local>org.apache.qpid.jca.example.ejb.QpidTestLocal</local>
- </ejb-local-ref>
-
<servlet>
<display-name>QpidTestServlet</display-name>
<servlet-name>QpidTestServlet</servlet-name>
diff --git a/qpid/java/jca/example/qpid-jca-example-properties.xml b/qpid/java/jca/example/qpid-jca-example-properties.xml
index 076e5dc241..eb219a05e1 100644
--- a/qpid/java/jca/example/qpid-jca-example-properties.xml
+++ b/qpid/java/jca/example/qpid-jca-example-properties.xml
@@ -36,7 +36,7 @@
<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='ANONYMOUS''"/>
+ <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"/>
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
index 8ad8aaa482..64e0effb1f 100644
--- 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
@@ -1,9 +1,35 @@
+/*
+ *
+ * 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"),
@@ -17,11 +43,25 @@ import javax.jms.MessageListener;
public class QpidGoodByeSubscriberBean implements MessageListener
{
+ private static final Logger _log = LoggerFactory.getLogger(QpidGoodByeSubscriberBean.class);
@Override
public void onMessage(Message message)
{
- System.out.println(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
index d6d08d1557..0056e7b0b8 100644
--- 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
@@ -23,6 +23,7 @@ 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;
@@ -49,33 +50,12 @@ 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@="GoodByeQueue")
private Destination _queue;
- @PostConstruct
- public void init()
- {
- InitialContext context = null;
-
- try
- {
- context = new InitialContext();
- _connectionFactory = (ConnectionFactory)context.lookup("java:comp/env/QpidJMSXA");
- _queue = (Destination)context.lookup("@qpid.goodbye.queue.jndi.name@");
-
- }
- catch(Exception e)
- {
- _log.error(e.getMessage(), e);
- }
- finally
- {
- QpidUtil.closeResources(context);
- }
-
- }
-
@Override
public void onMessage(Message message)
{
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
index 43ccf9defd..560de36e48 100644
--- 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
@@ -22,7 +22,7 @@ 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;
@@ -52,35 +52,14 @@ 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@="GoodByeTopic")
private Destination _topic;
- @PostConstruct
- public void init()
- {
- InitialContext context = null;
-
- try
- {
- context = new InitialContext();
- _connectionFactory = (ConnectionFactory)context.lookup("java:comp/env/QpidJMSXA");
- _topic = (Destination)context.lookup("@qpid.goodbye.topic.jndi.name@");
-
- }
- catch(Exception e)
- {
- _log.error(e.getMessage(), e);
- }
- finally
- {
- QpidUtil.closeResources(context);
- }
-
- }
-
@Override
- public void onMessage(Message message)
+ public void onMessage(Message message)
{
Connection connection = null;
Session session = null;
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
index 74d6fb6d89..e7b44e10ca 100644
--- 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
@@ -1,8 +1,28 @@
+/*
+ *
+ * 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;
@@ -29,30 +49,9 @@ public class QpidJMSResponderBean implements MessageListener
private static final Logger _log = LoggerFactory.getLogger(QpidJMSResponderBean.class);
+ @Resource(@jndi.scheme@="@qpid.xacf.jndi.name@")
private ConnectionFactory _connectionFactory;
- @PostConstruct
- public void init()
- {
- InitialContext context = null;
-
- try
- {
- context = new InitialContext();
- _connectionFactory = (ConnectionFactory)context.lookup("java:comp/env/QpidJMSXA");
-
- }
- catch(Exception e)
- {
- _log.error(e.getMessage(), e);
- }
- finally
- {
- QpidUtil.closeResources(context);
- }
-
- }
-
@Override
public void onMessage(Message message)
{
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
index 17e37b9475..014b459699 100644
--- 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
@@ -21,6 +21,7 @@
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;
@@ -39,35 +40,15 @@ 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@="HelloQueue")
private Destination _queue;
+ @Resource(@jndi.scheme@="HelloTopic")
private Destination _topic;
- @PostConstruct
- public void init()
- {
- InitialContext context = null;
-
- try
- {
- context = new InitialContext();
- _connectionFactory = (ConnectionFactory)context.lookup("java:comp/env/QpidJMSXA");
- _queue = (Destination)context.lookup("@qpid.hello.queue.jndi.name@");
- _topic = (Destination)context.lookup("@qpid.hello.topic.jndi.name@");
-
- }
- catch(Exception e)
- {
- _log.error(e.getMessage(), e);
- }
- finally
- {
- QpidUtil.closeResources(context);
- }
-
- }
@Override
public void testQpidAdapter(String content) throws Exception
{
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
index 71289b22c3..11a61e762c 100644
--- 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
@@ -22,6 +22,8 @@
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;
@@ -36,7 +38,7 @@ 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.QpidTestLocal;
import org.apache.qpid.jca.example.ejb.QpidUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -52,35 +54,17 @@ public class QpidTestServlet extends HttpServlet
private static final boolean DEFAULT_XA = false;
private static final boolean DEFAULT_SAY_GOODBYE = true;
+ @Resource(@jndi.scheme@="@qpid.xacf.jndi.name@")
private ConnectionFactory _connectionFactory;
+ @Resource(@jndi.scheme@="HelloQueue")
private Destination _queue;
+ @Resource(@jndi.scheme@="HelloTopic")
private Destination _topic;
- public void init(ServletConfig config) throws ServletException
- {
-
- InitialContext context = null;
-
- try
- {
- context = new InitialContext();
- _connectionFactory = (ConnectionFactory)context.lookup("java:comp/env/QpidJMSXA");
- _queue = (Destination)context.lookup("@qpid.hello.queue.jndi.name@");
- _topic = (Destination)context.lookup("@qpid.hello.topic.jndi.name@");
-
- }
- catch(Exception e)
- {
- _log.error(e.getMessage(), e);
- throw new ServletException(e.getMessage(), e);
- }
- finally
- {
- QpidUtil.closeResources(context);
- }
- }
+ @EJB
+ private QpidTestLocal ejb;
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
@@ -127,7 +111,6 @@ public class QpidTestServlet extends HttpServlet
if(useEJB)
{
- QpidTest ejb = (QpidTest)ctx.lookup("java:comp/env/QpidTestBean");
ejb.testQpidAdapter(content, count, useTopic, false, sayGoodBye);
}
else
diff --git a/qpid/java/jca/src/main/java/org/apache/qpid/ra/QpidRAManagedConnectionFactory.java b/qpid/java/jca/src/main/java/org/apache/qpid/ra/QpidRAManagedConnectionFactory.java
index 377a0c6253..318485a7f2 100644
--- a/qpid/java/jca/src/main/java/org/apache/qpid/ra/QpidRAManagedConnectionFactory.java
+++ b/qpid/java/jca/src/main/java/org/apache/qpid/ra/QpidRAManagedConnectionFactory.java
@@ -330,7 +330,7 @@ public class QpidRAManagedConnectionFactory implements ManagedConnectionFactory,
public int hashCode()
{
int hash = _mcfProperties.hashCode();
- hash += 31 * _ra.hashCode();
+ hash += 31 * ((_ra != null) ? _ra.hashCode() : 1);
return hash;
}
diff --git a/qpid/java/jca/src/main/java/org/apache/qpid/ra/Util.java b/qpid/java/jca/src/main/java/org/apache/qpid/ra/Util.java
index 3957fa9660..491595b9fb 100644
--- a/qpid/java/jca/src/main/java/org/apache/qpid/ra/Util.java
+++ b/qpid/java/jca/src/main/java/org/apache/qpid/ra/Util.java
@@ -32,11 +32,10 @@ import javax.naming.Context;
import javax.naming.RefAddr;
import javax.naming.Reference;
import javax.naming.Referenceable;
+import javax.naming.spi.NamingManager;
import javax.transaction.TransactionManager;
import org.apache.qpid.client.AMQConnectionURL;
-import org.apache.qpid.ra.admin.QpidQueue;
-import org.apache.qpid.ra.admin.QpidTopic;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -88,31 +87,7 @@ public class Util
if (object instanceof Reference)
{
-
- Reference ref = (Reference) object;
- String addressContent = null;
-
- if (ref.getClassName().equals(QpidQueue.class.getName()))
- {
- RefAddr addr = ref.get(QpidQueue.class.getName());
- addressContent = (String) addr.getContent();
-
- if (addr != null)
- {
- return (T)new QpidQueue(addressContent);
- }
- }
-
- if (ref.getClassName().equals(QpidTopic.class.getName()))
- {
- RefAddr addr = ref.get(QpidTopic.class.getName());
- addressContent = (String) addr.getContent();
-
- if (addr != null)
- {
- return (T)new QpidTopic(addressContent);
- }
- }
+ return (T)NamingManager.getObjectInstance(object, null, null, null);
}
return clazz.cast(object);
diff --git a/qpid/java/jca/src/main/java/org/apache/qpid/ra/admin/AdminObjectFactory.java b/qpid/java/jca/src/main/java/org/apache/qpid/ra/admin/AdminObjectFactory.java
index 11f2903c72..213ea815f2 100644
--- a/qpid/java/jca/src/main/java/org/apache/qpid/ra/admin/AdminObjectFactory.java
+++ b/qpid/java/jca/src/main/java/org/apache/qpid/ra/admin/AdminObjectFactory.java
@@ -46,26 +46,26 @@ public class AdminObjectFactory implements ObjectFactory
Reference ref = (Reference) object;
String bindingURLString;
- if (ref.getClassName().equals(QpidQueue.class.getName()))
+ if (ref.getClassName().equals(QpidQueueImpl.class.getName()))
{
- RefAddr addr = ref.get(QpidQueue.class.getName());
+ RefAddr addr = ref.get(QpidQueueImpl.class.getName());
bindingURLString = (String) addr.getContent();
if (addr != null)
{
- return new QpidQueue(bindingURLString);
+ return new QpidQueueImpl(bindingURLString);
}
}
- if (ref.getClassName().equals(QpidTopic.class.getName()))
+ if (ref.getClassName().equals(QpidTopicImpl.class.getName()))
{
- RefAddr addr = ref.get(QpidTopic.class.getName());
+ RefAddr addr = ref.get(QpidTopicImpl.class.getName());
bindingURLString = (String) addr.getContent();
if (addr != null)
{
- return new QpidTopic(bindingURLString);
+ return new QpidTopicImpl(bindingURLString);
}
}
}
diff --git a/qpid/java/jca/src/main/java/org/apache/qpid/ra/admin/QpidDestinationProxy.java b/qpid/java/jca/src/main/java/org/apache/qpid/ra/admin/QpidDestinationProxy.java
index 738ce4be0d..7fc84ea69f 100644
--- a/qpid/java/jca/src/main/java/org/apache/qpid/ra/admin/QpidDestinationProxy.java
+++ b/qpid/java/jca/src/main/java/org/apache/qpid/ra/admin/QpidDestinationProxy.java
@@ -111,11 +111,11 @@ public class QpidDestinationProxy implements Externalizable, Referenceable, Dest
{
if(getDestinationType().equalsIgnoreCase(DEFAULT_QUEUE_TYPE))
{
- _delegate = new QpidQueue(getDestinationAddress());
+ _delegate = new QpidQueueImpl(getDestinationAddress());
}
else if(getDestinationType().equalsIgnoreCase(DEFAULT_TOPIC_TYPE))
{
- _delegate = new QpidTopic(getDestinationAddress());
+ _delegate = new QpidTopicImpl(getDestinationAddress());
}
else
{
diff --git a/qpid/java/jca/src/main/java/org/apache/qpid/ra/admin/QpidQueue.java b/qpid/java/jca/src/main/java/org/apache/qpid/ra/admin/QpidQueue.java
index caef0c8ffd..1b93d1c42c 100644
--- a/qpid/java/jca/src/main/java/org/apache/qpid/ra/admin/QpidQueue.java
+++ b/qpid/java/jca/src/main/java/org/apache/qpid/ra/admin/QpidQueue.java
@@ -20,32 +20,8 @@
*/
package org.apache.qpid.ra.admin;
-import javax.naming.NamingException;
-import javax.naming.Reference;
-import javax.naming.StringRefAddr;
-
-import org.apache.qpid.client.AMQQueue;
-
-public class QpidQueue extends AMQQueue
+public interface QpidQueue
{
- private String _url;
-
- public QpidQueue(final String address) throws Exception
- {
- super(address);
- this._url = address;
- }
-
- @Override
- public Reference getReference() throws NamingException
- {
- return new Reference(this.getClass().getName(), new StringRefAddr(this.getClass().getName(), toURL()),
- AdminObjectFactory.class.getName(), null);
- }
-
- @Override
- public String toURL()
- {
- return _url;
- }
+ public void setDestinationAddress(String destinationAddress) throws Exception;
+ public String getDestinationAddress();
}
diff --git a/qpid/java/jca/src/main/java/org/apache/qpid/ra/admin/QpidQueueImpl.java b/qpid/java/jca/src/main/java/org/apache/qpid/ra/admin/QpidQueueImpl.java
new file mode 100644
index 0000000000..417849fc5c
--- /dev/null
+++ b/qpid/java/jca/src/main/java/org/apache/qpid/ra/admin/QpidQueueImpl.java
@@ -0,0 +1,119 @@
+/*
+ *
+ * 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.ra.admin;
+
+import java.io.Externalizable;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutput;
+import java.io.ObjectOutputStream;
+import java.util.Hashtable;
+
+import javax.naming.Context;
+import javax.naming.Name;
+import javax.naming.NamingException;
+import javax.naming.RefAddr;
+import javax.naming.Reference;
+import javax.naming.StringRefAddr;
+import javax.naming.spi.ObjectFactory;
+
+import org.apache.qpid.client.AMQQueue;
+import org.apache.qpid.ra.admin.AdminObjectFactory;
+
+public class QpidQueueImpl extends AMQQueue implements QpidQueue, Externalizable
+{
+ private String _url;
+
+ public QpidQueueImpl()
+ {
+ super();
+ }
+
+ public QpidQueueImpl(final String address) throws Exception
+ {
+ super(address);
+ this._url = address;
+ }
+
+ @Override
+ public Reference getReference() throws NamingException
+ {
+ return new Reference(this.getClass().getName(), new StringRefAddr(this.getClass().getName(), toURL()),
+ AdminObjectFactory.class.getName(), null);
+ }
+
+ @Override
+ public String toURL()
+ {
+ return _url;
+ }
+
+ public void setDestinationAddress(String destinationAddress) throws Exception
+ {
+ this._url = destinationAddress;
+ setDestinationString(this._url);
+ }
+
+
+ public String getDestinationAddress()
+ {
+ return this._url;
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
+ {
+ this._url = (String)in.readObject();
+
+ try
+ {
+ setDestinationString(this._url);
+
+ }
+ catch(Exception e)
+ {
+ throw new IOException(e.getMessage(), e);
+ }
+ }
+
+ public void writeExternal(ObjectOutput out) throws IOException
+ {
+ out.writeObject(this._url);
+ }
+
+ //TODO move to tests
+ public static void main(String[] args) throws Exception
+ {
+ QpidQueueImpl q = new QpidQueueImpl();
+ q.setDestinationAddress("hello.Queue;{create:always, node:{type:queue, x-declare:{auto-delete:true}}}");
+ ObjectOutputStream os = new ObjectOutputStream(new FileOutputStream("queue.out"));
+ os.writeObject(q);
+ os.close();
+
+
+ ObjectInputStream is = new ObjectInputStream(new FileInputStream("queue.out"));
+ q = (QpidQueueImpl)is.readObject();
+ System.out.println(q);
+
+ }
+}
diff --git a/qpid/java/jca/src/main/java/org/apache/qpid/ra/admin/QpidTopic.java b/qpid/java/jca/src/main/java/org/apache/qpid/ra/admin/QpidTopic.java
index 3f181b93eb..f87c35d9e2 100644
--- a/qpid/java/jca/src/main/java/org/apache/qpid/ra/admin/QpidTopic.java
+++ b/qpid/java/jca/src/main/java/org/apache/qpid/ra/admin/QpidTopic.java
@@ -20,33 +20,9 @@
*/
package org.apache.qpid.ra.admin;
-import javax.naming.NamingException;
-import javax.naming.Reference;
-import javax.naming.StringRefAddr;
-
-import org.apache.qpid.client.AMQTopic;
-
-public class QpidTopic extends AMQTopic
+public interface QpidTopic
{
- private String _url;
-
- public QpidTopic(final String address) throws Exception
- {
- super(address);
- this._url = address;
- }
-
- @Override
- public Reference getReference() throws NamingException
- {
- return new Reference(this.getClass().getName(), new StringRefAddr(this.getClass().getName(), toURL()),
- AdminObjectFactory.class.getName(), null);
- }
-
- @Override
- public String toURL()
- {
- return _url;
- }
+ public void setDestinationAddress(String destinationAddress) throws Exception;
+ public String getDestinationAddress();
}
diff --git a/qpid/java/jca/src/main/java/org/apache/qpid/ra/admin/QpidTopicImpl.java b/qpid/java/jca/src/main/java/org/apache/qpid/ra/admin/QpidTopicImpl.java
new file mode 100644
index 0000000000..8ac1a679ea
--- /dev/null
+++ b/qpid/java/jca/src/main/java/org/apache/qpid/ra/admin/QpidTopicImpl.java
@@ -0,0 +1,93 @@
+/*
+ *
+ * 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.ra.admin;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+
+import javax.naming.NamingException;
+import javax.naming.Reference;
+import javax.naming.StringRefAddr;
+
+import org.apache.qpid.client.AMQTopic;
+import org.apache.qpid.ra.inflow.QpidActivation;
+
+public class QpidTopicImpl extends AMQTopic implements QpidTopic, Externalizable
+{
+ private String _url;
+
+ public QpidTopicImpl()
+ {
+ super();
+ }
+ public QpidTopicImpl(final String address) throws Exception
+ {
+ super(address);
+ this._url = address;
+ }
+
+ @Override
+ public Reference getReference() throws NamingException
+ {
+ return new Reference(this.getClass().getName(), new StringRefAddr(this.getClass().getName(), toURL()),
+ AdminObjectFactory.class.getName(), null);
+ }
+
+ @Override
+ public String toURL()
+ {
+ return _url;
+ }
+
+ public void setDestinationAddress(String destinationAddress) throws Exception
+ {
+ this._url = destinationAddress;
+ setDestinationString(this._url);
+ }
+
+
+ public String getDestinationAddress()
+ {
+ return this._url;
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
+ {
+ this._url = (String)in.readObject();
+
+ try
+ {
+ setDestinationString(this._url);
+
+ }
+ catch(Exception e)
+ {
+ throw new IOException(e.getMessage(), e);
+ }
+ }
+
+ public void writeExternal(ObjectOutput out) throws IOException
+ {
+ out.writeObject(this._url);
+ }
+}
diff --git a/qpid/java/jca/src/main/resources/META-INF/ra.xml b/qpid/java/jca/src/main/resources/META-INF/ra.xml
index 90dc7b3b8e..2c8344c8f0 100755
--- a/qpid/java/jca/src/main/resources/META-INF/ra.xml
+++ b/qpid/java/jca/src/main/resources/META-INF/ra.xml
@@ -197,6 +197,23 @@
</inbound-resourceadapter>
<adminobject>
+ <adminobject-interface>org.apache.qpid.ra.admin.QpidQueue</adminobject-interface>
+ <adminobject-class> org.apache.qpid.ra.admin.QpidQueueImpl</adminobject-class>
+ <config-property>
+ <config-property-name>destinationAddress </config-property-name>
+ <config-property-type>java.lang.String </config-property-type>
+ </config-property>
+ </adminobject>
+ <adminobject>
+ <adminobject-interface>org.apache.qpid.ra.admin.QpidTopic</adminobject-interface>
+ <adminobject-class> org.apache.qpid.ra.admin.QpidTopicImpl</adminobject-class>
+ <config-property>
+ <config-property-name>destinationAddress </config-property-name>
+ <config-property-type>java.lang.String </config-property-type>
+ </config-property>
+ </adminobject>
+ <!--
+ <adminobject>
<adminobject-interface>javax.jms.Destination</adminobject-interface>
<adminobject-class> org.apache.qpid.ra.admin.QpidDestinationProxy</adminobject-class>
<config-property>
@@ -208,6 +225,7 @@
<config-property-type>java.lang.String </config-property-type>
</config-property>
</adminobject>
+ -->
<adminobject>
<adminobject-interface>javax.jms.ConnectionFactory</adminobject-interface>
<adminobject-class> org.apache.qpid.ra.admin.QpidConnectionFactoryProxy</adminobject-class>