aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r1602117 - in /aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc: RecoverableDataSource.java internal/DataSourceMCFFactory.java internal/XADataSourceMCFFactory.java
Date Thu, 12 Jun 2014 11:00:17 GMT
Author: gnodet
Date: Thu Jun 12 11:00:16 2014
New Revision: 1602117

URL: http://svn.apache.org/r1602117
Log:
[ARIES-1150] Add support for creating non xa DataSource

Modified:
    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/DataSourceMCFFactory.java
    aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/XADataSourceMCFFactory.java

Modified: 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=1602117&r1=1602116&r2=1602117&view=diff
==============================================================================
--- aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/RecoverableDataSource.java
(original)
+++ aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/RecoverableDataSource.java
Thu Jun 12 11:00:16 2014
@@ -165,16 +165,16 @@ public class RecoverableDataSource imple
      */
     public void start() throws Exception {
         AbstractMCFFactory mcf;
-        if (dataSource instanceof DataSource) {
-            mcf = new DataSourceMCFFactory();
-            if (transaction == null) {
-                transaction = "local";
-            }
-        } else if (dataSource instanceof XADataSource) {
+        if (dataSource instanceof XADataSource) {
             mcf = new XADataSourceMCFFactory();
             if (transaction == null) {
                 transaction = "xa";
             }
+        } else if (dataSource instanceof DataSource) {
+            mcf = new DataSourceMCFFactory();
+            if (transaction == null) {
+                transaction = "local";
+            }
         } else {
             throw new IllegalArgumentException("dataSource must be of type javax.sql.DataSource/XADataSource");
         }

Modified: aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/DataSourceMCFFactory.java
URL: http://svn.apache.org/viewvc/aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/DataSourceMCFFactory.java?rev=1602117&r1=1602116&r2=1602117&view=diff
==============================================================================
--- aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/DataSourceMCFFactory.java
(original)
+++ aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/DataSourceMCFFactory.java
Thu Jun 12 11:00:16 2014
@@ -18,6 +18,7 @@
  */
 package org.apache.aries.transaction.jdbc.internal;
 
+import javax.resource.spi.TransactionSupport;
 import javax.sql.DataSource;
 
 import org.tranql.connector.jdbc.AbstractLocalDataSourceMCF;
@@ -34,7 +35,7 @@ public class DataSourceMCFFactory extend
         }
     }
 
-    public class DataSourceMCF extends AbstractLocalDataSourceMCF<DataSource> {
+    public class DataSourceMCF extends AbstractLocalDataSourceMCF<DataSource> implements
TransactionSupport {
         public DataSourceMCF() {
             super((DataSource) DataSourceMCFFactory.this.getDataSource(), DataSourceMCFFactory.this.getExceptionSorter(),
true);
         }
@@ -46,5 +47,10 @@ public class DataSourceMCFFactory extend
         public String getPassword() {
             return DataSourceMCFFactory.this.getPassword();
         }
+
+        @Override
+        public TransactionSupportLevel getTransactionSupport() {
+            return TransactionSupportLevel.LocalTransaction;
+        }
     }
 }

Modified: aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/XADataSourceMCFFactory.java
URL: http://svn.apache.org/viewvc/aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/XADataSourceMCFFactory.java?rev=1602117&r1=1602116&r2=1602117&view=diff
==============================================================================
--- aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/XADataSourceMCFFactory.java
(original)
+++ aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/XADataSourceMCFFactory.java
Thu Jun 12 11:00:16 2014
@@ -29,6 +29,7 @@ import org.tranql.connector.jdbc.KnownSQ
 import javax.resource.ResourceException;
 import javax.resource.spi.ManagedConnectionFactory;
 import javax.resource.spi.ResourceAdapterInternalException;
+import javax.resource.spi.TransactionSupport;
 import javax.sql.XAConnection;
 import javax.sql.XADataSource;
 
@@ -47,7 +48,7 @@ public class XADataSourceMCFFactory exte
         }
     }
 
-    public class XADataSourceMCF extends AbstractXADataSourceMCF<XADataSource> {
+    public class XADataSourceMCF extends AbstractXADataSourceMCF<XADataSource> implements
TransactionSupport {
 
         public XADataSourceMCF() {
             super((XADataSource) XADataSourceMCFFactory.this.getDataSource(), XADataSourceMCFFactory.this.getExceptionSorter());
@@ -77,6 +78,10 @@ public class XADataSourceMCFFactory exte
             }
         }
 
+        @Override
+        public TransactionSupportLevel getTransactionSupport() {
+            return TransactionSupportLevel.XATransaction;
+        }
     }
 
 }



Mime
View raw message