[jboss-svn-commits] JBL Code SVN: r30019 - in labs/jbossesb/trunk/product: rosetta/src/org/jboss/soa/esb/common and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Nov 5 09:01:46 EST 2009


Author: beve
Date: 2009-11-05 09:01:46 -0500 (Thu, 05 Nov 2009)
New Revision: 30019

Added:
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/common/JBossESBTransactionService.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/common/JBossESBTransactionServiceMBean.java
Modified:
   labs/jbossesb/trunk/product/install/esb-deployers-jboss-beans.xml
   labs/jbossesb/trunk/product/install/jboss-service-jbossas5.xml
   labs/jbossesb/trunk/product/install/jboss-service.xml
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/common/JBossESBPropertyService.java
Log:
Work for https://jira.jboss.org/jira/browse/JBESB-2950 "AS5 ESB web deployments broken on server re-start"


Modified: labs/jbossesb/trunk/product/install/esb-deployers-jboss-beans.xml
===================================================================
--- labs/jbossesb/trunk/product/install/esb-deployers-jboss-beans.xml	2009-11-05 13:46:24 UTC (rev 30018)
+++ labs/jbossesb/trunk/product/install/esb-deployers-jboss-beans.xml	2009-11-05 14:01:46 UTC (rev 30019)
@@ -1,6 +1,20 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
 <deployment xmlns="urn:jboss:bean-deployer:2.0">
+    
+    <bean name="EsbPropertyService" class="org.jboss.soa.esb.common.JBossESBPropertyService">
+        <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.esb:service=PropertyService", exposedInterface=org.jboss.soa.esb.common.JBossESBPropertyServiceMBean.class, registerDirectly=true)</annotation>
+        <property name="propertyFile">
+            <!-- Use the ServiceBindingManager to process (xslt) jbossesb-properties.xml and set the result to the PropertyFile attribute.-->
+            <value-factory bean="ServiceBindingManager" method="getResourceBinding">
+                <!-- serviceName -->
+                <parameter>EsbPropertyService</parameter>
+                <!-- input -->
+                <parameter>${jboss.server.home.url}${/}deployers${/}esb.deployer${/}/jbossesb-properties.xml</parameter>
+            </value-factory>
+        </property>
+        <property name="propertiesFileDir">${jboss.server.data.dir}</property>
+    </bean>
 
     <bean name="GroupingStructure" class="org.jboss.soa.esb.listeners.deployers.mc.GroupingStructure">
         <property name="shortCircuitFilter">
@@ -39,7 +53,7 @@
 	</bean>
 
 	<bean name="EsbWebServiceDeployer" class="org.jboss.soa.esb.listeners.deployers.mc.EsbWebServiceDeployer">
-        <depends>jboss.esb:service=PropertyService</depends>
+        <depends>EsbPropertyService</depends>
     </bean>
 
 	<bean name="EsbWsdlDeployer" class="org.jboss.soa.esb.listeners.deployers.mc.EsbWsdlDeployer"/>

Modified: labs/jbossesb/trunk/product/install/jboss-service-jbossas5.xml
===================================================================
--- labs/jbossesb/trunk/product/install/jboss-service-jbossas5.xml	2009-11-05 13:46:24 UTC (rev 30018)
+++ labs/jbossesb/trunk/product/install/jboss-service-jbossas5.xml	2009-11-05 14:01:46 UTC (rev 30019)
@@ -2,19 +2,9 @@
 
 <server>
 
-	<mbean code="org.jboss.soa.esb.common.JBossESBPropertyService" name="jboss.esb:service=PropertyService">
-		<attribute name="PropertyFile">
-			<!-- Use the ServiceBindingManager to process (xslt) jbossesb-properties.xml and set the result to the PropertyFile attribute.-->
-			<value-factory bean="ServiceBindingManager" method="getResourceBinding">
-				<!-- serviceName -->
-				<parameter>EsbPropertyService</parameter>
-				<!-- input -->
-				<parameter>${jboss.server.home.url}${/}deployers${/}esb.deployer${/}/jbossesb-properties.xml</parameter>
-			</value-factory>
-		</attribute>
-		<attribute name="PropertiesFileDir">${jboss.server.data.dir}</attribute>
-		<depends>jboss:service=TransactionManager</depends>
-	</mbean>
+	<mbean code="org.jboss.soa.esb.common.JBossESBTransactionService" name="jboss.esb:service=TransactionService">
+        <depends>jboss:service=TransactionManager</depends>
+    </mbean>
 
 	<mbean code="org.jboss.internal.soa.esb.services.registry.RegistryService" name="jboss.esb:service=ESBRegistry">
 		<depends>jboss.esb:service=PropertyService</depends>

Modified: labs/jbossesb/trunk/product/install/jboss-service.xml
===================================================================
--- labs/jbossesb/trunk/product/install/jboss-service.xml	2009-11-05 13:46:24 UTC (rev 30018)
+++ labs/jbossesb/trunk/product/install/jboss-service.xml	2009-11-05 14:01:46 UTC (rev 30019)
@@ -3,11 +3,14 @@
 <server>
 
 	<classpath codebase="deploy/jbossesb.sar/lib" archives="*.jar"/>
+	
+	<mbean code="org.jboss.soa.esb.common.JBossESBTransactionService" name="jboss.esb:service=TransactionService">
+        <depends>jboss:service=TransactionManager</depends>
+    </mbean>
 
 	<mbean code="org.jboss.soa.esb.common.JBossESBPropertyService" name="jboss.esb:service=PropertyService">
 		<attribute name="PropertyFile">jbossesb-properties.xml</attribute>
 		<attribute name="PropertiesFileDir">${jboss.server.data.dir}</attribute>
-		<depends>jboss:service=TransactionManager</depends>
 	</mbean>
 
 	<mbean code="org.jboss.internal.soa.esb.services.registry.RegistryService" name="jboss.esb:service=ESBRegistry">

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/common/JBossESBPropertyService.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/common/JBossESBPropertyService.java	2009-11-05 13:46:24 UTC (rev 30018)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/common/JBossESBPropertyService.java	2009-11-05 14:01:46 UTC (rev 30019)
@@ -29,19 +29,11 @@
 import java.net.URL;
 import java.net.UnknownHostException;
 
-import javax.transaction.Status;
-import javax.transaction.Synchronization;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-import javax.transaction.xa.XAResource;
-
-import org.apache.log4j.Logger;
 import org.jboss.internal.soa.esb.util.XMLHelper;
 import org.jboss.mx.util.MBeanProxyExt;
 import org.jboss.system.ServiceMBeanSupport;
 import org.jboss.system.server.ServerConfig;
 import org.jboss.system.server.ServerConfigImplMBean;
-import org.jboss.tm.TransactionManagerLocator;
 
 /**
  * This MBean wraps the configuration to allow ServiceBindingManager
@@ -151,220 +143,8 @@
                 xmlPropertyIS.close() ;
             }
         }
-        // We also setup the transaction strategy here
-        TransactionStrategy.setTransactionStrategy(new JTATransactionStrategy()) ;
     }
     
-    /**
-     * The JTA transaction strategy used in the application server.
-     * @author kevin
-     */
-    private static class JTATransactionStrategy extends TransactionStrategy
-    {
-        /**
-         * The logger for this class.
-         */
-        private static final Logger LOGGER = Logger.getLogger(JTATransactionStrategy.class) ;
-        
-        /**
-         * The transaction manager.
-         */
-        private final TransactionManager tm ;
-        
-        /**
-         * Construct the JTA transaction strategy.
-         */
-        JTATransactionStrategy()
-        {
-            tm = TransactionManagerLocator.getInstance().locate() ;
-        }
-        
-        /**
-         * Begin a transaction on the current thread.
-         * @throws TransactionStrategyException
-         */
-        public void begin()
-            throws TransactionStrategyException
-        {
-            try
-            {
-                tm.begin() ;
-                LOGGER.trace("Transaction started on current thread") ;
-            }
-            catch (final Throwable th)
-            {
-                LOGGER.debug("Failed to start transaction on current thread", th) ;
-                throw new TransactionStrategyException("Failed to begin transaction on current thread", th) ;
-            }
-        }
-        
-        /**
-         * Terminate the transaction on the current thread.
-         * If the transaction has been marked for rollback then it
-         * will be rolled back, otherwise it will be committed.
-         * @throws TransactionStrategyException
-         */
-        public void terminate()
-            throws TransactionStrategyException
-        {
-            try
-            {
-                final int status = tm.getStatus() ;
-                switch(status)
-                {
-                    case Status.STATUS_ACTIVE:
-                        LOGGER.trace("Committing transaction on current thread") ;
-                        tm.commit() ;
-                        break ;
-                    case Status.STATUS_MARKED_ROLLBACK:
-                        LOGGER.trace("Rollback transaction on current thread") ;
-                        tm.rollback();
-                        break ;
-                    default:
-                        // Transaction is in some other state, just disassociate
-                        if (LOGGER.isTraceEnabled())
-                        {
-                            LOGGER.trace("Suspending transaction on current thread, status: " + status) ;
-                        }
-                        tm.suspend() ;
-                }
-            }
-            catch (final Throwable th)
-            {
-                LOGGER.debug("Failed to terminate transaction on current thread", th) ;
-                throw new TransactionStrategyException("Failed to terminate transaction on current thread", th) ;
-            }
-        }
-        
-        /**
-         * Mark the current transaction for rollback.
-         * @throws TransactionStrategyException
-         */
-        public void rollbackOnly()
-            throws TransactionStrategyException
-        {
-            try
-            {
-                tm.setRollbackOnly();
-            }
-            catch (final Throwable th)
-            {
-                throw new TransactionStrategyException("Failed to mark the transaction on current thread for rollback", th) ;
-            }
-        }
-        
-        /**
-         * Get a handle on the currently associated transaction (or null).
-         * @throws TransactionStrategyException
-         */
-        
-        public Object getTransaction () throws TransactionStrategyException
-        {
-        	try
-        	{
-        		return tm.getTransaction();
-        	}
-        	catch (final Throwable th)
-        	{
-        		throw new TransactionStrategyException("Problem when trying to getTransaction: ",th);
-        	}
-        }
-        
-        /**
-         * Suspend the current thread-to-transaction association.
-         * 
-         * @return the associated transaction, or null.
-         * @throws TransactionStrategyException
-         */
-        public Object suspend () throws TransactionStrategyException
-        {
-        	try
-        	{
-        		return tm.suspend();
-        	}
-        	catch (final Throwable th)
-        	{
-        		throw new TransactionStrategyException("Problem when trying to suspend transaction: ",th);
-        	}
-        }
-        
-        /**
-         * Associated the transaction with the current thread.
-         * @param tx
-         * @throws TransactionStrategyException
-         */
-        public void resume (Object tx) throws TransactionStrategyException
-        {
-        	try
-        	{
-        		tm.resume((Transaction) tx);
-        	}
-        	catch (final Throwable th)
-        	{
-        		throw new TransactionStrategyException("Problem when trying to resume transaction: ",th);
-        	}
-        }
-        
-        /**
-         * Add a synchronization to the current transaction.
-         * @param sync
-         * @throws TransactionStrategyException
-         */
-        public void registerSynchronization (Synchronization sync) throws TransactionStrategyException
-        {
-            try
-            {
-        	tm.getTransaction().registerSynchronization(sync);
-            }
-            catch (final Throwable th)
-            {
-        	throw new TransactionStrategyException("Problem when registering synchronization: ", th);
-            }
-        }
-        
-        /**
-         * Add a resource to the current transaction.
-         * @param resource
-         * @throws TransactionStrategyException
-         */
-        public void enlistResource(XAResource resource) throws TransactionStrategyException
-        {
-            try
-            {
-                tm.getTransaction().enlistResource(resource);
-            }
-            catch (final Throwable th)
-            {
-                throw new TransactionStrategyException("Problem when enlisting resource", th);
-            }
-        }
-        
-        /**
-         * Is the currently associated transaction active?
-         * @return
-         * @throws TransactionStrategyException
-         */
-        public boolean isActive () throws TransactionStrategyException
-        {
-        	try
-        	{
-        		if (tm.getStatus() == Status.STATUS_ACTIVE)
-        			return true;
-        		else
-        			return false;
-        	}
-        	catch (final Throwable th)
-        	{
-        		throw new TransactionStrategyException("Problem when trying to get transaction status: ",th);
-        	}
-        }
-        
-        public String toString ()
-        {
-        	return "JTATransactionStrategy";
-        }
-    }
-
     public void setPropertiesFileDir(String directory)
     {
         this.propertiesFileDir = directory;

Added: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/common/JBossESBTransactionService.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/common/JBossESBTransactionService.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/common/JBossESBTransactionService.java	2009-11-05 14:01:46 UTC (rev 30019)
@@ -0,0 +1,252 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated 
+ * by the @authors tag. All rights reserved. 
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors. 
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A 
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package org.jboss.soa.esb.common;
+
+import javax.transaction.Status;
+import javax.transaction.Synchronization;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+import javax.transaction.xa.XAResource;
+
+import org.apache.log4j.Logger;
+import org.jboss.system.ServiceMBeanSupport;
+import org.jboss.tm.TransactionManagerLocator;
+
+public class JBossESBTransactionService extends ServiceMBeanSupport implements JBossESBTransactionServiceMBean
+{
+    @Override
+    protected void createService()
+        throws Exception
+    {
+        TransactionStrategy.setTransactionStrategy(new JTATransactionStrategy()) ;
+    }
+    
+    /**
+     * The JTA transaction strategy used in the application server.
+     * @author kevin
+     */
+    private static class JTATransactionStrategy extends TransactionStrategy
+    {
+        /**
+         * The logger for this class.
+         */
+        private static final Logger LOGGER = Logger.getLogger(JTATransactionStrategy.class) ;
+        
+        /**
+         * The transaction manager.
+         */
+        private final TransactionManager tm ;
+        
+        /**
+         * Construct the JTA transaction strategy.
+         */
+        JTATransactionStrategy()
+        {
+            tm = TransactionManagerLocator.getInstance().locate() ;
+        }
+        
+        /**
+         * Begin a transaction on the current thread.
+         * @throws TransactionStrategyException
+         */
+        public void begin()
+            throws TransactionStrategyException
+        {
+            try
+            {
+                tm.begin() ;
+                LOGGER.trace("Transaction started on current thread") ;
+            }
+            catch (final Throwable th)
+            {
+                LOGGER.debug("Failed to start transaction on current thread", th) ;
+                throw new TransactionStrategyException("Failed to begin transaction on current thread", th) ;
+            }
+        }
+        
+        /**
+         * Terminate the transaction on the current thread.
+         * If the transaction has been marked for rollback then it
+         * will be rolled back, otherwise it will be committed.
+         * @throws TransactionStrategyException
+         */
+        public void terminate()
+            throws TransactionStrategyException
+        {
+            try
+            {
+                final int status = tm.getStatus() ;
+                switch(status)
+                {
+                    case Status.STATUS_ACTIVE:
+                        LOGGER.trace("Committing transaction on current thread") ;
+                        tm.commit() ;
+                        break ;
+                    case Status.STATUS_MARKED_ROLLBACK:
+                        LOGGER.trace("Rollback transaction on current thread") ;
+                        tm.rollback();
+                        break ;
+                    default:
+                        // Transaction is in some other state, just disassociate
+                        if (LOGGER.isTraceEnabled())
+                        {
+                            LOGGER.trace("Suspending transaction on current thread, status: " + status) ;
+                        }
+                        tm.suspend() ;
+                }
+            }
+            catch (final Throwable th)
+            {
+                LOGGER.debug("Failed to terminate transaction on current thread", th) ;
+                throw new TransactionStrategyException("Failed to terminate transaction on current thread", th) ;
+            }
+        }
+        
+        /**
+         * Mark the current transaction for rollback.
+         * @throws TransactionStrategyException
+         */
+        public void rollbackOnly()
+            throws TransactionStrategyException
+        {
+            try
+            {
+                tm.setRollbackOnly();
+            }
+            catch (final Throwable th)
+            {
+                throw new TransactionStrategyException("Failed to mark the transaction on current thread for rollback", th) ;
+            }
+        }
+        
+        /**
+         * Get a handle on the currently associated transaction (or null).
+         * @throws TransactionStrategyException
+         */
+        
+        public Object getTransaction () throws TransactionStrategyException
+        {
+        	try
+        	{
+        		return tm.getTransaction();
+        	}
+        	catch (final Throwable th)
+        	{
+        		throw new TransactionStrategyException("Problem when trying to getTransaction: ",th);
+        	}
+        }
+        
+        /**
+         * Suspend the current thread-to-transaction association.
+         * 
+         * @return the associated transaction, or null.
+         * @throws TransactionStrategyException
+         */
+        public Object suspend () throws TransactionStrategyException
+        {
+        	try
+        	{
+        		return tm.suspend();
+        	}
+        	catch (final Throwable th)
+        	{
+        		throw new TransactionStrategyException("Problem when trying to suspend transaction: ",th);
+        	}
+        }
+        
+        /**
+         * Associated the transaction with the current thread.
+         * @param tx
+         * @throws TransactionStrategyException
+         */
+        public void resume (Object tx) throws TransactionStrategyException
+        {
+        	try
+        	{
+        		tm.resume((Transaction) tx);
+        	}
+        	catch (final Throwable th)
+        	{
+        		throw new TransactionStrategyException("Problem when trying to resume transaction: ",th);
+        	}
+        }
+        
+        /**
+         * Add a synchronization to the current transaction.
+         * @param sync
+         * @throws TransactionStrategyException
+         */
+        public void registerSynchronization (Synchronization sync) throws TransactionStrategyException
+        {
+            try
+            {
+        	tm.getTransaction().registerSynchronization(sync);
+            }
+            catch (final Throwable th)
+            {
+        	throw new TransactionStrategyException("Problem when registering synchronization: ", th);
+            }
+        }
+        
+        /**
+         * Add a resource to the current transaction.
+         * @param resource
+         * @throws TransactionStrategyException
+         */
+        public void enlistResource(XAResource resource) throws TransactionStrategyException
+        {
+            try
+            {
+                tm.getTransaction().enlistResource(resource);
+            }
+            catch (final Throwable th)
+            {
+                throw new TransactionStrategyException("Problem when enlisting resource", th);
+            }
+        }
+        
+        /**
+         * Is the currently associated transaction active?
+         * @return
+         * @throws TransactionStrategyException
+         */
+        public boolean isActive () throws TransactionStrategyException
+        {
+        	try
+        	{
+        		if (tm.getStatus() == Status.STATUS_ACTIVE)
+        			return true;
+        		else
+        			return false;
+        	}
+        	catch (final Throwable th)
+        	{
+        		throw new TransactionStrategyException("Problem when trying to get transaction status: ",th);
+        	}
+        }
+        
+        public String toString ()
+        {
+        	return "JTATransactionStrategy";
+        }
+    }
+
+}

Added: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/common/JBossESBTransactionServiceMBean.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/common/JBossESBTransactionServiceMBean.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/common/JBossESBTransactionServiceMBean.java	2009-11-05 14:01:46 UTC (rev 30019)
@@ -0,0 +1,27 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated 
+ * by the @authors tag. All rights reserved. 
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors. 
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A 
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package org.jboss.soa.esb.common;
+
+import org.jboss.system.ServiceMBean;
+
+public interface JBossESBTransactionServiceMBean extends ServiceMBean
+{
+}



More information about the jboss-svn-commits mailing list