diff options
Diffstat (limited to 'java/jca/src')
3 files changed, 63 insertions, 273 deletions
diff --git a/java/jca/src/main/java/org/apache/qpid/ra/admin/QpidConnectionFactoryProxy.java b/java/jca/src/main/java/org/apache/qpid/ra/admin/QpidConnectionFactoryProxy.java index a948948d6a..d7ca29e04a 100644 --- a/java/jca/src/main/java/org/apache/qpid/ra/admin/QpidConnectionFactoryProxy.java +++ b/java/jca/src/main/java/org/apache/qpid/ra/admin/QpidConnectionFactoryProxy.java @@ -27,13 +27,17 @@ import java.io.ObjectInput; import java.io.ObjectOutput; import java.io.Serializable; -import javax.jms.ConnectionFactory; import javax.jms.Connection; +import javax.jms.ConnectionFactory; import javax.jms.JMSException; import javax.naming.NamingException; +import javax.jms.QueueConnection; +import javax.jms.QueueConnectionFactory; import javax.naming.Reference; import javax.naming.Referenceable; import javax.naming.spi.ObjectFactory; +import javax.jms.TopicConnection; +import javax.jms.TopicConnectionFactory; import org.apache.qpid.client.AMQConnectionFactory; @@ -44,7 +48,7 @@ import org.slf4j.LoggerFactory; * * */ -public class QpidConnectionFactoryProxy implements Externalizable, Referenceable, ConnectionFactory, Serializable +public class QpidConnectionFactoryProxy implements QueueConnectionFactory, TopicConnectionFactory, Externalizable, Referenceable, Serializable { private static final Logger _log = LoggerFactory.getLogger(QpidDestinationProxy.class); @@ -100,13 +104,6 @@ public class QpidConnectionFactoryProxy implements Externalizable, Referenceable try { _delegate = new AMQConnectionFactory(getConnectionURL()); - /* - QpidResourceAdapter ra = new QpidResourceAdapter(); - QpidRAManagedConnectionFactory mcf = new QpidRAManagedConnectionFactory(); - mcf.setResourceAdapter(ra); - mcf.setConnectionURL(getConnectionURL()); - delegate = new QpidRAConnectionFactoryImpl(mcf, null); - */ return ((Referenceable) _delegate).getReference(); } catch(Exception e) @@ -162,7 +159,63 @@ public class QpidConnectionFactoryProxy implements Externalizable, Referenceable */ public Connection createConnection(final String userName, final String password) throws JMSException { - return _delegate.createConnection(userName, password); + try + { + if(_delegate == null) + { + getReference(); + } + + return _delegate.createConnection(userName, password); + } + catch(Exception e) + { + throw new JMSException(e.getMessage()); + } + } + + /** + * Create a queue connection + * @return The queue connection + * @exception JMSException Thrown if the operation fails + */ + public QueueConnection createQueueConnection() throws JMSException + { + return (QueueConnection)createConnection(); + } + + /** + * Create a queue connection + * @param userName The user name + * @param password The password + * @return The connection + * @exception JMSException Thrown if the operation fails + */ + public QueueConnection createQueueConnection(final String userName, final String password) throws JMSException + { + return (QueueConnection)createConnection(userName, password); + } + + /** + * Create a topic connection + * @return The topic connection + * @exception JMSException Thrown if the operation fails + */ + public TopicConnection createTopicConnection() throws JMSException + { + return (TopicConnection)createConnection(); + } + + /** + * Create a topic connection + * @param userName The user name + * @param password The password + * @return The topic connection + * @exception JMSException Thrown if the operation fails + */ + public TopicConnection createTopicConnection(final String userName, final String password) throws JMSException + { + return (TopicConnection)createConnection(userName, password); } } diff --git a/java/jca/src/main/resources/META-INF/jboss-ra.xml b/java/jca/src/main/resources/META-INF/jboss-ra.xml deleted file mode 100644 index f459b1efc1..0000000000 --- a/java/jca/src/main/resources/META-INF/jboss-ra.xml +++ /dev/null @@ -1,33 +0,0 @@ -<?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-ra> - <ra-config-property> - <ra-config-property-name>TransactionManagerLocatorClass</ra-config-property-name> - <ra-config-property-type>java.lang.String</ra-config-property-type> - <ra-config-property-value>org.apache.qpid.ra.tm.JBossTransactionManagerLocator</ra-config-property-value> - </ra-config-property> - <ra-config-property> - <ra-config-property-name>TransactionManagerLocatorMethod</ra-config-property-name> - <ra-config-property-type>java.lang.String</ra-config-property-type> - <ra-config-property-value>getTm</ra-config-property-value> - </ra-config-property> -</jboss-ra> diff --git a/java/jca/src/main/resources/META-INF/ra.xml b/java/jca/src/main/resources/META-INF/ra.xml deleted file mode 100755 index a9374f52d7..0000000000 --- a/java/jca/src/main/resources/META-INF/ra.xml +++ /dev/null @@ -1,230 +0,0 @@ -<?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://java.sun.com/xml/ns/j2ee" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee - http://java.sun.com/xml/ns/j2ee/connector_1_5.xsd" - version="1.5"> - - <description>QPID Resource Adapter</description> - <display-name>QPID Resource Adapter</display-name> - - <vendor-name>Apache Software Foundation</vendor-name> - <eis-type>JMS 1.1 Server</eis-type> - <resourceadapter-version>1.0</resourceadapter-version> - - <license> - <description> - 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. - </description> - <license-required>true</license-required> - </license> - - <resourceadapter> - <resourceadapter-class>org.apache.qpid.ra.QpidResourceAdapter</resourceadapter-class> - <config-property> - <description>Client ID for the connection</description> - <config-property-name>ClientId</config-property-name> - <config-property-type>java.lang.String</config-property-type> - <config-property-value>client_id</config-property-value> - </config-property> - - <config-property> - <description>Number of setup attempts before failing</description> - <config-property-name>SetupAttempts</config-property-name> - <config-property-type>java.lang.Integer</config-property-type> - <config-property-value>5</config-property-value> - </config-property> - - <config-property> - <description>Interval between setup attempts in milliseconds</description> - <config-property-name>SetupInterval</config-property-name> - <config-property-type>java.lang.Long</config-property-type> - <config-property-value>5000</config-property-value> - </config-property> - - <config-property> - <description>Use local transactions rather than XA</description> - <config-property-name>UseLocalTx</config-property-name> - <config-property-type>java.lang.Boolean</config-property-type> - <config-property-value>false</config-property-value> - </config-property> - - <config-property> - <description>Broker host</description> - <config-property-name>Host</config-property-name> - <config-property-type>java.lang.String</config-property-type> - <config-property-value>localhost</config-property-value> - </config-property> - - <config-property> - <description>Broker port</description> - <config-property-name>Port</config-property-name> - <config-property-type>java.lang.Integer</config-property-type> - <config-property-value>5672</config-property-value> - </config-property> - - <config-property> - <description>Virtual Path for Connection Factory</description> - <config-property-name>Path</config-property-name> - <config-property-type>java.lang.String</config-property-type> - <config-property-value>test</config-property-value> - </config-property> - - <config-property> - <description>Connection URL</description> - <config-property-name>ConnectionURL</config-property-name> - <config-property-type>java.lang.String</config-property-type> - <config-property-value>amqp://anonymous:passwd@client/test?brokerlist='tcp://localhost?sasl_mechs='PLAIN''</config-property-value> - </config-property> - - <config-property> - <description>Use a JMS Connection per MessageHandler</description> - <config-property-name>UseConnectionPerHandler</config-property-name> - <config-property-type>java.lang.Boolean</config-property-type> - <config-property-value>true</config-property-value> - </config-property> - - <outbound-resourceadapter> - <connection-definition> - <managedconnectionfactory-class>org.apache.qpid.ra.QpidRAManagedConnectionFactory</managedconnectionfactory-class> - - <config-property> - <description>Default session type</description> - <config-property-name>SessionDefaultType</config-property-name> - <config-property-type>java.lang.String</config-property-type> - <config-property-value>javax.jms.Queue</config-property-value> - </config-property> - - <config-property> - <description>Specify lock timeout in seconds</description> - <config-property-name>UseTryLock</config-property-name> - <config-property-type>java.lang.Integer</config-property-type> - <config-property-value>0</config-property-value> - </config-property> - - <config-property> - <description>Use local transactions rather than XA</description> - <config-property-name>UseLocalTx</config-property-name> - <config-property-type>java.lang.Boolean</config-property-type> - <config-property-value>false</config-property-value> - </config-property> - - <config-property> - <description>Client ID for the connection</description> - <config-property-name>ClientId</config-property-name> - <config-property-type>java.lang.String</config-property-type> - <config-property-value>client_id</config-property-value> - </config-property> - - <config-property> - <description>Connection URL</description> - <config-property-name>ConnectionURL</config-property-name> - <config-property-type>java.lang.String</config-property-type> - <config-property-value></config-property-value> - </config-property> - - <config-property> - <description>Broker host</description> - <config-property-name>Host</config-property-name> - <config-property-type>java.lang.String</config-property-type> - <config-property-value>localhost</config-property-value> - </config-property> - - <config-property> - <description>Broker port</description> - <config-property-name>Port</config-property-name> - <config-property-type>java.lang.Integer</config-property-type> - <config-property-value>5672</config-property-value> - </config-property> - - <config-property> - <description>Virtual Path for Connection Factory</description> - <config-property-name>Path</config-property-name> - <config-property-type>java.lang.String</config-property-type> - <config-property-value>test</config-property-value> - </config-property> - - <connectionfactory-interface>org.apache.qpid.ra.QpidRAConnectionFactory</connectionfactory-interface> - <connectionfactory-impl-class>org.apache.qpid.ra.QpidRAConnectionFactoryImpl</connectionfactory-impl-class> - <connection-interface>javax.jms.Session</connection-interface> - <connection-impl-class>org.apache.qpid.ra.QpidRASessionImpl</connection-impl-class> - </connection-definition> - <transaction-support>XATransaction</transaction-support> - <authentication-mechanism> - <authentication-mechanism-type>BasicPassword</authentication-mechanism-type> - <credential-interface>javax.resource.spi.security.PasswordCredential</credential-interface> - </authentication-mechanism> - <reauthentication-support>false</reauthentication-support> - </outbound-resourceadapter> - <inbound-resourceadapter> - <messageadapter> - <messagelistener> - <messagelistener-type>javax.jms.MessageListener</messagelistener-type> - <activationspec> - <activationspec-class>org.apache.qpid.ra.inflow.QpidActivationSpec</activationspec-class> - <required-config-property> - <config-property-name>destination</config-property-name> - </required-config-property> - </activationspec> - </messagelistener> - </messageadapter> - </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.ConnectionFactory</adminobject-interface> - <adminobject-class> org.apache.qpid.ra.admin.QpidConnectionFactoryProxy</adminobject-class> - <config-property> - <config-property-name>ConnectionURL</config-property-name> - <config-property-type>java.lang.String</config-property-type> - </config-property> - </adminobject> - </resourceadapter> -</connector> |