camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r674187 - /activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringTransactionPolicy.java
Date Sat, 05 Jul 2008 12:18:56 GMT
Author: davsclaus
Date: Sat Jul  5 05:18:56 2008
New Revision: 674187

URL: http://svn.apache.org/viewvc?rev=674187&view=rev
Log:
CAMEL-668: Spring friendly configuration of transactional policy (ups needed to support the
propogation name also)

Modified:
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringTransactionPolicy.java

Modified: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringTransactionPolicy.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringTransactionPolicy.java?rev=674187&r1=674186&r2=674187&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringTransactionPolicy.java
(original)
+++ activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringTransactionPolicy.java
Sat Jul  5 05:18:56 2008
@@ -31,6 +31,8 @@
 public class SpringTransactionPolicy<E> implements Policy<E> {
     private static final transient Log LOG = LogFactory.getLog(SpringTransactionPolicy.class);
     private TransactionTemplate template;
+    private String propagationBehaviorName;
+    private PlatformTransactionManager transactionManager;
 
     /**
      * Default constructor for easy spring configuration.
@@ -55,6 +57,12 @@
     }
 
     public TransactionTemplate getTemplate() {
+        if (template == null) {
+            template = new TransactionTemplate(transactionManager);
+            if (propagationBehaviorName != null) {
+                template.setPropagationBehaviorName(propagationBehaviorName);
+            }
+        }
         return template;
     }
 
@@ -62,13 +70,20 @@
         this.template = template;
     }
 
-    /**
-     * Sets the transaction manager to use creating and also setting indirectly
-     * the transaction template.
-     */
     public void setTransactionManager(PlatformTransactionManager transactionManager) {
-        TransactionTemplate template = new TransactionTemplate(transactionManager);
-        setTemplate(template);
+        this.transactionManager = transactionManager;
+    }
+
+    public PlatformTransactionManager getTransactionManager() {
+        return transactionManager;
+    }
+
+    public void setPropagationBehaviorName(String propagationBehaviorName) {
+        this.propagationBehaviorName = propagationBehaviorName;
     }
 
+    public String getPropagationBehaviorName() {
+        return propagationBehaviorName;
+    }
+    
 }



Mime
View raw message