Author: gnodet
Date: Mon Feb 23 09:00:12 2009
New Revision: 746931

URL: http://svn.apache.org/viewvc?rev=746931&view=rev
Log:
Remove jca connector stuff from transaction support

Added:
    servicemix/smx4/nmr/trunk/transaction/src/main/java/
    servicemix/smx4/nmr/trunk/transaction/src/main/java/org/
    servicemix/smx4/nmr/trunk/transaction/src/main/java/org/apache/
    servicemix/smx4/nmr/trunk/transaction/src/main/java/org/apache/servicemix/
    
servicemix/smx4/nmr/trunk/transaction/src/main/java/org/apache/servicemix/transaction/
    
servicemix/smx4/nmr/trunk/transaction/src/main/java/org/apache/servicemix/transaction/GeronimoPlatformTransactionManager.java
    
servicemix/smx4/nmr/trunk/transaction/src/main/java/org/apache/servicemix/transaction/HowlLogFactoryBean.java
    
servicemix/smx4/nmr/trunk/transaction/src/main/java/org/apache/servicemix/transaction/TransactionManagerFactoryBean.java
Modified:
    servicemix/smx4/nmr/trunk/assembly/src/main/filtered-resources/features.xml
    servicemix/smx4/nmr/trunk/naming/pom.xml
    servicemix/smx4/nmr/trunk/pom.xml
    servicemix/smx4/nmr/trunk/transaction/pom.xml
    
servicemix/smx4/nmr/trunk/transaction/src/main/resources/META-INF/spring/servicemix-tx.xml

Modified: 
servicemix/smx4/nmr/trunk/assembly/src/main/filtered-resources/features.xml
URL: 
http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/assembly/src/main/filtered-resources/features.xml?rev=746931&r1=746930&r2=746931&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/assembly/src/main/filtered-resources/features.xml 
(original)
+++ servicemix/smx4/nmr/trunk/assembly/src/main/filtered-resources/features.xml 
Mon Feb 23 09:00:12 2009
@@ -26,9 +26,7 @@
         
<bundle>mvn:org.apache.geronimo.specs/geronimo-j2ee-connector_1.5_spec/${geronimo.j2ee.connector.version}</bundle>
         
<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.howl/${howl.version}</bundle>
         
<bundle>mvn:org.apache.geronimo.components/geronimo-transaction/${geronimo.transaction.version}</bundle>
-        
<bundle>mvn:org.apache.geronimo.components/geronimo-connector/${geronimo.connector.version}</bundle>
         <bundle>mvn:org.springframework/spring-tx/${spring.version}</bundle>
-        
<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jencks/${jencks.version}</bundle>
         
<bundle>mvn:org.apache.servicemix.transaction/org.apache.servicemix.transaction/${version}</bundle>
     </feature>
     <feature name="nmr" version="${version}">

Modified: servicemix/smx4/nmr/trunk/naming/pom.xml
URL: 
http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/naming/pom.xml?rev=746931&r1=746930&r2=746931&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/naming/pom.xml (original)
+++ servicemix/smx4/nmr/trunk/naming/pom.xml Mon Feb 23 09:00:12 2009
@@ -79,7 +79,7 @@
                         
<Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
                         <Export-Package>${pom.artifactId}*</Export-Package>
                         <DynamicImport-Package>*</DynamicImport-Package>
-                        
<Spring-Context>*;publish-context:=false;create-asynchronously:=true</Spring-Context>
+                        
<Spring-Context>*;publish-context:=false</Spring-Context>
                     </instructions>
                 </configuration>
             </plugin>

Modified: servicemix/smx4/nmr/trunk/pom.xml
URL: 
http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/pom.xml?rev=746931&r1=746930&r2=746931&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/pom.xml (original)
+++ servicemix/smx4/nmr/trunk/pom.xml Mon Feb 23 09:00:12 2009
@@ -77,7 +77,6 @@
       <felix.compendium.version>1.2.0</felix.compendium.version>
       <felix.bundlerepository.version>1.2.0</felix.bundlerepository.version>
       <felix.prefs.version>1.0.2</felix.prefs.version>
-      <geronimo.connector.version>2.2-r634076</geronimo.connector.version>
       <geronimo.j2ee.connector.version>2.0.0</geronimo.j2ee.connector.version>
       <geronimo.jms.version>1.1.1</geronimo.jms.version>
       <geronimo.jta.version>1.1.1</geronimo.jta.version>
@@ -636,16 +635,6 @@
           <version>${geronimo.transaction.version}</version>
       </dependency>
       <dependency>
-          <groupId>org.apache.geronimo.components</groupId>
-          <artifactId>geronimo-connector</artifactId>
-          <version>${geronimo.connector.version}</version>
-      </dependency>
-      <dependency>
-          <groupId>org.apache.servicemix.bundles</groupId>
-          <artifactId>org.apache.servicemix.bundles.jencks</artifactId>
-          <version>${jencks.version}</version>
-      </dependency>
-      <dependency>
           <groupId>org.apache.servicemix.bundles</groupId>
           <artifactId>org.apache.servicemix.bundles.howl</artifactId>
           <version>${howl.version}</version>

Modified: servicemix/smx4/nmr/trunk/transaction/pom.xml
URL: 
http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/transaction/pom.xml?rev=746931&r1=746930&r2=746931&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/transaction/pom.xml (original)
+++ servicemix/smx4/nmr/trunk/transaction/pom.xml Mon Feb 23 09:00:12 2009
@@ -42,14 +42,6 @@
             <artifactId>geronimo-transaction</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.apache.geronimo.components</groupId>
-            <artifactId>geronimo-connector</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.servicemix.bundles</groupId>
-            <artifactId>org.apache.servicemix.bundles.jencks</artifactId>
-        </dependency>
-        <dependency>
             <groupId>org.apache.servicemix.bundles</groupId>
             <artifactId>org.apache.servicemix.bundles.howl</artifactId>
         </dependency>
@@ -81,14 +73,15 @@
                 <configuration>
                     <instructions>
                         
<Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+                        <!--
                         <Import-Package>
                             javax.transaction,
                             org.apache.geronimo.transaction.manager,
                             org.springframework.transaction,
-                            org.jencks.factory
+                            *
                         </Import-Package>
-                        <Export-Package>
-                        </Export-Package>
+                        -->
+                        <Export-Package>${pom.artifactId}*</Export-Package>
                         
<Spring-Context>*;publish-context:=false</Spring-Context>
                     </instructions>
                 </configuration>

Added: 
servicemix/smx4/nmr/trunk/transaction/src/main/java/org/apache/servicemix/transaction/GeronimoPlatformTransactionManager.java
URL: 
http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/transaction/src/main/java/org/apache/servicemix/transaction/GeronimoPlatformTransactionManager.java?rev=746931&view=auto
==============================================================================
--- 
servicemix/smx4/nmr/trunk/transaction/src/main/java/org/apache/servicemix/transaction/GeronimoPlatformTransactionManager.java
 (added)
+++ 
servicemix/smx4/nmr/trunk/transaction/src/main/java/org/apache/servicemix/transaction/GeronimoPlatformTransactionManager.java
 Mon Feb 23 09:00:12 2009
@@ -0,0 +1,171 @@
+/*
+ * 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.servicemix.transaction;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.transaction.Status;
+import javax.transaction.SystemException;
+import javax.transaction.Transaction;
+import javax.transaction.xa.XAException;
+
+import org.apache.geronimo.transaction.manager.GeronimoTransactionManager;
+import org.apache.geronimo.transaction.manager.TransactionLog;
+import org.apache.geronimo.transaction.manager.TransactionManagerMonitor;
+import org.apache.geronimo.transaction.manager.XidFactory;
+import org.springframework.transaction.PlatformTransactionManager;
+import org.springframework.transaction.TransactionDefinition;
+import org.springframework.transaction.TransactionException;
+import org.springframework.transaction.TransactionStatus;
+import org.springframework.transaction.jta.JtaTransactionManager;
+import org.springframework.transaction.support.TransactionSynchronization;
+import 
org.springframework.transaction.support.TransactionSynchronizationManager;
+
+/**
+ * @version $Revision$ $Date$
+ */
+public class GeronimoPlatformTransactionManager extends 
GeronimoTransactionManager implements PlatformTransactionManager {
+
+    private final PlatformTransactionManager platformTransactionManager;
+    private final Map<Transaction, SuspendedResourcesHolder> 
suspendedResources = new ConcurrentHashMap<Transaction, 
SuspendedResourcesHolder>();
+
+    public GeronimoPlatformTransactionManager() throws XAException {
+        platformTransactionManager = new JtaTransactionManager(this, this);
+        registerTransactionAssociationListener();
+    }
+
+    public GeronimoPlatformTransactionManager(int 
defaultTransactionTimeoutSeconds) throws XAException {
+        super(defaultTransactionTimeoutSeconds);
+        platformTransactionManager = new JtaTransactionManager(this, this);
+        registerTransactionAssociationListener();
+    }
+
+    public GeronimoPlatformTransactionManager(int 
defaultTransactionTimeoutSeconds, TransactionLog transactionLog) throws 
XAException {
+        super(defaultTransactionTimeoutSeconds, transactionLog);
+        platformTransactionManager = new JtaTransactionManager(this, this);
+        registerTransactionAssociationListener();
+    }
+
+    public GeronimoPlatformTransactionManager(int 
defaultTransactionTimeoutSeconds, XidFactory xidFactory, TransactionLog 
transactionLog) throws XAException {
+        super(defaultTransactionTimeoutSeconds, xidFactory, transactionLog);
+        platformTransactionManager = new JtaTransactionManager(this, this);
+        registerTransactionAssociationListener();
+    }
+
+    public TransactionStatus getTransaction(TransactionDefinition definition) 
throws TransactionException {
+        return platformTransactionManager.getTransaction(definition);
+    }
+
+    public void commit(TransactionStatus status) throws TransactionException {
+        platformTransactionManager.commit(status);
+    }
+
+    public void rollback(TransactionStatus status) throws TransactionException 
{
+        platformTransactionManager.rollback(status);
+    }
+
+    protected void registerTransactionAssociationListener() {
+        addTransactionAssociationListener(new TransactionManagerMonitor() {
+            public void threadAssociated(Transaction transaction) {
+                try {
+                    if (transaction.getStatus() == Status.STATUS_ACTIVE) {
+                        SuspendedResourcesHolder holder = 
suspendedResources.remove(transaction);
+                        if (holder != null && 
holder.getSuspendedSynchronizations() != null) {
+                            
TransactionSynchronizationManager.setActualTransactionActive(true);
+                            
TransactionSynchronizationManager.setCurrentTransactionReadOnly(holder.isReadOnly());
+                            
TransactionSynchronizationManager.setCurrentTransactionName(holder.getName());
+                            
TransactionSynchronizationManager.initSynchronization();
+                            for (Iterator<?> it = 
holder.getSuspendedSynchronizations().iterator(); it.hasNext();) {
+                                TransactionSynchronization synchronization = 
(TransactionSynchronization) it.next();
+                                synchronization.resume();
+                                
TransactionSynchronizationManager.registerSynchronization(synchronization);
+                            }
+                        }
+                    }
+                } catch (SystemException e) {
+                    return;
+                }
+            }
+            public void threadUnassociated(Transaction transaction) {
+                try {
+                    if (transaction.getStatus() == Status.STATUS_ACTIVE) {
+                        if 
(TransactionSynchronizationManager.isSynchronizationActive()) {
+                            List<?> suspendedSynchronizations = 
TransactionSynchronizationManager.getSynchronizations();
+                            for (Iterator<?> it = 
suspendedSynchronizations.iterator(); it.hasNext();) {
+                                ((TransactionSynchronization) 
it.next()).suspend();
+                            }
+                            
TransactionSynchronizationManager.clearSynchronization();
+                            String name = 
TransactionSynchronizationManager.getCurrentTransactionName();
+                            
TransactionSynchronizationManager.setCurrentTransactionName(null);
+                            boolean readOnly = 
TransactionSynchronizationManager.isCurrentTransactionReadOnly();
+                            
TransactionSynchronizationManager.setCurrentTransactionReadOnly(false);
+                            
TransactionSynchronizationManager.setActualTransactionActive(false);
+                            SuspendedResourcesHolder holder = new 
SuspendedResourcesHolder(null, suspendedSynchronizations, name, readOnly);
+                            suspendedResources.put(transaction, holder);
+                        }
+                    }
+                } catch (SystemException e) {
+                    return;
+                }
+            }
+        });
+    }
+
+    /**
+     * Holder for suspended resources.
+     * Used internally by <code>suspend</code> and <code>resume</code>.
+     */
+    private static class SuspendedResourcesHolder {
+
+        private final Object suspendedResources;
+
+        private final List<?> suspendedSynchronizations;
+
+        private final String name;
+
+        private final boolean readOnly;
+
+        public SuspendedResourcesHolder(
+                Object suspendedResources, List<?> suspendedSynchronizations, 
String name, boolean readOnly) {
+
+            this.suspendedResources = suspendedResources;
+            this.suspendedSynchronizations = suspendedSynchronizations;
+            this.name = name;
+            this.readOnly = readOnly;
+        }
+
+        public Object getSuspendedResources() {
+            return suspendedResources;
+        }
+
+        public List<?> getSuspendedSynchronizations() {
+            return suspendedSynchronizations;
+        }
+
+        public String getName() {
+            return name;
+        }
+
+        public boolean isReadOnly() {
+            return readOnly;
+        }
+    }
+
+}

Added: 
servicemix/smx4/nmr/trunk/transaction/src/main/java/org/apache/servicemix/transaction/HowlLogFactoryBean.java
URL: 
http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/transaction/src/main/java/org/apache/servicemix/transaction/HowlLogFactoryBean.java?rev=746931&view=auto
==============================================================================
--- 
servicemix/smx4/nmr/trunk/transaction/src/main/java/org/apache/servicemix/transaction/HowlLogFactoryBean.java
 (added)
+++ 
servicemix/smx4/nmr/trunk/transaction/src/main/java/org/apache/servicemix/transaction/HowlLogFactoryBean.java
 Mon Feb 23 09:00:12 2009
@@ -0,0 +1,213 @@
+/*
+ * 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.servicemix.transaction;
+
+import java.io.File;
+
+import org.apache.geronimo.transaction.log.HOWLLog;
+import org.apache.geronimo.transaction.manager.TransactionLog;
+import org.apache.geronimo.transaction.manager.XidFactory;
+import org.apache.geronimo.transaction.manager.XidFactoryImpl;
+import org.springframework.beans.factory.DisposableBean;
+import org.springframework.beans.factory.FactoryBean;
+
+/**
+ * @version $Revision$ $Date$
+ */
+public class HowlLogFactoryBean implements FactoryBean, DisposableBean {
+    private HOWLLog howlLog;
+
+    private String logFileDir;
+    private XidFactory xidFactory;
+
+    private String bufferClassName = "org.objectweb.howl.log.BlockLogBuffer";
+    private int bufferSizeKBytes = 32;
+    private boolean checksumEnabled = true;
+    private boolean adler32Checksum = true;
+    private int flushSleepTimeMilliseconds = 50;
+    private String logFileExt = "log";
+    private String logFileName = "transaction";
+    private int maxBlocksPerFile = -1;
+    private int maxLogFiles = 2;
+    private int maxBuffers = 0;
+    private int minBuffers = 4;
+    private int threadsWaitingForceThreshold = -1;
+    private File serverBaseDir;
+
+    public HowlLogFactoryBean() {
+        String serverDir = System.getProperty("jencks.server.dir", 
System.getProperty("basedir", System.getProperty("user.dir")));
+        serverBaseDir = new File(serverDir);
+    }
+
+    public Object getObject() throws Exception {
+        if (howlLog == null) {
+            howlLog = new HOWLLog(bufferClassName,
+                    bufferSizeKBytes,
+                    checksumEnabled,
+                    adler32Checksum,
+                    flushSleepTimeMilliseconds,
+                    logFileDir,
+                    logFileExt,
+                    logFileName,
+                    maxBlocksPerFile,
+                    maxBuffers,
+                    maxLogFiles,
+                    minBuffers,
+                    threadsWaitingForceThreshold,
+                    xidFactory != null ? xidFactory : new XidFactoryImpl(),
+                    serverBaseDir);
+
+            howlLog.doStart();
+        }
+        return howlLog;
+    }
+
+    public void destroy() throws Exception {
+        if (howlLog != null) {
+            howlLog.doStop();
+            howlLog = null;
+        }
+    }
+
+    public Class<?> getObjectType() {
+        return TransactionLog.class;
+    }
+
+    public boolean isSingleton() {
+        return true;
+    }
+
+    public String getBufferClassName() {
+        return bufferClassName;
+    }
+
+    public void setBufferClassName(String bufferClassName) {
+        this.bufferClassName = bufferClassName;
+    }
+
+    public int getBufferSizeKBytes() {
+        return bufferSizeKBytes;
+    }
+
+    public void setBufferSizeKBytes(int bufferSizeKBytes) {
+        this.bufferSizeKBytes = bufferSizeKBytes;
+    }
+
+    public boolean isChecksumEnabled() {
+        return checksumEnabled;
+    }
+
+    public void setChecksumEnabled(boolean checksumEnabled) {
+        this.checksumEnabled = checksumEnabled;
+    }
+
+    public boolean isAdler32Checksum() {
+        return adler32Checksum;
+    }
+
+    public void setAdler32Checksum(boolean adler32Checksum) {
+        this.adler32Checksum = adler32Checksum;
+    }
+
+    public int getFlushSleepTimeMilliseconds() {
+        return flushSleepTimeMilliseconds;
+    }
+
+    public void setFlushSleepTimeMilliseconds(int flushSleepTimeMilliseconds) {
+        this.flushSleepTimeMilliseconds = flushSleepTimeMilliseconds;
+    }
+
+    public String getLogFileDir() {
+        return logFileDir;
+    }
+
+    public void setLogFileDir(String logFileDir) {
+        this.logFileDir = logFileDir;
+    }
+
+    public String getLogFileExt() {
+        return logFileExt;
+    }
+
+    public void setLogFileExt(String logFileExt) {
+        this.logFileExt = logFileExt;
+    }
+
+    public String getLogFileName() {
+        return logFileName;
+    }
+
+    public void setLogFileName(String logFileName) {
+        this.logFileName = logFileName;
+    }
+
+    public int getMaxBlocksPerFile() {
+        return maxBlocksPerFile;
+    }
+
+    public void setMaxBlocksPerFile(int maxBlocksPerFile) {
+        this.maxBlocksPerFile = maxBlocksPerFile;
+    }
+
+    public int getMaxBuffers() {
+        return maxBuffers;
+    }
+
+    public void setMaxBuffers(int maxBuffers) {
+        this.maxBuffers = maxBuffers;
+    }
+
+    public int getMaxLogFiles() {
+        return maxLogFiles;
+    }
+
+    public void setMaxLogFiles(int maxLogFiles) {
+        this.maxLogFiles = maxLogFiles;
+    }
+
+    public int getMinBuffers() {
+        return minBuffers;
+    }
+
+    public void setMinBuffers(int minBuffers) {
+        this.minBuffers = minBuffers;
+    }
+
+    public int getThreadsWaitingForceThreshold() {
+        return threadsWaitingForceThreshold;
+    }
+
+    public void setThreadsWaitingForceThreshold(int 
threadsWaitingForceThreshold) {
+        this.threadsWaitingForceThreshold = threadsWaitingForceThreshold;
+    }
+
+    public XidFactory getXidFactory() {
+        return xidFactory;
+    }
+
+    public void setXidFactory(XidFactory xidFactory) {
+        this.xidFactory = xidFactory;
+    }
+
+    public File getServerBaseDir() {
+        return serverBaseDir;
+    }
+
+    public void setServerBaseDir(File serverBaseDir) {
+        this.serverBaseDir = serverBaseDir;
+    }
+}

Added: 
servicemix/smx4/nmr/trunk/transaction/src/main/java/org/apache/servicemix/transaction/TransactionManagerFactoryBean.java
URL: 
http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/transaction/src/main/java/org/apache/servicemix/transaction/TransactionManagerFactoryBean.java?rev=746931&view=auto
==============================================================================
--- 
servicemix/smx4/nmr/trunk/transaction/src/main/java/org/apache/servicemix/transaction/TransactionManagerFactoryBean.java
 (added)
+++ 
servicemix/smx4/nmr/trunk/transaction/src/main/java/org/apache/servicemix/transaction/TransactionManagerFactoryBean.java
 Mon Feb 23 09:00:12 2009
@@ -0,0 +1,107 @@
+/*
+ * 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.servicemix.transaction;
+
+import java.util.Collection;
+
+import org.apache.geronimo.transaction.log.HOWLLog;
+import org.apache.geronimo.transaction.log.UnrecoverableLog;
+import org.apache.geronimo.transaction.manager.TransactionLog;
+import org.apache.geronimo.transaction.manager.XidFactory;
+import org.apache.geronimo.transaction.manager.XidFactoryImpl;
+import org.springframework.beans.factory.FactoryBean;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.beans.factory.DisposableBean;
+
+/**
+ * This FactoryBean creates and configures the Geronimo implementation
+ * of the TransactionManager interface.
+ */
+public class TransactionManagerFactoryBean implements FactoryBean, 
InitializingBean, DisposableBean {
+    private GeronimoPlatformTransactionManager transactionManager;
+
+    private int defaultTransactionTimeoutSeconds = 600;
+    private XidFactory xidFactory;
+
+    private TransactionLog transactionLog;
+    private boolean createdTransactionLog;
+
+
+    public Object getObject() throws Exception {
+        if (transactionManager == null) {
+            this.transactionManager = new GeronimoPlatformTransactionManager(
+                    defaultTransactionTimeoutSeconds,
+                    xidFactory,
+                    transactionLog);
+        }
+        return transactionManager;
+    }
+
+    public void destroy() throws Exception {
+        if (createdTransactionLog && transactionLog instanceof HOWLLog) {
+            ((HOWLLog) transactionLog).doStop();
+        }
+    }
+
+    public Class<?> getObjectType() {
+        return GeronimoPlatformTransactionManager.class;
+    }
+
+    public boolean isSingleton() {
+        return true;
+    }
+
+    /**
+     * Set the default transaction timeout in second.
+     */
+    public void setDefaultTransactionTimeoutSeconds(int timeout) {
+        defaultTransactionTimeoutSeconds = timeout;
+    }
+
+    /**
+     * Set the transaction log for the transaction context manager.
+     */
+    public void setTransactionLog(TransactionLog log) {
+        transactionLog = log;
+    }
+
+    public XidFactory getXidFactory() {
+        return xidFactory;
+    }
+
+    public void setXidFactory(XidFactory xidFactory) {
+        this.xidFactory = xidFactory;
+    }
+
+    /**
+     * Set the resource managers
+     */
+    public void setResourceManagers(Collection<?> resourceManagers) {
+        // TODO: warn about deprecated method
+    }
+
+    public void afterPropertiesSet() throws Exception {
+        if (transactionLog == null) {
+            transactionLog = new UnrecoverableLog();
+            createdTransactionLog = true;
+        }
+        if (xidFactory == null) {
+            xidFactory = new XidFactoryImpl();
+        }
+    }
+
+}

Modified: 
servicemix/smx4/nmr/trunk/transaction/src/main/resources/META-INF/spring/servicemix-tx.xml
URL: 
http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/transaction/src/main/resources/META-INF/spring/servicemix-tx.xml?rev=746931&r1=746930&r2=746931&view=diff
==============================================================================
--- 
servicemix/smx4/nmr/trunk/transaction/src/main/resources/META-INF/spring/servicemix-tx.xml
 (original)
+++ 
servicemix/smx4/nmr/trunk/transaction/src/main/resources/META-INF/spring/servicemix-tx.xml
 Mon Feb 23 09:00:12 2009
@@ -36,11 +36,19 @@
   
http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd";>
 
     <!-- Transaction Manager -->
-    <bean id="transactionManager" 
class="org.jencks.factory.TransactionManagerFactoryBean">
+    <bean id="transactionManager" 
class="org.apache.servicemix.transaction.TransactionManagerFactoryBean">
         <property name="defaultTransactionTimeoutSeconds" 
value="${defaultTransactionTimeoutSeconds}" />
-        <property name="transactionLogDir" value="${transactionLogDir}" />
+        <property name="xidFactory" ref="xidFactory" />
+        <property name="transactionLog" ref="transactionLog" />
     </bean>
 
+    <bean id="transactionLog" 
class="org.apache.servicemix.transaction.HowlLogFactoryBean">
+        <property name="logFileDir" value="${transactionLogDir}" />
+        <property name="xidFactory" ref="xidFactory" />
+    </bean>
+
+    <bean id="xidFactory" 
class="org.apache.geronimo.transaction.manager.XidFactoryImpl" />
+
     <osgi:service ref="transactionManager">
         <osgi:interfaces>
             <value>javax.transaction.TransactionManager</value>


Reply via email to