aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r1367679 - in /aries/trunk/transaction/transaction-jdbc: ./ src/main/java/org/apache/aries/transaction/jdbc/ src/main/java/org/apache/aries/transaction/jdbc/internal/ src/main/resources/OSGI-INF/ src/main/resources/OSGI-INF/blueprint/ src/m...
Date Tue, 31 Jul 2012 17:09:35 GMT
Author: gnodet
Date: Tue Jul 31 17:09:34 2012
New Revision: 1367679

URL: http://svn.apache.org/viewvc?rev=1367679&view=rev
Log:
[ARIES-890] Add support for recovery of JDBC XA transactions

Added:
    aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/RecoverableDataSource.java
    aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/
    aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/Activator.java
      - copied, changed from r1367678, aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/Activator.java
    aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/ConnectionKey.java
      - copied, changed from r1367678, aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/ConnectionKey.java
    aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/ConnectionWrapper.java
      - copied, changed from r1367678, aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/ConnectionWrapper.java
    aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/GenericResourceManager.java
    aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/NLS.java
      - copied, changed from r1367678, aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/NLS.java
    aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/XADatasourceEnlistingWrapper.java
      - copied, changed from r1367678, aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/XADatasourceEnlistingWrapper.java
    aries/trunk/transaction/transaction-jdbc/src/main/resources/OSGI-INF/
    aries/trunk/transaction/transaction-jdbc/src/main/resources/OSGI-INF/blueprint/
    aries/trunk/transaction/transaction-jdbc/src/main/resources/OSGI-INF/blueprint/transaction-jdbc.xml
    aries/trunk/transaction/transaction-jdbc/src/main/resources/org/apache/aries/transaction/jdbc/internal/
    aries/trunk/transaction/transaction-jdbc/src/main/resources/org/apache/aries/transaction/jdbc/internal/jdbcWrappers.properties
      - copied, changed from r1367678, aries/trunk/transaction/transaction-jdbc/src/main/resources/org/apache/aries/transaction/jdbc/jdbcWrappers.properties
Removed:
    aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/Activator.java
    aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/ConnectionKey.java
    aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/ConnectionWrapper.java
    aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/NLS.java
    aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/XADatasourceEnlistingWrapper.java
    aries/trunk/transaction/transaction-jdbc/src/main/resources/org/apache/aries/transaction/jdbc/jdbcWrappers.properties
Modified:
    aries/trunk/transaction/transaction-jdbc/pom.xml

Modified: aries/trunk/transaction/transaction-jdbc/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/transaction/transaction-jdbc/pom.xml?rev=1367679&r1=1367678&r2=1367679&view=diff
==============================================================================
--- aries/trunk/transaction/transaction-jdbc/pom.xml (original)
+++ aries/trunk/transaction/transaction-jdbc/pom.xml Tue Jul 31 17:09:34 2012
@@ -39,13 +39,17 @@
 
   <properties>
     <aries.osgi.export.pkg>
-      !org.apache.aries.transaction.jdbc
+      org.apache.aries.transaction.jdbc;-noimport:=true
     </aries.osgi.export.pkg>
+    <aries.osgi.import>
+      org.osgi.service.blueprint;resolution:=optional,
+      *
+    </aries.osgi.import>
     <aries.osgi.private.pkg>
-      org.apache.aries.transaction.jdbc
+      org.apache.aries.transaction.jdbc.internal
     </aries.osgi.private.pkg>
     <aries.osgi.activator>
-      org.apache.aries.transaction.jdbc.Activator
+      org.apache.aries.transaction.jdbc.internal.Activator
     </aries.osgi.activator>
   </properties>
 
@@ -58,7 +62,7 @@
         <dependency>
             <groupId>org.apache.aries</groupId>
             <artifactId>org.apache.aries.util</artifactId>
-            <version>1.0.0</version>
+            <version>0.3</version>
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
@@ -75,7 +79,19 @@
             <artifactId>slf4j-api</artifactId>
             <scope>provided</scope>
         </dependency>
-        <dependency>
+      <dependency>
+          <groupId>org.apache.aries.blueprint</groupId>
+          <artifactId>org.apache.aries.blueprint.core</artifactId>
+          <version>1.0.0</version>
+          <optional>true</optional>
+      </dependency>
+      <dependency>
+          <groupId>org.apache.xbean</groupId>
+          <artifactId>xbean-blueprint</artifactId>
+          <version>3.7</version>
+          <optional>true</optional>
+      </dependency>
+      <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-simple</artifactId>
             <scope>test</scope>
@@ -88,4 +104,24 @@
         </dependency>
   </dependencies>
 
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.xbean</groupId>
+                <artifactId>maven-xbean-plugin</artifactId>
+                <version>3.11</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>mapping</goal>
+                        </goals>
+                        <configuration>
+                            <namespace>http://aries.apache.org/xmlns/transaction-jdbc/1.0</namespace>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
 </project>

Added: aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/RecoverableDataSource.java
URL: http://svn.apache.org/viewvc/aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/RecoverableDataSource.java?rev=1367679&view=auto
==============================================================================
--- aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/RecoverableDataSource.java
(added)
+++ aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/RecoverableDataSource.java
Tue Jul 31 17:09:34 2012
@@ -0,0 +1,57 @@
+/*
+ * 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.aries.transaction.jdbc;
+
+import org.apache.aries.transaction.jdbc.internal.GenericResourceManager;
+import org.apache.aries.transaction.jdbc.internal.XADatasourceEnlistingWrapper;
+
+/**
+ * Defines a JDBC DataSource that will auto-enlist into existing XA transactions.
+ * The DataSource will also be registered with the Aries/Geronimo transaction
+ * manager in order to provide proper transaction recovery at startup.
+ * Other considerations such as connection pooling and error handling are
+ * completely ignored.
+ *
+ * @org.apache.xbean.XBean
+ */
+public class RecoverableDataSource extends XADatasourceEnlistingWrapper {
+
+    private String name;
+
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * The unique name for this managed XAResource.  This name will be used
+     * by the transaction manager to recover transactions.
+     *
+     * @param name
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * @org.apache.xbean.InitMethod
+     */
+    public void start() {
+        new GenericResourceManager(getName(), getTransactionManager(), getDataSource()).recoverResource();
+    }
+}

Copied: aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/Activator.java
(from r1367678, aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/Activator.java)
URL: http://svn.apache.org/viewvc/aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/Activator.java?p2=aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/Activator.java&p1=aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/Activator.java&r1=1367678&r2=1367679&rev=1367679&view=diff
==============================================================================
--- aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/Activator.java
(original)
+++ aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/Activator.java
Tue Jul 31 17:09:34 2012
@@ -16,9 +16,13 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.aries.transaction.jdbc;
+package org.apache.aries.transaction.jdbc.internal;
+
+import java.util.Hashtable;
+import javax.sql.DataSource;
+import javax.sql.XADataSource;
+import javax.transaction.TransactionManager;
 
-import org.apache.aries.util.AriesFrameworkUtil;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
@@ -29,10 +33,6 @@ import org.osgi.framework.ServiceReferen
 import org.osgi.framework.ServiceRegistration;
 import org.osgi.util.tracker.ServiceTracker;
 import org.osgi.util.tracker.ServiceTrackerCustomizer;
-import java.util.Hashtable;
-import javax.sql.DataSource;
-import javax.sql.XADataSource;
-import javax.transaction.TransactionManager;
 
 public class Activator implements BundleActivator, ServiceTrackerCustomizer, ServiceListener
 {
@@ -94,7 +94,7 @@ public class Activator implements Bundle
     map.put(Constants.SERVICE_RANKING, ranking);
 
     XADatasourceEnlistingWrapper wrapper = new XADatasourceEnlistingWrapper();
-    wrapper.setTxManager(tm);
+    wrapper.setTransactionManager(tm);
     wrapper.setDataSource((XADataSource) ctx.getService(ref));
 
     ServiceRegistration reg = ctx.registerService(DataSource.class.getName(), wrapper, map);

@@ -117,7 +117,7 @@ public class Activator implements Bundle
 
   public void removedService(ServiceReference ref, Object service)
   {
-    AriesFrameworkUtil.safeUnregisterService((ServiceRegistration)service);
+    safeUnregisterService((ServiceRegistration)service);
   }
 
   public void serviceChanged(ServiceEvent event)
@@ -136,4 +136,15 @@ public class Activator implements Bundle
       tm = null;
     }
   }
+
+  static void safeUnregisterService(ServiceRegistration reg)
+  {
+    if(reg != null) {
+      try {
+        reg.unregister();
+      } catch (IllegalStateException e) {
+        //This can be safely ignored
+      }
+    }
+  }
 }

Copied: aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/ConnectionKey.java
(from r1367678, aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/ConnectionKey.java)
URL: http://svn.apache.org/viewvc/aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/ConnectionKey.java?p2=aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/ConnectionKey.java&p1=aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/ConnectionKey.java&r1=1367678&r2=1367679&rev=1367679&view=diff
==============================================================================
--- aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/ConnectionKey.java
(original)
+++ aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/ConnectionKey.java
Tue Jul 31 17:09:34 2012
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.aries.transaction.jdbc;
+package org.apache.aries.transaction.jdbc.internal;
 
 import javax.transaction.Transaction;
 

Copied: aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/ConnectionWrapper.java
(from r1367678, aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/ConnectionWrapper.java)
URL: http://svn.apache.org/viewvc/aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/ConnectionWrapper.java?p2=aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/ConnectionWrapper.java&p1=aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/ConnectionWrapper.java&r1=1367678&r2=1367679&rev=1367679&view=diff
==============================================================================
--- aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/ConnectionWrapper.java
(original)
+++ aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/ConnectionWrapper.java
Tue Jul 31 17:09:34 2012
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.aries.transaction.jdbc;
+package org.apache.aries.transaction.jdbc.internal;
 
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
@@ -37,10 +37,10 @@ import java.sql.Statement;
 import java.sql.Struct;
 import java.util.Map;
 import java.util.Properties;
-import org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement;
-
+import java.util.concurrent.Executor;
 import javax.transaction.xa.XAResource;
 
+import org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -373,7 +373,32 @@ public class ConnectionWrapper implement
     	
     }
 
-	private Method getMethod(String methodName, Class<?> ...paramTypes) {
+    public void setSchema(String schema) throws SQLException {
+        Method method= getMethod("setSchema", String.class);
+        invokeByReflection(method, schema);
+    }
+
+    public String getSchema() throws SQLException {
+        Method method= getMethod("getSchema");
+        return (String) invokeByReflection(method);
+    }
+
+    public void abort(Executor executor) throws SQLException {
+        Method method= getMethod("abort", Executor.class);
+        invokeByReflection(method, executor);
+    }
+
+    public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException
{
+        Method method= getMethod("setNetworkTimeout", int.class);
+        invokeByReflection(method, executor, milliseconds);
+    }
+
+    public int getNetworkTimeout() throws SQLException {
+        Method method= getMethod("getNetworkTimeout");
+        return (Integer) invokeByReflection(method);
+    }
+
+    private Method getMethod(String methodName, Class<?> ...paramTypes) {
 		Method method = null;
 		try {
 			method = getClass().getMethod(methodName, paramTypes);

Added: aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/GenericResourceManager.java
URL: http://svn.apache.org/viewvc/aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/GenericResourceManager.java?rev=1367679&view=auto
==============================================================================
--- aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/GenericResourceManager.java
(added)
+++ aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/GenericResourceManager.java
Tue Jul 31 17:09:34 2012
@@ -0,0 +1,152 @@
+/*
+ * 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.aries.transaction.jdbc.internal;
+
+import java.io.IOException;
+import javax.sql.XAConnection;
+import javax.sql.XADataSource;
+import javax.transaction.SystemException;
+import javax.transaction.TransactionManager;
+import javax.transaction.xa.XAResource;
+
+import org.apache.geronimo.transaction.manager.NamedXAResource;
+import org.apache.geronimo.transaction.manager.NamedXAResourceFactory;
+import org.apache.geronimo.transaction.manager.RecoverableTransactionManager;
+import org.apache.geronimo.transaction.manager.WrapperNamedXAResource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class GenericResourceManager {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(GenericResourceManager.class);
+
+    private String resourceName;
+
+    private TransactionManager transactionManager;
+
+    private XADataSource dataSource;
+
+    public GenericResourceManager() {
+    }
+
+    public GenericResourceManager(String resourceName, TransactionManager transactionManager,
XADataSource dataSource) {
+        this.resourceName = resourceName;
+        this.transactionManager = transactionManager;
+        this.dataSource = dataSource;
+    }
+
+    public void recoverResource() {
+        try {
+            if (!Recovery.recover(this)) {
+                LOGGER.info("Resource manager is unrecoverable");
+            }
+        } catch (NoClassDefFoundError e) {
+            LOGGER.info("Resource manager is unrecoverable due to missing classes: " + e);
+        } catch (Throwable e) {
+            LOGGER.warn("Error while recovering resource manager", e);
+        }
+    }
+
+    public String getResourceName() {
+        return resourceName;
+    }
+
+    public void setResourceName(String resourceName) {
+        this.resourceName = resourceName;
+    }
+
+    public TransactionManager getTransactionManager() {
+        return transactionManager;
+    }
+
+    public void setTransactionManager(TransactionManager transactionManager) {
+        this.transactionManager = transactionManager;
+    }
+
+    public XADataSource getDataSource() {
+        return dataSource;
+    }
+
+    public void setDataSource(XADataSource dataSource) {
+        this.dataSource = dataSource;
+    }
+
+    /**
+     * This class will ensure the broker is properly recovered when wired with
+     * the Geronimo transaction manager.
+     */
+    public static class Recovery {
+
+        public static boolean isRecoverable(GenericResourceManager rm) {
+            return  rm.getTransactionManager() instanceof RecoverableTransactionManager &&
+                    rm.getResourceName() != null && !"".equals(rm.getResourceName());
+        }
+
+        public static boolean recover(final GenericResourceManager rm) throws IOException
{
+            if (isRecoverable(rm)) {
+                final XADataSource dataSource = (XADataSource) rm.getDataSource();
+
+                RecoverableTransactionManager rtxManager = (RecoverableTransactionManager)
rm.getTransactionManager();
+                rtxManager.registerNamedXAResourceFactory(new NamedXAResourceFactory() {
+
+                    public String getName() {
+                        return rm.getResourceName();
+                    }
+
+                    public NamedXAResource getNamedXAResource() throws SystemException {
+                        try {
+                            final XAConnection connection = (XAConnection) dataSource.getXAConnection();
+                            LOGGER.debug("new namedXAResource's connection: " + connection);
+
+                            return new ConnectionAndWrapperNamedXAResource(connection.getXAResource(),
getName(), connection);
+                        } catch (Exception e) {
+                            SystemException se =  new SystemException("Failed to create ConnectionAndWrapperNamedXAResource,
" + e.getLocalizedMessage());
+                            se.initCause(e);
+                            LOGGER.error(se.getLocalizedMessage(), se);
+                            throw se;
+                        }
+                    }
+
+                    public void returnNamedXAResource(NamedXAResource namedXaResource) {
+                        if (namedXaResource instanceof ConnectionAndWrapperNamedXAResource)
{
+                            try {
+                                LOGGER.debug("closing returned namedXAResource's connection:
" + ((ConnectionAndWrapperNamedXAResource)namedXaResource).connection);
+                                ((ConnectionAndWrapperNamedXAResource)namedXaResource).connection.close();
+                            } catch (Exception ignored) {
+                                LOGGER.debug("failed to close returned namedXAResource: "
+ namedXaResource, ignored);
+                            }
+                        }
+                    }
+                });
+                return true;
+            } else {
+                return false;
+            }
+        }
+    }
+
+    public static class ConnectionAndWrapperNamedXAResource extends WrapperNamedXAResource
{
+
+        final XAConnection connection;
+
+        public ConnectionAndWrapperNamedXAResource(XAResource xaResource, String name, XAConnection
connection) {
+            super(xaResource, name);
+            this.connection = connection;
+        }
+    }
+}

Copied: aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/NLS.java
(from r1367678, aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/NLS.java)
URL: http://svn.apache.org/viewvc/aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/NLS.java?p2=aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/NLS.java&p1=aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/NLS.java&r1=1367678&r2=1367679&rev=1367679&view=diff
==============================================================================
--- aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/NLS.java
(original)
+++ aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/NLS.java
Tue Jul 31 17:09:34 2012
@@ -16,11 +16,11 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.aries.transaction.jdbc;
+package org.apache.aries.transaction.jdbc.internal;
 
 import org.apache.aries.util.nls.MessageUtil;
 
 public class NLS
 {
-  public static final MessageUtil MESSAGES = MessageUtil.createMessageUtil(NLS.class, "org.apache.aries.transaction.jdbc.jdbcWrappers");
+  public static final MessageUtil MESSAGES = MessageUtil.createMessageUtil(NLS.class, "org.apache.aries.transaction.jdbc.internal.jdbcWrappers");
 }

Copied: aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/XADatasourceEnlistingWrapper.java
(from r1367678, aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/XADatasourceEnlistingWrapper.java)
URL: http://svn.apache.org/viewvc/aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/XADatasourceEnlistingWrapper.java?p2=aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/XADatasourceEnlistingWrapper.java&p1=aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/XADatasourceEnlistingWrapper.java&r1=1367678&r2=1367679&rev=1367679&view=diff
==============================================================================
--- aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/XADatasourceEnlistingWrapper.java
(original)
+++ aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/XADatasourceEnlistingWrapper.java
Tue Jul 31 17:09:34 2012
@@ -16,14 +16,16 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.aries.transaction.jdbc;
+package org.apache.aries.transaction.jdbc.internal;
 
 import java.io.PrintWriter;
 import java.io.Serializable;
 import java.sql.Connection;
 import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.logging.Logger;
 
 import javax.sql.DataSource;
 import javax.sql.XAConnection;
@@ -35,9 +37,11 @@ import javax.transaction.Transaction;
 import javax.transaction.TransactionManager;
 import javax.transaction.xa.XAResource;
 
+import org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement;
+
 /**
  * This class allows JDBC XA data sources to participate in global transactions,
- * via the {@link ConnectionWrapper} that is returned. The only service provided
+ * via the {@link org.apache.aries.transaction.jdbc.internal.ConnectionWrapper} that is returned.
The only service provided
  * is enlistment/delistment of the associated {@link XAResource} in transactions.
  * Important consideration such as connection pooling and error handling are
  * completely ignored.
@@ -135,7 +139,7 @@ public class XADatasourceEnlistingWrappe
         }
         
     }
-    
+
     public PrintWriter getLogWriter() throws SQLException
     {
       return wrappedDS.getLogWriter();
@@ -146,11 +150,17 @@ public class XADatasourceEnlistingWrappe
       return wrappedDS.getLoginTimeout();
     }
 
+    /**
+     * @org.apache.xbean.Property hidden=true
+     */
     public void setLogWriter(PrintWriter out) throws SQLException
     {
       wrappedDS.setLogWriter(out);
     }
 
+    /**
+     * @org.apache.xbean.Property hidden=true
+     */
     public void setLoginTimeout(int seconds) throws SQLException
     {
       wrappedDS.setLoginTimeout(seconds);
@@ -161,13 +171,32 @@ public class XADatasourceEnlistingWrappe
         return new ConnectionWrapper(connection, enlisted);
     }
 
+    public XADataSource getDataSource()
+    {
+      return wrappedDS;
+    }
+
+    /**
+     * The XADataSource object to wrap.
+     *
+     * @org.apache.xbean.Property required=true
+     */
     public void setDataSource(XADataSource dsToWrap)
     {
       wrappedDS = dsToWrap;
     }
 
+    public TransactionManager getTransactionManager()
+    {
+      return tm;
+    }
 
-    public void setTxManager(TransactionManager txMgr)
+    /**
+     * The XA TransactionManager to use to enlist the JDBC connections into.
+     *
+     * @org.apache.xbean.Property required=true
+     */
+    public void setTransactionManager(TransactionManager txMgr)
     {
       tm = txMgr;
     }
@@ -200,4 +229,10 @@ public class XADatasourceEnlistingWrappe
     {
       return null;
     }
+
+    @IgnoreJRERequirement
+    public Logger getParentLogger() throws SQLFeatureNotSupportedException
+    {
+      throw new SQLFeatureNotSupportedException();
+    }
 }

Added: aries/trunk/transaction/transaction-jdbc/src/main/resources/OSGI-INF/blueprint/transaction-jdbc.xml
URL: http://svn.apache.org/viewvc/aries/trunk/transaction/transaction-jdbc/src/main/resources/OSGI-INF/blueprint/transaction-jdbc.xml?rev=1367679&view=auto
==============================================================================
--- aries/trunk/transaction/transaction-jdbc/src/main/resources/OSGI-INF/blueprint/transaction-jdbc.xml
(added)
+++ aries/trunk/transaction/transaction-jdbc/src/main/resources/OSGI-INF/blueprint/transaction-jdbc.xml
Tue Jul 31 17:09:34 2012
@@ -0,0 +1,34 @@
+<?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.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+    <service interface="org.apache.aries.blueprint.NamespaceHandler">
+        <service-properties>
+            <entry key="osgi.service.blueprint.namespace" value="http://aries.apache.org/xmlns/transaction-jdbc/1.0"/>
+        </service-properties>
+        <bean class="org.apache.xbean.blueprint.context.impl.XBeanNamespaceHandler">
+            <argument value="http://aries.apache.org/xmlns/transaction-jdbc/1.0"/>
+            <argument value="org.apache.aries.transaction.jdbc.xsd"/>
+            <argument ref="blueprintBundle"/>
+            <argument value="META-INF/services/org/apache/xbean/spring/http/aries.apache.org/xmlns/transaction-jdbc/1.0"/>
+        </bean>
+    </service>
+
+</blueprint>

Copied: aries/trunk/transaction/transaction-jdbc/src/main/resources/org/apache/aries/transaction/jdbc/internal/jdbcWrappers.properties
(from r1367678, aries/trunk/transaction/transaction-jdbc/src/main/resources/org/apache/aries/transaction/jdbc/jdbcWrappers.properties)
URL: http://svn.apache.org/viewvc/aries/trunk/transaction/transaction-jdbc/src/main/resources/org/apache/aries/transaction/jdbc/internal/jdbcWrappers.properties?p2=aries/trunk/transaction/transaction-jdbc/src/main/resources/org/apache/aries/transaction/jdbc/internal/jdbcWrappers.properties&p1=aries/trunk/transaction/transaction-jdbc/src/main/resources/org/apache/aries/transaction/jdbc/jdbcWrappers.properties&r1=1367678&r2=1367679&rev=1367679&view=diff
==============================================================================
    (empty)



Mime
View raw message