summaryrefslogtreecommitdiff
path: root/qpid/java/jca/src/main
diff options
context:
space:
mode:
authorWeston M. Price <wprice@apache.org>2012-04-17 21:38:29 +0000
committerWeston M. Price <wprice@apache.org>2012-04-17 21:38:29 +0000
commit5e09be7cc6ed2de1be4db0f8d345e0e4685ba801 (patch)
treeb72f5fda834a10c1b9da5e33f393884b46204adc /qpid/java/jca/src/main
parent237152da04c827f44ece3c37e310b6e590c4cc91 (diff)
downloadqpid-python-5e09be7cc6ed2de1be4db0f8d345e0e4685ba801.tar.gz
QPID-3701
-Add support for Glassfish 3.1.1 AS -Add necessary configuration files for Glassfish support -Reworked JNDI naming conventions to be consistent across all supported app servers -Fixed NPE in QpidConnectionFactoryProxy -Added necessary documentation files for Glassfish support git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1327294 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/jca/src/main')
-rw-r--r--qpid/java/jca/src/main/java/org/apache/qpid/ra/admin/QpidConnectionFactoryProxy.java15
-rw-r--r--qpid/java/jca/src/main/java/org/apache/qpid/ra/tm/GlassfishTransactionManagerLocator.java63
2 files changed, 77 insertions, 1 deletions
diff --git a/qpid/java/jca/src/main/java/org/apache/qpid/ra/admin/QpidConnectionFactoryProxy.java b/qpid/java/jca/src/main/java/org/apache/qpid/ra/admin/QpidConnectionFactoryProxy.java
index 41242fefae..7f2bee079f 100644
--- a/qpid/java/jca/src/main/java/org/apache/qpid/ra/admin/QpidConnectionFactoryProxy.java
+++ b/qpid/java/jca/src/main/java/org/apache/qpid/ra/admin/QpidConnectionFactoryProxy.java
@@ -137,7 +137,20 @@ public class QpidConnectionFactoryProxy implements Externalizable, Referenceable
*/
public Connection createConnection() throws JMSException
{
- return _delegate.createConnection();
+ try
+ {
+ if(_delegate == null)
+ {
+ getReference();
+ }
+
+ return _delegate.createConnection();
+ }
+ catch(Exception e)
+ {
+ throw new JMSException(e.getMessage());
+ }
+
}
/**
diff --git a/qpid/java/jca/src/main/java/org/apache/qpid/ra/tm/GlassfishTransactionManagerLocator.java b/qpid/java/jca/src/main/java/org/apache/qpid/ra/tm/GlassfishTransactionManagerLocator.java
new file mode 100644
index 0000000000..cff53d2710
--- /dev/null
+++ b/qpid/java/jca/src/main/java/org/apache/qpid/ra/tm/GlassfishTransactionManagerLocator.java
@@ -0,0 +1,63 @@
+/*
+ * 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.tm;
+
+
+import javax.naming.InitialContext;
+import javax.transaction.TransactionManager;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class GlassfishTransactionManagerLocator
+{
+ private static final Logger _log = LoggerFactory.getLogger(GlassfishTransactionManagerLocator.class);
+
+ private static final String TM_JNDI_NAME = "java:appserver/TransactionManager";
+
+ public TransactionManager getTm() throws Exception
+ {
+ InitialContext ctx = null;
+ TransactionManager tm = null;
+
+ try
+ {
+ ctx = new InitialContext();
+ tm = (TransactionManager)ctx.lookup(TM_JNDI_NAME);
+ }
+ catch(Exception e)
+ {
+ _log.error("Error attempting to location TM " + e.getMessage());
+ }
+ finally
+ {
+ try
+ {
+ if(ctx != null)
+ {
+ ctx.close();
+ }
+ }
+ catch(Exception ignore){}
+ }
+
+ return tm;
+ }
+}