incubator-aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From z..@apache.org
Subject svn commit: r921834 - in /incubator/aries/trunk/transaction: ./ transaction-itests/ transaction-itests/src/test/java/org/apache/aries/transaction/itests/ transaction-testds/ transaction-testds/src/main/java/org/apache/aries/transaction/jdbc/ transactio...
Date Thu, 11 Mar 2010 13:13:14 GMT
Author: zoe
Date: Thu Mar 11 13:13:14 2010
New Revision: 921834

URL: http://svn.apache.org/viewvc?rev=921834&view=rev
Log:
ARIES-232 Committing Brian's transaction enlisting changes


Modified:
    incubator/aries/trunk/transaction/pom.xml
    incubator/aries/trunk/transaction/transaction-itests/pom.xml
    incubator/aries/trunk/transaction/transaction-itests/src/test/java/org/apache/aries/transaction/itests/AbstractIntegrationTest.java
    incubator/aries/trunk/transaction/transaction-testds/pom.xml
    incubator/aries/trunk/transaction/transaction-testds/src/main/java/org/apache/aries/transaction/jdbc/ConnectionWrapper.java
    incubator/aries/trunk/transaction/transaction-testds/src/main/java/org/apache/aries/transaction/jdbc/XADatasourceEnlistingWrapper.java
    incubator/aries/trunk/transaction/transaction-testds/src/main/resources/OSGI-INF/blueprint/dataSource.xml

Modified: incubator/aries/trunk/transaction/pom.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/transaction/pom.xml?rev=921834&r1=921833&r2=921834&view=diff
==============================================================================
--- incubator/aries/trunk/transaction/pom.xml (original)
+++ incubator/aries/trunk/transaction/pom.xml Thu Mar 11 13:13:14 2010
@@ -55,6 +55,11 @@
                 <artifactId>org.apache.aries.transaction.manager</artifactId>
                 <version>0.1-incubating-SNAPSHOT</version>
             </dependency>
+            <dependency>
+                <groupId>org.apache.aries.transaction</groupId>
+                <artifactId>org.apache.aries.transaction.wrappers</artifactId>
+                <version>0.1-incubating-SNAPSHOT</version>
+            </dependency>
 				<dependency>
 					<groupId>org.apache.aries.transaction</groupId>
 					<artifactId>org.apache.aries.transaction.testds</artifactId>
@@ -117,6 +122,7 @@
     <modules>
         <module>transaction-manager</module>
         <module>transaction-blueprint</module>
+		<module>transaction-wrappers</module>
 		<module>transaction-itests</module>
 		<module>transaction-testbundle</module>
 		<module>transaction-testds</module>

Modified: incubator/aries/trunk/transaction/transaction-itests/pom.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/transaction/transaction-itests/pom.xml?rev=921834&r1=921833&r2=921834&view=diff
==============================================================================
--- incubator/aries/trunk/transaction/transaction-itests/pom.xml (original)
+++ incubator/aries/trunk/transaction/transaction-itests/pom.xml Thu Mar 11 13:13:14 2010
@@ -95,6 +95,11 @@
         </dependency>
         <dependency>
             <groupId>org.apache.aries.transaction</groupId>
+            <artifactId>org.apache.aries.transaction.wrappers</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.aries.transaction</groupId>
             <artifactId>org.apache.aries.transaction.testds</artifactId>
             <scope>test</scope>
         </dependency>

Modified: incubator/aries/trunk/transaction/transaction-itests/src/test/java/org/apache/aries/transaction/itests/AbstractIntegrationTest.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/transaction/transaction-itests/src/test/java/org/apache/aries/transaction/itests/AbstractIntegrationTest.java?rev=921834&r1=921833&r2=921834&view=diff
==============================================================================
--- incubator/aries/trunk/transaction/transaction-itests/src/test/java/org/apache/aries/transaction/itests/AbstractIntegrationTest.java
(original)
+++ incubator/aries/trunk/transaction/transaction-itests/src/test/java/org/apache/aries/transaction/itests/AbstractIntegrationTest.java
Thu Mar 11 13:13:14 2010
@@ -69,13 +69,14 @@ public abstract class AbstractIntegratio
                 systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("DEBUG"),
 
                 // Bundles
-                mavenBundle("org.apache.aries.transaction", "org.apache.aries.transaction.manager"),
                 mavenBundle("org.osgi", "org.osgi.compendium"),
                 mavenBundle("asm", "asm-all"),
                 mavenBundle("org.apache.derby", "derby"),
                 mavenBundle("org.apache.aries", "org.apache.aries.util"),
                 mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint"),

+                mavenBundle("org.apache.aries.transaction", "org.apache.aries.transaction.manager"),
                 mavenBundle("org.apache.aries.transaction", "org.apache.aries.transaction.blueprint"),
+                mavenBundle("org.apache.aries.transaction", "org.apache.aries.transaction.wrappers"),
                 mavenBundle("org.apache.aries.transaction", "org.apache.aries.transaction.testbundle"),
                 mavenBundle("org.apache.aries.transaction", "org.apache.aries.transaction.testds"),
 

Modified: incubator/aries/trunk/transaction/transaction-testds/pom.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/transaction/transaction-testds/pom.xml?rev=921834&r1=921833&r2=921834&view=diff
==============================================================================
--- incubator/aries/trunk/transaction/transaction-testds/pom.xml (original)
+++ incubator/aries/trunk/transaction/transaction-testds/pom.xml Thu Mar 11 13:13:14 2010
@@ -27,7 +27,7 @@
   <groupId>org.apache.aries.transaction</groupId>
   <artifactId>org.apache.aries.transaction.testds</artifactId>
   <version>0.1-incubating-SNAPSHOT</version>
-  <name>Apache Aries Transaction Enlisting JDBC Datasource</name>
+  <name>Apache Aries Transaction Test Datasource</name>
   <packaging>bundle</packaging>
   <dependencies>
         <dependency>
@@ -38,10 +38,6 @@
             <groupId>org.apache.aries.transaction</groupId>
             <artifactId>org.apache.aries.transaction.blueprint</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.apache.geronimo.components</groupId>
-            <artifactId>geronimo-transaction</artifactId>
-        </dependency>
   </dependencies>
   <build>
    <resources>

Modified: incubator/aries/trunk/transaction/transaction-testds/src/main/java/org/apache/aries/transaction/jdbc/ConnectionWrapper.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/transaction/transaction-testds/src/main/java/org/apache/aries/transaction/jdbc/ConnectionWrapper.java?rev=921834&r1=921833&r2=921834&view=diff
==============================================================================
--- incubator/aries/trunk/transaction/transaction-testds/src/main/java/org/apache/aries/transaction/jdbc/ConnectionWrapper.java
(original)
+++ incubator/aries/trunk/transaction/transaction-testds/src/main/java/org/apache/aries/transaction/jdbc/ConnectionWrapper.java
Thu Mar 11 13:13:14 2010
@@ -1,312 +0,0 @@
-/*
- * 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 java.sql.Array;
-import java.sql.Blob;
-import java.sql.CallableStatement;
-import java.sql.Clob;
-import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.sql.NClob;
-import java.sql.PreparedStatement;
-import java.sql.SQLClientInfoException;
-import java.sql.SQLException;
-import java.sql.SQLWarning;
-import java.sql.SQLXML;
-import java.sql.Savepoint;
-import java.sql.Statement;
-import java.sql.Struct;
-import java.util.Map;
-import java.util.Properties;
-
-import javax.sql.XAConnection;
-import javax.transaction.Status;
-import javax.transaction.SystemException;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-import javax.transaction.xa.XAResource;
-
-/**
- * This class is a wrapper around a {@link Connection} that performs
- * enlistment/delistment of an {@link XAResource} from a transaction.
- * 
- * @see XADatasourceEnlistingWrapper
- */
-public class ConnectionWrapper implements Connection {
-    private Connection connection;
-    
-    private XAConnection xaConnection;
-    
-    private TransactionManager tm;
-    
-    public ConnectionWrapper(XAConnection xaConnection, TransactionManager tm) {
-        try {
-            this.xaConnection = xaConnection;
-            this.tm = tm;
-            this.connection = xaConnection.getConnection();
-            
-            if (tm.getStatus() == Status.STATUS_ACTIVE) {
-                Transaction tx = tm.getTransaction();
-                tx.enlistResource(xaConnection.getXAResource());
-            }
-        } catch (Exception e) {
-            try {
-                if (tm != null)
-                    tm.setRollbackOnly();
-            } catch (IllegalStateException e1) {
-                e1.printStackTrace();
-            } catch (SystemException e1) {
-                e1.printStackTrace();
-            }
-        }
-    }
-
-    public void clearWarnings() throws SQLException {
-        connection.clearWarnings();
-    }
-
-    public void close() throws SQLException {
-        try {
-            if (tm.getStatus() == Status.STATUS_ACTIVE) {
-                Transaction tx = tm.getTransaction();
-                tx.delistResource(xaConnection.getXAResource(), XAResource.TMSUCCESS);
-            }
-        } catch (Exception e) {
-            try {
-                if (tm != null)
-                    tm.setRollbackOnly();
-            } catch (IllegalStateException e1) {
-                e1.printStackTrace();
-            } catch (SystemException e1) {
-                e1.printStackTrace();
-            }
-        }
-        
-        connection.close();
-    }
-
-    public void commit() throws SQLException {
-        connection.commit();
-    }
-
-    public Array createArrayOf(String typeName, Object[] elements)
-            throws SQLException {
-        return connection.createArrayOf(typeName, elements);
-    }
-
-    public Blob createBlob() throws SQLException {
-        return connection.createBlob();
-    }
-
-    public Clob createClob() throws SQLException {
-        return connection.createClob();
-    }
-
-    public NClob createNClob() throws SQLException {
-        return connection.createNClob();
-    }
-
-    public SQLXML createSQLXML() throws SQLException {
-        return connection.createSQLXML();
-    }
-
-    public Statement createStatement() throws SQLException {
-        return connection.createStatement();
-    }
-
-    public Statement createStatement(int resultSetType,
-            int resultSetConcurrency, int resultSetHoldability)
-            throws SQLException {
-        return connection.createStatement(resultSetType, resultSetConcurrency,
-                resultSetHoldability);
-    }
-
-    public Statement createStatement(int resultSetType, int resultSetConcurrency)
-            throws SQLException {
-        return connection.createStatement(resultSetType, resultSetConcurrency);
-    }
-
-    public Struct createStruct(String typeName, Object[] attributes)
-            throws SQLException {
-        return connection.createStruct(typeName, attributes);
-    }
-
-    public boolean getAutoCommit() throws SQLException {
-        return connection.getAutoCommit();
-    }
-
-    public String getCatalog() throws SQLException {
-        return connection.getCatalog();
-    }
-
-    public Properties getClientInfo() throws SQLException {
-        return connection.getClientInfo();
-    }
-
-    public String getClientInfo(String name) throws SQLException {
-        return connection.getClientInfo(name);
-    }
-
-    public int getHoldability() throws SQLException {
-        return connection.getHoldability();
-    }
-
-    public DatabaseMetaData getMetaData() throws SQLException {
-        return connection.getMetaData();
-    }
-
-    public int getTransactionIsolation() throws SQLException {
-        return connection.getTransactionIsolation();
-    }
-
-    public Map<String, Class<?>> getTypeMap() throws SQLException {
-        return connection.getTypeMap();
-    }
-
-    public SQLWarning getWarnings() throws SQLException {
-        return connection.getWarnings();
-    }
-
-    public boolean isClosed() throws SQLException {
-        return connection.isClosed();
-    }
-
-    public boolean isReadOnly() throws SQLException {
-        return connection.isReadOnly();
-    }
-
-    public boolean isValid(int timeout) throws SQLException {
-        return connection.isValid(timeout);
-    }
-
-    public boolean isWrapperFor(Class<?> iface) throws SQLException {
-        return connection.isWrapperFor(iface);
-    }
-
-    public String nativeSQL(String sql) throws SQLException {
-        return connection.nativeSQL(sql);
-    }
-
-    public CallableStatement prepareCall(String sql, int resultSetType,
-            int resultSetConcurrency, int resultSetHoldability)
-            throws SQLException {
-        return connection.prepareCall(sql, resultSetType, resultSetConcurrency,
-                resultSetHoldability);
-    }
-
-    public CallableStatement prepareCall(String sql, int resultSetType,
-            int resultSetConcurrency) throws SQLException {
-        return connection.prepareCall(sql, resultSetType, resultSetConcurrency);
-    }
-
-    public CallableStatement prepareCall(String sql) throws SQLException {
-        return connection.prepareCall(sql);
-    }
-
-    public PreparedStatement prepareStatement(String sql, int resultSetType,
-            int resultSetConcurrency, int resultSetHoldability)
-            throws SQLException {
-        return connection.prepareStatement(sql, resultSetType,
-                resultSetConcurrency, resultSetHoldability);
-    }
-
-    public PreparedStatement prepareStatement(String sql, int resultSetType,
-            int resultSetConcurrency) throws SQLException {
-        return connection.prepareStatement(sql, resultSetType,
-                resultSetConcurrency);
-    }
-
-    public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys)
-            throws SQLException {
-        return connection.prepareStatement(sql, autoGeneratedKeys);
-    }
-
-    public PreparedStatement prepareStatement(String sql, int[] columnIndexes)
-            throws SQLException {
-        return connection.prepareStatement(sql, columnIndexes);
-    }
-
-    public PreparedStatement prepareStatement(String sql, String[] columnNames)
-            throws SQLException {
-        return connection.prepareStatement(sql, columnNames);
-    }
-
-    public PreparedStatement prepareStatement(String sql) throws SQLException {
-        return connection.prepareStatement(sql);
-    }
-
-    public void releaseSavepoint(Savepoint savepoint) throws SQLException {
-        connection.releaseSavepoint(savepoint);
-    }
-
-    public void rollback() throws SQLException {
-        connection.rollback();
-    }
-
-    public void rollback(Savepoint savepoint) throws SQLException {
-        connection.rollback(savepoint);
-    }
-
-    public void setAutoCommit(boolean autoCommit) throws SQLException {
-        connection.setAutoCommit(autoCommit);
-    }
-
-    public void setCatalog(String catalog) throws SQLException {
-        connection.setCatalog(catalog);
-    }
-
-    public void setClientInfo(Properties properties)
-            throws SQLClientInfoException {
-        connection.setClientInfo(properties);
-    }
-
-    public void setClientInfo(String name, String value)
-            throws SQLClientInfoException {
-        connection.setClientInfo(name, value);
-    }
-
-    public void setHoldability(int holdability) throws SQLException {
-        connection.setHoldability(holdability);
-    }
-
-    public void setReadOnly(boolean readOnly) throws SQLException {
-        connection.setReadOnly(readOnly);
-    }
-
-    public Savepoint setSavepoint() throws SQLException {
-        return connection.setSavepoint();
-    }
-
-    public Savepoint setSavepoint(String name) throws SQLException {
-        return connection.setSavepoint(name);
-    }
-
-    public void setTransactionIsolation(int level) throws SQLException {
-        connection.setTransactionIsolation(level);
-    }
-
-    public void setTypeMap(Map<String, Class<?>> map) throws SQLException {
-        connection.setTypeMap(map);
-    }
-
-    public <T> T unwrap(Class<T> iface) throws SQLException {
-        return connection.unwrap(iface);
-    }
-}

Modified: incubator/aries/trunk/transaction/transaction-testds/src/main/java/org/apache/aries/transaction/jdbc/XADatasourceEnlistingWrapper.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/transaction/transaction-testds/src/main/java/org/apache/aries/transaction/jdbc/XADatasourceEnlistingWrapper.java?rev=921834&r1=921833&r2=921834&view=diff
==============================================================================
--- incubator/aries/trunk/transaction/transaction-testds/src/main/java/org/apache/aries/transaction/jdbc/XADatasourceEnlistingWrapper.java
(original)
+++ incubator/aries/trunk/transaction/transaction-testds/src/main/java/org/apache/aries/transaction/jdbc/XADatasourceEnlistingWrapper.java
Thu Mar 11 13:13:14 2010
@@ -1,127 +0,0 @@
-/*
- * 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 java.io.PrintWriter;
-import java.io.Serializable;
-import java.sql.Connection;
-import java.sql.SQLException;
-
-import javax.sql.DataSource;
-import javax.sql.XAConnection;
-import javax.sql.XADataSource;
-import javax.transaction.TransactionManager;
-
-/**
- * This class allows JDBC XA data sources to participate in global transactions,
- * via the {@link 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.
- *
- */
-public class XADatasourceEnlistingWrapper implements DataSource, Serializable {
-    /** The serial version UID */
-    private static final long serialVersionUID = -3200389791205501228L;
-
-    private XADataSource wrappedDS;
-    
-    private transient TransactionManager tm;
-    
-    public Connection getConnection() throws SQLException
-    {
-      XAConnection xaConn = wrappedDS.getXAConnection();
-      Connection conn = getEnlistedConnection(xaConn);
-      
-      return conn;
-    }
-
-    public Connection getConnection(String username, String password) throws SQLException
-    {
-      XAConnection xaConn = wrappedDS.getXAConnection(username, password);
-      Connection conn = getEnlistedConnection(xaConn);
-      
-      return conn;
-    }
-
-    public PrintWriter getLogWriter() throws SQLException
-    {
-      return wrappedDS.getLogWriter();
-    }
-
-    public int getLoginTimeout() throws SQLException
-    {
-      return wrappedDS.getLoginTimeout();
-    }
-
-    public void setLogWriter(PrintWriter out) throws SQLException
-    {
-      wrappedDS.setLogWriter(out);
-    }
-
-    public void setLoginTimeout(int seconds) throws SQLException
-    {
-      wrappedDS.setLoginTimeout(seconds);
-    }
-
-    private Connection getEnlistedConnection(XAConnection xaConn) throws SQLException
-    {
-        return new ConnectionWrapper(xaConn, tm);
-    }
-
-    public void setDataSource(XADataSource dsToWrap)
-    {
-      wrappedDS = dsToWrap;
-    }
-
-
-    public void setTxManager(TransactionManager txMgr)
-    {
-      tm = txMgr;
-    }
-    
-    @Override
-    public boolean equals(Object other)
-    {
-      if (other == this) return true;
-      if (other == null) return false;
-      
-      if (other.getClass() == this.getClass()) {
-        return wrappedDS.equals(((XADatasourceEnlistingWrapper)other).wrappedDS);
-      }
-      
-      return false;
-    }
-    
-    @Override
-    public int hashCode()
-    {
-      return wrappedDS.hashCode();
-    }
-
-    public boolean isWrapperFor(Class<?> arg0) throws SQLException
-    {
-      return false;
-    }
-
-    public <T> T unwrap(Class<T> arg0) throws SQLException
-    {
-      return null;
-    }
-}

Modified: incubator/aries/trunk/transaction/transaction-testds/src/main/resources/OSGI-INF/blueprint/dataSource.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/transaction/transaction-testds/src/main/resources/OSGI-INF/blueprint/dataSource.xml?rev=921834&r1=921833&r2=921834&view=diff
==============================================================================
--- incubator/aries/trunk/transaction/transaction-testds/src/main/resources/OSGI-INF/blueprint/dataSource.xml
(original)
+++ incubator/aries/trunk/transaction/transaction-testds/src/main/resources/OSGI-INF/blueprint/dataSource.xml
Thu Mar 11 13:13:14 2010
@@ -22,21 +22,12 @@
             xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0"
             default-activation="lazy">
   
-  <bean id="dataSourceWrapper" class="org.apache.aries.transaction.jdbc.XADatasourceEnlistingWrapper">
-    <property name="txManager" ref="txManager"/>
-    <property name="dataSource" ref="derbyXADataSource"/>
-  </bean>
-  
   <bean id="derbyXADataSource" class="org.apache.derby.jdbc.EmbeddedXADataSource">
     <property name="databaseName" value="TESTDB"/>
     <property name="createDatabase" value="create"/>
   </bean>
 
-  <service id="enlistingDataSource" ref="dataSourceWrapper" interface="javax.sql.DataSource">
-   <service-properties>
-     <entry key="xa.aware" value="true"/>
-   </service-properties>
-  </service>
+  <service id="xaDataSource" ref="derbyXADataSource" interface="javax.sql.XADataSource"/>
   
   <bean id="derbyDataSource" class="org.apache.derby.jdbc.EmbeddedDataSource">
     <property name="databaseName" value="TESTDB"/>
@@ -48,6 +39,4 @@
      <entry key="xa.aware" value="false"/>
    </service-properties>
   </service>
-  
-  <reference id="txManager" interface="javax.transaction.TransactionManager"/>
 </blueprint>
\ No newline at end of file



Mime
View raw message