You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by rf...@apache.org on 2007/10/20 01:24:21 UTC
svn commit: r586640 - in /incubator/tuscany/java/sca/modules: ./
policy-transaction/ policy-transaction/src/ policy-transaction/src/main/
policy-transaction/src/main/java/ policy-transaction/src/main/java/org/
policy-transaction/src/main/java/org/apach...
Author: rfeng
Date: Fri Oct 19 16:24:19 2007
New Revision: 586640
URL: http://svn.apache.org/viewvc?rev=586640&view=rev
Log:
Add seed code for transaction policy
Added:
incubator/tuscany/java/sca/modules/policy-transaction/ (with props)
incubator/tuscany/java/sca/modules/policy-transaction/DISCLAIMER
incubator/tuscany/java/sca/modules/policy-transaction/LICENSE
incubator/tuscany/java/sca/modules/policy-transaction/NOTICE
incubator/tuscany/java/sca/modules/policy-transaction/pom.xml (with props)
incubator/tuscany/java/sca/modules/policy-transaction/src/
incubator/tuscany/java/sca/modules/policy-transaction/src/main/
incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/
incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/
incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/
incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/
incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/
incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/
incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/
incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionManagerHelper.java (with props)
incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionModuleActivator.java (with props)
incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicy.java (with props)
incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyHandler.java (with props)
incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyImpl.java (with props)
incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyProcessor.java (with props)
incubator/tuscany/java/sca/modules/policy-transaction/src/main/resources/
incubator/tuscany/java/sca/modules/policy-transaction/src/main/resources/META-INF/
incubator/tuscany/java/sca/modules/policy-transaction/src/main/resources/META-INF/services/
incubator/tuscany/java/sca/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
incubator/tuscany/java/sca/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
incubator/tuscany/java/sca/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.PolicySetHandlers
incubator/tuscany/java/sca/modules/policy-transaction/src/main/resources/policy_definitions.xml (with props)
incubator/tuscany/java/sca/modules/policy-transaction/src/test/
incubator/tuscany/java/sca/modules/policy-transaction/src/test/java/
incubator/tuscany/java/sca/modules/policy-transaction/src/test/java/org/
incubator/tuscany/java/sca/modules/policy-transaction/src/test/java/org/apache/
incubator/tuscany/java/sca/modules/policy-transaction/src/test/java/org/apache/tuscany/
incubator/tuscany/java/sca/modules/policy-transaction/src/test/java/org/apache/tuscany/sca/
incubator/tuscany/java/sca/modules/policy-transaction/src/test/java/org/apache/tuscany/sca/policy/
incubator/tuscany/java/sca/modules/policy-transaction/src/test/java/org/apache/tuscany/sca/policy/transaction/
incubator/tuscany/java/sca/modules/policy-transaction/src/test/java/org/apache/tuscany/sca/policy/transaction/PolicyReadTestCase.java (with props)
incubator/tuscany/java/sca/modules/policy-transaction/src/test/java/org/apache/tuscany/sca/policy/transaction/TransactionManagerHelperTestCase.java (with props)
incubator/tuscany/java/sca/modules/policy-transaction/src/test/resources/
Modified:
incubator/tuscany/java/sca/modules/pom.xml
Propchange: incubator/tuscany/java/sca/modules/policy-transaction/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Oct 19 16:24:19 2007
@@ -0,0 +1,14 @@
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules
+
Added: incubator/tuscany/java/sca/modules/policy-transaction/DISCLAIMER
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-transaction/DISCLAIMER?rev=586640&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/policy-transaction/DISCLAIMER (added)
+++ incubator/tuscany/java/sca/modules/policy-transaction/DISCLAIMER Fri Oct 19 16:24:19 2007
@@ -0,0 +1,8 @@
+Apache Tuscany is an effort undergoing incubation at The Apache Software
+Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is
+required of all newly accepted projects until a further review indicates that
+the infrastructure, communications, and decision making process have stabilized
+in a manner consistent with other successful ASF projects. While incubation
+status is not necessarily a reflection of the completeness or stability of the
+code, it does indicate that the project has yet to be fully endorsed by the ASF.
+
Added: incubator/tuscany/java/sca/modules/policy-transaction/LICENSE
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-transaction/LICENSE?rev=586640&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/policy-transaction/LICENSE (added)
+++ incubator/tuscany/java/sca/modules/policy-transaction/LICENSE Fri Oct 19 16:24:19 2007
@@ -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.
+
+
+
Added: incubator/tuscany/java/sca/modules/policy-transaction/NOTICE
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-transaction/NOTICE?rev=586640&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/policy-transaction/NOTICE (added)
+++ incubator/tuscany/java/sca/modules/policy-transaction/NOTICE Fri Oct 19 16:24:19 2007
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2007 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
Added: incubator/tuscany/java/sca/modules/policy-transaction/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-transaction/pom.xml?rev=586640&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/policy-transaction/pom.xml (added)
+++ incubator/tuscany/java/sca/modules/policy-transaction/pom.xml Fri Oct 19 16:24:19 2007
@@ -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>1.1-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-policy-transaction</artifactId>
+ <name>Apache Tuscany Transaction Policy Model</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.components</groupId>
+ <artifactId>geronimo-transaction</artifactId>
+ <version>2.0.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
Propchange: incubator/tuscany/java/sca/modules/policy-transaction/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/policy-transaction/pom.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionManagerHelper.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionManagerHelper.java?rev=586640&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionManagerHelper.java (added)
+++ incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionManagerHelper.java Fri Oct 19 16:24:19 2007
@@ -0,0 +1,112 @@
+/*
+ * 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.transaction.HeuristicMixedException;
+import javax.transaction.HeuristicRollbackException;
+import javax.transaction.InvalidTransactionException;
+import javax.transaction.NotSupportedException;
+import javax.transaction.RollbackException;
+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 {
+ if (tm.getTransaction() == null) {
+ tm.begin();
+ return tm.getTransaction();
+ }
+ return null;
+ }
+
+ public void managedGlobalTransactionPostInvoke(Transaction created) throws InvalidTransactionException,
+ IllegalStateException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException,
+ RollbackException {
+ if (created != null) {
+ created.commit();
+ }
+ }
+
+ public void managedLocalTransactionPreInvoke() {
+ //
+ }
+
+ public Transaction noManagedTransactionPreInvoke() throws SystemException {
+ if (tm.getTransaction() != null) {
+ return tm.suspend();
+ }
+ return null;
+ }
+
+ public void noManagedTransactionPostInvoke(Transaction suspended) throws InvalidTransactionException,
+ IllegalStateException, SystemException {
+ if (suspended != null) {
+ tm.resume(suspended);
+ }
+ }
+
+ public void propgatesTransactionPreInvoke() {
+ }
+
+ 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 void transactedOnewayPreInvoke() {
+ //
+ }
+
+ public void immediateOnewayPreInvoke() {
+ //
+ }
+
+ public TransactionManager getTransactionManager() {
+ return tm;
+ }
+
+ public void setTransactionManager(TransactionManager tm) {
+ this.tm = tm;
+ }
+
+
+}
Propchange: incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionManagerHelper.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionManagerHelper.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionModuleActivator.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionModuleActivator.java?rev=586640&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionModuleActivator.java (added)
+++ incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionModuleActivator.java Fri Oct 19 16:24:19 2007
@@ -0,0 +1,53 @@
+/*
+ * 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.transaction.TransactionManager;
+import javax.transaction.xa.XAException;
+
+import org.apache.geronimo.transaction.manager.GeronimoTransactionManager;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModuleActivator;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TransactionModuleActivator implements ModuleActivator {
+ private TransactionManager transactionManager;
+
+ /**
+ * @see org.apache.tuscany.sca.core.ModuleActivator#start(org.apache.tuscany.sca.core.ExtensionPointRegistry)
+ */
+ public void start(ExtensionPointRegistry registry) {
+ try {
+ this.transactionManager = new GeronimoTransactionManager();
+ } catch (XAException e) {
+ throw new IllegalStateException(e);
+ }
+ registry.addExtensionPoint(this.transactionManager);
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.core.ModuleActivator#stop(org.apache.tuscany.sca.core.ExtensionPointRegistry)
+ */
+ public void stop(ExtensionPointRegistry registry) {
+ }
+
+}
Propchange: incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionModuleActivator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionModuleActivator.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicy.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicy.java?rev=586640&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicy.java (added)
+++ incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicy.java Fri Oct 19 16:24:19 2007
@@ -0,0 +1,33 @@
+/*
+ * 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;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface TransactionPolicy {
+ enum Type {GLOBAL, LOCAL, NONE};
+ int getTransactionTimeout();
+
+ void setTransactionTimeout(int seconds);
+
+ void setType(Type type);
+ Type getType();
+}
Propchange: incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicy.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicy.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyHandler.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyHandler.java?rev=586640&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyHandler.java (added)
+++ incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyHandler.java Fri Oct 19 16:24:19 2007
@@ -0,0 +1,67 @@
+/*
+ * 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 org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.util.PolicyHandler;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TransactionPolicyHandler implements PolicyHandler {
+
+ /**
+ * @see org.apache.tuscany.sca.policy.util.PolicyHandler#afterInvoke(java.lang.Object[])
+ */
+ public void afterInvoke(Object... context) {
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.policy.util.PolicyHandler#beforeInvoke(java.lang.Object[])
+ */
+ public void beforeInvoke(Object... context) {
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.policy.util.PolicyHandler#cleanUp(java.lang.Object[])
+ */
+ public void cleanUp(Object... context) {
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.policy.util.PolicyHandler#getApplicablePolicySet()
+ */
+ public PolicySet getApplicablePolicySet() {
+ return null;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.policy.util.PolicyHandler#setApplicablePolicySet(org.apache.tuscany.sca.policy.PolicySet)
+ */
+ public void setApplicablePolicySet(PolicySet context) {
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.policy.util.PolicyHandler#setUp(java.lang.Object[])
+ */
+ public void setUp(Object... context) {
+ }
+
+}
Propchange: incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyHandler.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyImpl.java?rev=586640&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyImpl.java (added)
+++ incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyImpl.java Fri Oct 19 16:24:19 2007
@@ -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;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TransactionPolicyImpl implements TransactionPolicy {
+ private int transactionTimeout = 1200;
+ private Type type = Type.NONE;
+
+ public int getTransactionTimeout() {
+ return transactionTimeout;
+ }
+
+ public void setTransactionTimeout(int transactionTimeout) {
+ this.transactionTimeout = transactionTimeout;
+ }
+
+ public Type getType() {
+ return type;
+ }
+
+ public void setType(Type type) {
+ this.type = type;
+ }
+}
Propchange: incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyProcessor.java?rev=586640&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyProcessor.java (added)
+++ incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyProcessor.java Fri Oct 19 16:24:19 2007
@@ -0,0 +1,97 @@
+/*
+ * 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.assembly.xml.Constants;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TransactionPolicyProcessor implements StAXArtifactProcessor<TransactionPolicy> {
+ public static final QName POLICY_QNAME = new QName(Constants.SCA10_TUSCANY_NS, "transactionPolicy");
+ public static final String TIMEOUT = "transactionTimeout";
+ public static final String TYPE = "type";
+
+ public QName getArtifactType() {
+ return POLICY_QNAME;
+ }
+
+ public TransactionPolicyProcessor(ModelFactoryExtensionPoint modelFactories) {
+ }
+
+ public TransactionPolicy read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ TransactionPolicy policy = 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) {
+ policy.setTransactionTimeout(Integer.parseInt(timeout));
+ }
+ String type = reader.getAttributeValue(null, TYPE);
+ if (type != null) {
+ policy.setType(TransactionPolicy.Type.valueOf(type.toUpperCase()));
+ }
+ break;
+ }
+ }
+
+ if (event == END_ELEMENT) {
+ if (POLICY_QNAME.equals(reader.getName())) {
+ break;
+ }
+ }
+
+ //Read the next element
+ if (reader.hasNext()) {
+ reader.next();
+ }
+ }
+
+ return policy;
+ }
+
+ public void write(TransactionPolicy policy, XMLStreamWriter writer) throws ContributionWriteException,
+ XMLStreamException {
+ }
+
+ public Class<TransactionPolicy> getModelType() {
+ return TransactionPolicy.class;
+ }
+
+ public void resolve(TransactionPolicy policy, ModelResolver resolver) throws ContributionResolveException {
+
+ }
+}
Propchange: incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyProcessor.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyProcessor.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor?rev=586640&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor (added)
+++ incubator/tuscany/java/sca/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor Fri Oct 19 16:24:19 2007
@@ -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.0#transactionPolicy,model=org.apache.tuscany.sca.policy.transaction.TransactionPolicy
\ No newline at end of file
Added: incubator/tuscany/java/sca/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator?rev=586640&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator (added)
+++ incubator/tuscany/java/sca/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator Fri Oct 19 16:24:19 2007
@@ -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.TransactionModuleActivator
Added: incubator/tuscany/java/sca/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.PolicySetHandlers
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.PolicySetHandlers?rev=586640&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.PolicySetHandlers (added)
+++ incubator/tuscany/java/sca/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.PolicySetHandlers Fri Oct 19 16:24:19 2007
@@ -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
+{http\://tuscany.apache.org/xmlns/sca/1.0}TransactionPolicy=org.apache.tuscany.sca.policy.transaction.TransactionPolicyHandler
Added: incubator/tuscany/java/sca/modules/policy-transaction/src/main/resources/policy_definitions.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-transaction/src/main/resources/policy_definitions.xml?rev=586640&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/policy-transaction/src/main/resources/policy_definitions.xml (added)
+++ incubator/tuscany/java/sca/modules/policy-transaction/src/main/resources/policy_definitions.xml Fri Oct 19 16:24:19 2007
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * 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.
+-->
+<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0/policy/transaction"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
+
+ <sca:policySet name="tuscany:TransactionImplementationPolicySet"
+ provides="managedTransaction noManagedTransaction transactedOneWay immediateOneWay"
+ appliesTo="sca:implementation">
+ <intentMap provides="managedTransaction" default="global">
+ <sca:qualifier name="global">
+ <tuscany:transactionPolicy transactionTimeout="1200" type="global"/>
+ </sca:qualifier>
+ <sca:qualifier name="local">
+ <tuscany:transactionPolicy transactionTimeout="1200" type="local"/>
+ </sca:qualifier>
+ </intentMap>
+ <tuscany:transactionPolicy transactionTimeout="1200" />
+ </sca:policySet>
+
+ <sca:policySet name="tuscany:TransactionBindingPolicySet"
+ provides="managedTransaction noManagedTransaction propagatesTransaction suspendsTransaction transactedOneWay immediateOneWay"
+ appliesTo="sca:binding">
+ <tuscany:transactionPolicy transactionTimeout="1200" />
+ </sca:policySet>
+
+ <intent name="managedTransaction" constrains="sca:implementation">
+ <description>
+ Used to indicate the transaction environment desired by a
+ component implementation.
+ </description>
+ </intent>
+ <intent name="managedTransaction.global"
+ constrains="sca:implementation">
+ <description>
+ Used to indicate that a component implementation requires a
+ managed global transaction.
+ </description>
+ </intent>
+ <intent name="managedTransaction.local"
+ constrains="sca:implementation">
+ <description>
+ Used to indicate that a component implementation requires a
+ managed local transaction.
+ </description>
+ </intent>
+ <intent name="noManagedTransaction"
+ constrains="sca:implementation">
+ <description>
+ Used to indicate that a component implementation will manage
+ its own transaction resources.
+ </description>
+ </intent>
+ <intent name="propagatesTransaction" constrains="sca:binding">
+ <description>
+ Used to indicate that a reference will propagate any client
+ transaction or that a service will be dispatched under any
+ received transaction.
+ </description>
+ </intent>
+ <intent name="suspendsTransaction" constrains="sca:binding">
+ <description>
+ Used to indicate that a reference will not propagate any
+ client transaction or that a service will not be dispatched
+ under any received transaction.
+ </description>
+ </intent>
+ <intent name="transactedOneWay" constrains="sca:binding">
+ <description>
+ Used to indicate that the component requires the SCA runtime
+ to transact OneWay send of messages as part of any client
+ global transaction or to transact oneWay message receipt as
+ part of any service global transaction.
+ </description>
+ </intent>
+ <intent name="immediateOneWay" constrains="sca:binding">
+ <description>
+ Used to indicate that the component requires the SCA runtime
+ to process the sending or receiving of OneWay messages
+ immediately, regardless of any transaction under which the
+ sending/receiving component runs.
+ </description>
+ </intent>
+
+</definitions>
\ No newline at end of file
Propchange: incubator/tuscany/java/sca/modules/policy-transaction/src/main/resources/policy_definitions.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/policy-transaction/src/main/resources/policy_definitions.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/modules/policy-transaction/src/test/java/org/apache/tuscany/sca/policy/transaction/PolicyReadTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-transaction/src/test/java/org/apache/tuscany/sca/policy/transaction/PolicyReadTestCase.java?rev=586640&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/policy-transaction/src/test/java/org/apache/tuscany/sca/policy/transaction/PolicyReadTestCase.java (added)
+++ incubator/tuscany/java/sca/modules/policy-transaction/src/test/java/org/apache/tuscany/sca/policy/transaction/PolicyReadTestCase.java Fri Oct 19 16:24:19 2007
@@ -0,0 +1,39 @@
+package org.apache.tuscany.sca.policy.transaction;
+
+import java.io.InputStream;
+import java.net.URL;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+/**
+ *
+ * Test the reading of ws config params policy.
+ */
+public class PolicyReadTestCase extends TestCase {
+
+ @Override
+ public void setUp() throws Exception {
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ }
+
+ public void testPolicyReading() throws Exception {
+
+ TransactionPolicyProcessor processor = new TransactionPolicyProcessor(null);
+
+ URL url = getClass().getResource("/policy_definitions.xml");
+ XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+
+ InputStream urlStream = url.openStream();
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(urlStream);
+
+ TransactionPolicy policy = processor.read(reader);
+ assertEquals(1200, policy.getTransactionTimeout());
+ }
+
+}
Propchange: incubator/tuscany/java/sca/modules/policy-transaction/src/test/java/org/apache/tuscany/sca/policy/transaction/PolicyReadTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/policy-transaction/src/test/java/org/apache/tuscany/sca/policy/transaction/PolicyReadTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/modules/policy-transaction/src/test/java/org/apache/tuscany/sca/policy/transaction/TransactionManagerHelperTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-transaction/src/test/java/org/apache/tuscany/sca/policy/transaction/TransactionManagerHelperTestCase.java?rev=586640&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/policy-transaction/src/test/java/org/apache/tuscany/sca/policy/transaction/TransactionManagerHelperTestCase.java (added)
+++ incubator/tuscany/java/sca/modules/policy-transaction/src/test/java/org/apache/tuscany/sca/policy/transaction/TransactionManagerHelperTestCase.java Fri Oct 19 16:24:19 2007
@@ -0,0 +1,167 @@
+/*
+ * 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 java.util.logging.Logger;
+
+import javax.transaction.Transaction;
+import javax.transaction.xa.XAException;
+import javax.transaction.xa.XAResource;
+import javax.transaction.xa.Xid;
+
+import junit.framework.TestCase;
+
+import org.apache.geronimo.transaction.GeronimoUserTransaction;
+import org.apache.geronimo.transaction.manager.GeronimoTransactionManager;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TransactionManagerHelperTestCase extends TestCase {
+ private static final Logger logger = Logger.getLogger(TransactionManagerHelper.class.getName());
+
+ public static class MockXAResource implements XAResource {
+ private String id;
+ private int timeout = 1000;
+
+ public MockXAResource(String id) {
+ super();
+ this.id = id;
+ }
+
+ public void commit(Xid xid, boolean onePhase) throws XAException {
+ logger.info(id + ": commit(" + xid + "," + onePhase + ")");
+ }
+
+ public void end(Xid xid, int flags) throws XAException {
+ logger.info(id + ": end(" + xid + "," + toString(flags) + ")");
+ }
+
+ public void forget(Xid xid) throws XAException {
+ logger.info(id + ": forget(" + xid + ")");
+ }
+
+ public int getTransactionTimeout() throws XAException {
+ return timeout;
+ }
+
+ public boolean isSameRM(XAResource xares) throws XAException {
+ return xares instanceof MockXAResource;
+ }
+
+ public int prepare(Xid xid) throws XAException {
+ logger.info(id + ": prepare(" + xid + ")");
+ return XA_OK;
+ }
+
+ public Xid[] recover(int flag) throws XAException {
+ return null;
+ }
+
+ public void rollback(Xid xid) throws XAException {
+ logger.info(id + ": rollback(" + xid + ")");
+ }
+
+ public boolean setTransactionTimeout(int seconds) throws XAException {
+ this.timeout = seconds;
+ return true;
+ }
+
+ public void start(Xid xid, int flags) throws XAException {
+ logger.info(id + ": start(" + xid + "," + toString(flags) + ")");
+ }
+
+ private String toString(int flags) {
+ StringBuffer sb = new StringBuffer();
+ if ((flags & TMENDRSCAN) != 0) {
+ sb.append("TMENDRSCAN ");
+ }
+ if ((flags & TMFAIL) != 0) {
+ sb.append("TMFAIL ");
+ }
+ if ((flags & TMJOIN) != 0) {
+ sb.append("TMJOIN ");
+ }
+ if ((flags & TMONEPHASE) != 0) {
+ sb.append("TMONEPHASE ");
+ }
+ if ((flags & TMRESUME) != 0) {
+ sb.append("TMRESUME ");
+ }
+ if ((flags & TMSTARTRSCAN) != 0) {
+ sb.append("TMSTARTRSCAN ");
+ }
+ if ((flags & TMSUCCESS) != 0) {
+ sb.append("TMSUCCESS ");
+ }
+ if ((flags & TMSUSPEND) != 0) {
+ sb.append("TMSUSPEND ");
+ }
+ if (sb.length() == 0) {
+ sb.append("TMNOFLAGS");
+ } else {
+ sb.deleteCharAt(sb.length() - 1);
+ }
+ return sb.toString();
+ }
+
+ }
+
+ public void testHelper() throws Exception {
+ GeronimoTransactionManager tm = new GeronimoTransactionManager();
+ GeronimoUserTransaction tx = new GeronimoUserTransaction(tm);
+ TransactionManagerHelper helper = new TransactionManagerHelper(tm);
+
+ // No TX yet
+ assertNull(tm.getTransaction());
+ Transaction t1 = helper.managedGlobalTransactionPreInvoke();
+ // Should create T1
+ assertNotNull(t1);
+ // The current TX should be T1
+ assertSame(t1, tm.getTransaction());
+ tm.getTransaction().enlistResource(new MockXAResource("001"));
+ tm.getTransaction().enlistResource(new MockXAResource("002"));
+
+ Transaction suspended = helper.suspendsTransactionPreInvoke();
+ // T1 is suspended
+ assertSame(t1, suspended);
+ // No more active TX
+ assertNull(tm.getTransaction());
+
+ Transaction t2 = helper.managedGlobalTransactionPreInvoke();
+ assertNotNull(t2);
+ // The current TX should be T2
+ assertSame(t2, tm.getTransaction());
+ tm.getTransaction().enlistResource(new MockXAResource("003"));
+
+ tx.rollback();
+
+ // Skip post
+ // helper.managedGlobalTransactionPostInvoke(t2);
+
+ helper.suspendsTransactionPostInvoke(suspended);
+ // T1 is not resumed
+ assertSame(t1, tm.getTransaction());
+
+ helper.managedGlobalTransactionPostInvoke(t1);
+ assertNotNull(tm.getTransaction());
+ assertEquals(6, t1.getStatus());
+ }
+}
Propchange: incubator/tuscany/java/sca/modules/policy-transaction/src/test/java/org/apache/tuscany/sca/policy/transaction/TransactionManagerHelperTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/policy-transaction/src/test/java/org/apache/tuscany/sca/policy/transaction/TransactionManagerHelperTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/java/sca/modules/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/pom.xml?rev=586640&r1=586639&r2=586640&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/pom.xml (original)
+++ incubator/tuscany/java/sca/modules/pom.xml Fri Oct 19 16:24:19 2007
@@ -119,6 +119,7 @@
<module>policy-xml</module>
<module>policy-logging</module>
<module>policy-security</module>
+ <module>policy-transaction</module>
<module>sca-api</module>
<module>definitions</module>
<module>definitions-xml</module>
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org