You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sl...@apache.org on 2010/01/21 22:38:01 UTC

svn commit: r901868 [1/2] - in /tuscany/sca-java-2.x/trunk/modules/policy-transaction: ./ META-INF/ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/tuscany/ src/main/java/org/apache/tuscany/sca/ src/m...

Author: slaws
Date: Thu Jan 21 21:38:00 2010
New Revision: 901868

URL: http://svn.apache.org/viewvc?rev=901868&view=rev
Log:
TUSCANY-3433 - add policy transaction from 1.x. Different here is that code is changed to match 2.x SPI and the "runtime" parts are in a separate package. 

Added:
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/LICENSE   (with props)
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/META-INF/
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/META-INF/MANIFEST.MF
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/NOTICE   (with props)
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/pom.xml   (with props)
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicy.java   (with props)
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyImpl.java   (with props)
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyProcessor.java   (with props)
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/IncompatibleIntentException.java   (with props)
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionImplementationPolicyProvider.java   (with props)
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionIntent.java   (with props)
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionInterceptor.java   (with props)
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionManagerHelper.java   (with props)
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionManagerWrapper.java   (with props)
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionModuleActivator.java   (with props)
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionPolicyProviderFactory.java   (with props)
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionReferencePolicyProvider.java   (with props)
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionServicePolicyProvider.java   (with props)
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionalAction.java   (with props)
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/resources/
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/resources/META-INF/
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/resources/META-INF/services/
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.xml.Definitions
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/resources/log4j.properties   (with props)
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/resources/org/
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/resources/org/apache/
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/resources/org/apache/tuscany/
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/resources/org/apache/tuscany/sca/
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/resources/org/apache/tuscany/sca/policy/
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/resources/org/apache/tuscany/sca/policy/transaction/
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/resources/org/apache/tuscany/sca/policy/transaction/definitions.xml   (with props)
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/test/
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/test/java/
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/test/java/org/
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/test/java/org/apache/
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/test/java/org/apache/tuscany/
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/test/java/org/apache/tuscany/sca/
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/test/java/org/apache/tuscany/sca/policy/
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/test/java/org/apache/tuscany/sca/policy/transaction/
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/test/java/org/apache/tuscany/sca/policy/transaction/PolicyReadTestCase.java   (with props)
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/test/java/org/apache/tuscany/sca/policy/transaction/runtime/
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/test/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionManagerHelperTestCaseOFF.java   (with props)
    tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/test/resources/

Added: tuscany/sca-java-2.x/trunk/modules/policy-transaction/LICENSE
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/policy-transaction/LICENSE?rev=901868&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/policy-transaction/LICENSE (added)
+++ tuscany/sca-java-2.x/trunk/modules/policy-transaction/LICENSE Thu Jan 21 21:38:00 2010
@@ -0,0 +1,205 @@
+
+                                 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.
+
+
+

Propchange: tuscany/sca-java-2.x/trunk/modules/policy-transaction/LICENSE
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sca-java-2.x/trunk/modules/policy-transaction/LICENSE
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: tuscany/sca-java-2.x/trunk/modules/policy-transaction/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/policy-transaction/META-INF/MANIFEST.MF?rev=901868&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/policy-transaction/META-INF/MANIFEST.MF (added)
+++ tuscany/sca-java-2.x/trunk/modules/policy-transaction/META-INF/MANIFEST.MF Thu Jan 21 21:38:00 2010
@@ -0,0 +1,31 @@
+Manifest-Version: 1.0
+SCA-Version: 1.1
+Bundle-Name: Apache Tuscany Transaction Policy Model
+Bundle-Vendor: The Apache Software Foundation
+Bundle-Version: 2.0.0
+Bundle-ManifestVersion: 2
+Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
+Bundle-Description: Apache Tuscany Security Policy Model
+Import-Package: javax.security.auth.callback,
+ javax.security.auth.login,
+ javax.xml.namespace,
+ javax.xml.stream,
+ org.apache.tuscany.sca.assembly;version="2.0.0",
+ org.apache.tuscany.sca.contribution.processor;version="2.0.0",
+ org.apache.tuscany.sca.contribution.resolver;version="2.0.0",
+ org.apache.tuscany.sca.core;version="2.0.0",
+ org.apache.tuscany.sca.definitions;version="2.0.0",
+ org.apache.tuscany.sca.definitions.util;version="2.0.0",
+ org.apache.tuscany.sca.interfacedef;version="2.0.0",
+ org.apache.tuscany.sca.invocation;version="2.0.0",
+ org.apache.tuscany.sca.monitor;version="2.0.0",
+ org.apache.tuscany.sca.policy;version="2.0.0",
+ org.apache.tuscany.sca.policy.transaction;version="2.0.0",
+ org.apache.tuscany.sca.policy.util;version="2.0.0",
+ org.apache.tuscany.sca.provider;version="2.0.0",
+ org.apache.tuscany.sca.runtime;version="2.0.0",
+ org.oasisopen.sca;version="2.0.0"
+Bundle-SymbolicName: org.apache.tuscany.sca.policy.transaction
+Bundle-DocURL: http://www.apache.org/
+Bundle-RequiredExecutionEnvironment: J2SE-1.5,JavaSE-1.6
+Export-Package: org.apache.tuscany.sca.policy.transaction;version="2.0.0"

Added: tuscany/sca-java-2.x/trunk/modules/policy-transaction/NOTICE
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/policy-transaction/NOTICE?rev=901868&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/policy-transaction/NOTICE (added)
+++ tuscany/sca-java-2.x/trunk/modules/policy-transaction/NOTICE Thu Jan 21 21:38:00 2010
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2009 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+

Propchange: tuscany/sca-java-2.x/trunk/modules/policy-transaction/NOTICE
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sca-java-2.x/trunk/modules/policy-transaction/NOTICE
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: tuscany/sca-java-2.x/trunk/modules/policy-transaction/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/policy-transaction/pom.xml?rev=901868&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/policy-transaction/pom.xml (added)
+++ tuscany/sca-java-2.x/trunk/modules/policy-transaction/pom.xml Thu Jan 21 21:38:00 2010
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    * Licensed to the Apache Software Foundation (ASF) under one
+    * or more contributor license agreements.  See the NOTICE file
+    * distributed with this work for additional information
+    * regarding copyright ownership.  The ASF licenses this file
+    * to you under the Apache License, Version 2.0 (the
+    * "License"); you may not use this file except in compliance
+    * with the License.  You may obtain a copy of the License at
+    * 
+    *   http://www.apache.org/licenses/LICENSE-2.0
+    * 
+    * Unless required by applicable law or agreed to in writing,
+    * software distributed under the License is distributed on an
+    * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    * KIND, either express or implied.  See the License for the
+    * specific language governing permissions and limitations
+    * under the License.    
+-->
+<project>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.tuscany.sca</groupId>
+        <artifactId>tuscany-modules</artifactId>
+        <version>2.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <artifactId>tuscany-policy-transaction</artifactId>
+    <name>Apache Tuscany SCA Transaction Policy Model</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-assembly-xml</artifactId>
+            <version>2.0-SNAPSHOT</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-contribution</artifactId>
+            <version>2.0-SNAPSHOT</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.components</groupId>
+            <artifactId>geronimo-transaction</artifactId>
+            <version>2.1.1</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.components</groupId>
+            <artifactId>geronimo-connector</artifactId>
+            <version>2.1.1</version>
+        </dependency>
+        
+    </dependencies>
+
+</project>

Propchange: tuscany/sca-java-2.x/trunk/modules/policy-transaction/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sca-java-2.x/trunk/modules/policy-transaction/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: tuscany/sca-java-2.x/trunk/modules/policy-transaction/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicy.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicy.java?rev=901868&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicy.java (added)
+++ tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicy.java Thu Jan 21 21:38:00 2010
@@ -0,0 +1,49 @@
+/*
+ * 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.tuscany.sca.policy.transaction;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.xml.Constants;
+
+/**
+ * The model for Tuscany transaction policy. 
+ * 
+ * @version $Rev$ $Date$
+ */
+public interface TransactionPolicy {
+    QName NAME = new QName(Constants.SCA11_TUSCANY_NS, "transactionPolicy");
+
+    enum Action {
+        PROPAGATE, 
+        SUSPEND, 
+        REQUIRE_GLOBAL, 
+        REQUIRE_LOCAL, 
+        REQUIRE_NONE
+    };
+
+    int getTransactionTimeout();
+
+    void setTransactionTimeout(int seconds);
+
+    void setAction(Action action);
+
+    Action getAction();
+}

Propchange: tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicy.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyImpl.java?rev=901868&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyImpl.java (added)
+++ tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyImpl.java Thu Jan 21 21:38:00 2010
@@ -0,0 +1,59 @@
+/*
+ * 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.tuscany.sca.policy.transaction;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TransactionPolicyImpl implements TransactionPolicy {
+    private boolean unresolved;
+    private int transactionTimeout = 1200;
+    private Action action = Action.PROPAGATE;
+
+    public int getTransactionTimeout() {
+        return transactionTimeout;
+    }
+
+    public void setTransactionTimeout(int transactionTimeout) {
+        this.transactionTimeout = transactionTimeout;
+    }
+
+    public Action getAction() {
+        return action;
+    }
+
+    public void setAction(Action policy) {
+        this.action = policy;
+    }
+
+    public QName getSchemaName() {
+        return NAME;
+    }
+
+    public boolean isUnresolved() {
+        return unresolved;
+    }
+
+    public void setUnresolved(boolean unresolved) {
+        this.unresolved = unresolved;
+    }
+}

Propchange: tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyProcessor.java?rev=901868&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyProcessor.java (added)
+++ tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyProcessor.java Thu Jan 21 21:38:00 2010
@@ -0,0 +1,98 @@
+/*
+ * 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.tuscany.sca.policy.transaction;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.contribution.processor.ContributionReadException;
+import org.apache.tuscany.sca.contribution.processor.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.processor.ContributionWriteException;
+import org.apache.tuscany.sca.contribution.processor.ProcessorContext;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.core.FactoryExtensionPoint;
+
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TransactionPolicyProcessor implements StAXArtifactProcessor<TransactionPolicy> {
+    public static final String TIMEOUT = "transactionTimeout";
+    public static final String ACTION = "action";
+    
+    public QName getArtifactType() {
+        return TransactionPolicy.NAME;
+    }
+
+    public TransactionPolicyProcessor(FactoryExtensionPoint modelFactories) {
+    }
+
+    public TransactionPolicy read(XMLStreamReader reader, ProcessorContext context) throws ContributionReadException, XMLStreamException {
+        TransactionPolicy txPolicy = new TransactionPolicyImpl();
+        int event = reader.getEventType();
+        while (reader.hasNext()) {
+            event = reader.getEventType();
+            switch (event) {
+                case START_ELEMENT: {
+                    String timeout = reader.getAttributeValue(null, TIMEOUT);
+                    if (timeout != null) {
+                        txPolicy.setTransactionTimeout(Integer.parseInt(timeout));
+                    }
+                    String action = reader.getAttributeValue(null, ACTION);
+                    if (action != null) {
+                        txPolicy.setAction(TransactionPolicy.Action.valueOf(action));
+                    }
+                    break;
+                }
+            }
+
+            if (event == END_ELEMENT) {
+                if (TransactionPolicy.NAME.equals(reader.getName())) {
+                    break;
+                }
+            }
+
+            //Read the next element
+            if (reader.hasNext()) {
+                reader.next();
+            }
+        }
+
+        return txPolicy;
+    }
+
+    public void write(TransactionPolicy policy, XMLStreamWriter writer, ProcessorContext context) throws ContributionWriteException,
+        XMLStreamException {
+        // TODO 
+    }
+
+    public Class<TransactionPolicy> getModelType() {
+        return TransactionPolicy.class;
+    }
+
+    public void resolve(TransactionPolicy policy, ModelResolver resolver, ProcessorContext context) throws ContributionResolveException {
+        // TODO
+    }
+}

Propchange: tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyProcessor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyProcessor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/IncompatibleIntentException.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/IncompatibleIntentException.java?rev=901868&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/IncompatibleIntentException.java (added)
+++ tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/IncompatibleIntentException.java Thu Jan 21 21:38:00 2010
@@ -0,0 +1,44 @@
+/*
+ * 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.tuscany.sca.policy.transaction.runtime;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class IncompatibleIntentException extends Exception {
+    private static final long serialVersionUID = -2993825019200280397L;
+
+    public IncompatibleIntentException() {
+        super();
+    }
+
+    public IncompatibleIntentException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public IncompatibleIntentException(String message) {
+        super(message);
+    }
+
+    public IncompatibleIntentException(Throwable cause) {
+        super(cause);
+    }
+
+}

Propchange: tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/IncompatibleIntentException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/IncompatibleIntentException.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionImplementationPolicyProvider.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionImplementationPolicyProvider.java?rev=901868&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionImplementationPolicyProvider.java (added)
+++ tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionImplementationPolicyProvider.java Thu Jan 21 21:38:00 2010
@@ -0,0 +1,65 @@
+/*
+ * 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.tuscany.sca.policy.transaction.runtime;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Phase;
+import org.apache.tuscany.sca.invocation.PhasedInterceptor;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.transaction.TransactionPolicy;
+import org.apache.tuscany.sca.provider.BasePolicyProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TransactionImplementationPolicyProvider extends BasePolicyProvider<TransactionPolicy> {
+    private TransactionManagerHelper helper;
+    private List<PolicySet> policySets;
+    private RuntimeComponent component;
+
+    public TransactionImplementationPolicyProvider(TransactionManagerHelper helper, RuntimeComponent component) {
+        super(TransactionPolicy.class, component);
+        this.helper = helper;
+        this.policySets = component.getPolicySets();
+    }
+
+    public PhasedInterceptor createInterceptor(Operation operation) {
+/* TODO - 2.x better way of doing this in 2.x */
+        for (PolicySet policySet : policySets) {
+            for (Object p : policySet.getPolicies()) {
+                if (p instanceof TransactionPolicy) {
+                    TransactionInterceptor interceptor =
+                        new TransactionInterceptor(helper, false, (TransactionPolicy)p, null);
+                    return interceptor;
+                }
+            }
+        }
+     
+        return null;
+    }
+
+    public String getPhase() {
+        return Phase.IMPLEMENTATION_POLICY;
+    }
+
+}

Propchange: tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionImplementationPolicyProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionImplementationPolicyProvider.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionIntent.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionIntent.java?rev=901868&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionIntent.java (added)
+++ tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionIntent.java Thu Jan 21 21:38:00 2010
@@ -0,0 +1,35 @@
+/*
+ * 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.tuscany.sca.policy.transaction.runtime;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public enum TransactionIntent {
+    managedTransactionLocal, 
+    managedTransactionGlobal, 
+    noManagedTransaction, 
+    propagatesTransacton, 
+    suspendsTransaction, 
+    transactedOneWay, 
+    immediateOneWay,
+    managedSharedTransaction
+}

Propchange: tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionIntent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionIntent.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionInterceptor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionInterceptor.java?rev=901868&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionInterceptor.java (added)
+++ tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionInterceptor.java Thu Jan 21 21:38:00 2010
@@ -0,0 +1,129 @@
+/*
+ * 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.tuscany.sca.policy.transaction.runtime;
+
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.invocation.PhasedInterceptor;
+import org.apache.tuscany.sca.policy.transaction.TransactionPolicy;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TransactionInterceptor implements PhasedInterceptor {
+    private Invoker next;
+    private TransactionManagerHelper helper;
+    private boolean outbound;
+    private TransactionPolicy interactionPolicy;
+    private TransactionPolicy implementationPolicy;
+
+    public TransactionInterceptor(TransactionManagerHelper helper,
+                                  boolean outbound,
+                                  TransactionPolicy interactionPolicy,
+                                  TransactionPolicy implementationPolicy) {
+        super();
+        this.helper = helper;
+        this.outbound = outbound;
+        this.interactionPolicy = interactionPolicy;
+        this.implementationPolicy = implementationPolicy;
+    }
+
+    /**
+     * @see org.apache.tuscany.sca.invocation.Interceptor#getNext()
+     */
+    public Invoker getNext() {
+        return next;
+    }
+
+    /**
+     * @see org.apache.tuscany.sca.invocation.Interceptor#setNext(org.apache.tuscany.sca.invocation.Invoker)
+     */
+    public void setNext(Invoker next) {
+        this.next = next;
+    }
+
+    /**
+     * @see org.apache.tuscany.sca.invocation.Invoker#invoke(org.apache.tuscany.sca.invocation.Message)
+     */
+    public Message invoke(Message msg) {
+        TransactionalInvocation invocation = new TransactionalInvocation(next, msg);
+
+        Message result = null;
+        if (msg.getOperation().isNonBlocking()) {
+
+        }
+        TransactionIntent interactionIntent = TransactionIntent.propagatesTransacton;
+        if (interactionPolicy != null) {
+            if (interactionPolicy.getAction() == TransactionPolicy.Action.PROPAGATE) {
+                interactionIntent = TransactionIntent.propagatesTransacton;
+            } else {
+                interactionIntent = TransactionIntent.suspendsTransaction;
+            }
+        }
+        TransactionIntent implementationIntent = TransactionIntent.managedTransactionGlobal;
+        if (implementationPolicy != null) {
+            switch (implementationPolicy.getAction()) {
+                case REQUIRE_GLOBAL:
+                    implementationIntent = TransactionIntent.managedTransactionGlobal;
+                    break;
+                case REQUIRE_LOCAL:
+                    implementationIntent = TransactionIntent.managedTransactionLocal;
+                    break;
+                default:
+                    implementationIntent = TransactionIntent.noManagedTransaction;
+                    break;
+            }
+        }
+        try {
+            if (outbound) {
+                result = helper.handlesOutbound(interactionIntent, implementationIntent, invocation);
+            } else {
+                result = helper.handlesInbound(interactionIntent, implementationIntent, invocation);
+            }
+        } catch (Exception e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        return result;
+    }
+
+    private static class TransactionalInvocation implements TransactionalAction<Message> {
+        private final Invoker invoker;
+        private final Message message;
+
+        public TransactionalInvocation(Invoker invoker, Message message) {
+            super();
+            this.invoker = invoker;
+            this.message = message;
+        }
+
+        public Message run() throws Exception {
+            return invoker.invoke(message);
+        }
+
+    }
+    
+    public String getPhase() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+}

Propchange: tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionInterceptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionInterceptor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionManagerHelper.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionManagerHelper.java?rev=901868&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionManagerHelper.java (added)
+++ tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionManagerHelper.java Thu Jan 21 21:38:00 2010
@@ -0,0 +1,243 @@
+/*
+ * 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.tuscany.sca.policy.transaction.runtime;
+
+import java.lang.reflect.InvocationTargetException;
+
+import javax.transaction.HeuristicMixedException;
+import javax.transaction.HeuristicRollbackException;
+import javax.transaction.InvalidTransactionException;
+import javax.transaction.NotSupportedException;
+import javax.transaction.RollbackException;
+import javax.transaction.Status;
+import javax.transaction.SystemException;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TransactionManagerHelper {
+    // private static final Logger logger = Logger.getLogger(TransactionManagerHelper.class.getName());
+
+    private TransactionManager tm;
+
+    public TransactionManagerHelper(TransactionManager tm) {
+        super();
+        this.tm = tm;
+    }
+
+    public Transaction managedGlobalTransactionPreInvoke() throws SystemException, NotSupportedException {
+        int status = tm.getStatus();
+        if (status == Status.STATUS_COMMITTED || status == Status.STATUS_NO_TRANSACTION
+            || status == Status.STATUS_ROLLEDBACK) {
+            tm.begin();
+            return tm.getTransaction();
+        }
+        return null;
+    }
+
+    public void managedGlobalTransactionPostInvoke(Transaction created, boolean rollback)
+        throws InvalidTransactionException, IllegalStateException, SystemException, SecurityException,
+        HeuristicMixedException, HeuristicRollbackException, RollbackException {
+        if (created != null) {
+            int status = created.getStatus();
+            if (status == Status.STATUS_MARKED_ROLLBACK) {
+                created.rollback();
+            } else if (status == Status.STATUS_ACTIVE) {
+                if (rollback) {
+                    created.rollback();
+                } else {
+                    created.commit();
+                }
+            }
+        }
+    }
+
+    public Transaction suspendsTransactionPreInvoke() throws SystemException {
+        if (tm.getTransaction() != null) {
+            return tm.suspend();
+        } else {
+            return null;
+        }
+    }
+
+    public void suspendsTransactionPostInvoke(Transaction suspended) throws InvalidTransactionException,
+        IllegalStateException, SystemException {
+        if (suspended != null) {
+            tm.resume(suspended);
+        }
+    }
+
+    public TransactionManager getTransactionManager() {
+        return tm;
+    }
+
+    public void setTransactionManager(TransactionManager tm) {
+        this.tm = tm;
+    }
+
+    public void validateOneway(TransactionIntent onewayIntent, TransactionIntent implIntent)
+        throws IncompatibleIntentException {
+        if (onewayIntent == TransactionIntent.transactedOneWay) {
+            if (implIntent != TransactionIntent.managedTransactionGlobal) {
+                throw new IncompatibleIntentException(onewayIntent + "<-X->" + implIntent);
+            }
+        }
+    }
+
+    public void validateInbound(TransactionIntent serviceIntent, TransactionIntent implIntent)
+        throws IncompatibleIntentException {
+        if (serviceIntent == TransactionIntent.propagatesTransacton) {
+            if (implIntent != TransactionIntent.managedTransactionGlobal) {
+                throw new IncompatibleIntentException(serviceIntent + "<-X->" + implIntent);
+            }
+        }
+    }
+
+    public void validateOutbound(TransactionIntent referenceIntent, TransactionIntent implIntent)
+        throws IncompatibleIntentException {
+        if (referenceIntent == TransactionIntent.propagatesTransacton) {
+            if (implIntent != TransactionIntent.managedTransactionGlobal) {
+                throw new IncompatibleIntentException(referenceIntent + "<-X->" + implIntent);
+            }
+        }
+    }
+
+    public <T> T handlesOutbound(TransactionIntent referenceIntent,
+                                 TransactionIntent implIntent,
+                                 TransactionalAction<T> action) throws Exception {
+
+        if (implIntent == null) {
+            implIntent = TransactionIntent.noManagedTransaction;
+        }
+
+        if (referenceIntent == TransactionIntent.propagatesTransacton) {
+            if (implIntent != TransactionIntent.managedTransactionGlobal) {
+                throw new IncompatibleIntentException(referenceIntent + "<-X->" + implIntent);
+            } else {
+                // propagates the current TX
+                return run(action);
+            }
+        } else if (referenceIntent == TransactionIntent.suspendsTransaction) {
+            Transaction tx = suspendsTransactionPreInvoke();
+            try {
+                return run(action);
+            } finally {
+                suspendsTransactionPostInvoke(tx);
+            }
+        } else {
+            return run(action);
+        }
+    }
+
+    private <T> T run(TransactionalAction<T> action) throws Exception {
+        // Make sure a global TX is in place
+        Transaction tx = managedGlobalTransactionPreInvoke();
+        boolean rollback = false;
+        try {
+            return action.run();
+        } catch (InvocationTargetException e) {
+            throw e;
+        } catch (Throwable e) {
+            rollback = true;
+            if (e instanceof Error) {
+                throw (Error)e;
+            } else if (e instanceof RuntimeException) {
+                throw (RuntimeException)e;
+            } else {
+                throw (Exception)e;
+            }
+        } finally {
+            managedGlobalTransactionPostInvoke(tx, rollback);
+        }
+    }
+
+    public <T> T handlesInbound(TransactionIntent serviceIntent,
+                                TransactionIntent implIntent,
+                                TransactionalAction<T> action) throws Exception {
+        if (serviceIntent == null && implIntent == null) {
+            return run(action);
+        }
+
+        if (implIntent == null) {
+            implIntent = TransactionIntent.noManagedTransaction;
+        }
+
+        if (serviceIntent == TransactionIntent.propagatesTransacton) {
+            if (implIntent != TransactionIntent.managedTransactionGlobal) {
+                throw new IncompatibleIntentException(serviceIntent + "<-X->" + implIntent);
+            } else {
+                return run(action);
+            }
+        } else if (serviceIntent == TransactionIntent.suspendsTransaction) {
+            Transaction tx1 = suspendsTransactionPreInvoke();
+            try {
+                if (implIntent == TransactionIntent.managedTransactionGlobal) {
+                    return run(action);
+                } else {
+                    return action.run();
+                }
+            } finally {
+                suspendsTransactionPostInvoke(tx1);
+            }
+        } else {
+            if (implIntent == TransactionIntent.managedTransactionGlobal) {
+                // Start a new TX
+                return run(action);
+            } else {
+                return action.run();
+            }
+        }
+    }
+
+    public <T> void handlesOneWay(TransactionIntent onewayIntent,
+                                  TransactionIntent implIntent,
+                                  TransactionalAction<T> action) throws Exception {
+        if (implIntent == null) {
+            implIntent = TransactionIntent.noManagedTransaction;
+        }
+
+        if (onewayIntent == null) {
+            // Assume transactedOneWay
+            run(action);
+            return;
+        }
+
+        if (onewayIntent == TransactionIntent.transactedOneWay) {
+            if (implIntent != TransactionIntent.managedTransactionGlobal) {
+                throw new IncompatibleIntentException(onewayIntent + "<-X->" + implIntent);
+            } else {
+                run(action);
+                return;
+            }
+        } else {
+            // TransactionIntent.immediateOneWay
+            Transaction tx = suspendsTransactionPreInvoke();
+            try {
+                run(action);
+                return;
+            } finally {
+                suspendsTransactionPostInvoke(tx);
+            }
+        }
+    }
+
+}

Propchange: tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionManagerHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionManagerHelper.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionManagerWrapper.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionManagerWrapper.java?rev=901868&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionManagerWrapper.java (added)
+++ tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionManagerWrapper.java Thu Jan 21 21:38:00 2010
@@ -0,0 +1,90 @@
+/*
+ * 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.tuscany.sca.policy.transaction.runtime;
+
+import java.io.File;
+
+import javax.transaction.TransactionManager;
+
+import org.apache.geronimo.transaction.log.HOWLLog;
+import org.apache.geronimo.transaction.manager.GeronimoTransactionManager;
+import org.apache.geronimo.transaction.manager.XidFactory;
+import org.apache.geronimo.transaction.manager.XidFactoryImpl;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TransactionManagerWrapper {
+    private TransactionManager transactionManager;
+    private HOWLLog howlLog;
+
+    private String logFileDir = "target/logs";
+    private String bufferClassName = "org.objectweb.howl.log.BlockLogBuffer";
+    private int bufferSizeKBytes = 32;
+    private boolean checksumEnabled = true;
+    private boolean adler32Checksum = true;
+    private int flushSleepTimeMilliseconds = 50;
+    private String logFileExt = "log";
+    private String logFileName = "transaction";
+    private int maxBlocksPerFile = -1;
+    private int maxLogFiles = 2;
+    private int maxBuffers = 0;
+    private int minBuffers = 4;
+    private int threadsWaitingForceThreshold = -1;
+    private File serverBaseDir = new File(System.getProperty("basedir", System.getProperty("user.dir")));
+
+    public TransactionManagerWrapper() {
+        super();
+    }
+
+    public void start() {
+        try {
+            XidFactory xidFactory = new XidFactoryImpl();
+            howlLog =
+                new HOWLLog(bufferClassName, bufferSizeKBytes, checksumEnabled, adler32Checksum,
+                            flushSleepTimeMilliseconds, logFileDir, logFileExt, logFileName, maxBlocksPerFile,
+                            maxBuffers, maxLogFiles, minBuffers, threadsWaitingForceThreshold, xidFactory,
+                            serverBaseDir);
+
+            howlLog.doStart();
+            transactionManager = new GeronimoTransactionManager(1200, xidFactory, howlLog);
+        } catch (Exception e) {
+            throw new IllegalStateException(e);
+        }
+    }
+
+    /**
+     * @see org.apache.tuscany.sca.core.ModuleActivator#stop(org.apache.tuscany.sca.core.ExtensionPointRegistry)
+     */
+    public void stop() {
+        try {
+            if (howlLog != null) {
+                howlLog.doStop();
+            }
+        } catch (Exception e) {
+            throw new IllegalStateException(e);
+        }
+    }
+
+    public TransactionManager getTransactionManager() {
+        return transactionManager;
+    }
+
+}

Propchange: tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionManagerWrapper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionManagerWrapper.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionModuleActivator.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionModuleActivator.java?rev=901868&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionModuleActivator.java (added)
+++ tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionModuleActivator.java Thu Jan 21 21:38:00 2010
@@ -0,0 +1,89 @@
+/*
+ * 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.tuscany.sca.policy.transaction.runtime;
+
+import javax.transaction.TransactionManager;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TransactionModuleActivator implements ModuleActivator {
+    private TransactionManagerWrapper wrapper;
+    private ExtensionPointRegistry registry;
+    
+    public TransactionModuleActivator(ExtensionPointRegistry registry) {
+        this.registry = registry;
+    }
+
+    /**
+     * @see org.apache.tuscany.sca.core.ModuleActivator#start(org.apache.tuscany.sca.core.ExtensionPointRegistry)
+     */
+    public void start() {
+        if (registry != null) {
+            UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
+            TransactionManager transactionManager = utilities.getUtility(TransactionManager.class);
+            if (transactionManager != null) {
+                // The transaction manage is provided by the hosting environment
+//                RuntimeWireProcessorExtensionPoint wireProcessorExtensionPoint =
+//                    registry.getExtensionPoint(RuntimeWireProcessorExtensionPoint.class);
+//                TransactionManagerHelper helper = new TransactionManagerHelper(transactionManager);
+//                wireProcessorExtensionPoint.addWireProcessor(new TransactionRuntimeWireProcessor(helper));
+                return;
+            }
+        }
+        try {
+            wrapper = new TransactionManagerWrapper();
+            wrapper.start();
+        } catch (Exception e) {
+            throw new IllegalStateException(e);
+        }
+        if (registry != null) {
+            UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
+            utilities.addUtility(wrapper.getTransactionManager());
+//            RuntimeWireProcessorExtensionPoint wireProcessorExtensionPoint =
+//                registry.getExtensionPoint(RuntimeWireProcessorExtensionPoint.class);
+//            TransactionManagerHelper helper = new TransactionManagerHelper(wrapper.getTransactionManager());
+//            wireProcessorExtensionPoint.addWireProcessor(new TransactionRuntimeWireProcessor(helper));
+        }
+    }
+
+    /**
+     * @see org.apache.tuscany.sca.core.ModuleActivator#stop(org.apache.tuscany.sca.core.ExtensionPointRegistry)
+     */
+    public void stop() {
+        try {
+            if (wrapper != null) {
+                wrapper.stop();
+                wrapper = null;
+            }
+            if (registry != null && wrapper != null) {
+                UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
+                utilities.removeUtility(wrapper.getTransactionManager());
+            }
+        } catch (Exception e) {
+            throw new IllegalStateException(e);
+        }
+    }
+
+}

Propchange: tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionModuleActivator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionModuleActivator.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionPolicyProviderFactory.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionPolicyProviderFactory.java?rev=901868&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionPolicyProviderFactory.java (added)
+++ tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionPolicyProviderFactory.java Thu Jan 21 21:38:00 2010
@@ -0,0 +1,62 @@
+/*
+ * 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.tuscany.sca.policy.transaction.runtime;
+
+import javax.transaction.TransactionManager;
+import org.apache.tuscany.sca.assembly.Endpoint;
+import org.apache.tuscany.sca.assembly.EndpointReference;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.policy.transaction.TransactionPolicy;
+import org.apache.tuscany.sca.provider.PolicyProvider;
+import org.apache.tuscany.sca.provider.PolicyProviderFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TransactionPolicyProviderFactory implements PolicyProviderFactory<TransactionPolicy> {
+    private TransactionManagerHelper helper;
+
+    public TransactionPolicyProviderFactory(ExtensionPointRegistry registry) {
+        super();
+        UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
+        TransactionManager tm = utilities.getUtility(TransactionManager.class);
+        this.helper = new TransactionManagerHelper(tm);
+    }
+
+    public PolicyProvider createImplementationPolicyProvider(RuntimeComponent component) {
+        return new TransactionImplementationPolicyProvider(helper, component);
+    }
+
+    public PolicyProvider createReferencePolicyProvider(EndpointReference endpointReference) {
+        return new TransactionReferencePolicyProvider(helper, endpointReference);
+    }
+    
+    public PolicyProvider createServicePolicyProvider(Endpoint endpoint) {
+        return new TransactionServicePolicyProvider(helper, endpoint);
+    }
+
+    public Class<TransactionPolicy> getModelType() {
+        return TransactionPolicy.class;
+    }
+
+}

Propchange: tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionPolicyProviderFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionPolicyProviderFactory.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionReferencePolicyProvider.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionReferencePolicyProvider.java?rev=901868&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionReferencePolicyProvider.java (added)
+++ tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionReferencePolicyProvider.java Thu Jan 21 21:38:00 2010
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.sca.policy.transaction.runtime;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.EndpointReference;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Phase;
+import org.apache.tuscany.sca.invocation.PhasedInterceptor;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.transaction.TransactionPolicy;
+import org.apache.tuscany.sca.provider.BasePolicyProvider;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TransactionReferencePolicyProvider extends BasePolicyProvider<TransactionPolicy> {
+    private TransactionManagerHelper helper;
+    private List<PolicySet> policySets;
+
+    public TransactionReferencePolicyProvider(TransactionManagerHelper helper, EndpointReference epr) {
+        super(TransactionPolicy.class, epr);
+        this.helper = helper;
+        this.policySets = epr.getPolicySets();
+    }
+
+    public PhasedInterceptor createInterceptor(Operation operation) {
+/* TODO - 2.x better way of doing this in 2.x */
+        for (PolicySet policySet : policySets) {
+            for (Object p : policySet.getPolicies()) {
+                if (p instanceof TransactionPolicy) {
+                    TransactionInterceptor interceptor =
+                        new TransactionInterceptor(helper, true, (TransactionPolicy)p, null);
+                    return interceptor;
+                }
+            }
+        }
+        return null;
+    }
+
+    public String getPhase() {
+        return Phase.REFERENCE_POLICY;
+    }
+
+}

Propchange: tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionReferencePolicyProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionReferencePolicyProvider.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionServicePolicyProvider.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionServicePolicyProvider.java?rev=901868&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionServicePolicyProvider.java (added)
+++ tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionServicePolicyProvider.java Thu Jan 21 21:38:00 2010
@@ -0,0 +1,62 @@
+/*
+ * 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.tuscany.sca.policy.transaction.runtime;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Endpoint;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Phase;
+import org.apache.tuscany.sca.invocation.PhasedInterceptor;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.transaction.TransactionPolicy;
+import org.apache.tuscany.sca.provider.BasePolicyProvider;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TransactionServicePolicyProvider extends BasePolicyProvider<TransactionPolicy> {
+    private TransactionManagerHelper helper;
+    private List<PolicySet> policySets;
+
+    public TransactionServicePolicyProvider(TransactionManagerHelper helper, Endpoint ep) {
+        super(TransactionPolicy.class, ep);
+        this.helper = helper;
+        this.policySets = ep.getPolicySets();
+    }
+
+    public PhasedInterceptor createInterceptor(Operation operation) {
+        for (PolicySet policySet : policySets) {
+            for (Object p : policySet.getPolicies()) {
+                if (p instanceof TransactionPolicy) {
+                    TransactionInterceptor interceptor =
+                        new TransactionInterceptor(helper, true, (TransactionPolicy)p, null);
+                    return interceptor;
+                }
+            }
+        }
+        return null;
+    }
+
+    public String getPhase() {
+        return Phase.SERVICE_POLICY;
+    }
+
+}

Propchange: tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionServicePolicyProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionServicePolicyProvider.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionalAction.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionalAction.java?rev=901868&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionalAction.java (added)
+++ tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionalAction.java Thu Jan 21 21:38:00 2010
@@ -0,0 +1,31 @@
+/*
+ * 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.tuscany.sca.policy.transaction.runtime;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface TransactionalAction<T> {
+    /**
+     * @return
+     * @throws Exception
+     */
+    T run() throws Exception;
+}

Propchange: tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionalAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionalAction.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor?rev=901868&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor (added)
+++ tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor Thu Jan 21 21:38:00 2010
@@ -0,0 +1,19 @@
+# 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. 
+
+# Implementation class for the artifact processor extension
+org.apache.tuscany.sca.policy.transaction.TransactionPolicyProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.1#transactionPolicy,model=org.apache.tuscany.sca.policy.transaction.TransactionPolicy
\ No newline at end of file

Added: tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator?rev=901868&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator (added)
+++ tuscany/sca-java-2.x/trunk/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator Thu Jan 21 21:38:00 2010
@@ -0,0 +1,18 @@
+# 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.
+# Implementation class for the ModuleActivator
+org.apache.tuscany.sca.policy.transaction.runtime.TransactionModuleActivator