You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by ti...@apache.org on 2016/02/15 19:29:31 UTC

svn commit: r1730592 - in /aries/trunk/tx-control: ./ tx-control-api/ tx-control-api/src/ tx-control-api/src/main/ tx-control-api/src/main/java/ tx-control-api/src/main/java/org/ tx-control-api/src/main/java/org/osgi/ tx-control-api/src/main/java/org/o...

Author: timothyjward
Date: Mon Feb 15 18:29:30 2016
New Revision: 1730592

URL: http://svn.apache.org/viewvc?rev=1730592&view=rev
Log:
[tx-control] Initial commit of the OSGi Transaction Control API from RFC-221

Added:
    aries/trunk/tx-control/
    aries/trunk/tx-control/README
    aries/trunk/tx-control/pom.xml
    aries/trunk/tx-control/tx-control-api/
    aries/trunk/tx-control/tx-control-api/LICENSE
    aries/trunk/tx-control/tx-control-api/NOTICE
    aries/trunk/tx-control/tx-control-api/pom.xml
    aries/trunk/tx-control/tx-control-api/src/
    aries/trunk/tx-control/tx-control-api/src/main/
    aries/trunk/tx-control/tx-control-api/src/main/java/
    aries/trunk/tx-control/tx-control-api/src/main/java/org/
    aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/
    aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/
    aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/
    aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/
    aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/LocalResource.java
    aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/ResourceProvider.java
    aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/TransactionBuilder.java
    aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/TransactionContext.java
    aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/TransactionControl.java
    aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/TransactionException.java
    aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/TransactionRolledBackException.java
    aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/TransactionStarter.java
    aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/TransactionStatus.java
    aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/jdbc/
    aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/jdbc/JDBCConnectionProvider.java
    aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/jdbc/JDBCConnectionProviderFactory.java
    aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/jdbc/packageinfo
    aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/jpa/
    aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/jpa/JPAEntityManagerProvider.java
    aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/jpa/JPAEntityManagerProviderFactory.java
    aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/jpa/packageinfo
    aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/package-info.java
    aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/packageinfo

Added: aries/trunk/tx-control/README
URL: http://svn.apache.org/viewvc/aries/trunk/tx-control/README?rev=1730592&view=auto
==============================================================================
--- aries/trunk/tx-control/README (added)
+++ aries/trunk/tx-control/README Mon Feb 15 18:29:30 2016
@@ -0,0 +1,9 @@
+Sample OSGi Transaction Control Service implementation
+------------------------------------------------------
+
+This set of modules is a prototype implementation of the OSGi Transaction Control Service and related services, such as JDBC resource provision.
+
+The Transaction Control Service (RFC-221) is an in-progress RFC publicly available from the OSGi Alliance: https://github.com/osgi/design/blob/master/rfcs/rfc0221/rfc-0221-TransactionControl.pdf
+
+Given that the RFC is non-final the OSGi API declared in this project is subject to change at any time up to its official release. Also the behaviour of this implementation may not always be up-to-date with the latest wording in the RFC. The project maintainers will, however try to keep pace with the RFC, and to ensure that the implementations are compliant with any OSGi specifications that result from the RFC.
+

Added: aries/trunk/tx-control/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/tx-control/pom.xml?rev=1730592&view=auto
==============================================================================
--- aries/trunk/tx-control/pom.xml (added)
+++ aries/trunk/tx-control/pom.xml Mon Feb 15 18:29:30 2016
@@ -0,0 +1,39 @@
+<!-- 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. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.aries</groupId>
+        <artifactId>parent</artifactId>
+        <version>2.0.1</version>
+        <relativePath>../parent/pom.xml</relativePath>
+    </parent>
+    <groupId>org.apache.aries.tx-control</groupId>
+    <artifactId>tx-control</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+    <packaging>pom</packaging>
+    <description>Transaction Control service, including Resource Provider implementations.</description>
+    <scm>
+        <connection>
+            scm:svn:http://svn.apache.org/repos/asf/aries/trunk/tx-control
+        </connection>
+        <developerConnection>
+            scm:svn:https://svn.apache.org/repos/asf/aries/trunk/tx-control
+        </developerConnection>
+        <url>
+            http://svn.apache.org/viewvc/aries/trunk/tx-control
+        </url>
+    </scm>
+    <modules>
+        <module>tx-control-api</module>
+    </modules>
+</project>
\ No newline at end of file

Added: aries/trunk/tx-control/tx-control-api/LICENSE
URL: http://svn.apache.org/viewvc/aries/trunk/tx-control/tx-control-api/LICENSE?rev=1730592&view=auto
==============================================================================
--- aries/trunk/tx-control/tx-control-api/LICENSE (added)
+++ aries/trunk/tx-control/tx-control-api/LICENSE Mon Feb 15 18:29:30 2016
@@ -0,0 +1,203 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.
+

Added: aries/trunk/tx-control/tx-control-api/NOTICE
URL: http://svn.apache.org/viewvc/aries/trunk/tx-control/tx-control-api/NOTICE?rev=1730592&view=auto
==============================================================================
--- aries/trunk/tx-control/tx-control-api/NOTICE (added)
+++ aries/trunk/tx-control/tx-control-api/NOTICE Mon Feb 15 18:29:30 2016
@@ -0,0 +1,8 @@
+
+Apache Aries
+Copyright 2009-2011 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+

Added: aries/trunk/tx-control/tx-control-api/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/tx-control/tx-control-api/pom.xml?rev=1730592&view=auto
==============================================================================
--- aries/trunk/tx-control/tx-control-api/pom.xml (added)
+++ aries/trunk/tx-control/tx-control-api/pom.xml Mon Feb 15 18:29:30 2016
@@ -0,0 +1,93 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<parent>
+		<groupId>org.apache.aries</groupId>
+		<artifactId>parent</artifactId>
+		<version>2.0.1</version>
+		<relativePath>../../parent/pom.xml</relativePath>
+	</parent>
+	<groupId>org.apache.aries.tx-control</groupId>
+	<artifactId>tx-control-api</artifactId>
+	<packaging>bundle</packaging>
+	<name>OSGi Transaction Control API</name>
+	<version>0.0.1-SNAPSHOT</version>
+
+
+	<description>
+        This bundle contains the OSGi Transaction Control Service API.
+    </description>
+
+	<scm>
+		<connection>
+            scm:svn:http://svn.apache.org/repos/asf/aries/trunk/tx-control/tx-control-api
+        </connection>
+		<developerConnection>
+            scm:svn:https://svn.apache.org/repos/asf/aries/trunk/tx-control/tx-control-api
+        </developerConnection>
+		<url>
+            http://svn.apache.org/viewvc/aries/trunk/tx-control/tx-control-api
+        </url>
+	</scm>
+
+	<properties>
+		<!-- Export package versions are maintained in packageinfo files -->
+		<aries.osgi.export.pkg>
+			org.osgi.service.transaction.control,
+			org.osgi.service.transaction.control.jdbc,
+			org.osgi.service.transaction.control.jpa
+		</aries.osgi.export.pkg>
+		<aries.osgi.private.pkg />
+		<aries.osgi.import.pkg>
+			org.osgi.service.transaction.control,
+			org.osgi.service.transaction.control.jdbc,
+			org.osgi.service.transaction.control.jpa,
+			*
+		</aries.osgi.import.pkg>
+	</properties>
+
+	<dependencies>
+		<dependency>
+			<groupId>org.osgi</groupId>
+			<artifactId>org.osgi.service.jdbc</artifactId>
+			<version>1.0.0</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.osgi</groupId>
+			<artifactId>org.osgi.service.jpa</artifactId>
+			<version>1.0.0</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.geronimo.specs</groupId>
+			<artifactId>geronimo-jpa_2.0_spec</artifactId>
+			<version>1.1</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.osgi</groupId>
+			<artifactId>osgi.annotation</artifactId>
+			<version>6.0.1</version>
+			<scope>provided</scope>
+		</dependency>
+	</dependencies>
+
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.aries.versioning</groupId>
+				<artifactId>org.apache.aries.versioning.plugin</artifactId>
+				<executions>
+					<execution>
+						<id>default-verify</id>
+						<phase>verify</phase>
+						<goals>
+							<goal>version-check</goal>
+						</goals>
+					</execution>
+				</executions>
+			</plugin>
+		</plugins>
+	</build>
+</project>
\ No newline at end of file

Added: aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/LocalResource.java
URL: http://svn.apache.org/viewvc/aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/LocalResource.java?rev=1730592&view=auto
==============================================================================
--- aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/LocalResource.java (added)
+++ aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/LocalResource.java Mon Feb 15 18:29:30 2016
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) OSGi Alliance (2016). All Rights Reserved.
+ * 
+ * Licensed 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.osgi.service.transaction.control;
+
+/**
+ * Resources that can integrate with local transactions should do so using this
+ * interface
+ */
+public interface LocalResource {
+
+	/**
+	 * Commit the resource
+	 * 
+	 * @throws TransactionException
+	 */
+	void commit() throws TransactionException;
+
+	/**
+	 * Roll back the resource
+	 * 
+	 * @throws TransactionException
+	 */
+	void rollback() throws TransactionException;
+}

Added: aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/ResourceProvider.java
URL: http://svn.apache.org/viewvc/aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/ResourceProvider.java?rev=1730592&view=auto
==============================================================================
--- aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/ResourceProvider.java (added)
+++ aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/ResourceProvider.java Mon Feb 15 18:29:30 2016
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) OSGi Alliance (2016). All Rights Reserved.
+ * 
+ * Licensed 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.osgi.service.transaction.control;
+
+/**
+ * A resource provider is used to provide a transactional resource to the
+ * application
+ * 
+ * @param <T>
+ */
+public interface ResourceProvider<T> {
+
+	/**
+	 * Get a resource which will associate with the current transaction context
+	 * when used
+	 * 
+	 * @param txControl
+	 * @return The resource which will participate in the current transaction
+	 * @throws TransactionException if the resource cannot be registered with
+	 *             the transaction
+	 */
+	T getResource(TransactionControl txControl) throws TransactionException;
+
+}

Added: aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/TransactionBuilder.java
URL: http://svn.apache.org/viewvc/aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/TransactionBuilder.java?rev=1730592&view=auto
==============================================================================
--- aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/TransactionBuilder.java (added)
+++ aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/TransactionBuilder.java Mon Feb 15 18:29:30 2016
@@ -0,0 +1,134 @@
+/*
+ * Copyright (c) OSGi Alliance (2016). All Rights Reserved.
+ * 
+ * Licensed 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.osgi.service.transaction.control;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * A builder for a piece of transactional work
+ */
+public abstract class TransactionBuilder implements TransactionStarter {
+
+	/**
+	 * The list of {@link Throwable} types that must trigger rollback
+	 */
+	protected final List<Class< ? extends Throwable>>	rollbackFor		= new ArrayList<Class< ? extends Throwable>>();
+	/**
+	 * The list of {@link Throwable} types that must not trigger rollback
+	 */
+	protected final List<Class< ? extends Throwable>>	noRollbackFor	= new ArrayList<Class< ? extends Throwable>>();
+
+	/**
+	 * Declare a list of Exception types (and their subtypes) that <em>must</em>
+	 * trigger a rollback. By default the transaction will rollback for all
+	 * {@link Exception}s. If a more specific type is registered using
+	 * {@link #noRollbackFor(Class, Class...)} then that type will not trigger
+	 * rollback. If the same type is registered using both
+	 * {@link #rollbackFor(Class, Class...)} and
+	 * {@link #noRollbackFor(Class, Class...)} then the transaction
+	 * <em>will not</em> begin and will instead throw a
+	 * {@link TransactionException}
+	 * <p>
+	 * Note that the behaviour of this method differs from Java EE and Spring in
+	 * two ways:
+	 * <ul>
+	 * <li>In Java EE and Spring transaction management checked exceptions are
+	 * considered "normal returns" and do not trigger rollback. Using an
+	 * Exception as a normal return value is considered a <em>bad</em> design
+	 * practice. In addition this means that checked Exceptions such as
+	 * java.sql.SQLException do not trigger rollback by default. This, in turn,
+	 * leads to implementation mistakes that break the transactional behaviour
+	 * of applications.</li>
+	 * <li>In Java EE it is legal to specify the same Exception type in
+	 * {@link #rollbackFor} and {@link #noRollbackFor}. Stating that the same
+	 * Exception should both trigger <em>and</em> not trigger rollback is a
+	 * logical impossibility, and clearly indicates an API usage error. This API
+	 * therefore enforces usage by triggering an exception in this invalid case.
+	 * </li>
+	 * </ul>
+	 * 
+	 * @param t
+	 * @param throwables The Exception types that should trigger rollback
+	 * @return this builder
+	 */
+	@SafeVarargs
+	public final TransactionBuilder rollbackFor(Class< ? extends Throwable> t,
+			Class< ? extends Throwable>... throwables) {
+		Objects.requireNonNull(t,
+				"The supplied exception types must be non Null");
+		for (Class< ? extends Throwable> t2 : throwables) {
+			Objects.requireNonNull(t2,
+					"The supplied exception types must be non-null");
+		}
+		rollbackFor.clear();
+		rollbackFor.add(t);
+		rollbackFor.addAll(Arrays.asList(throwables));
+		return this;
+	}
+
+	/**
+	 * Declare a list of Exception types (and their subtypes) that
+	 * <em>must not</em> trigger a rollback. By default the transaction will
+	 * rollback for all {@link Exception}s. If an Exception type is registered
+	 * using this method then that type and its subtypes will <em>not</em>
+	 * trigger rollback. If the same type is registered using both
+	 * {@link #rollbackFor(Class, Class...)} and
+	 * {@link #noRollbackFor(Class, Class...)} then the transaction
+	 * <em>will not</em> begin and will instead throw a
+	 * {@link TransactionException}
+	 * <p>
+	 * Note that the behaviour of this method differs from Java EE and Spring in
+	 * two ways:
+	 * <ul>
+	 * <li>In Java EE and Spring transaction management checked exceptions are
+	 * considered "normal returns" and do not trigger rollback. Using an
+	 * Exception as a normal return value is considered a <em>bad</em> design
+	 * practice. In addition this means that checked Exceptions such as
+	 * java.sql.SQLException do not trigger rollback by default. This, in turn,
+	 * leads to implementation mistakes that break the transactional behaviour
+	 * of applications.</li>
+	 * <li>In Java EE it is legal to specify the same Exception type in
+	 * {@link #rollbackFor} and {@link #noRollbackFor}. Stating that the same
+	 * Exception should both trigger <em>and</em> not trigger rollback is a
+	 * logical impossibility, and clearly indicates an API usage error. This API
+	 * therefore enforces usage by triggering an exception in this invalid case.
+	 * </li>
+	 * </ul>
+	 * 
+	 * @param t An exception type that should not trigger rollback
+	 * @param throwables further exception types that should not trigger
+	 *            rollback
+	 * @return this builder
+	 */
+	@SafeVarargs
+	public final TransactionBuilder noRollbackFor(Class< ? extends Throwable> t,
+			Class< ? extends Throwable>... throwables) {
+
+		Objects.requireNonNull(t,
+				"The supplied exception types must be non Null");
+		for (Class< ? extends Throwable> t2 : throwables) {
+			Objects.requireNonNull(t2,
+					"The supplied exception types must be non-null");
+		}
+		noRollbackFor.clear();
+		noRollbackFor.add(t);
+		noRollbackFor.addAll(Arrays.asList(throwables));
+		return this;
+	}
+}

Added: aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/TransactionContext.java
URL: http://svn.apache.org/viewvc/aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/TransactionContext.java?rev=1730592&view=auto
==============================================================================
--- aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/TransactionContext.java (added)
+++ aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/TransactionContext.java Mon Feb 15 18:29:30 2016
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) OSGi Alliance (2016). All Rights Reserved.
+ * 
+ * Licensed 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.osgi.service.transaction.control;
+
+import java.util.function.Consumer;
+
+import javax.transaction.xa.XAResource;
+
+/**
+ * A transaction context defines the current transaction, and allows resources
+ * to register information and/or synchronisations
+ */
+public interface TransactionContext {
+
+	/**
+	 * Get the key associated with the current transaction
+	 * 
+	 * @return the transaction key, or null if there is no transaction
+	 */
+	Object getTransactionKey();
+
+	/**
+	 * Get a value scoped to this transaction
+	 * 
+	 * @param key
+	 * @return The resource, or <code>null</code>
+	 */
+	Object getScopedValue(Object key);
+
+	/**
+	 * Associate a value with this transaction
+	 * 
+	 * @param key
+	 * @param value
+	 */
+	void putScopedValue(Object key, Object value);
+
+	/**
+	 * Is this transaction marked for rollback only
+	 * 
+	 * @return true if this transaction is rollback only
+	 * @throws IllegalStateException if no transaction is active
+	 */
+	boolean getRollbackOnly() throws IllegalStateException;
+
+	/**
+	 * Mark this transaction for rollback
+	 * 
+	 * @throws IllegalStateException if no transaction is active
+	 */
+	void setRollbackOnly() throws IllegalStateException;
+
+	/**
+	 * @return The current transaction status
+	 */
+	TransactionStatus getTransactionStatus();
+
+	/**
+	 * Register a callback that will be made before a call to commit or rollback
+	 * 
+	 * @param job
+	 * @throws IllegalStateException if no transaction is active or the
+	 *             transaction has already passed beyond the
+	 *             {@link TransactionStatus#MARKED_ROLLBACK} state
+	 */
+	void preCompletion(Runnable job) throws IllegalStateException;
+
+	/**
+	 * Register a callback that will be made after the decision to commit or
+	 * rollback
+	 * 
+	 * @param job
+	 * @throws IllegalStateException if no transaction is active
+	 */
+	void postCompletion(Consumer<TransactionStatus> job)
+			throws IllegalStateException;
+
+	/**
+	 * @return true if the current transaction supports XA resources
+	 */
+	boolean supportsXA();
+
+	/**
+	 * @return true if the current transaction supports Local resources
+	 */
+	boolean supportsLocal();
+
+	/**
+	 * Register an XA resource with the current transaction
+	 * 
+	 * @param resource
+	 * @throws IllegalStateException if no transaction is active, or the current
+	 *             transaction is not XA capable
+	 */
+	void registerXAResource(XAResource resource) throws IllegalStateException;
+
+	/**
+	 * Register an XA resource with the current transaction
+	 * 
+	 * @param resource
+	 * @throws IllegalStateException if no transaction is active, or the current
+	 *             transaction is not XA capable
+	 */
+	void registerLocalResource(LocalResource resource)
+			throws IllegalStateException;
+}

Added: aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/TransactionControl.java
URL: http://svn.apache.org/viewvc/aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/TransactionControl.java?rev=1730592&view=auto
==============================================================================
--- aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/TransactionControl.java (added)
+++ aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/TransactionControl.java Mon Feb 15 18:29:30 2016
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) OSGi Alliance (2016). All Rights Reserved.
+ * 
+ * Licensed 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.osgi.service.transaction.control;
+
+/**
+ * The interface used by clients to control the active transaction context
+ */
+public interface TransactionControl extends TransactionStarter {
+
+	/**
+	 * Build a transaction context to surround a piece of transactional work
+	 * 
+	 * @param propagation The transaction propagation to use
+	 * @return A builder to complete the creation of the transaction
+	 */
+	TransactionBuilder build();
+
+	/**
+	 * @return true if a transaction is currently active
+	 */
+	boolean activeTransaction();
+
+	/**
+	 * @return true if a transaction is currently active, or if there is a
+	 *         "no transaction" context active
+	 */
+	boolean activeScope();
+
+	/**
+	 * @return The current transaction context, which may be a "no transaction"
+	 *         context, or null if there is no active context
+	 */
+	TransactionContext getCurrentContext();
+
+	/**
+	 * Gets the rollback status of the active transaction
+	 * 
+	 * @return true if the transaction is marked for rollback
+	 * @throws IllegalStateException if no transaction is active
+	 */
+	boolean getRollbackOnly() throws IllegalStateException;
+
+	/**
+	 * Marks the current transaction to be rolled back
+	 * 
+	 * @throws IllegalStateException if no transaction is active
+	 */
+	void setRollbackOnly() throws IllegalStateException;
+
+	/**
+	 * Marks that the current transaction should not be rolled back if the
+	 * supplied Exception is thrown by the current transactional work
+	 * 
+	 * @param t The exception to ignore
+	 * @throws IllegalStateException if no transaction is active
+	 */
+	void ignoreException(Throwable t) throws IllegalStateException;
+}

Added: aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/TransactionException.java
URL: http://svn.apache.org/viewvc/aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/TransactionException.java?rev=1730592&view=auto
==============================================================================
--- aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/TransactionException.java (added)
+++ aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/TransactionException.java Mon Feb 15 18:29:30 2016
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) OSGi Alliance (2016). All Rights Reserved.
+ * 
+ * Licensed 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.osgi.service.transaction.control;
+
+/**
+ * An Exception indicating that there was a problem with starting, finishing,
+ * suspending or resuming a transaction
+ */
+public class TransactionException extends RuntimeException {
+
+	/**
+	 * Creates a new TransactionException with the supplied message
+	 * 
+	 * @param message
+	 */
+	public TransactionException(String message) {
+		super(message);
+	}
+
+	/**
+	 * Creates a new TransactionException with the supplied message and cause
+	 * 
+	 * @param message
+	 * @param cause
+	 */
+	public TransactionException(String message, Throwable cause) {
+		super(message, cause);
+	}
+
+	private static final long serialVersionUID = 5207030182661816993L;
+
+}

Added: aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/TransactionRolledBackException.java
URL: http://svn.apache.org/viewvc/aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/TransactionRolledBackException.java?rev=1730592&view=auto
==============================================================================
--- aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/TransactionRolledBackException.java (added)
+++ aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/TransactionRolledBackException.java Mon Feb 15 18:29:30 2016
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) OSGi Alliance (2016). All Rights Reserved.
+ * 
+ * Licensed 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.osgi.service.transaction.control;
+
+/**
+ * An Exception indicating that the active transaction was rolled back
+ */
+public class TransactionRolledBackException extends TransactionException {
+
+	/**
+	 * Create a new {@link TransactionRolledBackException} with the supplied
+	 * message
+	 * 
+	 * @param message
+	 */
+	public TransactionRolledBackException(String message) {
+		super(message);
+	}
+
+	/**
+	 * Create a new {@link TransactionRolledBackException} with the supplied
+	 * message
+	 * 
+	 * @param cause
+	 * @param message
+	 */
+	public TransactionRolledBackException(String message, Throwable cause) {
+		super(message, cause);
+
+	}
+
+	private static final long serialVersionUID = -4144455511452441543L;
+
+}

Added: aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/TransactionStarter.java
URL: http://svn.apache.org/viewvc/aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/TransactionStarter.java?rev=1730592&view=auto
==============================================================================
--- aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/TransactionStarter.java (added)
+++ aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/TransactionStarter.java Mon Feb 15 18:29:30 2016
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) OSGi Alliance (2016). All Rights Reserved.
+ * 
+ * Licensed 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.osgi.service.transaction.control;
+
+import java.util.concurrent.Callable;
+
+/**
+ * Implementations of this interface are able to run a piece of work within a
+ * transaction
+ */
+public interface TransactionStarter {
+	/**
+	 * A transaction is required to run the supplied piece of work. If no
+	 * transaction is active then it must be started and associated with the
+	 * work and then completed after the transactional work has finished.
+	 * 
+	 * @param work
+	 * @return The value returned by the work
+	 * @throws TransactionException if there is an error starting or completing
+	 *             the transaction
+	 * @throws TransactionRolledBackException if the transaction rolled back due
+	 *             to a failure
+	 */
+	<T> T required(Callable<T> work)
+			throws TransactionException, TransactionRolledBackException;
+
+	/**
+	 * A new transaction is required to run the supplied piece of work. If an
+	 * existing transaction is active then it must suspended and a new
+	 * transaction started and associated with the work. After the work has
+	 * completed the new transaction must also complete and any suspended
+	 * transaction be resumed.
+	 * 
+	 * @param work
+	 * @return The value returned by the work
+	 * @throws TransactionException if there is an error starting or completing
+	 *             the transaction
+	 * @throws TransactionRolledBackException if the transaction rolled back due
+	 *             to a failure
+	 */
+	<T> T requiresNew(Callable<T> work)
+			throws TransactionException, TransactionRolledBackException;
+
+	/**
+	 * The supplied piece of work must be run outside the context of a
+	 * transaction. If an existing transaction is active then it must be
+	 * suspended and a "no transaction" context associated with the work. After
+	 * the work has completed any suspended transaction must be resumed.
+	 * <p>
+	 * The "no transaction" context does not support resource enlistment, and
+	 * will not commit or rollback any changes, however it does provide a post
+	 * completion callback to any registered functions. This function is
+	 * suitable for final cleanup, such as closing a connection
+	 * 
+	 * @param work
+	 * @return The value returned by the work
+	 * @throws TransactionException if there is an error starting or completing
+	 *             the transaction
+	 */
+	<T> T notSupported(Callable<T> work) throws TransactionException;
+
+	/**
+	 * The supplied piece of work may run inside or outside the context of a
+	 * transaction. If an existing transaction or "no transaction" context is
+	 * active then it will continue, otherwise a new "no transaction" context is
+	 * associated with the work. After the work has completed any created
+	 * transaction context must be completed.
+	 * <p>
+	 * The "no transaction" context does not support resource enlistment, and
+	 * will not commit or rollback any changes, however it does provide a post
+	 * completion callback to any registered functions. This function is
+	 * suitable for final cleanup, such as closing a connection
+	 * 
+	 * @param work
+	 * @return The value returned by the work
+	 * @throws TransactionException if there is an error starting or completing
+	 *             the transaction
+	 */
+	<T> T supports(Callable<T> work) throws TransactionException;
+
+
+}

Added: aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/TransactionStatus.java
URL: http://svn.apache.org/viewvc/aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/TransactionStatus.java?rev=1730592&view=auto
==============================================================================
--- aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/TransactionStatus.java (added)
+++ aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/TransactionStatus.java Mon Feb 15 18:29:30 2016
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) OSGi Alliance (2016). All Rights Reserved.
+ * 
+ * Licensed 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.osgi.service.transaction.control;
+
+/**
+ * The status of the transaction
+ * 
+ * A transaction may not enter all of the states in this enum, however it will always
+ * traverse the enum in ascending order. In particular if the TransactionStatus is 
+ * reported as X then it will never proceed into a state Y where X.compareTo(Y) >= 0;
+ *
+ */
+public enum TransactionStatus {
+
+	/**
+	 * No transaction is currently active
+	 */
+	NO_TRANSACTION,
+	/**
+	 * A transaction is currently in progress
+	 */
+	ACTIVE,
+	/**
+	 * A transaction is currently in progress and has been marked for rollback
+	 */
+	MARKED_ROLLBACK,
+	/**
+	 * A two phase commit is occurring and the transaction is being prepared
+	 */
+	PREPARING,
+	/**
+	 * A two phase commit is occurring and the transaction has been prepared
+	 */
+	PREPARED,
+	/**
+	 * The transaction is in the process of being committed
+	 */
+	COMMITTING,
+	/**
+	 * The transaction has committed
+	 */
+	COMMITTED,
+	/**
+	 * The transaction is in the process of rolling back
+	 */
+	ROLLING_BACK,
+	/**
+	 * The transaction has been rolled back
+	 */
+	ROLLED_BACK;
+}

Added: aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/jdbc/JDBCConnectionProvider.java
URL: http://svn.apache.org/viewvc/aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/jdbc/JDBCConnectionProvider.java?rev=1730592&view=auto
==============================================================================
--- aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/jdbc/JDBCConnectionProvider.java (added)
+++ aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/jdbc/JDBCConnectionProvider.java Mon Feb 15 18:29:30 2016
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) OSGi Alliance (2016). All Rights Reserved.
+ * 
+ * Licensed 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.osgi.service.transaction.control.jdbc;
+
+import java.sql.Connection;
+
+import org.osgi.service.transaction.control.ResourceProvider;
+
+/**
+ * A specialised {@link ResourceProvider} suitable for obtaining JDBC
+ * connections.
+ * <p>
+ * Instances of this interface may be available in the Service Registry, or can
+ * be created using a {@link JDBCConnectionProviderFactory}.
+ */
+public interface JDBCConnectionProvider extends ResourceProvider<Connection> {
+	/**
+	 * This interface specialises the ResourceProvider for creating JDBC
+	 * connections
+	 */
+}

Added: aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/jdbc/JDBCConnectionProviderFactory.java
URL: http://svn.apache.org/viewvc/aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/jdbc/JDBCConnectionProviderFactory.java?rev=1730592&view=auto
==============================================================================
--- aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/jdbc/JDBCConnectionProviderFactory.java (added)
+++ aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/jdbc/JDBCConnectionProviderFactory.java Mon Feb 15 18:29:30 2016
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) OSGi Alliance (2016). All Rights Reserved.
+ * 
+ * Licensed 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.osgi.service.transaction.control.jdbc;
+
+import java.sql.Driver;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.sql.DataSource;
+import javax.sql.XADataSource;
+
+import org.osgi.service.jdbc.DataSourceFactory;
+
+/**
+ * A factory for creating JDBCConnectionProvider instances
+ * <p>
+ * This factory can be used if the {@link JDBCConnectionProvider} should not be
+ * a public service, for example to protect a username/password.
+ */
+public interface JDBCConnectionProviderFactory {
+
+	/**
+	 * The property used to determine whether XA enlistment is enabled for this
+	 * resource provider
+	 */
+	public static final String	XA_ENLISTMENT_ENABLED		= "osgi.xa.enabled";
+
+	/**
+	 * The property used to determine whether local enlistment is enabled for
+	 * this resource provider
+	 */
+	public static final String	LOCAL_ENLISTMENT_ENABLED	= "osgi.local.enabled";
+
+	/**
+	 * The property used to determine whether connection pooling is enabled for
+	 * this resource provider
+	 */
+	public static final String	CONNECTION_POOLING_ENABLED	= "osgi.connection.pooling.enabled";
+
+	/**
+	 * The property used to set the maximum amount of time that the pool should
+	 * wait for a connection
+	 */
+	public static final String	CONNECTION_TIMEOUT			= "osgi.connection.timeout";
+
+	/**
+	 * The property used to set the maximum amount of time that connections in
+	 * the pool should remain idle before being closed
+	 */
+	public static final String	IDLE_TIMEOUT				= "osgi.idle.timeout";
+
+	/**
+	 * The property used to set the maximum amount of time that connections in
+	 * the pool should remain open
+	 */
+	public static final String	CONNECTION_LIFETIME			= "osgi.connection.lifetime";
+
+	/**
+	 * The property used to set the minimum number of connections that should be
+	 * held in the pool
+	 */
+	public static final String	MIN_CONNECTIONS				= "osgi.connection.min";
+
+	/**
+	 * The property used to set the maximum number of connections that should be
+	 * held in the pool
+	 */
+	public static final String	MAX_CONNECTIONS				= "osgi.connection.max";
+
+	/**
+	 * The property used to set the maximum number of connections that should be
+	 * held in the pool
+	 */
+	public static final String	USE_DRIVER					= "osgi.use.driver";
+
+	/**
+	 * Create a private {@link JDBCConnectionProvider} using a
+	 * DataSourceFactory.
+	 * 
+	 * @param dsf
+	 * @param jdbcProperties The properties to pass to the
+	 *            {@link DataSourceFactory} in order to create the underlying
+	 *            {@link DataSource}
+	 * @param resourceProviderProperties Configuration properties to pass to the
+	 *            JDBC Resource Provider runtime
+	 * @return A {@link JDBCConnectionProvider} that can be used in transactions
+	 */
+	JDBCConnectionProvider getProviderFor(DataSourceFactory dsf,
+			Properties jdbcProperties,
+			Map<String,Object> resourceProviderProperties);
+
+	/**
+	 * Create a private {@link JDBCConnectionProvider} using an existing
+	 * {@link DataSource}.
+	 * 
+	 * @param ds
+	 * @param resourceProviderProperties Configuration properties to pass to the
+	 *            JDBC Resource Provider runtime
+	 * @return A {@link JDBCConnectionProvider} that can be used in transactions
+	 */
+	JDBCConnectionProvider getProviderFor(DataSource ds,
+			Map<String,Object> resourceProviderProperties);
+
+	/**
+	 * Create a private {@link JDBCConnectionProvider} using an existing
+	 * {@link Driver}.
+	 * 
+	 * @param driver
+	 * @param resourceProviderProperties Configuration properties to pass to the
+	 *            JDBC Resource Provider runtime
+	 * @return A {@link JDBCConnectionProvider} that can be used in transactions
+	 */
+	JDBCConnectionProvider getProviderFor(Driver driver,
+			Map<String,Object> resourceProviderProperties);
+
+	/**
+	 * Create a private {@link JDBCConnectionProvider} using an existing
+	 * {@link XADataSource}.
+	 * 
+	 * @param ds
+	 * @param resourceProviderProperties Configuration properties to pass to the
+	 *            JDBC Resource Provider runtime
+	 * @return A {@link JDBCConnectionProvider} that can be used in transactions
+	 */
+	JDBCConnectionProvider getProviderFor(XADataSource ds,
+			Map<String,Object> resourceProviderProperties);
+
+}

Added: aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/jdbc/packageinfo
URL: http://svn.apache.org/viewvc/aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/jdbc/packageinfo?rev=1730592&view=auto
==============================================================================
--- aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/jdbc/packageinfo (added)
+++ aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/jdbc/packageinfo Mon Feb 15 18:29:30 2016
@@ -0,0 +1 @@
+version 0.0.1.SNAPSHOT

Added: aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/jpa/JPAEntityManagerProvider.java
URL: http://svn.apache.org/viewvc/aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/jpa/JPAEntityManagerProvider.java?rev=1730592&view=auto
==============================================================================
--- aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/jpa/JPAEntityManagerProvider.java (added)
+++ aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/jpa/JPAEntityManagerProvider.java Mon Feb 15 18:29:30 2016
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) OSGi Alliance (2016). All Rights Reserved.
+ * 
+ * Licensed 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.osgi.service.transaction.control.jpa;
+
+import javax.persistence.EntityManager;
+
+import org.osgi.service.transaction.control.ResourceProvider;
+
+/**
+ * A specialised {@link ResourceProvider} suitable for obtaining JPA
+ * {@link EntityManager} instances.
+ * <p>
+ * Instances of this interface may be available in the Service Registry, or can
+ * be created using a {@link JPAEntityManagerProviderFactory}.
+ */
+public interface JPAEntityManagerProvider extends ResourceProvider<EntityManager> {
+	/**
+	 * This interface specialises the ResourceProvider for creating JPA
+	 * {@link EntityManager} instances
+	 */
+}

Added: aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/jpa/JPAEntityManagerProviderFactory.java
URL: http://svn.apache.org/viewvc/aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/jpa/JPAEntityManagerProviderFactory.java?rev=1730592&view=auto
==============================================================================
--- aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/jpa/JPAEntityManagerProviderFactory.java (added)
+++ aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/jpa/JPAEntityManagerProviderFactory.java Mon Feb 15 18:29:30 2016
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) OSGi Alliance (2016). All Rights Reserved.
+ * 
+ * Licensed 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.osgi.service.transaction.control.jpa;
+
+import java.util.Map;
+
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+
+import org.osgi.service.jpa.EntityManagerFactoryBuilder;
+import org.osgi.service.transaction.control.jdbc.JDBCConnectionProvider;
+
+/**
+ * A factory for creating JDBCConnectionProvider instances
+ * <p>
+ * This factory can be used if the {@link JDBCConnectionProvider} should not be
+ * a public service, for example to protect a username/password.
+ */
+public interface JPAEntityManagerProviderFactory {
+
+	/**
+	 * The property used to determine whether XA enlistment is enabled for this
+	 * resource provider
+	 */
+	public static final String	XA_ENLISTMENT_ENABLED		= "osgi.xa.enabled";
+
+	/**
+	 * The property used to determine whether local enlistment is enabled for
+	 * this resource provider
+	 */
+	public static final String	LOCAL_ENLISTMENT_ENABLED	= "osgi.local.enabled";
+
+	/**
+	 * The property used to provide a {@link JDBCConnectionProvider} to the
+	 * resource provider. This will be converted into a DataSource by the
+	 * factory, and passed to the {@link EntityManagerFactoryBuilder} using the
+	 * javax.persistence.jtaDataSource property
+	 */
+	public static final String	TRANSACTIONAL_DB_CONNECTION	= "osgi.jdbc.provider";
+
+	/**
+	 * Create a private {@link JPAEntityManagerProvider} using an
+	 * {@link EntityManagerFactoryBuilder}
+	 * 
+	 * @param emfb
+	 * @param jpaProperties The properties to pass to the
+	 *            {@link EntityManagerFactoryBuilder} in order to create the
+	 *            underlying {@link EntityManagerFactory} and
+	 *            {@link EntityManager} instances
+	 * @param resourceProviderProperties Configuration properties to pass to the
+	 *            JPA Resource Provider runtime
+	 * @return A {@link JPAEntityManagerProvider} that can be used in
+	 *         transactions
+	 */
+	JPAEntityManagerProvider getProviderFor(EntityManagerFactoryBuilder emfb,
+			Map<String,Object> jpaProperties,
+			Map<String,Object> resourceProviderProperties);
+
+	/**
+	 * Create a private {@link JPAEntityManagerProvider} using an existing
+	 * {@link EntityManagerFactory}.
+	 * 
+	 * @param emf
+	 * @param jpaProperties The properties to pass to the
+	 *            {@link EntityManagerFactory} in order to create the underlying
+	 *            {@link EntityManager} instances
+	 * @param resourceProviderProperties Configuration properties to pass to the
+	 *            JDBC Resource Provider runtime
+	 * @return A {@link JPAEntityManagerProvider} that can be used in
+	 *         transactions
+	 */
+	JPAEntityManagerProvider getProviderFor(EntityManagerFactory emf,
+			Map<String,Object> jpaProperties,
+			Map<String,Object> resourceProviderProperties);
+
+}

Added: aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/jpa/packageinfo
URL: http://svn.apache.org/viewvc/aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/jpa/packageinfo?rev=1730592&view=auto
==============================================================================
--- aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/jpa/packageinfo (added)
+++ aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/jpa/packageinfo Mon Feb 15 18:29:30 2016
@@ -0,0 +1 @@
+version 0.0.1.SNAPSHOT

Added: aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/package-info.java
URL: http://svn.apache.org/viewvc/aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/package-info.java?rev=1730592&view=auto
==============================================================================
--- aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/package-info.java (added)
+++ aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/package-info.java Mon Feb 15 18:29:30 2016
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) OSGi Alliance (2016). All Rights Reserved.
+ * 
+ * Licensed 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.
+ */
+
+/**
+ * Transaction Control Service Package Version 1.0.
+ * <p>
+ * Bundles wishing to use this package must list the package in the
+ * Import-Package header of the bundle's manifest. This package has two types of
+ * users: the consumers that use the API in this package and the providers that
+ * implement the API in this package.
+ * <p>
+ * Example import for consumers using the API in this package:
+ * <p>
+ * {@code  Import-Package: org.osgi.service.transaction.control; version="[1.0,2.0)"}
+ * <p>
+ * Example import for providers implementing the API in this package:
+ * <p>
+ * {@code  Import-Package: org.osgi.service.transaction.control; version="[1.0,1.1)"}
+ * 
+ * @version 1.0
+ * @author $Id:
+ */
+
+@org.osgi.annotation.versioning.Version("0.0.1.SNAPSHOT")
+package org.osgi.service.transaction.control;
+

Added: aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/packageinfo
URL: http://svn.apache.org/viewvc/aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/packageinfo?rev=1730592&view=auto
==============================================================================
--- aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/packageinfo (added)
+++ aries/trunk/tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/packageinfo Mon Feb 15 18:29:30 2016
@@ -0,0 +1 @@
+version 0.0.1.SNAPSHOT