summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime-geronimo/META-INF/MANIFEST.MF35
-rw-r--r--sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime-geronimo/pom.xml70
-rw-r--r--sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime-geronimo/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/geronimo/GeronimoTransactionManagerHelper.java36
-rw-r--r--sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime-geronimo/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/geronimo/TransactionManagerWrapper.java90
-rw-r--r--sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime-geronimo/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/geronimo/TransactionModuleActivator.java89
-rw-r--r--sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime-geronimo/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime-geronimo/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.transaction.runtime.TransactionManagerHelper17
-rw-r--r--sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime-geronimo/src/test/java/org/apache/tuscany/sca/policy/transaction/runtime/geronimo/TransactionManagerHelperTestCaseOFF.java196
-rw-r--r--sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/META-INF/MANIFEST.MF33
-rw-r--r--sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/pom.xml63
-rw-r--r--sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/IncompatibleIntentException.java44
-rw-r--r--sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionImplementationPolicyProvider.java51
-rw-r--r--sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionIntent.java34
-rw-r--r--sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionInterceptor.java151
-rw-r--r--sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionManagerHelper.java252
-rw-r--r--sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionPolicyProviderFactory.java60
-rw-r--r--sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionReferencePolicyProvider.java51
-rw-r--r--sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionServicePolicyProvider.java51
-rw-r--r--sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionalAction.java31
-rw-r--r--sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory19
20 files changed, 0 insertions, 1391 deletions
diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime-geronimo/META-INF/MANIFEST.MF b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime-geronimo/META-INF/MANIFEST.MF
deleted file mode 100644
index 6872cb5249..0000000000
--- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime-geronimo/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,35 +0,0 @@
-Manifest-Version: 1.0
-SCA-Version: 1.1
-Bundle-Name: Apache Tuscany Transaction Policy Runtime Geronimo
-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.transaction;version="1.1.0",
- javax.transaction.xa;version="1.1.0",
- javax.xml.namespace,
- javax.xml.stream,
- org.apache.geronimo.transaction.log,
- org.apache.geronimo.transaction.manager,
- 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.transaction.runtime;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.runtime.geronimo
-Bundle-DocURL: http://www.apache.org/
-Bundle-RequiredExecutionEnvironment: J2SE-1.5,JavaSE-1.6
diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime-geronimo/pom.xml b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime-geronimo/pom.xml
deleted file mode 100644
index 2fef31e90c..0000000000
--- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime-geronimo/pom.xml
+++ /dev/null
@@ -1,70 +0,0 @@
-<?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-Beta2</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-policy-transaction-runtime-geronimo</artifactId>
- <name>Apache Tuscany SCA Transaction Policy Runtime (Geronimo)</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly-xml</artifactId>
- <version>2.0-Beta2</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>2.0-Beta2</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution</artifactId>
- <version>2.0-Beta2</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-policy-transaction-runtime</artifactId>
- <version>2.0-Beta2</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.geronimo.components</groupId>
- <artifactId>geronimo-transaction</artifactId>
- <version>2.1.4</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.geronimo.components</groupId>
- <artifactId>geronimo-connector</artifactId>
- <version>2.1.4</version>
- </dependency>
-
- </dependencies>
-
-</project>
diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime-geronimo/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/geronimo/GeronimoTransactionManagerHelper.java b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime-geronimo/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/geronimo/GeronimoTransactionManagerHelper.java
deleted file mode 100644
index 6ec8b34848..0000000000
--- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime-geronimo/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/geronimo/GeronimoTransactionManagerHelper.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy.transaction.runtime.geronimo;
-
-import javax.transaction.TransactionManager;
-
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.policy.transaction.runtime.TransactionManagerHelper;
-
-public class GeronimoTransactionManagerHelper extends TransactionManagerHelper {
-
- public GeronimoTransactionManagerHelper(ExtensionPointRegistry registry) {
- super(registry);
- }
-
- public GeronimoTransactionManagerHelper(TransactionManager tm) {
- super(tm);
- }
-}
diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime-geronimo/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/geronimo/TransactionManagerWrapper.java b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime-geronimo/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/geronimo/TransactionManagerWrapper.java
deleted file mode 100644
index 27e777b2c8..0000000000
--- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime-geronimo/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/geronimo/TransactionManagerWrapper.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy.transaction.runtime.geronimo;
-
-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;
- }
-
-}
diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime-geronimo/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/geronimo/TransactionModuleActivator.java b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime-geronimo/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/geronimo/TransactionModuleActivator.java
deleted file mode 100644
index e5ff21fca9..0000000000
--- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime-geronimo/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/geronimo/TransactionModuleActivator.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy.transaction.runtime.geronimo;
-
-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);
- }
- }
-
-}
diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime-geronimo/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime-geronimo/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
deleted file mode 100644
index 890ac4694b..0000000000
--- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime-geronimo/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
+++ /dev/null
@@ -1,18 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-# Implementation class for the ModuleActivator
-org.apache.tuscany.sca.policy.transaction.runtime.geronimo.TransactionModuleActivator
diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime-geronimo/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.transaction.runtime.TransactionManagerHelper b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime-geronimo/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.transaction.runtime.TransactionManagerHelper
deleted file mode 100644
index 7d88aee19d..0000000000
--- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime-geronimo/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.transaction.runtime.TransactionManagerHelper
+++ /dev/null
@@ -1,17 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-org.apache.tuscany.sca.policy.transaction.runtime.geronimo.GeronimoTransactionManagerHelper \ No newline at end of file
diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime-geronimo/src/test/java/org/apache/tuscany/sca/policy/transaction/runtime/geronimo/TransactionManagerHelperTestCaseOFF.java b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime-geronimo/src/test/java/org/apache/tuscany/sca/policy/transaction/runtime/geronimo/TransactionManagerHelperTestCaseOFF.java
deleted file mode 100644
index 07ce921ebe..0000000000
--- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime-geronimo/src/test/java/org/apache/tuscany/sca/policy/transaction/runtime/geronimo/TransactionManagerHelperTestCaseOFF.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy.transaction.runtime.geronimo;
-
-import java.util.logging.Logger;
-
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-import javax.transaction.xa.XAException;
-import javax.transaction.xa.XAResource;
-import javax.transaction.xa.Xid;
-
-import junit.framework.TestCase;
-
-import org.apache.geronimo.transaction.manager.NamedXAResource;
-import org.apache.tuscany.sca.policy.transaction.runtime.TransactionManagerHelper;
-import org.apache.tuscany.sca.policy.transaction.runtime.geronimo.TransactionManagerWrapper;
-
-/**
- * @version $Rev$ $Date$
- */
-public class TransactionManagerHelperTestCaseOFF extends TestCase {
- private static final Logger logger = Logger.getLogger(TransactionManagerHelperTestCaseOFF.class.getName());
-
- public static class MockXAResource implements NamedXAResource {
-
- private String rm;
- private String id;
- private int timeout = 1000;
-
- public MockXAResource(String rm, String id) {
- super();
- this.rm = rm;
- this.id = id;
- }
-
- public String getName() {
- return rm + ":" + 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 {
- if (xares instanceof MockXAResource) {
- MockXAResource res = (MockXAResource)xares;
- return res.rm.endsWith(rm);
- } else {
- return false;
- }
- }
-
- 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 {
- TransactionManagerWrapper activator = new TransactionManagerWrapper();
- activator.start();
- TransactionManager tm = activator.getTransactionManager();
- // 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());
-
- XAResource res1 = new MockXAResource("Derby", "001");
- XAResource res2 = new MockXAResource("DB2", "002");
- tm.getTransaction().enlistResource(res1);
- tm.getTransaction().enlistResource(res2);
-
- Transaction suspended = helper.suspendsTransactionPreInvoke();
- suspended.delistResource(res1, XAResource.TMSUSPEND);
- suspended.delistResource(res2, XAResource.TMSUSPEND);
-
- // 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());
-
- XAResource res3 = new MockXAResource("Oracle", "003");
- tm.getTransaction().enlistResource(res3);
-
- tm.getTransaction().delistResource(res3, XAResource.TMSUCCESS);
- tm.rollback();
-
- // Skip post
- // helper.managedGlobalTransactionPostInvoke(t2);
-
- helper.suspendsTransactionPostInvoke(suspended);
- suspended.enlistResource(res1);
- suspended.enlistResource(res2);
- // T1 is now resumed
- assertSame(t1, tm.getTransaction());
-
- helper.managedGlobalTransactionPostInvoke(t1, false);
- assertNotNull(tm.getTransaction());
- assertEquals(6, t1.getStatus());
-
- activator.stop();
- }
-}
diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/META-INF/MANIFEST.MF b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/META-INF/MANIFEST.MF
deleted file mode 100644
index df084390b8..0000000000
--- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,33 +0,0 @@
-Manifest-Version: 1.0
-SCA-Version: 1.1
-Bundle-Name: Apache Tuscany Transaction Policy Runtime
-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.transaction;version="1.1.0",
- javax.transaction.xa;version="1.1.0",
- 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.runtime
-Bundle-DocURL: http://www.apache.org/
-Bundle-RequiredExecutionEnvironment: J2SE-1.5,JavaSE-1.6
-Export-Package: org.apache.tuscany.sca.policy.transaction.runtime;version="2.0.0"
diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/pom.xml b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/pom.xml
deleted file mode 100644
index 09132c89a2..0000000000
--- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/pom.xml
+++ /dev/null
@@ -1,63 +0,0 @@
-<?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-Beta2</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-policy-transaction-runtime</artifactId>
- <name>Apache Tuscany SCA Transaction Policy Runtime</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly-xml</artifactId>
- <version>2.0-Beta2</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>2.0-Beta2</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution</artifactId>
- <version>2.0-Beta2</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-policy-transaction</artifactId>
- <version>2.0-Beta2</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jta_1.1_spec</artifactId>
- <version>1.1.1</version>
- </dependency>
- </dependencies>
-
-</project>
diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/IncompatibleIntentException.java b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/IncompatibleIntentException.java
deleted file mode 100644
index e3cb6fc359..0000000000
--- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/IncompatibleIntentException.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.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);
- }
-
-}
diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionImplementationPolicyProvider.java b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionImplementationPolicyProvider.java
deleted file mode 100644
index dc042ed5cc..0000000000
--- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionImplementationPolicyProvider.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.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.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;
-
- public TransactionImplementationPolicyProvider(TransactionManagerHelper helper, RuntimeComponent component) {
- super(TransactionPolicy.class, component);
- this.helper = helper;
- }
-
- public PhasedInterceptor createInterceptor(Operation operation) {
- List<TransactionPolicy> policies = findPolicies();
- return policies.isEmpty() ? null : new TransactionInterceptor(helper, false, null, policies.get(0), getPhase());
- }
-
- public String getPhase() {
- return Phase.IMPLEMENTATION_POLICY;
- }
-
-}
diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionIntent.java b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionIntent.java
deleted file mode 100644
index 196b9cc0a1..0000000000
--- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionIntent.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy.transaction.runtime;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public enum TransactionIntent {
- managedTransactionLocal,
- managedTransactionGlobal,
- noManagedTransaction,
- propagatesTransacton,
- suspendsTransaction,
- transactedOneWay,
- immediateOneWay
-}
diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionInterceptor.java b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionInterceptor.java
deleted file mode 100644
index f6e0e87ece..0000000000
--- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionInterceptor.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy.transaction.runtime;
-
-import java.util.logging.Logger;
-
-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 static final Logger logger = Logger.getLogger(TransactionInterceptor.class.getName());
-
- private Invoker next;
- private TransactionManagerHelper helper;
- private boolean outbound;
- private TransactionPolicy interactionPolicy;
- private TransactionPolicy implementationPolicy;
- private String phase;
-
- public TransactionInterceptor(TransactionManagerHelper helper,
- boolean outbound,
- TransactionPolicy interactionPolicy,
- TransactionPolicy implementationPolicy,
- String phase) {
- 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) {
- //logger.info("Executing TransactionInterceptor.invoke");
- TransactionalInvocation invocation = new TransactionalInvocation(next, msg);
-
- Message result = null;
- if (msg.getOperation().isNonBlocking()) {
-
- }
-
- // initialize default values
- TransactionIntent interactionIntent = null; //TransactionIntent.propagatesTransacton;
- TransactionIntent implementationIntent = TransactionIntent.managedTransactionGlobal;
-
- if (interactionPolicy != null) {
- if (interactionPolicy.getAction() == TransactionPolicy.Action.PROPAGATE) {
- interactionIntent = TransactionIntent.propagatesTransacton;
- } else if (interactionPolicy.getAction() == TransactionPolicy.Action.REQUIRE_NONE) {
- interactionIntent = TransactionIntent.suspendsTransaction;
- if(implementationPolicy == null) {
- implementationIntent = TransactionIntent.noManagedTransaction;
- }
- } else {
- interactionIntent = TransactionIntent.suspendsTransaction;
- }
- }
-
- 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 (Throwable e) {
- if (e instanceof Error) {
- throw (Error)e;
- } else if (e instanceof RuntimeException) {
- throw (RuntimeException)e;
- } else {
- result = msg;
- msg.setFaultBody(e);
- }
-
- }
- 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() {
- return phase;
- }
-
-}
diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionManagerHelper.java b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionManagerHelper.java
deleted file mode 100644
index 6d67e51bd7..0000000000
--- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionManagerHelper.java
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.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;
-
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-
-/**
- * @version $Rev$ $Date$
- */
-public class TransactionManagerHelper {
- // private static final Logger logger = Logger.getLogger(TransactionManagerHelper.class.getName());
-
- private TransactionManager tm;
-
- public TransactionManagerHelper(ExtensionPointRegistry registry) {
- super();
- UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
- this.tm = utilities.getUtility(TransactionManager.class);
- }
-
- 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);
- }
- }
- }
-
-}
diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionPolicyProviderFactory.java b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionPolicyProviderFactory.java
deleted file mode 100644
index 23c25c9b8a..0000000000
--- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionPolicyProviderFactory.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy.transaction.runtime;
-
-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);
- this.helper = utilities.getUtility(TransactionManagerHelper.class);
- }
-
- 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;
- }
-
-}
diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionReferencePolicyProvider.java b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionReferencePolicyProvider.java
deleted file mode 100644
index 1dc0feb0b5..0000000000
--- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionReferencePolicyProvider.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.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.transaction.TransactionPolicy;
-import org.apache.tuscany.sca.provider.BasePolicyProvider;
-
-/**
- * @version $Rev$ $Date$
- */
-public class TransactionReferencePolicyProvider extends BasePolicyProvider<TransactionPolicy> {
- private TransactionManagerHelper helper;
-
- public TransactionReferencePolicyProvider(TransactionManagerHelper helper, EndpointReference epr) {
- super(TransactionPolicy.class, epr);
- this.helper = helper;
- }
-
- public PhasedInterceptor createInterceptor(Operation operation) {
- List<TransactionPolicy> policies = findPolicies();
- return policies.isEmpty() ? null : new TransactionInterceptor(helper, true, policies.get(0), null, getPhase());
- }
-
- public String getPhase() {
- return Phase.REFERENCE_POLICY;
- }
-
-}
diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionServicePolicyProvider.java b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionServicePolicyProvider.java
deleted file mode 100644
index c2a7c1039b..0000000000
--- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionServicePolicyProvider.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.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.transaction.TransactionPolicy;
-import org.apache.tuscany.sca.provider.BasePolicyProvider;
-
-/**
- * @version $Rev$ $Date$
- */
-public class TransactionServicePolicyProvider extends BasePolicyProvider<TransactionPolicy> {
- private TransactionManagerHelper helper;
-
- public TransactionServicePolicyProvider(TransactionManagerHelper helper, Endpoint ep) {
- super(TransactionPolicy.class, ep);
- this.helper = helper;
- }
-
- public PhasedInterceptor createInterceptor(Operation operation) {
- List<TransactionPolicy> policies = findPolicies();
- return policies.isEmpty() ? null : new TransactionInterceptor(helper, true, policies.get(0), null, getPhase());
- }
-
- public String getPhase() {
- return Phase.SERVICE_POLICY;
- }
-
-}
diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionalAction.java b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionalAction.java
deleted file mode 100644
index 2785177000..0000000000
--- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/src/main/java/org/apache/tuscany/sca/policy/transaction/runtime/TransactionalAction.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy.transaction.runtime;
-
-/**
- * @version $Rev$ $Date$
- */
-public interface TransactionalAction<T> {
- /**
- * @return
- * @throws Exception
- */
- T run() throws Exception;
-}
diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory
deleted file mode 100644
index 0b38a71ad4..0000000000
--- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/policy-transaction-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the policy extension
-org.apache.tuscany.sca.policy.transaction.runtime.TransactionPolicyProviderFactory;model=org.apache.tuscany.sca.policy.transaction.TransactionPolicy