You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@aries.apache.org by Guillaume Nodet <gn...@gmail.com> on 2010/02/19 23:44:35 UTC
Re: svn commit: r911975 - in /incubator/aries/trunk/transaction: ./
src/ src/main/ src/main/java/org/apache/aries/transaction/
src/main/java/org/apache/aries/transaction/exception/ src/main/java/org/apache/aries/transaction/parsing/
src/main/resource
I really don't think we should merge those two things (the transaction
manager and support for declarative transactions for blueprint).
I'll split them asap.
On Fri, Feb 19, 2010 at 21:37, <jb...@apache.org> wrote:
> Author: jbohn
> Date: Fri Feb 19 20:37:04 2010
> New Revision: 911975
>
> URL: http://svn.apache.org/viewvc?rev=911975&view=rev
> Log:
> ARIES-152 Initial Contribution - declarative transaction support - contribution by Brian DePradine
>
> Added:
> incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/TransactionStrategy.java (with props)
> incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/TxComponentMetaDataHelper.java (with props)
> incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/TxComponentMetaDataHelperImpl.java (with props)
> incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/TxInterceptorImpl.java (with props)
> incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/exception/
> incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/exception/TransactionRollbackException.java (with props)
> incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/parsing/
> incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/parsing/TxElementHandler.java (with props)
> incubator/aries/trunk/transaction/src/main/resources/OSGI-INF/
> incubator/aries/trunk/transaction/src/main/resources/OSGI-INF/blueprint/
> incubator/aries/trunk/transaction/src/main/resources/OSGI-INF/blueprint/transaction.xml (with props)
> incubator/aries/trunk/transaction/src/main/resources/org/
> incubator/aries/trunk/transaction/src/main/resources/org/apache/
> incubator/aries/trunk/transaction/src/main/resources/org/apache/aries/
> incubator/aries/trunk/transaction/src/main/resources/org/apache/aries/transaction/
> incubator/aries/trunk/transaction/src/main/resources/org/apache/aries/transaction/parsing/
> incubator/aries/trunk/transaction/src/main/resources/org/apache/aries/transaction/parsing/transaction.xsd (with props)
> incubator/aries/trunk/transaction/src/test/ (with props)
> incubator/aries/trunk/transaction/src/test/java/
> incubator/aries/trunk/transaction/src/test/java/org/
> incubator/aries/trunk/transaction/src/test/java/org/apache/
> incubator/aries/trunk/transaction/src/test/java/org/apache/aries/
> incubator/aries/trunk/transaction/src/test/java/org/apache/aries/transaction/
> incubator/aries/trunk/transaction/src/test/java/org/apache/aries/transaction/NameSpaceHandlerTest.java (with props)
> incubator/aries/trunk/transaction/src/test/java/org/apache/aries/transaction/TranStrategyTest.java (with props)
> incubator/aries/trunk/transaction/src/test/resources/
> incubator/aries/trunk/transaction/src/test/resources/org/
> incubator/aries/trunk/transaction/src/test/resources/org/apache/
> incubator/aries/trunk/transaction/src/test/resources/org/apache/aries/
> incubator/aries/trunk/transaction/src/test/resources/org/apache/aries/transaction/
> incubator/aries/trunk/transaction/src/test/resources/org/apache/aries/transaction/aries.xml (with props)
> Modified:
> incubator/aries/trunk/transaction/pom.xml
> incubator/aries/trunk/transaction/src/ (props changed)
> incubator/aries/trunk/transaction/src/main/ (props changed)
>
> Modified: incubator/aries/trunk/transaction/pom.xml
> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/transaction/pom.xml?rev=911975&r1=911974&r2=911975&view=diff
> ==============================================================================
> --- incubator/aries/trunk/transaction/pom.xml (original)
> +++ incubator/aries/trunk/transaction/pom.xml Fri Feb 19 20:37:04 2010
> @@ -64,9 +64,56 @@
> <version>2.5.6</version>
> <optional>true</optional>
> </dependency>
> + <dependency>
> + <groupId>org.apache.aries.blueprint</groupId>
> + <artifactId>org.apache.aries.blueprint</artifactId>
> + <version>${version}</version>
> + <scope>provided</scope>
> + </dependency>
> + <dependency>
> + <groupId>junit</groupId>
> + <artifactId>junit</artifactId>
> + <version>4.7</version>
> + <scope>test</scope>
> + </dependency>
> + <dependency>
> + <groupId>org.apache.aries.testsupport</groupId>
> + <artifactId>org.apache.aries.testsupport.unit</artifactId>
> + <version>${version}</version>
> + <scope>test</scope>
> + </dependency>
> + <dependency>
> + <groupId>org.slf4j</groupId>
> + <artifactId>slf4j-api</artifactId>
> + <version>1.5.6</version>
> + </dependency>
> + <dependency>
> + <groupId>org.slf4j</groupId>
> + <artifactId>slf4j-simple</artifactId>
> + <version>1.5.6</version>
> + <scope>test</scope>
> + </dependency>
> </dependencies>
>
> <build>
> + <resources>
> + <resource>
> + <targetPath>OSGI-INF/blueprint</targetPath>
> + <filtering>false</filtering>
> + <directory>${basedir}/src/main/resources/OSGI-INF/blueprint</directory>
> + <includes>
> + <include>*.xml</include>
> + </includes>
> + </resource>
> + <resource>
> + <targetPath>org/apache/aries/transaction/parsing</targetPath>
> + <filtering>false</filtering>
> + <directory>${basedir}/src/main/resources/org/apache/aries/transaction/parsing</directory>
> + <includes>
> + <include>*.xsd</include>
> + </includes>
> + </resource>
> + </resources>
> <plugins>
> <plugin>
> <groupId>org.apache.felix</groupId>
> @@ -79,17 +126,19 @@
> org.springframework.*;resolution:=optional,
> !org.apache.geronimo.transaction*,
> javax.resource.spi;version="1.5";resolution:=optional,
> - org.osgi.framework;version="1.4",
> + org.osgi.framework;version="1.5",
> org.osgi.service.cm;version="[1.2.0,2.0.0)",
> *
> </Import-Package>
> <Export-Package>
> org.apache.geronimo.transaction*;version="${geronimo-transaction-version}",
> - javax.transaction*;version="1.1"
> + javax.transaction*;version="1.1",
> + org.apache.aries.transaction.exception
> </Export-Package>
> <Private-Package>
> org.objectweb.howl.log*,
> - org.apache.aries.transaction
> + org.apache.aries.transaction,
> + org.apache.aries.transaction.parsing
> </Private-Package>
> <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
> <Bundle-Activator>org.apache.aries.transaction.Activator</Bundle-Activator>
>
> Propchange: incubator/aries/trunk/transaction/src/
> ------------------------------------------------------------------------------
> --- svn:ignore (added)
> +++ svn:ignore Fri Feb 19 20:37:04 2010
> @@ -0,0 +1 @@
> +
>
> Propchange: incubator/aries/trunk/transaction/src/main/
> ------------------------------------------------------------------------------
> --- svn:ignore (added)
> +++ svn:ignore Fri Feb 19 20:37:04 2010
> @@ -0,0 +1 @@
> +
>
> Added: incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/TransactionStrategy.java
> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/TransactionStrategy.java?rev=911975&view=auto
> ==============================================================================
> --- incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/TransactionStrategy.java (added)
> +++ incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/TransactionStrategy.java Fri Feb 19 20:37:04 2010
> @@ -0,0 +1,156 @@
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one
> + * or more contributor license agreements. See the NOTICE file
> + * distributed with this work for additional information
> + * regarding copyright ownership. The ASF licenses this file
> + * to you under the Apache License, Version 2.0 (the
> + * "License"); you may not use this file except in compliance
> + * with the License. You may obtain a copy of the License at
> + *
> + * http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing,
> + * software distributed under the License is distributed on an
> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> + * KIND, either express or implied. See the License for the
> + * specific language governing permissions and limitations
> + * under the License.
> + */
> +package org.apache.aries.transaction;
> +
> +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;
> +
> +public enum TransactionStrategy {
> + MANDATORY
> + {
> + public Transaction begin(TransactionManager man) throws SystemException
> + {
> + if (man.getStatus() == Status.STATUS_NO_TRANSACTION) {
> + throw new IllegalStateException("No tran on thread");
> + }
> +
> + return null;
> + }
> + },
> + NEVER
> + {
> + public Transaction begin(TransactionManager man) throws SystemException
> + {
> + if (man.getStatus() == Status.STATUS_ACTIVE) {
> + throw new IllegalStateException("Tran on thread");
> + }
> +
> + return null;
> + }
> + },
> + NOT_SUPPORTED
> + {
> + public Transaction begin(TransactionManager man) throws SystemException
> + {
> + if (man.getStatus() == Status.STATUS_ACTIVE) {
> + return man.suspend();
> + }
> +
> + return null;
> + }
> +
> + public void finish(TransactionManager man, Transaction tran) throws SystemException,
> + InvalidTransactionException, IllegalStateException
> + {
> + if (tran != null) {
> + man.resume(tran);
> + }
> + }
> + },
> + REQUIRED
> + {
> + public Transaction begin(TransactionManager man) throws SystemException, NotSupportedException
> + {
> + if (man.getStatus() == Status.STATUS_NO_TRANSACTION) {
> + man.begin();
> + return man.getTransaction();
> + }
> +
> + return null;
> + }
> +
> + public void finish(TransactionManager man, Transaction tran) throws SystemException,
> + InvalidTransactionException, IllegalStateException, SecurityException, RollbackException,
> + HeuristicMixedException, HeuristicRollbackException
> + {
> + if (tran != null) {
> + if (man.getStatus() == Status.STATUS_MARKED_ROLLBACK) {
> + man.rollback();
> + } else {
> + man.commit();
> + }
> + }
> + }
> + },
> + REQUIRES_NEW
> + {
> + public Transaction begin(TransactionManager man) throws SystemException, NotSupportedException,
> + InvalidTransactionException, IllegalStateException
> + {
> + Transaction result;
> + if (man.getStatus() == Status.STATUS_ACTIVE) {
> + result = man.suspend();
> + } else {
> + result = null;
> + }
> +
> + try {
> + man.begin();
> + } catch (SystemException e) {
> + man.resume(result);
> + throw e;
> + } catch (NotSupportedException e) {
> + man.resume(result);
> + throw e;
> + }
> + return result;
> + }
> +
> + public void finish(TransactionManager man, Transaction tran) throws SystemException,
> + InvalidTransactionException, IllegalStateException, SecurityException, RollbackException,
> + HeuristicMixedException, HeuristicRollbackException
> + {
> + if (man.getStatus() == Status.STATUS_MARKED_ROLLBACK) {
> + man.rollback();
> + } else {
> + man.commit();
> + }
> +
> + if (tran != null) {
> + man.resume(tran);
> + }
> + }
> + },
> + SUPPORTS;
> +
> + public static TransactionStrategy fromValue(String value)
> + {
> + return valueOf(value.toUpperCase());
> + }
> +
> + public Transaction begin(TransactionManager man) throws SystemException, NotSupportedException,
> + InvalidTransactionException, IllegalStateException
> + {
> + return null;
> + }
> +
> + public void finish(TransactionManager man, Transaction tran) throws SystemException,
> + InvalidTransactionException, IllegalStateException, SecurityException, RollbackException,
> + HeuristicMixedException, HeuristicRollbackException
> + {
> +
> + }
> +}
>
> Propchange: incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/TransactionStrategy.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Propchange: incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/TransactionStrategy.java
> ------------------------------------------------------------------------------
> svn:keywords = Date Revision
>
> Propchange: incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/TransactionStrategy.java
> ------------------------------------------------------------------------------
> svn:mime-type = text/plain
>
> Added: incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/TxComponentMetaDataHelper.java
> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/TxComponentMetaDataHelper.java?rev=911975&view=auto
> ==============================================================================
> --- incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/TxComponentMetaDataHelper.java (added)
> +++ incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/TxComponentMetaDataHelper.java Fri Feb 19 20:37:04 2010
> @@ -0,0 +1,31 @@
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one
> + * or more contributor license agreements. See the NOTICE file
> + * distributed with this work for additional information
> + * regarding copyright ownership. The ASF licenses this file
> + * to you under the Apache License, Version 2.0 (the
> + * "License"); you may not use this file except in compliance
> + * with the License. You may obtain a copy of the License at
> + *
> + * http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing,
> + * software distributed under the License is distributed on an
> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> + * KIND, either express or implied. See the License for the
> + * specific language governing permissions and limitations
> + * under the License.
> + */
> +package org.apache.aries.transaction;
> +
> +import org.osgi.service.blueprint.reflect.ComponentMetadata;
> +
> +public interface TxComponentMetaDataHelper {
> +
> + public void setComponentTransactionData(ComponentMetadata component, String value,
> + String method);
> +
> + public String getComponentMethodTxStrategy(
> + ComponentMetadata component, String methodName);
> +
> +}
>
> Propchange: incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/TxComponentMetaDataHelper.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Propchange: incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/TxComponentMetaDataHelper.java
> ------------------------------------------------------------------------------
> svn:keywords = Date Revision
>
> Propchange: incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/TxComponentMetaDataHelper.java
> ------------------------------------------------------------------------------
> svn:mime-type = text/plain
>
> Added: incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/TxComponentMetaDataHelperImpl.java
> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/TxComponentMetaDataHelperImpl.java?rev=911975&view=auto
> ==============================================================================
> --- incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/TxComponentMetaDataHelperImpl.java (added)
> +++ incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/TxComponentMetaDataHelperImpl.java Fri Feb 19 20:37:04 2010
> @@ -0,0 +1,93 @@
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one
> + * or more contributor license agreements. See the NOTICE file
> + * distributed with this work for additional information
> + * regarding copyright ownership. The ASF licenses this file
> + * to you under the Apache License, Version 2.0 (the
> + * "License"); you may not use this file except in compliance
> + * with the License. You may obtain a copy of the License at
> + *
> + * http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing,
> + * software distributed under the License is distributed on an
> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> + * KIND, either express or implied. See the License for the
> + * specific language governing permissions and limitations
> + * under the License.
> + */
> +package org.apache.aries.transaction;
> +
> +import java.util.Map;
> +import java.util.concurrent.ConcurrentHashMap;
> +import java.util.regex.Pattern;
> +
> +import javax.transaction.TransactionManager;
> +
> +import org.osgi.service.blueprint.reflect.ComponentMetadata;
> +
> +public class TxComponentMetaDataHelperImpl implements TxComponentMetaDataHelper {
> +
> + private static class TranData
> + {
> + private final String strategy;
> + private final Pattern[] methodNames;
> +
> + public TranData(String s, String m)
> + {
> + strategy = s;
> + String[] names = m.split("[, \t]");
> + methodNames = new Pattern[names.length];
> +
> + for (int i = 0; i < names.length; i++) {
> + methodNames[i] = Pattern.compile(names[i].replaceAll("\\*", ".*"));
> + }
> + }
> +
> + public boolean matches(String name)
> + {
> + for (Pattern p : methodNames) {
> + if (p.matcher(name).matches()) {
> + return true;
> + }
> + }
> + return false;
> + }
> + }
> +
> + // TODO cope with having multiple tran data per component.
> + private final Map<ComponentMetadata, TranData> data = new ConcurrentHashMap<ComponentMetadata, TranData>();
> + private TransactionManager tm;
> +
> + public void setComponentTransactionData(ComponentMetadata component, String value, String method)
> + {
> + TranData td = new TranData(value, method);
> +
> + data.put(component, td);
> + }
> +
> + public TransactionManager getTransactionManager()
> + {
> + return tm;
> + }
> +
> + public void setTransactionManager(TransactionManager manager)
> + {
> + tm = manager;
> + }
> +
> +
> + public String getComponentMethodTxStrategy(ComponentMetadata component, String methodName)
> + {
> + String result = null;
> + TranData td = data.get(component);
> +
> + if (td != null) {
> + if (td.matches(methodName)) {
> + result = td.strategy;
> + }
> + }
> +
> + return result;
> + }
> +}
>
> Propchange: incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/TxComponentMetaDataHelperImpl.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Propchange: incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/TxComponentMetaDataHelperImpl.java
> ------------------------------------------------------------------------------
> svn:keywords = Date Revision
>
> Propchange: incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/TxComponentMetaDataHelperImpl.java
> ------------------------------------------------------------------------------
> svn:mime-type = text/plain
>
> Added: incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/TxInterceptorImpl.java
> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/TxInterceptorImpl.java?rev=911975&view=auto
> ==============================================================================
> --- incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/TxInterceptorImpl.java (added)
> +++ incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/TxInterceptorImpl.java Fri Feb 19 20:37:04 2010
> @@ -0,0 +1,129 @@
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one
> + * or more contributor license agreements. See the NOTICE file
> + * distributed with this work for additional information
> + * regarding copyright ownership. The ASF licenses this file
> + * to you under the Apache License, Version 2.0 (the
> + * "License"); you may not use this file except in compliance
> + * with the License. You may obtain a copy of the License at
> + *
> + * http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing,
> + * software distributed under the License is distributed on an
> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> + * KIND, either express or implied. See the License for the
> + * specific language governing permissions and limitations
> + * under the License.
> + */
> +package org.apache.aries.transaction;
> +
> +import java.lang.reflect.Method;
> +
> +import javax.transaction.Transaction;
> +import javax.transaction.TransactionManager;
> +
> +import org.apache.aries.blueprint.Interceptor;
> +import org.apache.aries.transaction.exception.TransactionRollbackException;
> +import org.osgi.service.blueprint.reflect.ComponentMetadata;
> +import org.slf4j.Logger;
> +import org.slf4j.LoggerFactory;
> +
> +
> +public class TxInterceptorImpl implements Interceptor {
> + private static final Logger _logger =
> + LoggerFactory.getLogger("org.apache.aries.transaction");
> +
> + private TransactionManager tm;
> + private TxComponentMetaDataHelper metaDataHelper;
> +
> + public int getRank()
> + {
> + // TODO Auto-generated method stub
> + return 0;
> + }
> +
> + public void postCallWithException(ComponentMetadata cm, Method m,
> + Exception ex, Object preCallToken)
> + {
> + if (preCallToken instanceof TransactionToken)
> + {
> + final TransactionToken token = (TransactionToken)preCallToken;
> + try {
> + token.ts.finish(tm, token.t);
> + }
> + catch (Exception e)
> + {
> + // we do not throw the exception since there already is one, but we need to log it
> + _logger.error("An exception has occured.", e);
> + }
> + } else {
> + // TODO: what now?
> + }
> + }
> +
> + public void postCallWithReturn(ComponentMetadata cm, Method m,
> + Object returnType, Object preCallToken) throws Exception
> + {
> + if (preCallToken instanceof TransactionToken)
> + {
> + final TransactionToken token = (TransactionToken)preCallToken;
> + try {
> + token.ts.finish(tm, token.t);
> + }
> + catch (Exception e)
> + {
> + _logger.error("An exception has occured.", e);
> + throw new TransactionRollbackException(e);
> + }
> + }
> + else {
> + // TODO: what now?
> + }
> + }
> +
> + public Object preCall(ComponentMetadata cm, Method m,
> + Object... parameters) throws Throwable {
> + // extract bundleId, componentName and method name
> + // then lookup using metadatahelper
> + // build transtrategy and call begin
> + // store resulting tx and strategy in return object
> + // which will be passed to postInvoke call
> + final String methodName = m.getName();
> +
> + final String strategy = metaDataHelper.getComponentMethodTxStrategy(cm, methodName);
> +
> + Transaction t;
> + TransactionStrategy txStrategy = TransactionStrategy.REQUIRED;
> + if (strategy != null)
> + {
> + txStrategy = TransactionStrategy.fromValue(strategy);
> + }
> +
> + t = txStrategy.begin(tm);
> +
> + // now construct return object from txStrategy and t
> + return new TransactionToken(t, txStrategy);
> + }
> +
> + public final void setTransactionManager(TransactionManager manager)
> + {
> + tm = manager;
> + }
> +
> + public final void setTxMetaDataHelper(TxComponentMetaDataHelper transactionEnhancer)
> + {
> + this.metaDataHelper = transactionEnhancer;
> + }
> +
> + private static class TransactionToken
> + {
> + private Transaction t;
> + private TransactionStrategy ts;
> + private TransactionToken(Transaction t, TransactionStrategy ts)
> + {
> + this.t = t;
> + this.ts = ts;
> + }
> + }
> +}
>
> Propchange: incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/TxInterceptorImpl.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Propchange: incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/TxInterceptorImpl.java
> ------------------------------------------------------------------------------
> svn:keywords = Date Revision
>
> Propchange: incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/TxInterceptorImpl.java
> ------------------------------------------------------------------------------
> svn:mime-type = text/plain
>
> Added: incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/exception/TransactionRollbackException.java
> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/exception/TransactionRollbackException.java?rev=911975&view=auto
> ==============================================================================
> --- incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/exception/TransactionRollbackException.java (added)
> +++ incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/exception/TransactionRollbackException.java Fri Feb 19 20:37:04 2010
> @@ -0,0 +1,27 @@
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one
> + * or more contributor license agreements. See the NOTICE file
> + * distributed with this work for additional information
> + * regarding copyright ownership. The ASF licenses this file
> + * to you under the Apache License, Version 2.0 (the
> + * "License"); you may not use this file except in compliance
> + * with the License. You may obtain a copy of the License at
> + *
> + * http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing,
> + * software distributed under the License is distributed on an
> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> + * KIND, either express or implied. See the License for the
> + * specific language governing permissions and limitations
> + * under the License.
> + */
> +package org.apache.aries.transaction.exception;
> +
> +public class TransactionRollbackException extends RuntimeException {
> + private static final long serialVersionUID = 6156165262745617113L;
> +
> + public TransactionRollbackException(Throwable cause) {
> + super(cause);
> + }
> +}
>
> Propchange: incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/exception/TransactionRollbackException.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Propchange: incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/exception/TransactionRollbackException.java
> ------------------------------------------------------------------------------
> svn:keywords = Date Revision
>
> Propchange: incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/exception/TransactionRollbackException.java
> ------------------------------------------------------------------------------
> svn:mime-type = text/plain
>
> Added: incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/parsing/TxElementHandler.java
> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/parsing/TxElementHandler.java?rev=911975&view=auto
> ==============================================================================
> --- incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/parsing/TxElementHandler.java (added)
> +++ incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/parsing/TxElementHandler.java Fri Feb 19 20:37:04 2010
> @@ -0,0 +1,106 @@
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one
> + * or more contributor license agreements. See the NOTICE file
> + * distributed with this work for additional information
> + * regarding copyright ownership. The ASF licenses this file
> + * to you under the Apache License, Version 2.0 (the
> + * "License"); you may not use this file except in compliance
> + * with the License. You may obtain a copy of the License at
> + *
> + * http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing,
> + * software distributed under the License is distributed on an
> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> + * KIND, either express or implied. See the License for the
> + * specific language governing permissions and limitations
> + * under the License.
> + */
> +package org.apache.aries.transaction.parsing;
> +
> +import java.net.URL;
> +import java.util.Set;
> +
> +import org.apache.aries.blueprint.ComponentDefinitionRegistry;
> +import org.apache.aries.blueprint.Interceptor;
> +import org.apache.aries.blueprint.NamespaceHandler;
> +import org.apache.aries.blueprint.ParserContext;
> +import org.apache.aries.transaction.TxComponentMetaDataHelper;
> +import org.osgi.service.blueprint.reflect.ComponentMetadata;
> +import org.osgi.service.blueprint.reflect.Metadata;
> +import org.slf4j.Logger;
> +import org.slf4j.LoggerFactory;
> +import org.w3c.dom.Element;
> +import org.w3c.dom.Node;
> +
> +public class TxElementHandler implements NamespaceHandler {
> + private static final Logger _logger =
> + LoggerFactory.getLogger("org.apache.aries.transaction.parsing");
> +
> + private TxComponentMetaDataHelper metaDataHelper;
> + private Interceptor interceptor = null;
> +
> + private void parseElement(Element elt, ComponentMetadata cm, ParserContext pc)
> + {
> + if (_logger.isDebugEnabled())
> + _logger.debug("parser asked to parse .. " + elt);
> +
> + if ("transaction".equals(elt.getLocalName())) {
> + if (_logger.isDebugEnabled())
> + _logger.debug("parser adding interceptor for " + elt);
> +
> + ComponentDefinitionRegistry cdr = pc.getComponentDefinitionRegistry();
> + cdr.registerInterceptorWithComponent(cm, interceptor);
> + if (_logger.isDebugEnabled())
> + _logger.debug("parser setting comp trans data for " + elt.getAttribute("value") + " "
> + + elt.getAttribute("method"));
> +
> + metaDataHelper.setComponentTransactionData(cm, elt.getAttribute("value"), elt
> + .getAttribute("method"));
> + }
> +
> + if (_logger.isDebugEnabled())
> + _logger.debug("parser done with " + elt);
> + }
> +
> + public ComponentMetadata decorate(Node node, ComponentMetadata cm, ParserContext pc)
> + {
> + if (node instanceof Element) {
> + Element elt = (Element) node;
> + parseElement(elt, cm, pc);
> + }
> + return cm;
> + }
> +
> + public Metadata parse(Element elt, ParserContext pc)
> + {
> + //really not sure here if using enclosing component is valid...
> + //TODO: confirm if null may be better.
> + parseElement(elt, pc.getEnclosingComponent(), pc);
> + return null;
> + }
> +
> + public URL getSchemaLocation(String arg0)
> + {
> + return this.getClass().getResource("transaction.xsd");
> + }
> +
> + public final void setTxMetaDataHelper(TxComponentMetaDataHelper transactionEnhancer)
> + {
> + this.metaDataHelper = transactionEnhancer;
> + }
> +
> + public final void setTransactionInterceptor(Interceptor itx)
> + {
> + if (_logger.isDebugEnabled())
> + _logger.debug("parser having interceptor set " + itx);
> +
> + this.interceptor = itx;
> + }
> +
> + public Set<Class> getManagedClasses()
> + {
> + // TODO Auto-generated method stub
> + return null;
> + }
> +}
>
> Propchange: incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/parsing/TxElementHandler.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Propchange: incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/parsing/TxElementHandler.java
> ------------------------------------------------------------------------------
> svn:keywords = Date Revision
>
> Propchange: incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/parsing/TxElementHandler.java
> ------------------------------------------------------------------------------
> svn:mime-type = text/plain
>
> Added: incubator/aries/trunk/transaction/src/main/resources/OSGI-INF/blueprint/transaction.xml
> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/transaction/src/main/resources/OSGI-INF/blueprint/transaction.xml?rev=911975&view=auto
> ==============================================================================
> --- incubator/aries/trunk/transaction/src/main/resources/OSGI-INF/blueprint/transaction.xml (added)
> +++ incubator/aries/trunk/transaction/src/main/resources/OSGI-INF/blueprint/transaction.xml Fri Feb 19 20:37:04 2010
> @@ -0,0 +1,52 @@
> +<?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.
> +
> +-->
> +<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> + xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0"
> + default-activation="lazy">
> +
> + <service interface="org.apache.aries.blueprint.NamespaceHandler">
> + <service-properties>
> + <entry key="osgi.service.blueprint.namespace" value="http://aries.apache.org/xmlns/transactions/v1.0.0"/>
> + </service-properties>
> + <bean class="org.apache.aries.transaction.parsing.TxElementHandler">
> + <property ref="txenhancer" name="txMetaDataHelper"/>
> + <property ref="txinterceptor" name="transactionInterceptor"/>
> + </bean>
> + </service>
> +
> + <bean id="txenhancer" class="org.apache.aries.transaction.TxComponentMetaDataHelperImpl">
> + <property name="transactionManager" ref="tm"/>
> + </bean>
> +
> + <bean id="txinterceptor" class="org.apache.aries.transaction.TxInterceptorImpl">
> + <property name="transactionManager" ref="tm"/>
> + <property ref="txenhancer" name="txMetaDataHelper"/>
> + </bean>
> +
> + <reference id="tm" interface="javax.transaction.TransactionManager"/>
> +
> + <service ref="txinterceptor" interface="org.apache.aries.blueprint.Interceptor">
> + <service-properties>
> + <entry key="namespace" value="http://aries.apache.org/xmlns/transactions/v1.0.0"/>
> + </service-properties>
> + </service>
> +
> +</blueprint>
> \ No newline at end of file
>
> Propchange: incubator/aries/trunk/transaction/src/main/resources/OSGI-INF/blueprint/transaction.xml
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Propchange: incubator/aries/trunk/transaction/src/main/resources/OSGI-INF/blueprint/transaction.xml
> ------------------------------------------------------------------------------
> svn:keywords = Date Revision
>
> Propchange: incubator/aries/trunk/transaction/src/main/resources/OSGI-INF/blueprint/transaction.xml
> ------------------------------------------------------------------------------
> svn:mime-type = text/xml
>
> Added: incubator/aries/trunk/transaction/src/main/resources/org/apache/aries/transaction/parsing/transaction.xsd
> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/transaction/src/main/resources/org/apache/aries/transaction/parsing/transaction.xsd?rev=911975&view=auto
> ==============================================================================
> --- incubator/aries/trunk/transaction/src/main/resources/org/apache/aries/transaction/parsing/transaction.xsd (added)
> +++ incubator/aries/trunk/transaction/src/main/resources/org/apache/aries/transaction/parsing/transaction.xsd Fri Feb 19 20:37:04 2010
> @@ -0,0 +1,45 @@
> +<?xml version="1.0" encoding="UTF-8" standalone="no"?>
> +<!--
> +
> + 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.
> +
> +-->
> +<xsd:schema xmlns="http://aries.apache.org/xmlns/transactions/v1.0.0"
> + xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://aries.apache.org/xmlns/transactions/v1.0.0"
> + elementFormDefault="qualified" attributeFormDefault="unqualified"
> + version="1.0.0">
> +
> +<xsd:simpleType name="TtransactionStrategy">
> + <xsd:restriction base="xsd:string">
> + <xsd:enumeration value="Required"/>
> + <xsd:enumeration value="Mandatory"/>
> + <xsd:enumeration value="RequiresNew"/>
> + <xsd:enumeration value="Supports"/>
> + <xsd:enumeration value="NotSupported"/>
> + <xsd:enumeration value="Never"/>
> + </xsd:restriction>
> +</xsd:simpleType>
> +
> +<xsd:complexType name="Ttransaction">
> + <xsd:attribute name="method" type="xsd:string"/>
> + <xsd:attribute name="value" type="TtransactionStrategy"/>
> +</xsd:complexType>
> +
> +<xsd:element name="transaction" type="Ttransaction">
> +</xsd:element>
> +
> +
> +</xsd:schema>
> \ No newline at end of file
>
> Propchange: incubator/aries/trunk/transaction/src/main/resources/org/apache/aries/transaction/parsing/transaction.xsd
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Propchange: incubator/aries/trunk/transaction/src/main/resources/org/apache/aries/transaction/parsing/transaction.xsd
> ------------------------------------------------------------------------------
> svn:keywords = Date Revision
>
> Propchange: incubator/aries/trunk/transaction/src/main/resources/org/apache/aries/transaction/parsing/transaction.xsd
> ------------------------------------------------------------------------------
> svn:mime-type = text/xml
>
> Propchange: incubator/aries/trunk/transaction/src/test/
> ------------------------------------------------------------------------------
> --- svn:ignore (added)
> +++ svn:ignore Fri Feb 19 20:37:04 2010
> @@ -0,0 +1 @@
> +
>
> Added: incubator/aries/trunk/transaction/src/test/java/org/apache/aries/transaction/NameSpaceHandlerTest.java
> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/transaction/src/test/java/org/apache/aries/transaction/NameSpaceHandlerTest.java?rev=911975&view=auto
> ==============================================================================
> --- incubator/aries/trunk/transaction/src/test/java/org/apache/aries/transaction/NameSpaceHandlerTest.java (added)
> +++ incubator/aries/trunk/transaction/src/test/java/org/apache/aries/transaction/NameSpaceHandlerTest.java Fri Feb 19 20:37:04 2010
> @@ -0,0 +1,101 @@
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one
> + * or more contributor license agreements. See the NOTICE file
> + * distributed with this work for additional information
> + * regarding copyright ownership. The ASF licenses this file
> + * to you under the Apache License, Version 2.0 (the
> + * "License"); you may not use this file except in compliance
> + * with the License. You may obtain a copy of the License at
> + *
> + * http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing,
> + * software distributed under the License is distributed on an
> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> + * KIND, either express or implied. See the License for the
> + * specific language governing permissions and limitations
> + * under the License.
> + */
> +package org.apache.aries.transaction;
> +
> +import static org.junit.Assert.assertEquals;
> +
> +import java.net.URI;
> +import java.net.URL;
> +import java.util.LinkedList;
> +import java.util.List;
> +import java.util.Properties;
> +import java.util.Set;
> +
> +import javax.transaction.TransactionManager;
> +
> +import org.apache.aries.mocks.BundleMock;
> +
> +import org.apache.aries.blueprint.ComponentDefinitionRegistry;
> +import org.apache.aries.blueprint.NamespaceHandler;
> +import org.apache.aries.blueprint.container.NamespaceHandlerRegistry;
> +import org.apache.aries.blueprint.container.Parser;
> +import org.apache.aries.blueprint.container.NamespaceHandlerRegistry.NamespaceHandlerSet;
> +import org.apache.aries.blueprint.namespace.ComponentDefinitionRegistryImpl;
> +import org.apache.aries.blueprint.namespace.NamespaceHandlerRegistryImpl;
> +import org.junit.Test;
> +import org.osgi.framework.Bundle;
> +import org.osgi.framework.BundleContext;
> +import org.osgi.service.blueprint.reflect.BeanMetadata;
> +import org.osgi.service.blueprint.reflect.BeanProperty;
> +
> +import org.apache.aries.transaction.TxComponentMetaDataHelperImpl;
> +import org.apache.aries.transaction.TxInterceptorImpl;
> +import org.apache.aries.transaction.parsing.TxElementHandler;
> +import org.apache.aries.unittest.mocks.Skeleton;
> +
> +public class NameSpaceHandlerTest {
> +
> +
> + @Test
> + public void testMultipleElements() throws Exception
> + {
> + Bundle b = Skeleton.newMock(new BundleMock("com.ibm.ws.eba.tx", new Properties()), Bundle.class);
> + BundleContext ctx = b.getBundleContext();
> + NamespaceHandlerRegistry nhri = new NamespaceHandlerRegistryImpl(ctx);
> +
> + TransactionManager tm = Skeleton.newMock(TransactionManager.class);
> +
> + TxComponentMetaDataHelperImpl txenhancer = new TxComponentMetaDataHelperImpl();
> + txenhancer.setTransactionManager(tm);
> +
> + TxInterceptorImpl txinterceptor = new TxInterceptorImpl();
> + txinterceptor.setTransactionManager(tm);
> + txinterceptor.setTxMetaDataHelper(txenhancer);
> +
> + TxElementHandler namespaceHandler = new TxElementHandler();
> + namespaceHandler.setTransactionInterceptor(txinterceptor);
> + namespaceHandler.setTxMetaDataHelper(txenhancer);
> +
> + Properties props = new Properties();
> + props.put("osgi.service.blueprint.namespace", "http://aries.apache.org/xmlns/transactions/v1.0.0");
> + ctx.registerService(NamespaceHandler.class.getName(), namespaceHandler, props);
> + Parser p = new Parser();
> +
> + URL bpxml = this.getClass().getResource("aries.xml");
> + List<URL> bpxmlList = new LinkedList<URL>();
> + bpxmlList.add(bpxml);
> +
> + p.parse(bpxmlList);
> + Set<URI> nsuris = p.getNamespaces();
> + NamespaceHandlerSet nshandlers = nhri.getNamespaceHandlers(nsuris, b);
> + p.validate(nshandlers.getSchema());
> +
> + ComponentDefinitionRegistry cdr = new ComponentDefinitionRegistryImpl();
> + p.populate(nshandlers, cdr);
> +
> + BeanMetadata comp = (BeanMetadata) cdr.getComponentDefinition("top");
> +
> + BeanMetadata anon = (BeanMetadata) ((BeanProperty) comp.getProperties().get(0)).getValue();
> + BeanMetadata anonToo = (BeanMetadata) ((BeanProperty) comp.getProperties().get(1)).getValue();
> +
> + assertEquals("Required", txenhancer.getComponentMethodTxStrategy(anon, "doSomething"));
> + assertEquals("Never", txenhancer.getComponentMethodTxStrategy(anonToo, "doSomething"));
> +
> + }
> +}
>
> Propchange: incubator/aries/trunk/transaction/src/test/java/org/apache/aries/transaction/NameSpaceHandlerTest.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Propchange: incubator/aries/trunk/transaction/src/test/java/org/apache/aries/transaction/NameSpaceHandlerTest.java
> ------------------------------------------------------------------------------
> svn:keywords = Date Revision
>
> Propchange: incubator/aries/trunk/transaction/src/test/java/org/apache/aries/transaction/NameSpaceHandlerTest.java
> ------------------------------------------------------------------------------
> svn:mime-type = text/plain
>
> Added: incubator/aries/trunk/transaction/src/test/java/org/apache/aries/transaction/TranStrategyTest.java
> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/transaction/src/test/java/org/apache/aries/transaction/TranStrategyTest.java?rev=911975&view=auto
> ==============================================================================
> --- incubator/aries/trunk/transaction/src/test/java/org/apache/aries/transaction/TranStrategyTest.java (added)
> +++ incubator/aries/trunk/transaction/src/test/java/org/apache/aries/transaction/TranStrategyTest.java Fri Feb 19 20:37:04 2010
> @@ -0,0 +1,404 @@
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one
> + * or more contributor license agreements. See the NOTICE file
> + * distributed with this work for additional information
> + * regarding copyright ownership. The ASF licenses this file
> + * to you under the Apache License, Version 2.0 (the
> + * "License"); you may not use this file except in compliance
> + * with the License. You may obtain a copy of the License at
> + *
> + * http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing,
> + * software distributed under the License is distributed on an
> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> + * KIND, either express or implied. See the License for the
> + * specific language governing permissions and limitations
> + * under the License.
> + */
> +package org.apache.aries.transaction;
> +
> +import static org.junit.Assert.assertNotNull;
> +import static org.junit.Assert.assertNull;
> +import static org.junit.Assert.fail;
> +
> +import java.util.HashSet;
> +import java.util.Iterator;
> +import java.util.Set;
> +
> +import javax.transaction.NotSupportedException;
> +import javax.transaction.Status;
> +import javax.transaction.SystemException;
> +import javax.transaction.Transaction;
> +import javax.transaction.TransactionManager;
> +
> +import org.junit.Before;
> +import org.junit.Test;
> +
> +import org.apache.aries.transaction.TransactionStrategy;
> +import org.apache.aries.unittest.mocks.MethodCall;
> +import org.apache.aries.unittest.mocks.Skeleton;
> +
> +public class TranStrategyTest {
> +
> + TransactionManager tm = Skeleton.newMock(TransactionManager.class);
> + Transaction t = Skeleton.newMock(Transaction.class);
> + Skeleton skel = Skeleton.getSkeleton(tm);
> +
> + @Before
> + public void clean()
> + {
> + skel.clearMethodCalls();
> + }
> +
> + @Test
> + public void testMandatoryBegin() throws Exception
> + {
> + // MANDATORY strategy should throw IllegalStateException when tran manager
> + // status is Status.STATUS_NO_TRANSACTION it should not return null.
> + skel.setReturnValue(new MethodCall(TransactionManager.class, "getStatus"), Status.STATUS_NO_TRANSACTION);
> +
> + try {
> + assertNotNull("TransactionStrategy.MANDATORY.begin(tm) returned null when manager " +
> + "status is STATUS_NO_TRANSACTION", TransactionStrategy.MANDATORY.begin(tm));
> + } catch (IllegalStateException ise) {
> + // Expected to be in here
> + } catch (Exception e) {
> + fail("TransactionStrategy.MANDATORY.begin() threw an unexpected exception when tran manager status is STATUS_NO_TRANSACTION");
> + }
> +
> + // MANDATORY strategy should return null for all tran manager states other
> + // than Status.STATUS_NO_TRANSACTION.
> + int[] invalids = new int[]{ Status.STATUS_COMMITTED, Status.STATUS_COMMITTING, Status.STATUS_MARKED_ROLLBACK,
> + Status.STATUS_ACTIVE, Status.STATUS_PREPARED, Status.STATUS_PREPARING, Status.STATUS_ROLLEDBACK,
> + Status.STATUS_ROLLING_BACK, Status.STATUS_UNKNOWN };
> +
> + for (int i = 0; i < invalids.length ; i++) {
> + skel.setReturnValue(new MethodCall(TransactionManager.class, "getStatus"), invalids[i]);
> + try {
> + assertNull("TransactionStrategy.MANDATORY.begin() did not return null when manager status value is " + invalids[i], TransactionStrategy.MANDATORY.begin(tm));
> + } catch (Exception ise) {
> + fail("TransactionStrategy.MANDATORY.begin() threw Exception when manager status value is " + invalids[i]);
> + }
> + }
> + }
> +
> + @Test
> + public void testMandatoryFinish()
> + {
> + try {
> + TransactionStrategy.MANDATORY.finish(tm, t);
> + } catch (Exception e) {
> + fail("TransactionStrategy.MANDATORY.finish() threw an unexpected exception");
> + }
> + }
> +
> +
> + @Test
> + public void testNeverBegin() throws Exception
> + {
> + // NEVER strategy should throw IllegalStateException when tran manager
> + // status is Status.STATUS_ACTIVE it should not return null.
> + skel.setReturnValue(new MethodCall(TransactionManager.class, "getStatus"), Status.STATUS_ACTIVE);
> +
> + try {
> + assertNotNull("TransactionStrategy.NEVER.begin() returned null when manager status is STATUS_ACTIVE", TransactionStrategy.NEVER.begin(tm));
> + } catch (IllegalStateException ise) {
> + // Expect to be in here
> + } catch (Exception e) {
> + fail("TransactionStrategy.NEVER.begin() threw an unexpected exception when tran manager status is STATUS_ACTIVE");
> + }
> +
> + // NEVER strategy should return null for all tran manager states other
> + // than Status.STATUS_ACTIVE.
> + int[] invalids = new int[]{ Status.STATUS_COMMITTED, Status.STATUS_COMMITTING, Status.STATUS_MARKED_ROLLBACK,
> + Status.STATUS_NO_TRANSACTION, Status.STATUS_PREPARED, Status.STATUS_PREPARING, Status.STATUS_ROLLEDBACK,
> + Status.STATUS_ROLLING_BACK, Status.STATUS_UNKNOWN };
> +
> + for (int i = 0; i < invalids.length ; i++) {
> + skel.setReturnValue(new MethodCall(TransactionManager.class, "getStatus"), invalids[i]);
> + try {
> + assertNull("TransactionStrategy.NEVER.begin() did not return null when manager status value is " + invalids[i], TransactionStrategy.NEVER.begin(tm));
> + } catch (Exception ise) {
> + fail("TransactionStrategy.NEVER.begin() threw unexpected exception when manager status value is " + invalids[i]);
> + }
> + }
> +
> + }
> +
> + @Test
> + public void testNeverFinish()
> + {
> + try {
> + TransactionStrategy.NEVER.finish(tm, t);
> + } catch (Exception e) {
> + fail("TransactionStrategy.NEVER.finish() threw an unexpected exception");
> + }
> + }
> +
> + @Test
> + public void testNotSupportedBegin() throws Exception
> + {
> + // NOT_SUPPORTED strategy should suspend an active transaction
> + // and _NOT_ begin a new one
> + skel.setReturnValue(new MethodCall(TransactionManager.class, "getStatus"), Status.STATUS_ACTIVE);
> +
> + TransactionStrategy.NOT_SUPPORTED.begin(tm);
> + skel.assertCalled(new MethodCall(TransactionManager.class, "suspend"));
> + skel.assertNotCalled(new MethodCall(TransactionManager.class, "begin"));
> +
> + // For all situations where there is no active transaction the
> + // NOT_SUPPORTED strategy should return null
> + int[] invalids = new int[]{ Status.STATUS_COMMITTED, Status.STATUS_COMMITTING, Status.STATUS_MARKED_ROLLBACK,
> + Status.STATUS_NO_TRANSACTION, Status.STATUS_PREPARED, Status.STATUS_PREPARING, Status.STATUS_ROLLEDBACK,
> + Status.STATUS_ROLLING_BACK, Status.STATUS_UNKNOWN };
> +
> + for (int i = 0; i < invalids.length ; i++) {
> + skel.setReturnValue(new MethodCall(TransactionManager.class, "getStatus"), invalids[i]);
> + try {
> + assertNull("TransactionStrategy.NOT_SUPPORTED.begin() did not return null when manager status value is " + invalids[i], TransactionStrategy.NOT_SUPPORTED.begin(tm));
> + } catch (Exception ise) {
> + fail("TransactionStrategy.NOT_SUPPORTED.begin() threw unexpected exception when manager status value is " + invalids[i]);
> + }
> + }
> +
> + }
> +
> + @Test
> + public void testNotSupportedFinish()
> + {
> + // If finish is called with a previously active transaction, then
> + // we expect this transaction to be resumed for a NOT_SUPPORTED strategy
> + try {
> + TransactionStrategy.NOT_SUPPORTED.finish(tm, t);
> + skel.assertCalled(new MethodCall(TransactionManager.class, "resume", t));
> + skel.clearMethodCalls();
> + TransactionStrategy.NOT_SUPPORTED.finish(tm, null);
> + skel.assertNotCalled(new MethodCall(TransactionManager.class, "resume", Transaction.class));
> + } catch (Exception e) {
> + fail("TransactionStrategy.NOT_SUPPORTED.finish() threw unexpected exception");
> + }
> + }
> +
> + @Test
> + public void testRequiredBegin() throws Exception
> + {
> + // If there is no previously active transaction when the REQUIRED strategy
> + // is invoked then we expect a call to begin one
> + skel.setReturnValue(new MethodCall(TransactionManager.class, "getStatus"), Status.STATUS_NO_TRANSACTION);
> +
> + TransactionStrategy.REQUIRED.begin(tm);
> + skel.assertCalled(new MethodCall(TransactionManager.class, "begin"));
> + skel.assertNotCalled(new MethodCall(TransactionManager.class, "suspend"));
> +
> + // For all cases where there is a transaction we expect REQUIRED to return null
> + int[] invalids = new int[]{ Status.STATUS_COMMITTED, Status.STATUS_COMMITTING, Status.STATUS_MARKED_ROLLBACK,
> + Status.STATUS_ACTIVE, Status.STATUS_PREPARED, Status.STATUS_PREPARING, Status.STATUS_ROLLEDBACK,
> + Status.STATUS_ROLLING_BACK, Status.STATUS_UNKNOWN };
> +
> + for (int i = 0; i < invalids.length ; i++) {
> + skel.setReturnValue(new MethodCall(TransactionManager.class, "getStatus"), invalids[i]);
> + try {
> + assertNull("TransactionStrategy.REQUIRED.begin() did not return null when manager status value is " + invalids[i], TransactionStrategy.REQUIRED.begin(tm));
> + } catch (Exception ise) {
> + fail("TransactionStrategy.REQUIRED.begin() threw unexpected exception when manager status value is " + invalids[i]);
> + }
> + }
> + }
> +
> + @Test
> + public void testRequiredFinish()
> + {
> + // In the REQUIRED strategy we expect a call to rollback when a call to finish()
> + // is made with a tran where the tran manager status shows Status.STATUS_MARKED_ROLLBACK
> + skel.setReturnValue(new MethodCall(TransactionManager.class, "getStatus"), Status.STATUS_MARKED_ROLLBACK);
> +
> + try {
> + TransactionStrategy.REQUIRED.finish(tm, t);
> + skel.assertCalled(new MethodCall(TransactionManager.class, "rollback"));
> + skel.assertNotCalled(new MethodCall(TransactionManager.class, "commit"));
> +
> + int[] invalids = new int[]{ Status.STATUS_COMMITTED, Status.STATUS_COMMITTING, Status.STATUS_NO_TRANSACTION,
> + Status.STATUS_ACTIVE, Status.STATUS_PREPARED, Status.STATUS_PREPARING, Status.STATUS_ROLLEDBACK,
> + Status.STATUS_ROLLING_BACK, Status.STATUS_UNKNOWN };
> +
> + // For all other tran manager states we expect a call to commit
> + for (int i = 0; i < invalids.length ; i++) {
> + skel.clearMethodCalls();
> + skel.setReturnValue(new MethodCall(TransactionManager.class, "getStatus"), invalids[i]);
> + TransactionStrategy.REQUIRED.finish(tm, t);
> + skel.assertCalled(new MethodCall(TransactionManager.class, "commit"));
> + skel.assertNotCalled(new MethodCall(TransactionManager.class, "rollback"));
> + }
> +
> + // If null is passed instead of a tran we expect nothing to happen
> + skel.clearMethodCalls();
> + TransactionStrategy.REQUIRED.finish(tm, null);
> + skel.assertNotCalled(new MethodCall(TransactionManager.class, "commit"));
> + skel.assertNotCalled(new MethodCall(TransactionManager.class, "rollback"));
> +
> + }catch (Exception e) {
> + fail("TransactionStrategy.REQUIRED.begin() threw unexpected exception");
> + }
> + }
> +
> + @Test
> + public void testRequiresNew_BeginActiveTran() throws Exception
> + {
> + // Suspend case (no exception from tm.begin())
> + skel.setReturnValue(new MethodCall(TransactionManager.class, "getStatus"), Status.STATUS_ACTIVE);
> +
> + // In the case of the REQUIRES_NEW strategy we expect an active tran to be suspended
> + // a new new transaction to begin
> + TransactionStrategy.REQUIRES_NEW.begin(tm);
> + skel.assertCalled(new MethodCall(TransactionManager.class, "suspend"));
> + skel.assertCalled(new MethodCall(TransactionManager.class, "begin"));
> +
> + }
> +
> + @Test
> + public void testRequiresNew_BeginNoActiveTran() throws Exception
> + {
> + // No active tran cases (no exception from tm.begin())
> +
> + int[] manStatus = new int[]{ Status.STATUS_COMMITTED, Status.STATUS_COMMITTING, Status.STATUS_MARKED_ROLLBACK,
> + Status.STATUS_NO_TRANSACTION, Status.STATUS_PREPARED, Status.STATUS_PREPARING, Status.STATUS_ROLLEDBACK,
> + Status.STATUS_ROLLING_BACK, Status.STATUS_UNKNOWN };
> +
> + // For all cases where the tran manager state is _not_ Status.STATUS_ACTIVE
> + // we expect a call to begin a new tran, no call to suspend and null to be
> + // returned from TransactionStrategy.REQUIRES_NEW.begin(tm)
> + for (int i = 0; i < manStatus.length ; i++) {
> + skel.clearMethodCalls();
> + skel.setReturnValue(new MethodCall(TransactionManager.class, "getStatus"), manStatus[i]);
> + try {
> + assertNull("TransactionStrategy.REQUIRES_NEW.begin() did not return null when manager status value is " + manStatus[i], TransactionStrategy.REQUIRES_NEW.begin(tm));
> + skel.assertCalled(new MethodCall(TransactionManager.class, "begin"));
> + skel.assertNotCalled(new MethodCall(TransactionManager.class, "suspend"));
> + } catch (Exception ise) {
> + fail("TransactionStrategy.REQUIRES_NEW.begin() threw unexpected exception when manager status value is " + manStatus[i]);
> + }
> + }
> +
> + }
> +
> + @Test
> + public void testRequiresNew_TmExceptions()
> + {
> + int[] allStates = new int[]{ Status.STATUS_COMMITTED, Status.STATUS_COMMITTING, Status.STATUS_NO_TRANSACTION,
> + Status.STATUS_ACTIVE, Status.STATUS_PREPARED, Status.STATUS_PREPARING, Status.STATUS_ROLLEDBACK,
> + Status.STATUS_MARKED_ROLLBACK, Status.STATUS_ROLLING_BACK, Status.STATUS_UNKNOWN };
> +
> + // SystemException and NotSupportedException from tm.begin()
> + Set<Exception> ees = new HashSet<Exception>();
> + ees.add(new SystemException("KABOOM!"));
> + ees.add(new NotSupportedException("KABOOM!"));
> +
> + // Loop through all states states twice changing the exception thrown
> + // from tm.begin()
> + for (int i = 0 ; i < allStates.length ; i++ ) {
> + Iterator<Exception> iterator = ees.iterator();
> + while (iterator.hasNext()) {
> + Exception e = iterator.next();
> + skel.clearMethodCalls();
> + skel.setReturnValue(new MethodCall(TransactionManager.class, "getStatus"), allStates[i]);
> + skel.setThrows(new MethodCall(TransactionManager.class, "begin"), e);
> + requiresNewExceptionCheck(tm, skel);
> + }
> + }
> + }
> +
> + private void requiresNewExceptionCheck(TransactionManager tm, Skeleton skel)
> + {
> + int managerStatus = -1 ;
> +
> + try {
> + managerStatus = tm.getStatus();
> + } catch (SystemException se){
> + fail("Unable to obtain tran manager status");
> + }
> +
> + // If an ACTIVE tran is already present we expect a call to suspend this tran.
> + // All states should call begin(), whereupon we receive our exception resulting
> + // in calls to resume(t)
> +
> + try {
> + TransactionStrategy.REQUIRES_NEW.begin(tm);
> + } catch (SystemException se) {
> + // Expect to be in here
> + } catch (NotSupportedException nse) {
> + // or to be in here
> + } catch (Exception thrownE) {
> + fail("TransactionStrategy.REQUIRES_NEW.begin() threw unexpected exception when manager status is " + managerStatus);
> + } finally {
> + // If Status.STATUS_ACTIVE
> + if (managerStatus == 0) {
> + skel.assertCalled(new MethodCall(TransactionManager.class, "suspend"));
> + } else {
> + skel.assertNotCalled(new MethodCall(TransactionManager.class, "suspend"));
> + }
> + skel.assertCalled(new MethodCall(TransactionManager.class, "begin"));
> + skel.assertCalled(new MethodCall(TransactionManager.class, "resume", Transaction.class));
> + }
> + }
> +
> + @Test
> + public void testRequiresNew_Finish()
> + {
> + int[] allStates = new int[]{ Status.STATUS_COMMITTED, Status.STATUS_COMMITTING, Status.STATUS_NO_TRANSACTION,
> + Status.STATUS_ACTIVE, Status.STATUS_PREPARED, Status.STATUS_PREPARING, Status.STATUS_ROLLEDBACK,
> + Status.STATUS_MARKED_ROLLBACK, Status.STATUS_ROLLING_BACK, Status.STATUS_UNKNOWN };
> +
> + // Loop through all states calling TransactionStrategy.REQUIRES_NEW.finish
> + // passing tran manager and a tran, then passing tran manager and null
> + for (int i = 0 ; i < allStates.length ; i++ ) {
> + skel.clearMethodCalls();
> + skel.setReturnValue(new MethodCall(TransactionManager.class, "getStatus"), allStates[i]);
> +
> + try {
> + TransactionStrategy.REQUIRES_NEW.finish(tm, t);
> + } catch (Exception e) {
> + fail("TransactionStrategy.REQUIRES_NEW.finish() threw unexpected exception when manager status is " + allStates[i]);
> + } finally {
> + requiresNew_assertion(skel, allStates, i);
> + skel.assertCalled(new MethodCall(TransactionManager.class, "resume", t));
> + }
> +
> + try {
> + skel.clearMethodCalls();
> + TransactionStrategy.REQUIRES_NEW.finish(tm, null);
> + } catch (Exception e) {
> + fail("TransactionStrategy.REQUIRES_NEW.finish() threw unexpected exception when manager status is " + allStates[i]);
> + } finally {
> + requiresNew_assertion(skel, allStates, i);
> + skel.assertNotCalled(new MethodCall(TransactionManager.class, "resume", Transaction.class));
> + }
> + }
> +
> + }
> +
> + private void requiresNew_assertion(Skeleton skel, int[] allStates, int i)
> + {
> + // If tran manager status reports Status.STATUS_MARKED_ROLLBACK we expect
> + // a call to rollback ... otherwise we expect a call to commit
> + if (allStates[i] == Status.STATUS_MARKED_ROLLBACK) {
> + skel.assertCalled(new MethodCall(TransactionManager.class, "rollback"));
> + skel.assertNotCalled(new MethodCall(TransactionManager.class, "commit"));
> + }
> + else {
> + skel.assertCalled(new MethodCall(TransactionManager.class, "commit"));
> + skel.assertNotCalled(new MethodCall(TransactionManager.class, "rollback"));
> + }
> + }
> +
> + @Test
> + public void testSupports()
> + {
> + try {
> + assertNull("TransTransactionStrategy.SUPPORTS.begin(tm) did not return null", TransactionStrategy.SUPPORTS.begin(tm));
> + } catch (Exception e) {
> + fail("TransTransactionStrategy.SUPPORTS.begin(tm) threw an unexpected exception");
> + }
> +
> + }
> +}
>
> Propchange: incubator/aries/trunk/transaction/src/test/java/org/apache/aries/transaction/TranStrategyTest.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Propchange: incubator/aries/trunk/transaction/src/test/java/org/apache/aries/transaction/TranStrategyTest.java
> ------------------------------------------------------------------------------
> svn:keywords = Date Revision
>
> Propchange: incubator/aries/trunk/transaction/src/test/java/org/apache/aries/transaction/TranStrategyTest.java
> ------------------------------------------------------------------------------
> svn:mime-type = text/plain
>
> Added: incubator/aries/trunk/transaction/src/test/resources/org/apache/aries/transaction/aries.xml
> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/transaction/src/test/resources/org/apache/aries/transaction/aries.xml?rev=911975&view=auto
> ==============================================================================
> --- incubator/aries/trunk/transaction/src/test/resources/org/apache/aries/transaction/aries.xml (added)
> +++ incubator/aries/trunk/transaction/src/test/resources/org/apache/aries/transaction/aries.xml Fri Feb 19 20:37:04 2010
> @@ -0,0 +1,35 @@
> +<?xml version="1.0" encoding="UTF-8" standalone="no"?>
> +<!--
> +
> + 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.
> +
> +-->
> +<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
> + xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.0.0">
> +
> + <bean id="top" class="org.apache.aries.transaction.TestBean">
> + <property name="txRequired">
> + <bean class="org.apache.aries.transaction.TestTxBean">
> + <tx:transaction method="*" value="Required"/>
> + </bean>
> + </property>
> + <property name="txNever">
> + <bean class="org.apache.aries.transaction.TestTxBean">
> + <tx:transaction method="*" value="Never"/>
> + </bean>
> + </property>
> + </bean>
> +</blueprint>
> \ No newline at end of file
>
> Propchange: incubator/aries/trunk/transaction/src/test/resources/org/apache/aries/transaction/aries.xml
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Propchange: incubator/aries/trunk/transaction/src/test/resources/org/apache/aries/transaction/aries.xml
> ------------------------------------------------------------------------------
> svn:keywords = Date Revision
>
> Propchange: incubator/aries/trunk/transaction/src/test/resources/org/apache/aries/transaction/aries.xml
> ------------------------------------------------------------------------------
> svn:mime-type = text/xml
>
>
>
--
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com
Re: svn commit: r911975 - in /incubator/aries/trunk/transaction: ./ src/ src/main/ src/main/java/org/apache/aries/transaction/ src/main/java/org/apache/aries/transaction/exception/ src/main/java/org/apache/aries/transaction/parsing/ src/main/resource
Posted by Alasdair Nottingham <no...@apache.org>.
+1
Alasdair
On 19 Feb 2010, at 22:44, Guillaume Nodet <gn...@gmail.com> wrote:
> I really don't think we should merge those two things (the transaction
> manager and support for declarative transactions for blueprint).
> I'll split them asap.
>
> On Fri, Feb 19, 2010 at 21:37, <jb...@apache.org> wrote:
>> Author: jbohn
>> Date: Fri Feb 19 20:37:04 2010
>> New Revision: 911975
>>
>> URL: http://svn.apache.org/viewvc?rev=911975&view=rev
>> Log:
>> ARIES-152 Initial Contribution - declarative transaction support -
>> contribution by Brian DePradine
>>
>> Added:
>> incubator/aries/trunk/transaction/src/main/java/org/apache/aries/
>> transaction/TransactionStrategy.java (with props)
>> incubator/aries/trunk/transaction/src/main/java/org/apache/aries/
>> transaction/TxComponentMetaDataHelper.java (with props)
>> incubator/aries/trunk/transaction/src/main/java/org/apache/aries/
>> transaction/TxComponentMetaDataHelperImpl.java (with props)
>> incubator/aries/trunk/transaction/src/main/java/org/apache/aries/
>> transaction/TxInterceptorImpl.java (with props)
>> incubator/aries/trunk/transaction/src/main/java/org/apache/aries/
>> transaction/exception/
>> incubator/aries/trunk/transaction/src/main/java/org/apache/aries/
>> transaction/exception/TransactionRollbackException.java (with
>> props)
>> incubator/aries/trunk/transaction/src/main/java/org/apache/aries/
>> transaction/parsing/
>> incubator/aries/trunk/transaction/src/main/java/org/apache/aries/
>> transaction/parsing/TxElementHandler.java (with props)
>> incubator/aries/trunk/transaction/src/main/resources/OSGI-INF/
>> incubator/aries/trunk/transaction/src/main/resources/OSGI-INF/
>> blueprint/
>> incubator/aries/trunk/transaction/src/main/resources/OSGI-INF/
>> blueprint/transaction.xml (with props)
>> incubator/aries/trunk/transaction/src/main/resources/org/
>> incubator/aries/trunk/transaction/src/main/resources/org/apache/
>> incubator/aries/trunk/transaction/src/main/resources/org/apache/
>> aries/
>> incubator/aries/trunk/transaction/src/main/resources/org/apache/
>> aries/transaction/
>> incubator/aries/trunk/transaction/src/main/resources/org/apache/
>> aries/transaction/parsing/
>> incubator/aries/trunk/transaction/src/main/resources/org/apache/
>> aries/transaction/parsing/transaction.xsd (with props)
>> incubator/aries/trunk/transaction/src/test/ (with props)
>> incubator/aries/trunk/transaction/src/test/java/
>> incubator/aries/trunk/transaction/src/test/java/org/
>> incubator/aries/trunk/transaction/src/test/java/org/apache/
>> incubator/aries/trunk/transaction/src/test/java/org/apache/aries/
>> incubator/aries/trunk/transaction/src/test/java/org/apache/aries/
>> transaction/
>> incubator/aries/trunk/transaction/src/test/java/org/apache/aries/
>> transaction/NameSpaceHandlerTest.java (with props)
>> incubator/aries/trunk/transaction/src/test/java/org/apache/aries/
>> transaction/TranStrategyTest.java (with props)
>> incubator/aries/trunk/transaction/src/test/resources/
>> incubator/aries/trunk/transaction/src/test/resources/org/
>> incubator/aries/trunk/transaction/src/test/resources/org/apache/
>> incubator/aries/trunk/transaction/src/test/resources/org/apache/
>> aries/
>> incubator/aries/trunk/transaction/src/test/resources/org/apache/
>> aries/transaction/
>> incubator/aries/trunk/transaction/src/test/resources/org/apache/
>> aries/transaction/aries.xml (with props)
>> Modified:
>> incubator/aries/trunk/transaction/pom.xml
>> incubator/aries/trunk/transaction/src/ (props changed)
>> incubator/aries/trunk/transaction/src/main/ (props changed)
>>
>> Modified: incubator/aries/trunk/transaction/pom.xml
>> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/transaction/pom.xml?rev=911975&r1=911974&r2=911975&view=diff
>> ===
>> ===
>> ===
>> =====================================================================
>> --- incubator/aries/trunk/transaction/pom.xml (original)
>> +++ incubator/aries/trunk/transaction/pom.xml Fri Feb 19 20:37:04
>> 2010
>> @@ -64,9 +64,56 @@
>> <version>2.5.6</version>
>> <optional>true</optional>
>> </dependency>
>> + <dependency>
>> + <groupId>org.apache.aries.blueprint</groupId>
>> + <artifactId>org.apache.aries.blueprint</artifactId>
>> + <version>${version}</version>
>> + <scope>provided</scope>
>> + </dependency>
>> + <dependency>
>> + <groupId>junit</groupId>
>> + <artifactId>junit</artifactId>
>> + <version>4.7</version>
>> + <scope>test</scope>
>> + </dependency>
>> + <dependency>
>> + <groupId>org.apache.aries.testsupport</groupId>
>> + <artifactId>org.apache.aries.testsupport.unit</artifactId>
>> + <version>${version}</version>
>> + <scope>test</scope>
>> + </dependency>
>> + <dependency>
>> + <groupId>org.slf4j</groupId>
>> + <artifactId>slf4j-api</artifactId>
>> + <version>1.5.6</version>
>> + </dependency>
>> + <dependency>
>> + <groupId>org.slf4j</groupId>
>> + <artifactId>slf4j-simple</artifactId>
>> + <version>1.5.6</version>
>> + <scope>test</scope>
>> + </dependency>
>> </dependencies>
>>
>> <build>
>> + <resources>
>> + <resource>
>> + <targetPath>OSGI-INF/blueprint</targetPath>
>> + <filtering>false</filtering>
>> + <directory>${basedir}/src/main/resources/OSGI-INF/
>> blueprint</directory>
>> + <includes>
>> + <include>*.xml</include>
>> + </includes>
>> + </resource>
>> + <resource>
>> + <targetPath>org/apache/aries/transaction/parsing</
>> targetPath>
>> + <filtering>false</filtering>
>> + <directory>${basedir}/src/main/resources/org/
>> apache/aries/transaction/parsing</directory>
>> + <includes>
>> + <include>*.xsd</include>
>> + </includes>
>> + </resource>
>> + </resources>
>> <plugins>
>> <plugin>
>> <groupId>org.apache.felix</groupId>
>> @@ -79,17 +126,19 @@
>>
>> org.springframework.*;resolution:=optional,
>> !org.apache.geronimo.transaction*,
>>
>> javax.resource.spi;version="1.5";resolution:=optional,
>> - org.osgi.framework;version="1.4",
>> + org.osgi.framework;version="1.5",
>>
>> org.osgi.service.cm;version="[1.2.0,2.0.0)",
>> *
>> </Import-Package>
>> <Export-Package>
>>
>> org.apache.geronimo.transaction*;version="${geronimo-transaction-
>> version}",
>> - javax.transaction*;version="1.1"
>> + javax.transaction*;version="1.1",
>> + org.apache.aries.transaction.exception
>> </Export-Package>
>> <Private-Package>
>> org.objectweb.howl.log*,
>> - org.apache.aries.transaction
>> + org.apache.aries.transaction,
>> + org.apache.aries.transaction.parsing
>> </Private-Package>
>> <Bundle-SymbolicName>${pom.artifactId}</
>> Bundle-SymbolicName>
>> <Bundle-
>> Activator>org.apache.aries.transaction.Activator</Bundle-Activator>
>>
>> Propchange: incubator/aries/trunk/transaction/src/
>> ---
>> ---
>> ---
>> ---------------------------------------------------------------------
>> --- svn:ignore (added)
>> +++ svn:ignore Fri Feb 19 20:37:04 2010
>> @@ -0,0 +1 @@
>> +
>>
>> Propchange: incubator/aries/trunk/transaction/src/main/
>> ---
>> ---
>> ---
>> ---------------------------------------------------------------------
>> --- svn:ignore (added)
>> +++ svn:ignore Fri Feb 19 20:37:04 2010
>> @@ -0,0 +1 @@
>> +
>>
>> Added: incubator/aries/trunk/transaction/src/main/java/org/apache/
>> aries/transaction/TransactionStrategy.java
>> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/TransactionStrategy.java?rev=911975&view=auto
>> ===
>> ===
>> ===
>> =====================================================================
>> --- incubator/aries/trunk/transaction/src/main/java/org/apache/
>> aries/transaction/TransactionStrategy.java (added)
>> +++ incubator/aries/trunk/transaction/src/main/java/org/apache/
>> aries/transaction/TransactionStrategy.java Fri Feb 19 20:37:04 2010
>> @@ -0,0 +1,156 @@
>> +/*
>> + * Licensed to the Apache Software Foundation (ASF) under one
>> + * or more contributor license agreements. See the NOTICE file
>> + * distributed with this work for additional information
>> + * regarding copyright ownership. The ASF licenses this file
>> + * to you under the Apache License, Version 2.0 (the
>> + * "License"); you may not use this file except in compliance
>> + * with the License. You may obtain a copy of the License at
>> + *
>> + * http://www.apache.org/licenses/LICENSE-2.0
>> + *
>> + * Unless required by applicable law or agreed to in writing,
>> + * software distributed under the License is distributed on an
>> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>> + * KIND, either express or implied. See the License for the
>> + * specific language governing permissions and limitations
>> + * under the License.
>> + */
>> +package org.apache.aries.transaction;
>> +
>> +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;
>> +
>> +public enum TransactionStrategy {
>> + MANDATORY
>> + {
>> + public Transaction begin(TransactionManager man) throws
>> SystemException
>> + {
>> + if (man.getStatus() == Status.STATUS_NO_TRANSACTION) {
>> + throw new IllegalStateException("No tran on thread");
>> + }
>> +
>> + return null;
>> + }
>> + },
>> + NEVER
>> + {
>> + public Transaction begin(TransactionManager man) throws
>> SystemException
>> + {
>> + if (man.getStatus() == Status.STATUS_ACTIVE) {
>> + throw new IllegalStateException("Tran on thread");
>> + }
>> +
>> + return null;
>> + }
>> + },
>> + NOT_SUPPORTED
>> + {
>> + public Transaction begin(TransactionManager man) throws
>> SystemException
>> + {
>> + if (man.getStatus() == Status.STATUS_ACTIVE) {
>> + return man.suspend();
>> + }
>> +
>> + return null;
>> + }
>> +
>> + public void finish(TransactionManager man, Transaction tran)
>> throws SystemException,
>> + InvalidTransactionException, IllegalStateException
>> + {
>> + if (tran != null) {
>> + man.resume(tran);
>> + }
>> + }
>> + },
>> + REQUIRED
>> + {
>> + public Transaction begin(TransactionManager man) throws
>> SystemException, NotSupportedException
>> + {
>> + if (man.getStatus() == Status.STATUS_NO_TRANSACTION) {
>> + man.begin();
>> + return man.getTransaction();
>> + }
>> +
>> + return null;
>> + }
>> +
>> + public void finish(TransactionManager man, Transaction tran)
>> throws SystemException,
>> + InvalidTransactionException, IllegalStateException,
>> SecurityException, RollbackException,
>> + HeuristicMixedException, HeuristicRollbackException
>> + {
>> + if (tran != null) {
>> + if (man.getStatus() == Status.STATUS_MARKED_ROLLBACK) {
>> + man.rollback();
>> + } else {
>> + man.commit();
>> + }
>> + }
>> + }
>> + },
>> + REQUIRES_NEW
>> + {
>> + public Transaction begin(TransactionManager man) throws
>> SystemException, NotSupportedException,
>> + InvalidTransactionException, IllegalStateException
>> + {
>> + Transaction result;
>> + if (man.getStatus() == Status.STATUS_ACTIVE) {
>> + result = man.suspend();
>> + } else {
>> + result = null;
>> + }
>> +
>> + try {
>> + man.begin();
>> + } catch (SystemException e) {
>> + man.resume(result);
>> + throw e;
>> + } catch (NotSupportedException e) {
>> + man.resume(result);
>> + throw e;
>> + }
>> + return result;
>> + }
>> +
>> + public void finish(TransactionManager man, Transaction tran)
>> throws SystemException,
>> + InvalidTransactionException, IllegalStateException,
>> SecurityException, RollbackException,
>> + HeuristicMixedException, HeuristicRollbackException
>> + {
>> + if (man.getStatus() == Status.STATUS_MARKED_ROLLBACK) {
>> + man.rollback();
>> + } else {
>> + man.commit();
>> + }
>> +
>> + if (tran != null) {
>> + man.resume(tran);
>> + }
>> + }
>> + },
>> + SUPPORTS;
>> +
>> + public static TransactionStrategy fromValue(String value)
>> + {
>> + return valueOf(value.toUpperCase());
>> + }
>> +
>> + public Transaction begin(TransactionManager man) throws
>> SystemException, NotSupportedException,
>> + InvalidTransactionException, IllegalStateException
>> + {
>> + return null;
>> + }
>> +
>> + public void finish(TransactionManager man, Transaction tran)
>> throws SystemException,
>> + InvalidTransactionException, IllegalStateException,
>> SecurityException, RollbackException,
>> + HeuristicMixedException, HeuristicRollbackException
>> + {
>> +
>> + }
>> +}
>>
>> Propchange: incubator/aries/trunk/transaction/src/main/java/org/
>> apache/aries/transaction/TransactionStrategy.java
>> ---
>> ---
>> ---
>> ---------------------------------------------------------------------
>> svn:eol-style = native
>>
>> Propchange: incubator/aries/trunk/transaction/src/main/java/org/
>> apache/aries/transaction/TransactionStrategy.java
>> ---
>> ---
>> ---
>> ---------------------------------------------------------------------
>> svn:keywords = Date Revision
>>
>> Propchange: incubator/aries/trunk/transaction/src/main/java/org/
>> apache/aries/transaction/TransactionStrategy.java
>> ---
>> ---
>> ---
>> ---------------------------------------------------------------------
>> svn:mime-type = text/plain
>>
>> Added: incubator/aries/trunk/transaction/src/main/java/org/apache/
>> aries/transaction/TxComponentMetaDataHelper.java
>> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/TxComponentMetaDataHelper.java?rev=911975&view=auto
>> ===
>> ===
>> ===
>> =====================================================================
>> --- incubator/aries/trunk/transaction/src/main/java/org/apache/
>> aries/transaction/TxComponentMetaDataHelper.java (added)
>> +++ incubator/aries/trunk/transaction/src/main/java/org/apache/
>> aries/transaction/TxComponentMetaDataHelper.java Fri Feb 19
>> 20:37:04 2010
>> @@ -0,0 +1,31 @@
>> +/*
>> + * Licensed to the Apache Software Foundation (ASF) under one
>> + * or more contributor license agreements. See the NOTICE file
>> + * distributed with this work for additional information
>> + * regarding copyright ownership. The ASF licenses this file
>> + * to you under the Apache License, Version 2.0 (the
>> + * "License"); you may not use this file except in compliance
>> + * with the License. You may obtain a copy of the License at
>> + *
>> + * http://www.apache.org/licenses/LICENSE-2.0
>> + *
>> + * Unless required by applicable law or agreed to in writing,
>> + * software distributed under the License is distributed on an
>> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>> + * KIND, either express or implied. See the License for the
>> + * specific language governing permissions and limitations
>> + * under the License.
>> + */
>> +package org.apache.aries.transaction;
>> +
>> +import org.osgi.service.blueprint.reflect.ComponentMetadata;
>> +
>> +public interface TxComponentMetaDataHelper {
>> +
>> + public void setComponentTransactionData(ComponentMetadata
>> component, String value,
>> + String method);
>> +
>> + public String getComponentMethodTxStrategy(
>> + ComponentMetadata component, String methodName);
>> +
>> +}
>>
>> Propchange: incubator/aries/trunk/transaction/src/main/java/org/
>> apache/aries/transaction/TxComponentMetaDataHelper.java
>> ---
>> ---
>> ---
>> ---------------------------------------------------------------------
>> svn:eol-style = native
>>
>> Propchange: incubator/aries/trunk/transaction/src/main/java/org/
>> apache/aries/transaction/TxComponentMetaDataHelper.java
>> ---
>> ---
>> ---
>> ---------------------------------------------------------------------
>> svn:keywords = Date Revision
>>
>> Propchange: incubator/aries/trunk/transaction/src/main/java/org/
>> apache/aries/transaction/TxComponentMetaDataHelper.java
>> ---
>> ---
>> ---
>> ---------------------------------------------------------------------
>> svn:mime-type = text/plain
>>
>> Added: incubator/aries/trunk/transaction/src/main/java/org/apache/
>> aries/transaction/TxComponentMetaDataHelperImpl.java
>> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/TxComponentMetaDataHelperImpl.java?rev=911975&view=auto
>> ===
>> ===
>> ===
>> =====================================================================
>> --- incubator/aries/trunk/transaction/src/main/java/org/apache/
>> aries/transaction/TxComponentMetaDataHelperImpl.java (added)
>> +++ incubator/aries/trunk/transaction/src/main/java/org/apache/
>> aries/transaction/TxComponentMetaDataHelperImpl.java Fri Feb 19
>> 20:37:04 2010
>> @@ -0,0 +1,93 @@
>> +/*
>> + * Licensed to the Apache Software Foundation (ASF) under one
>> + * or more contributor license agreements. See the NOTICE file
>> + * distributed with this work for additional information
>> + * regarding copyright ownership. The ASF licenses this file
>> + * to you under the Apache License, Version 2.0 (the
>> + * "License"); you may not use this file except in compliance
>> + * with the License. You may obtain a copy of the License at
>> + *
>> + * http://www.apache.org/licenses/LICENSE-2.0
>> + *
>> + * Unless required by applicable law or agreed to in writing,
>> + * software distributed under the License is distributed on an
>> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>> + * KIND, either express or implied. See the License for the
>> + * specific language governing permissions and limitations
>> + * under the License.
>> + */
>> +package org.apache.aries.transaction;
>> +
>> +import java.util.Map;
>> +import java.util.concurrent.ConcurrentHashMap;
>> +import java.util.regex.Pattern;
>> +
>> +import javax.transaction.TransactionManager;
>> +
>> +import org.osgi.service.blueprint.reflect.ComponentMetadata;
>> +
>> +public class TxComponentMetaDataHelperImpl implements
>> TxComponentMetaDataHelper {
>> +
>> + private static class TranData
>> + {
>> + private final String strategy;
>> + private final Pattern[] methodNames;
>> +
>> + public TranData(String s, String m)
>> + {
>> + strategy = s;
>> + String[] names = m.split("[, \t]");
>> + methodNames = new Pattern[names.length];
>> +
>> + for (int i = 0; i < names.length; i++) {
>> + methodNames[i] = Pattern.compile(names[i].replaceAll("\
>> \*", ".*"));
>> + }
>> + }
>> +
>> + public boolean matches(String name)
>> + {
>> + for (Pattern p : methodNames) {
>> + if (p.matcher(name).matches()) {
>> + return true;
>> + }
>> + }
>> + return false;
>> + }
>> + }
>> +
>> + // TODO cope with having multiple tran data per component.
>> + private final Map<ComponentMetadata, TranData> data = new
>> ConcurrentHashMap<ComponentMetadata, TranData>();
>> + private TransactionManager tm;
>> +
>> + public void setComponentTransactionData(ComponentMetadata
>> component, String value, String method)
>> + {
>> + TranData td = new TranData(value, method);
>> +
>> + data.put(component, td);
>> + }
>> +
>> + public TransactionManager getTransactionManager()
>> + {
>> + return tm;
>> + }
>> +
>> + public void setTransactionManager(TransactionManager manager)
>> + {
>> + tm = manager;
>> + }
>> +
>> +
>> + public String getComponentMethodTxStrategy(ComponentMetadata
>> component, String methodName)
>> + {
>> + String result = null;
>> + TranData td = data.get(component);
>> +
>> + if (td != null) {
>> + if (td.matches(methodName)) {
>> + result = td.strategy;
>> + }
>> + }
>> +
>> + return result;
>> + }
>> +}
>>
>> Propchange: incubator/aries/trunk/transaction/src/main/java/org/
>> apache/aries/transaction/TxComponentMetaDataHelperImpl.java
>> ---
>> ---
>> ---
>> ---------------------------------------------------------------------
>> svn:eol-style = native
>>
>> Propchange: incubator/aries/trunk/transaction/src/main/java/org/
>> apache/aries/transaction/TxComponentMetaDataHelperImpl.java
>> ---
>> ---
>> ---
>> ---------------------------------------------------------------------
>> svn:keywords = Date Revision
>>
>> Propchange: incubator/aries/trunk/transaction/src/main/java/org/
>> apache/aries/transaction/TxComponentMetaDataHelperImpl.java
>> ---
>> ---
>> ---
>> ---------------------------------------------------------------------
>> svn:mime-type = text/plain
>>
>> Added: incubator/aries/trunk/transaction/src/main/java/org/apache/
>> aries/transaction/TxInterceptorImpl.java
>> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/TxInterceptorImpl.java?rev=911975&view=auto
>> ===
>> ===
>> ===
>> =====================================================================
>> --- incubator/aries/trunk/transaction/src/main/java/org/apache/
>> aries/transaction/TxInterceptorImpl.java (added)
>> +++ incubator/aries/trunk/transaction/src/main/java/org/apache/
>> aries/transaction/TxInterceptorImpl.java Fri Feb 19 20:37:04 2010
>> @@ -0,0 +1,129 @@
>> +/*
>> + * Licensed to the Apache Software Foundation (ASF) under one
>> + * or more contributor license agreements. See the NOTICE file
>> + * distributed with this work for additional information
>> + * regarding copyright ownership. The ASF licenses this file
>> + * to you under the Apache License, Version 2.0 (the
>> + * "License"); you may not use this file except in compliance
>> + * with the License. You may obtain a copy of the License at
>> + *
>> + * http://www.apache.org/licenses/LICENSE-2.0
>> + *
>> + * Unless required by applicable law or agreed to in writing,
>> + * software distributed under the License is distributed on an
>> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>> + * KIND, either express or implied. See the License for the
>> + * specific language governing permissions and limitations
>> + * under the License.
>> + */
>> +package org.apache.aries.transaction;
>> +
>> +import java.lang.reflect.Method;
>> +
>> +import javax.transaction.Transaction;
>> +import javax.transaction.TransactionManager;
>> +
>> +import org.apache.aries.blueprint.Interceptor;
>> +import
>> org.apache.aries.transaction.exception.TransactionRollbackException;
>> +import org.osgi.service.blueprint.reflect.ComponentMetadata;
>> +import org.slf4j.Logger;
>> +import org.slf4j.LoggerFactory;
>> +
>> +
>> +public class TxInterceptorImpl implements Interceptor {
>> + private static final Logger _logger =
>> + LoggerFactory.getLogger("org.apache.aries.transaction");
>> +
>> + private TransactionManager tm;
>> + private TxComponentMetaDataHelper metaDataHelper;
>> +
>> + public int getRank()
>> + {
>> + // TODO Auto-generated method stub
>> + return 0;
>> + }
>> +
>> + public void postCallWithException(ComponentMetadata cm, Method
>> m,
>> + Exception ex, Object preCallToken)
>> + {
>> + if (preCallToken instanceof TransactionToken)
>> + {
>> + final TransactionToken token = (TransactionToken)
>> preCallToken;
>> + try {
>> + token.ts.finish(tm, token.t);
>> + }
>> + catch (Exception e)
>> + {
>> + // we do not throw the exception since there already is
>> one, but we need to log it
>> + _logger.error("An exception has occured.", e);
>> + }
>> + } else {
>> + // TODO: what now?
>> + }
>> + }
>> +
>> + public void postCallWithReturn(ComponentMetadata cm, Method m,
>> + Object returnType, Object preCallToken) throws Exception
>> + {
>> + if (preCallToken instanceof TransactionToken)
>> + {
>> + final TransactionToken token = (TransactionToken)
>> preCallToken;
>> + try {
>> + token.ts.finish(tm, token.t);
>> + }
>> + catch (Exception e)
>> + {
>> + _logger.error("An exception has occured.", e);
>> + throw new TransactionRollbackException(e);
>> + }
>> + }
>> + else {
>> + // TODO: what now?
>> + }
>> + }
>> +
>> + public Object preCall(ComponentMetadata cm, Method m,
>> + Object... parameters) throws Throwable {
>> + // extract bundleId, componentName and method name
>> + // then lookup using metadatahelper
>> + // build transtrategy and call begin
>> + // store resulting tx and strategy in return object
>> + // which will be passed to postInvoke call
>> + final String methodName = m.getName();
>> +
>> + final String strategy =
>> metaDataHelper.getComponentMethodTxStrategy(cm, methodName);
>> +
>> + Transaction t;
>> + TransactionStrategy txStrategy = TransactionStrategy.REQUIRED;
>> + if (strategy != null)
>> + {
>> + txStrategy = TransactionStrategy.fromValue(strategy);
>> + }
>> +
>> + t = txStrategy.begin(tm);
>> +
>> + // now construct return object from txStrategy and t
>> + return new TransactionToken(t, txStrategy);
>> + }
>> +
>> + public final void setTransactionManager(TransactionManager
>> manager)
>> + {
>> + tm = manager;
>> + }
>> +
>> + public final void setTxMetaDataHelper
>> (TxComponentMetaDataHelper transactionEnhancer)
>> + {
>> + this.metaDataHelper = transactionEnhancer;
>> + }
>> +
>> + private static class TransactionToken
>> + {
>> + private Transaction t;
>> + private TransactionStrategy ts;
>> + private TransactionToken(Transaction t, TransactionStrategy
>> ts)
>> + {
>> + this.t = t;
>> + this.ts = ts;
>> + }
>> + }
>> +}
>>
>> Propchange: incubator/aries/trunk/transaction/src/main/java/org/
>> apache/aries/transaction/TxInterceptorImpl.java
>> ---
>> ---
>> ---
>> ---------------------------------------------------------------------
>> svn:eol-style = native
>>
>> Propchange: incubator/aries/trunk/transaction/src/main/java/org/
>> apache/aries/transaction/TxInterceptorImpl.java
>> ---
>> ---
>> ---
>> ---------------------------------------------------------------------
>> svn:keywords = Date Revision
>>
>> Propchange: incubator/aries/trunk/transaction/src/main/java/org/
>> apache/aries/transaction/TxInterceptorImpl.java
>> ---
>> ---
>> ---
>> ---------------------------------------------------------------------
>> svn:mime-type = text/plain
>>
>> Added: incubator/aries/trunk/transaction/src/main/java/org/apache/
>> aries/transaction/exception/TransactionRollbackException.java
>> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/exception/TransactionRollbackException.java?rev=911975&view=auto
>> ===
>> ===
>> ===
>> =====================================================================
>> --- incubator/aries/trunk/transaction/src/main/java/org/apache/
>> aries/transaction/exception/TransactionRollbackException.java (added)
>> +++ incubator/aries/trunk/transaction/src/main/java/org/apache/
>> aries/transaction/exception/TransactionRollbackException.java Fri
>> Feb 19 20:37:04 2010
>> @@ -0,0 +1,27 @@
>> +/*
>> + * Licensed to the Apache Software Foundation (ASF) under one
>> + * or more contributor license agreements. See the NOTICE file
>> + * distributed with this work for additional information
>> + * regarding copyright ownership. The ASF licenses this file
>> + * to you under the Apache License, Version 2.0 (the
>> + * "License"); you may not use this file except in compliance
>> + * with the License. You may obtain a copy of the License at
>> + *
>> + * http://www.apache.org/licenses/LICENSE-2.0
>> + *
>> + * Unless required by applicable law or agreed to in writing,
>> + * software distributed under the License is distributed on an
>> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>> + * KIND, either express or implied. See the License for the
>> + * specific language governing permissions and limitations
>> + * under the License.
>> + */
>> +package org.apache.aries.transaction.exception;
>> +
>> +public class TransactionRollbackException extends RuntimeException {
>> + private static final long serialVersionUID =
>> 6156165262745617113L;
>> +
>> + public TransactionRollbackException(Throwable cause) {
>> + super(cause);
>> + }
>> +}
>>
>> Propchange: incubator/aries/trunk/transaction/src/main/java/org/
>> apache/aries/transaction/exception/TransactionRollbackException.java
>> ---
>> ---
>> ---
>> ---------------------------------------------------------------------
>> svn:eol-style = native
>>
>> Propchange: incubator/aries/trunk/transaction/src/main/java/org/
>> apache/aries/transaction/exception/TransactionRollbackException.java
>> ---
>> ---
>> ---
>> ---------------------------------------------------------------------
>> svn:keywords = Date Revision
>>
>> Propchange: incubator/aries/trunk/transaction/src/main/java/org/
>> apache/aries/transaction/exception/TransactionRollbackException.java
>> ---
>> ---
>> ---
>> ---------------------------------------------------------------------
>> svn:mime-type = text/plain
>>
>> Added: incubator/aries/trunk/transaction/src/main/java/org/apache/
>> aries/transaction/parsing/TxElementHandler.java
>> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/transaction/src/main/java/org/apache/aries/transaction/parsing/TxElementHandler.java?rev=911975&view=auto
>> ===
>> ===
>> ===
>> =====================================================================
>> --- incubator/aries/trunk/transaction/src/main/java/org/apache/
>> aries/transaction/parsing/TxElementHandler.java (added)
>> +++ incubator/aries/trunk/transaction/src/main/java/org/apache/
>> aries/transaction/parsing/TxElementHandler.java Fri Feb 19 20:37:04
>> 2010
>> @@ -0,0 +1,106 @@
>> +/*
>> + * Licensed to the Apache Software Foundation (ASF) under one
>> + * or more contributor license agreements. See the NOTICE file
>> + * distributed with this work for additional information
>> + * regarding copyright ownership. The ASF licenses this file
>> + * to you under the Apache License, Version 2.0 (the
>> + * "License"); you may not use this file except in compliance
>> + * with the License. You may obtain a copy of the License at
>> + *
>> + * http://www.apache.org/licenses/LICENSE-2.0
>> + *
>> + * Unless required by applicable law or agreed to in writing,
>> + * software distributed under the License is distributed on an
>> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>> + * KIND, either express or implied. See the License for the
>> + * specific language governing permissions and limitations
>> + * under the License.
>> + */
>> +package org.apache.aries.transaction.parsing;
>> +
>> +import java.net.URL;
>> +import java.util.Set;
>> +
>> +import org.apache.aries.blueprint.ComponentDefinitionRegistry;
>> +import org.apache.aries.blueprint.Interceptor;
>> +import org.apache.aries.blueprint.NamespaceHandler;
>> +import org.apache.aries.blueprint.ParserContext;
>> +import org.apache.aries.transaction.TxComponentMetaDataHelper;
>> +import org.osgi.service.blueprint.reflect.ComponentMetadata;
>> +import org.osgi.service.blueprint.reflect.Metadata;
>> +import org.slf4j.Logger;
>> +import org.slf4j.LoggerFactory;
>> +import org.w3c.dom.Element;
>> +import org.w3c.dom.Node;
>> +
>> +public class TxElementHandler implements NamespaceHandler {
>> + private static final Logger _logger =
>> + LoggerFactory.getLogger
>> ("org.apache.aries.transaction.parsing");
>> +
>> + private TxComponentMetaDataHelper metaDataHelper;
>> + private Interceptor interceptor = null;
>> +
>> + private void parseElement(Element elt, ComponentMetadata cm,
>> ParserContext pc)
>> + {
>> + if (_logger.isDebugEnabled())
>> + _logger.debug("parser asked to parse .. " + elt);
>> +
>> + if ("transaction".equals(elt.getLocalName())) {
>> + if (_logger.isDebugEnabled())
>> + _logger.debug("parser adding interceptor for " +
>> elt);
>> +
>> + ComponentDefinitionRegistry cdr =
>> pc.getComponentDefinitionRegistry();
>> + cdr.registerInterceptorWithComponent(cm, interceptor);
>> + if (_logger.isDebugEnabled())
>> + _logger.debug("parser setting comp trans data for
>> " + elt.getAttribute("value") + " "
>> + + elt.getAttribute("method"));
>> +
>> + metaDataHelper.setComponentTransactionData(cm,
>> elt.getAttribute("value"), elt
>> + .getAttribute("method"));
>> + }
>> +
>> + if (_logger.isDebugEnabled())
>> + _logger.debug("parser done with " + elt);
>> + }
>> +
>> + public ComponentMetadata decorate(Node node, ComponentMetadata
>> cm, ParserContext pc)
>> + {
>> + if (node instanceof Element) {
>> + Element elt = (Element) node;
>> + parseElement(elt, cm, pc);
>> + }
>> + return cm;
>> + }
>> +
>> + public Metadata parse(Element elt, ParserContext pc)
>> + {
>> + //really not sure here if using enclosing component is
>> valid...
>> + //TODO: confirm if null may be better.
>> + parseElement(elt, pc.getEnclosingComponent(), pc);
>> + return null;
>> + }
>> +
>> + public URL getSchemaLocation(String arg0)
>> + {
>> + return this.getClass().getResource("transaction.xsd");
>> + }
>> +
>> + public final void setTxMetaDataHelper
>> (TxComponentMetaDataHelper transactionEnhancer)
>> + {
>> + this.metaDataHelper = transactionEnhancer;
>> + }
>> +
>> + public final void setTransactionInterceptor(Interceptor itx)
>> + {
>> + if (_logger.isDebugEnabled())
>> + _logger.debug("parser having interceptor set " + itx);
>> +
>> + this.interceptor = itx;
>> + }
>> +
>> + public Set<Class> getManagedClasses()
>> + {
>> + // TODO Auto-generated method stub
>> + return null;
>> + }
>> +}
>>
>> Propchange: incubator/aries/trunk/transaction/src/main/java/org/
>> apache/aries/transaction/parsing/TxElementHandler.java
>> ---
>> ---
>> ---
>> ---------------------------------------------------------------------
>> svn:eol-style = native
>>
>> Propchange: incubator/aries/trunk/transaction/src/main/java/org/
>> apache/aries/transaction/parsing/TxElementHandler.java
>> ---
>> ---
>> ---
>> ---------------------------------------------------------------------
>> svn:keywords = Date Revision
>>
>> Propchange: incubator/aries/trunk/transaction/src/main/java/org/
>> apache/aries/transaction/parsing/TxElementHandler.java
>> ---
>> ---
>> ---
>> ---------------------------------------------------------------------
>> svn:mime-type = text/plain
>>
>> Added: incubator/aries/trunk/transaction/src/main/resources/OSGI-
>> INF/blueprint/transaction.xml
>> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/transaction/src/main/resources/OSGI-INF/blueprint/transaction.xml?rev=911975&view=auto
>> ===
>> ===
>> ===
>> =====================================================================
>> --- incubator/aries/trunk/transaction/src/main/resources/OSGI-INF/
>> blueprint/transaction.xml (added)
>> +++ incubator/aries/trunk/transaction/src/main/resources/OSGI-INF/
>> blueprint/transaction.xml Fri Feb 19 20:37:04 2010
>> @@ -0,0 +1,52 @@
>> +<?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.
>> +
>> +-->
>> +<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> + xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0
>> "
>> + default-activation="lazy">
>> +
>> + <service interface="org.apache.aries.blueprint.NamespaceHandler">
>> + <service-properties>
>> + <entry key="osgi.service.blueprint.namespace" value="http://aries.apache.org/xmlns/transactions/v1.0.0
>> "/>
>> + </service-properties>
>> + <bean
>> class="org.apache.aries.transaction.parsing.TxElementHandler">
>> + <property ref="txenhancer" name="txMetaDataHelper"/>
>> + <property ref="txinterceptor"
>> name="transactionInterceptor"/>
>> + </bean>
>> + </service>
>> +
>> + <bean id="txenhancer"
>> class="org.apache.aries.transaction.TxComponentMetaDataHelperImpl">
>> + <property name="transactionManager" ref="tm"/>
>> + </bean>
>> +
>> + <bean id="txinterceptor"
>> class="org.apache.aries.transaction.TxInterceptorImpl">
>> + <property name="transactionManager" ref="tm"/>
>> + <property ref="txenhancer" name="txMetaDataHelper"/>
>> + </bean>
>> +
>> + <reference id="tm"
>> interface="javax.transaction.TransactionManager"/>
>> +
>> + <service ref="txinterceptor"
>> interface="org.apache.aries.blueprint.Interceptor">
>> + <service-properties>
>> + <entry key="namespace" value="http://aries.apache.org/xmlns/transactions/v1.0.0
>> "/>
>> + </service-properties>
>> + </service>
>> +
>> +</blueprint>
>> \ No newline at end of file
>>
>> Propchange: incubator/aries/trunk/transaction/src/main/resources/
>> OSGI-INF/blueprint/transaction.xml
>> ---
>> ---
>> ---
>> ---------------------------------------------------------------------
>> svn:eol-style = native
>>
>> Propchange: incubator/aries/trunk/transaction/src/main/resources/
>> OSGI-INF/blueprint/transaction.xml
>> ---
>> ---
>> ---
>> ---------------------------------------------------------------------
>> svn:keywords = Date Revision
>>
>> Propchange: incubator/aries/trunk/transaction/src/main/resources/
>> OSGI-INF/blueprint/transaction.xml
>> ---
>> ---
>> ---
>> ---------------------------------------------------------------------
>> svn:mime-type = text/xml
>>
>> Added: incubator/aries/trunk/transaction/src/main/resources/org/
>> apache/aries/transaction/parsing/transaction.xsd
>> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/transaction/src/main/resources/org/apache/aries/transaction/parsing/transaction.xsd?rev=911975&view=auto
>> ===
>> ===
>> ===
>> =====================================================================
>> --- incubator/aries/trunk/transaction/src/main/resources/org/apache/
>> aries/transaction/parsing/transaction.xsd (added)
>> +++ incubator/aries/trunk/transaction/src/main/resources/org/apache/
>> aries/transaction/parsing/transaction.xsd Fri Feb 19 20:37:04 2010
>> @@ -0,0 +1,45 @@
>> +<?xml version="1.0" encoding="UTF-8" standalone="no"?>
>> +<!--
>> +
>> + 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.
>> +
>> +-->
>> +<xsd:schema xmlns="http://aries.apache.org/xmlns/transactions/
>> v1.0.0"
>> + xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>> targetNamespace="http://aries.apache.org/xmlns/transactions/v1.0.0"
>> + elementFormDefault="qualified"
>> attributeFormDefault="unqualified"
>> + version="1.0.0">
>> +
>> +<xsd:simpleType name="TtransactionStrategy">
>> + <xsd:restriction base="xsd:string">
>> + <xsd:enumeration value="Required"/>
>> + <xsd:enumeration value="Mandatory"/>
>> + <xsd:enumeration value="RequiresNew"/>
>> + <xsd:enumeration value="Supports"/>
>> + <xsd:enumeration value="NotSupported"/>
>> + <xsd:enumeration value="Never"/>
>> + </xsd:restriction>
>> +</xsd:simpleType>
>> +
>> +<xsd:complexType name="Ttransaction">
>> + <xsd:attribute name="method" type="xsd:string"/>
>> + <xsd:attribute name="value" type="TtransactionStrategy"/>
>> +</xsd:complexType>
>> +
>> +<xsd:element name="transaction" type="Ttransaction">
>> +</xsd:element>
>> +
>> +
>> +</xsd:schema>
>> \ No newline at end of file
>>
>> Propchange: incubator/aries/trunk/transaction/src/main/resources/
>> org/apache/aries/transaction/parsing/transaction.xsd
>> ---
>> ---
>> ---
>> ---------------------------------------------------------------------
>> svn:eol-style = native
>>
>> Propchange: incubator/aries/trunk/transaction/src/main/resources/
>> org/apache/aries/transaction/parsing/transaction.xsd
>> ---
>> ---
>> ---
>> ---------------------------------------------------------------------
>> svn:keywords = Date Revision
>>
>> Propchange: incubator/aries/trunk/transaction/src/main/resources/
>> org/apache/aries/transaction/parsing/transaction.xsd
>> ---
>> ---
>> ---
>> ---------------------------------------------------------------------
>> svn:mime-type = text/xml
>>
>> Propchange: incubator/aries/trunk/transaction/src/test/
>> ---
>> ---
>> ---
>> ---------------------------------------------------------------------
>> --- svn:ignore (added)
>> +++ svn:ignore Fri Feb 19 20:37:04 2010
>> @@ -0,0 +1 @@
>> +
>>
>> Added: incubator/aries/trunk/transaction/src/test/java/org/apache/
>> aries/transaction/NameSpaceHandlerTest.java
>> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/transaction/src/test/java/org/apache/aries/transaction/NameSpaceHandlerTest.java?rev=911975&view=auto
>> ===
>> ===
>> ===
>> =====================================================================
>> --- incubator/aries/trunk/transaction/src/test/java/org/apache/
>> aries/transaction/NameSpaceHandlerTest.java (added)
>> +++ incubator/aries/trunk/transaction/src/test/java/org/apache/
>> aries/transaction/NameSpaceHandlerTest.java Fri Feb 19 20:37:04 2010
>> @@ -0,0 +1,101 @@
>> +/*
>> + * Licensed to the Apache Software Foundation (ASF) under one
>> + * or more contributor license agreements. See the NOTICE file
>> + * distributed with this work for additional information
>> + * regarding copyright ownership. The ASF licenses this file
>> + * to you under the Apache License, Version 2.0 (the
>> + * "License"); you may not use this file except in compliance
>> + * with the License. You may obtain a copy of the License at
>> + *
>> + * http://www.apache.org/licenses/LICENSE-2.0
>> + *
>> + * Unless required by applicable law or agreed to in writing,
>> + * software distributed under the License is distributed on an
>> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>> + * KIND, either express or implied. See the License for the
>> + * specific language governing permissions and limitations
>> + * under the License.
>> + */
>> +package org.apache.aries.transaction;
>> +
>> +import static org.junit.Assert.assertEquals;
>> +
>> +import java.net.URI;
>> +import java.net.URL;
>> +import java.util.LinkedList;
>> +import java.util.List;
>> +import java.util.Properties;
>> +import java.util.Set;
>> +
>> +import javax.transaction.TransactionManager;
>> +
>> +import org.apache.aries.mocks.BundleMock;
>> +
>> +import org.apache.aries.blueprint.ComponentDefinitionRegistry;
>> +import org.apache.aries.blueprint.NamespaceHandler;
>> +import
>> org.apache.aries.blueprint.container.NamespaceHandlerRegistry;
>> +import org.apache.aries.blueprint.container.Parser;
>> +import
>> org.apache.aries.blueprint.container.NamespaceHandlerRegistry.NamespaceHandlerSet;
>> +import
>> org.apache.aries.blueprint.namespace.ComponentDefinitionRegistryImpl;
>> +import
>> org.apache.aries.blueprint.namespace.NamespaceHandlerRegistryImpl;
>> +import org.junit.Test;
>> +import org.osgi.framework.Bundle;
>> +import org.osgi.framework.BundleContext;
>> +import org.osgi.service.blueprint.reflect.BeanMetadata;
>> +import org.osgi.service.blueprint.reflect.BeanProperty;
>> +
>> +import org.apache.aries.transaction.TxComponentMetaDataHelperImpl;
>> +import org.apache.aries.transaction.TxInterceptorImpl;
>> +import org.apache.aries.transaction.parsing.TxElementHandler;
>> +import org.apache.aries.unittest.mocks.Skeleton;
>> +
>> +public class NameSpaceHandlerTest {
>> +
>> +
>> + @Test
>> + public void testMultipleElements() throws Exception
>> + {
>> + Bundle b = Skeleton.newMock(new BundleMock
>> ("com.ibm.ws.eba.tx", new Properties()), Bundle.class);
>> + BundleContext ctx = b.getBundleContext();
>> + NamespaceHandlerRegistry nhri = new
>> NamespaceHandlerRegistryImpl(ctx);
>> +
>> + TransactionManager tm = Skeleton.newMock
>> (TransactionManager.class);
>> +
>> + TxComponentMetaDataHelperImpl txenhancer = new
>> TxComponentMetaDataHelperImpl();
>> + txenhancer.setTransactionManager(tm);
>> +
>> + TxInterceptorImpl txinterceptor = new TxInterceptorImpl();
>> + txinterceptor.setTransactionManager(tm);
>> + txinterceptor.setTxMetaDataHelper(txenhancer);
>> +
>> + TxElementHandler namespaceHandler = new TxElementHandler();
>> + namespaceHandler.setTransactionInterceptor(txinterceptor);
>> + namespaceHandler.setTxMetaDataHelper(txenhancer);
>> +
>> + Properties props = new Properties();
>> + props.put("osgi.service.blueprint.namespace", "http://aries.apache.org/xmlns/transactions/v1.0.0
>> ");
>> + ctx.registerService(NamespaceHandler.class.getName(),
>> namespaceHandler, props);
>> + Parser p = new Parser();
>> +
>> + URL bpxml = this.getClass().getResource("aries.xml");
>> + List<URL> bpxmlList = new LinkedList<URL>();
>> + bpxmlList.add(bpxml);
>> +
>> + p.parse(bpxmlList);
>> + Set<URI> nsuris = p.getNamespaces();
>> + NamespaceHandlerSet nshandlers = nhri.getNamespaceHandlers
>> (nsuris, b);
>> + p.validate(nshandlers.getSchema());
>> +
>> + ComponentDefinitionRegistry cdr = new
>> ComponentDefinitionRegistryImpl();
>> + p.populate(nshandlers, cdr);
>> +
>> + BeanMetadata comp = (BeanMetadata) cdr.getComponentDefinition
>> ("top");
>> +
>> + BeanMetadata anon = (BeanMetadata) ((BeanProperty)
>> comp.getProperties().get(0)).getValue();
>> + BeanMetadata anonToo = (BeanMetadata) ((BeanProperty)
>> comp.getProperties().get(1)).getValue();
>> +
>> + assertEquals("Required",
>> txenhancer.getComponentMethodTxStrategy(anon, "doSomething"));
>> + assertEquals("Never", txenhancer.getComponentMethodTxStrategy
>> (anonToo, "doSomething"));
>> +
>> + }
>> +}
>>
>> Propchange: incubator/aries/trunk/transaction/src/test/java/org/
>> apache/aries/transaction/NameSpaceHandlerTest.java
>> ---
>> ---
>> ---
>> ---------------------------------------------------------------------
>> svn:eol-style = native
>>
>> Propchange: incubator/aries/trunk/transaction/src/test/java/org/
>> apache/aries/transaction/NameSpaceHandlerTest.java
>> ---
>> ---
>> ---
>> ---------------------------------------------------------------------
>> svn:keywords = Date Revision
>>
>> Propchange: incubator/aries/trunk/transaction/src/test/java/org/
>> apache/aries/transaction/NameSpaceHandlerTest.java
>> ---
>> ---
>> ---
>> ---------------------------------------------------------------------
>> svn:mime-type = text/plain
>>
>> Added: incubator/aries/trunk/transaction/src/test/java/org/apache/
>> aries/transaction/TranStrategyTest.java
>> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/transaction/src/test/java/org/apache/aries/transaction/TranStrategyTest.java?rev=911975&view=auto
>> ===
>> ===
>> ===
>> =====================================================================
>> --- incubator/aries/trunk/transaction/src/test/java/org/apache/
>> aries/transaction/TranStrategyTest.java (added)
>> +++ incubator/aries/trunk/transaction/src/test/java/org/apache/
>> aries/transaction/TranStrategyTest.java Fri Feb 19 20:37:04 2010
>> @@ -0,0 +1,404 @@
>> +/*
>> + * Licensed to the Apache Software Foundation (ASF) under one
>> + * or more contributor license agreements. See the NOTICE file
>> + * distributed with this work for additional information
>> + * regarding copyright ownership. The ASF licenses this file
>> + * to you under the Apache License, Version 2.0 (the
>> + * "License"); you may not use this file except in compliance
>> + * with the License. You may obtain a copy of the License at
>> + *
>> + * http://www.apache.org/licenses/LICENSE-2.0
>> + *
>> + * Unless required by applicable law or agreed to in writing,
>> + * software distributed under the License is distributed on an
>> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>> + * KIND, either express or implied. See the License for the
>> + * specific language governing permissions and limitations
>> + * under the License.
>> + */
>> +package org.apache.aries.transaction;
>> +
>> +import static org.junit.Assert.assertNotNull;
>> +import static org.junit.Assert.assertNull;
>> +import static org.junit.Assert.fail;
>> +
>> +import java.util.HashSet;
>> +import java.util.Iterator;
>> +import java.util.Set;
>> +
>> +import javax.transaction.NotSupportedException;
>> +import javax.transaction.Status;
>> +import javax.transaction.SystemException;
>> +import javax.transaction.Transaction;
>> +import javax.transaction.TransactionManager;
>> +
>> +import org.junit.Before;
>> +import org.junit.Test;
>> +
>> +import org.apache.aries.transaction.TransactionStrategy;
>> +import org.apache.aries.unittest.mocks.MethodCall;
>> +import org.apache.aries.unittest.mocks.Skeleton;
>> +
>> +public class TranStrategyTest {
>> +
>> + TransactionManager tm = Skeleton.newMock
>> (TransactionManager.class);
>> + Transaction t = Skeleton.newMock(Transaction.class);
>> + Skeleton skel = Skeleton.getSkeleton(tm);
>> +
>> + @Before
>> + public void clean()
>> + {
>> + skel.clearMethodCalls();
>> + }
>> +
>> + @Test
>> + public void testMandatoryBegin() throws Exception
>> + {
>> + // MANDATORY strategy should throw IllegalStateException
>> when tran manager
>> + // status is Status.STATUS_NO_TRANSACTION it should not
>> return null.
>> + skel.setReturnValue(new MethodCall(TransactionManager.class,
>> "getStatus"), Status.STATUS_NO_TRANSACTION);
>> +
>> + try {
>> + assertNotNull("TransactionStrategy.MANDATORY.begin(tm)
>> returned null when manager " +
>> + "status is STATUS_NO_TRANSACTION",
>> TransactionStrategy.MANDATORY.begin(tm));
>> + } catch (IllegalStateException ise) {
>> + // Expected to be in here
>> + } catch (Exception e) {
>> + fail("TransactionStrategy.MANDATORY.begin() threw an
>> unexpected exception when tran manager status is
>> STATUS_NO_TRANSACTION");
>> + }
>> +
>> + // MANDATORY strategy should return null for all tran
>> manager states other
>> + // than Status.STATUS_NO_TRANSACTION.
>> + int[] invalids = new int[]{ Status.STATUS_COMMITTED,
>> Status.STATUS_COMMITTING, Status.STATUS_MARKED_ROLLBACK,
>> + Status.STATUS_ACTIVE, Status.STATUS_PREPARED,
>> Status.STATUS_PREPARING, Status.STATUS_ROLLEDBACK,
>> + Status.STATUS_ROLLING_BACK, Status.STATUS_UNKNOWN };
>> +
>> + for (int i = 0; i < invalids.length ; i++) {
>> + skel.setReturnValue(new MethodCall
>> (TransactionManager.class, "getStatus"), invalids[i]);
>> + try {
>> + assertNull("TransactionStrategy.MANDATORY.begin() did
>> not return null when manager status value is " + invalids[i],
>> TransactionStrategy.MANDATORY.begin(tm));
>> + } catch (Exception ise) {
>> + fail("TransactionStrategy.MANDATORY.begin() threw
>> Exception when manager status value is " + invalids[i]);
>> + }
>> + }
>> + }
>> +
>> + @Test
>> + public void testMandatoryFinish()
>> + {
>> + try {
>> + TransactionStrategy.MANDATORY.finish(tm, t);
>> + } catch (Exception e) {
>> + fail("TransactionStrategy.MANDATORY.finish() threw an
>> unexpected exception");
>> + }
>> + }
>> +
>> +
>> + @Test
>> + public void testNeverBegin() throws Exception
>> + {
>> + // NEVER strategy should throw IllegalStateException when
>> tran manager
>> + // status is Status.STATUS_ACTIVE it should not return null.
>> + skel.setReturnValue(new MethodCall(TransactionManager.class,
>> "getStatus"), Status.STATUS_ACTIVE);
>> +
>> + try {
>> + assertNotNull("TransactionStrategy.NEVER.begin() returned
>> null when manager status is STATUS_ACTIVE",
>> TransactionStrategy.NEVER.begin(tm));
>> + } catch (IllegalStateException ise) {
>> + // Expect to be in here
>> + } catch (Exception e) {
>> + fail("TransactionStrategy.NEVER.begin() threw an
>> unexpected exception when tran manager status is STATUS_ACTIVE");
>> + }
>> +
>> + // NEVER strategy should return null for all tran manager
>> states other
>> + // than Status.STATUS_ACTIVE.
>> + int[] invalids = new int[]{ Status.STATUS_COMMITTED,
>> Status.STATUS_COMMITTING, Status.STATUS_MARKED_ROLLBACK,
>> + Status.STATUS_NO_TRANSACTION, Status.STATUS_PREPARED,
>> Status.STATUS_PREPARING, Status.STATUS_ROLLEDBACK,
>> + Status.STATUS_ROLLING_BACK, Status.STATUS_UNKNOWN };
>> +
>> + for (int i = 0; i < invalids.length ; i++) {
>> + skel.setReturnValue(new MethodCall
>> (TransactionManager.class, "getStatus"), invalids[i]);
>> + try {
>> + assertNull("TransactionStrategy.NEVER.begin() did not
>> return null when manager status value is " + invalids[i],
>> TransactionStrategy.NEVER.begin(tm));
>> + } catch (Exception ise) {
>> + fail("TransactionStrategy.NEVER.begin() threw
>> unexpected exception when manager status value is " + invalids[i]);
>> + }
>> + }
>> +
>> + }
>> +
>> + @Test
>> + public void testNeverFinish()
>> + {
>> + try {
>> + TransactionStrategy.NEVER.finish(tm, t);
>> + } catch (Exception e) {
>> + fail("TransactionStrategy.NEVER.finish() threw an
>> unexpected exception");
>> + }
>> + }
>> +
>> + @Test
>> + public void testNotSupportedBegin() throws Exception
>> + {
>> + // NOT_SUPPORTED strategy should suspend an active transaction
>> + // and _NOT_ begin a new one
>> + skel.setReturnValue(new MethodCall(TransactionManager.class,
>> "getStatus"), Status.STATUS_ACTIVE);
>> +
>> + TransactionStrategy.NOT_SUPPORTED.begin(tm);
>> + skel.assertCalled(new MethodCall(TransactionManager.class,
>> "suspend"));
>> + skel.assertNotCalled(new MethodCall
>> (TransactionManager.class, "begin"));
>> +
>> + // For all situations where there is no active transaction the
>> + // NOT_SUPPORTED strategy should return null
>> + int[] invalids = new int[]{ Status.STATUS_COMMITTED,
>> Status.STATUS_COMMITTING, Status.STATUS_MARKED_ROLLBACK,
>> + Status.STATUS_NO_TRANSACTION, Status.STATUS_PREPARED,
>> Status.STATUS_PREPARING, Status.STATUS_ROLLEDBACK,
>> + Status.STATUS_ROLLING_BACK, Status.STATUS_UNKNOWN };
>> +
>> + for (int i = 0; i < invalids.length ; i++) {
>> + skel.setReturnValue(new MethodCall
>> (TransactionManager.class, "getStatus"), invalids[i]);
>> + try {
>> + assertNull("TransactionStrategy.NOT_SUPPORTED.begin()
>> did not return null when manager status value is " + invalids[i],
>> TransactionStrategy.NOT_SUPPORTED.begin(tm));
>> + } catch (Exception ise) {
>> + fail("TransactionStrategy.NOT_SUPPORTED.begin() threw
>> unexpected exception when manager status value is " + invalids[i]);
>> + }
>> + }
>> +
>> + }
>> +
>> + @Test
>> + public void testNotSupportedFinish()
>> + {
>> + // If finish is called with a previously active transaction,
>> then
>> + // we expect this transaction to be resumed for a
>> NOT_SUPPORTED strategy
>> + try {
>> + TransactionStrategy.NOT_SUPPORTED.finish(tm, t);
>> + skel.assertCalled(new MethodCall(TransactionManager.class,
>> "resume", t));
>> + skel.clearMethodCalls();
>> + TransactionStrategy.NOT_SUPPORTED.finish(tm, null);
>> + skel.assertNotCalled(new MethodCall
>> (TransactionManager.class, "resume", Transaction.class));
>> + } catch (Exception e) {
>> + fail("TransactionStrategy.NOT_SUPPORTED.finish() threw
>> unexpected exception");
>> + }
>> + }
>> +
>> + @Test
>> + public void testRequiredBegin() throws Exception
>> + {
>> + // If there is no previously active transaction when the
>> REQUIRED strategy
>> + // is invoked then we expect a call to begin one
>> + skel.setReturnValue(new MethodCall(TransactionManager.class,
>> "getStatus"), Status.STATUS_NO_TRANSACTION);
>> +
>> + TransactionStrategy.REQUIRED.begin(tm);
>> + skel.assertCalled(new MethodCall(TransactionManager.class,
>> "begin"));
>> + skel.assertNotCalled(new MethodCall
>> (TransactionManager.class, "suspend"));
>> +
>> + // For all cases where there is a transaction we expect
>> REQUIRED to return null
>> + int[] invalids = new int[]{ Status.STATUS_COMMITTED,
>> Status.STATUS_COMMITTING, Status.STATUS_MARKED_ROLLBACK,
>> + Status.STATUS_ACTIVE, Status.STATUS_PREPARED,
>> Status.STATUS_PREPARING, Status.STATUS_ROLLEDBACK,
>> + Status.STATUS_ROLLING_BACK, Status.STATUS_UNKNOWN };
>> +
>> + for (int i = 0; i < invalids.length ; i++) {
>> + skel.setReturnValue(new MethodCall
>> (TransactionManager.class, "getStatus"), invalids[i]);
>> + try {
>> + assertNull("TransactionStrategy.REQUIRED.begin() did not
>> return null when manager status value is " + invalids[i],
>> TransactionStrategy.REQUIRED.begin(tm));
>> + } catch (Exception ise) {
>> + fail("TransactionStrategy.REQUIRED.begin() threw
>> unexpected exception when manager status value is " + invalids[i]);
>> + }
>> + }
>> + }
>> +
>> + @Test
>> + public void testRequiredFinish()
>> + {
>> + // In the REQUIRED strategy we expect a call to rollback
>> when a call to finish()
>> + // is made with a tran where the tran manager status shows
>> Status.STATUS_MARKED_ROLLBACK
>> + skel.setReturnValue(new MethodCall(TransactionManager.class,
>> "getStatus"), Status.STATUS_MARKED_ROLLBACK);
>> +
>> + try {
>> + TransactionStrategy.REQUIRED.finish(tm, t);
>> + skel.assertCalled(new MethodCall(TransactionManager.class,
>> "rollback"));
>> + skel.assertNotCalled(new MethodCall
>> (TransactionManager.class, "commit"));
>> +
>> + int[] invalids = new int[]{ Status.STATUS_COMMITTED,
>> Status.STATUS_COMMITTING, Status.STATUS_NO_TRANSACTION,
>> + Status.STATUS_ACTIVE, Status.STATUS_PREPARED,
>> Status.STATUS_PREPARING, Status.STATUS_ROLLEDBACK,
>> + Status.STATUS_ROLLING_BACK, Status.STATUS_UNKNOWN };
>> +
>> + // For all other tran manager states we expect a call to
>> commit
>> + for (int i = 0; i < invalids.length ; i++) {
>> + skel.clearMethodCalls();
>> + skel.setReturnValue(new MethodCall
>> (TransactionManager.class, "getStatus"), invalids[i]);
>> + TransactionStrategy.REQUIRED.finish(tm, t);
>> + skel.assertCalled(new MethodCall
>> (TransactionManager.class, "commit"));
>> + skel.assertNotCalled(new MethodCall
>> (TransactionManager.class, "rollback"));
>> + }
>> +
>> + // If null is passed instead of a tran we expect nothing
>> to happen
>> + skel.clearMethodCalls();
>> + TransactionStrategy.REQUIRED.finish(tm, null);
>> + skel.assertNotCalled(new MethodCall
>> (TransactionManager.class, "commit"));
>> + skel.assertNotCalled(new MethodCall
>> (TransactionManager.class, "rollback"));
>> +
>> + }catch (Exception e) {
>> + fail("TransactionStrategy.REQUIRED.begin() threw
>> unexpected exception");
>> + }
>> + }
>> +
>> + @Test
>> + public void testRequiresNew_BeginActiveTran() throws Exception
>> + {
>> + // Suspend case (no exception from tm.begin())
>> + skel.setReturnValue(new MethodCall(TransactionManager.class,
>> "getStatus"), Status.STATUS_ACTIVE);
>> +
>> + // In the case of the REQUIRES_NEW strategy we expect an
>> active tran to be suspended
>> + // a new new transaction to begin
>> + TransactionStrategy.REQUIRES_NEW.begin(tm);
>> + skel.assertCalled(new MethodCall(TransactionManager.class,
>> "suspend"));
>> + skel.assertCalled(new MethodCall(TransactionManager.class,
>> "begin"));
>> +
>> + }
>> +
>> + @Test
>> + public void testRequiresNew_BeginNoActiveTran() throws Exception
>> + {
>> + // No active tran cases (no exception from tm.begin())
>> +
>> + int[] manStatus = new int[]{ Status.STATUS_COMMITTED,
>> Status.STATUS_COMMITTING, Status.STATUS_MARKED_ROLLBACK,
>> + Status.STATUS_NO_TRANSACTION, Status.STATUS_PREPARED,
>> Status.STATUS_PREPARING, Status.STATUS_ROLLEDBACK,
>> + Status.STATUS_ROLLING_BACK, Status.STATUS_UNKNOWN };
>> +
>> + // For all cases where the tran manager state is _not_
>> Status.STATUS_ACTIVE
>> + // we expect a call to begin a new tran, no call to suspend
>> and null to be
>> + // returned from TransactionStrategy.REQUIRES_NEW.begin(tm)
>> + for (int i = 0; i < manStatus.length ; i++) {
>> + skel.clearMethodCalls();
>> + skel.setReturnValue(new MethodCall
>> (TransactionManager.class, "getStatus"), manStatus[i]);
>> + try {
>> + assertNull("TransactionStrategy.REQUIRES_NEW.begin() did
>> not return null when manager status value is " + manStatus[i],
>> TransactionStrategy.REQUIRES_NEW.begin(tm));
>> + skel.assertCalled(new MethodCall
>> (TransactionManager.class, "begin"));
>> + skel.assertNotCalled(new MethodCall
>> (TransactionManager.class, "suspend"));
>> + } catch (Exception ise) {
>> + fail("TransactionStrategy.REQUIRES_NEW.begin() threw
>> unexpected exception when manager status value is " + manStatus[i]);
>> + }
>> + }
>> +
>> + }
>> +
>> + @Test
>> + public void testRequiresNew_TmExceptions()
>> + {
>> + int[] allStates = new int[]{ Status.STATUS_COMMITTED,
>> Status.STATUS_COMMITTING, Status.STATUS_NO_TRANSACTION,
>> + Status.STATUS_ACTIVE, Status.STATUS_PREPARED,
>> Status.STATUS_PREPARING, Status.STATUS_ROLLEDBACK,
>> + Status.STATUS_MARKED_ROLLBACK,
>> Status.STATUS_ROLLING_BACK, Status.STATUS_UNKNOWN };
>> +
>> + // SystemException and NotSupportedException from tm.begin()
>> + Set<Exception> ees = new HashSet<Exception>();
>> + ees.add(new SystemException("KABOOM!"));
>> + ees.add(new NotSupportedException("KABOOM!"));
>> +
>> + // Loop through all states states twice changing the
>> exception thrown
>> + // from tm.begin()
>> + for (int i = 0 ; i < allStates.length ; i++ ) {
>> + Iterator<Exception> iterator = ees.iterator();
>> + while (iterator.hasNext()) {
>> + Exception e = iterator.next();
>> + skel.clearMethodCalls();
>> + skel.setReturnValue(new MethodCall
>> (TransactionManager.class, "getStatus"), allStates[i]);
>> + skel.setThrows(new MethodCall(TransactionManager.class,
>> "begin"), e);
>> + requiresNewExceptionCheck(tm, skel);
>> + }
>> + }
>> + }
>> +
>> + private void requiresNewExceptionCheck(TransactionManager tm,
>> Skeleton skel)
>> + {
>> + int managerStatus = -1 ;
>> +
>> + try {
>> + managerStatus = tm.getStatus();
>> + } catch (SystemException se){
>> + fail("Unable to obtain tran manager status");
>> + }
>> +
>> + // If an ACTIVE tran is already present we expect a call to
>> suspend this tran.
>> + // All states should call begin(), whereupon we receive our
>> exception resulting
>> + // in calls to resume(t)
>> +
>> + try {
>> + TransactionStrategy.REQUIRES_NEW.begin(tm);
>> + } catch (SystemException se) {
>> + // Expect to be in here
>> + } catch (NotSupportedException nse) {
>> + // or to be in here
>> + } catch (Exception thrownE) {
>> + fail("TransactionStrategy.REQUIRES_NEW.begin() threw
>> unexpected exception when manager status is " + managerStatus);
>> + } finally {
>> + // If Status.STATUS_ACTIVE
>> + if (managerStatus == 0) {
>> + skel.assertCalled(new MethodCall
>> (TransactionManager.class, "suspend"));
>> + } else {
>> + skel.assertNotCalled(new MethodCall
>> (TransactionManager.class, "suspend"));
>> + }
>> + skel.assertCalled(new MethodCall
>> (TransactionManager.class, "begin"));
>> + skel.assertCalled(new MethodCall
>> (TransactionManager.class, "resume", Transaction.class));
>> + }
>> + }
>> +
>> + @Test
>> + public void testRequiresNew_Finish()
>> + {
>> + int[] allStates = new int[]{ Status.STATUS_COMMITTED,
>> Status.STATUS_COMMITTING, Status.STATUS_NO_TRANSACTION,
>> + Status.STATUS_ACTIVE, Status.STATUS_PREPARED,
>> Status.STATUS_PREPARING, Status.STATUS_ROLLEDBACK,
>> + Status.STATUS_MARKED_ROLLBACK,
>> Status.STATUS_ROLLING_BACK, Status.STATUS_UNKNOWN };
>> +
>> + // Loop through all states calling
>> TransactionStrategy.REQUIRES_NEW.finish
>> + // passing tran manager and a tran, then passing tran
>> manager and null
>> + for (int i = 0 ; i < allStates.length ; i++ ) {
>> + skel.clearMethodCalls();
>> + skel.setReturnValue(new MethodCall
>> (TransactionManager.class, "getStatus"), allStates[i]);
>> +
>> + try {
>> + TransactionStrategy.REQUIRES_NEW.finish(tm, t);
>> + } catch (Exception e) {
>> + fail("TransactionStrategy.REQUIRES_NEW.finish() threw
>> unexpected exception when manager status is " + allStates[i]);
>> + } finally {
>> + requiresNew_assertion(skel, allStates, i);
>> + skel.assertCalled(new MethodCall
>> (TransactionManager.class, "resume", t));
>> + }
>> +
>> + try {
>> + skel.clearMethodCalls();
>> + TransactionStrategy.REQUIRES_NEW.finish(tm, null);
>> + } catch (Exception e) {
>> + fail("TransactionStrategy.REQUIRES_NEW.finish() threw
>> unexpected exception when manager status is " + allStates[i]);
>> + } finally {
>> + requiresNew_assertion(skel, allStates, i);
>> + skel.assertNotCalled(new MethodCall
>> (TransactionManager.class, "resume", Transaction.class));
>> + }
>> + }
>> +
>> + }
>> +
>> + private void requiresNew_assertion(Skeleton skel, int[]
>> allStates, int i)
>> + {
>> + // If tran manager status reports
>> Status.STATUS_MARKED_ROLLBACK we expect
>> + // a call to rollback ... otherwise we expect a call to commit
>> + if (allStates[i] == Status.STATUS_MARKED_ROLLBACK) {
>> + skel.assertCalled(new MethodCall(TransactionManager.class,
>> "rollback"));
>> + skel.assertNotCalled(new MethodCall
>> (TransactionManager.class, "commit"));
>> + }
>> + else {
>> + skel.assertCalled(new MethodCall(TransactionManager.class,
>> "commit"));
>> + skel.assertNotCalled(new MethodCall
>> (TransactionManager.class, "rollback"));
>> + }
>> + }
>> +
>> + @Test
>> + public void testSupports()
>> + {
>> + try {
>> + assertNull("TransTransactionStrategy.SUPPORTS.begin(tm)
>> did not return null", TransactionStrategy.SUPPORTS.begin(tm));
>> + } catch (Exception e) {
>> + fail("TransTransactionStrategy.SUPPORTS.begin(tm) threw
>> an unexpected exception");
>> + }
>> +
>> + }
>> +}
>>
>> Propchange: incubator/aries/trunk/transaction/src/test/java/org/
>> apache/aries/transaction/TranStrategyTest.java
>> ---
>> ---
>> ---
>> ---------------------------------------------------------------------
>> svn:eol-style = native
>>
>> Propchange: incubator/aries/trunk/transaction/src/test/java/org/
>> apache/aries/transaction/TranStrategyTest.java
>> ---
>> ---
>> ---
>> ---------------------------------------------------------------------
>> svn:keywords = Date Revision
>>
>> Propchange: incubator/aries/trunk/transaction/src/test/java/org/
>> apache/aries/transaction/TranStrategyTest.java
>> ---
>> ---
>> ---
>> ---------------------------------------------------------------------
>> svn:mime-type = text/plain
>>
>> Added: incubator/aries/trunk/transaction/src/test/resources/org/
>> apache/aries/transaction/aries.xml
>> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/transaction/src/test/resources/org/apache/aries/transaction/aries.xml?rev=911975&view=auto
>> ===
>> ===
>> ===
>> =====================================================================
>> --- incubator/aries/trunk/transaction/src/test/resources/org/apache/
>> aries/transaction/aries.xml (added)
>> +++ incubator/aries/trunk/transaction/src/test/resources/org/apache/
>> aries/transaction/aries.xml Fri Feb 19 20:37:04 2010
>> @@ -0,0 +1,35 @@
>> +<?xml version="1.0" encoding="UTF-8" standalone="no"?>
>> +<!--
>> +
>> + 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.
>> +
>> +-->
>> +<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>> + xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.0.0
>> ">
>> +
>> + <bean id="top" class="org.apache.aries.transaction.TestBean">
>> + <property name="txRequired">
>> + <bean
>> class="org.apache.aries.transaction.TestTxBean">
>> + <tx:transaction method="*"
>> value="Required"/>
>> + </bean>
>> + </property>
>> + <property name="txNever">
>> + <bean
>> class="org.apache.aries.transaction.TestTxBean">
>> + <tx:transaction method="*"
>> value="Never"/>
>> + </bean>
>> + </property>
>> + </bean>
>> +</blueprint>
>> \ No newline at end of file
>>
>> Propchange: incubator/aries/trunk/transaction/src/test/resources/
>> org/apache/aries/transaction/aries.xml
>> ---
>> ---
>> ---
>> ---------------------------------------------------------------------
>> svn:eol-style = native
>>
>> Propchange: incubator/aries/trunk/transaction/src/test/resources/
>> org/apache/aries/transaction/aries.xml
>> ---
>> ---
>> ---
>> ---------------------------------------------------------------------
>> svn:keywords = Date Revision
>>
>> Propchange: incubator/aries/trunk/transaction/src/test/resources/
>> org/apache/aries/transaction/aries.xml
>> ---
>> ---
>> ---
>> ---------------------------------------------------------------------
>> svn:mime-type = text/xml
>>
>>
>>
>
>
>
> --
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> ------------------------
> Open Source SOA
> http://fusesource.com
RE: svn commit: r911975 - in /incubator/aries/trunk/transaction: ./
src/ src/main/ src/main/java/org/apache/aries/transaction/
src/main/java/org/apache/aries/transaction/exception/
src/main/java/org/apache/aries/transaction/parsing/ src/main/resource
Posted by Timothy Ward <ti...@hotmail.com>.
+1
> Date: Fri, 19 Feb 2010 23:23:20 -0500
> From: joebohn@gmail.com
> To: aries-dev@incubator.apache.org
> Subject: Re: svn commit: r911975 - in /incubator/aries/trunk/transaction: ./ src/ src/main/ src/main/java/org/apache/aries/transaction/ src/main/java/org/apache/aries/transaction/exception/ src/main/java/org/apache/aries/transaction/parsing/ src/main/resource
>
> Guillaume Nodet wrote:
> > I really don't think we should merge those two things (the transaction
> > manager and support for declarative transactions for blueprint).
> > I'll split them asap.
> >
>
> Thank you Guillaume - that makes more sense.
>
> I'll fix ariestrader so that it works with the new bundles.
>
> Joe
_________________________________________________________________
Do you have a story that started on Hotmail? Tell us now
http://clk.atdmt.com/UKM/go/195013117/direct/01/
Re: svn commit: r911975 - in /incubator/aries/trunk/transaction:
./ src/ src/main/ src/main/java/org/apache/aries/transaction/ src/main/java/org/apache/aries/transaction/exception/
src/main/java/org/apache/aries/transaction/parsing/ src/main/resource
Posted by Joe Bohn <jo...@gmail.com>.
Guillaume Nodet wrote:
> I really don't think we should merge those two things (the transaction
> manager and support for declarative transactions for blueprint).
> I'll split them asap.
>
Thank you Guillaume - that makes more sense.
I'll fix ariestrader so that it works with the new bundles.
Joe