geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jboy...@apache.org
Subject cvs commit: incubator-geronimo/modules/web/src/java/org/apache/geronimo/web AbstractWebContainer.java WebDeploymentPlanner.java
Date Sun, 23 Nov 2003 22:39:21 GMT
jboynes     2003/11/23 14:39:21

  Modified:    modules/web/src/java/org/apache/geronimo/web
                        AbstractWebContainer.java WebDeploymentPlanner.java
  Log:
  Make UserTransaction available to webapps
  
  Revision  Changes    Path
  1.21      +16 -5     incubator-geronimo/modules/web/src/java/org/apache/geronimo/web/AbstractWebContainer.java
  
  Index: AbstractWebContainer.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/web/src/java/org/apache/geronimo/web/AbstractWebContainer.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- AbstractWebContainer.java	20 Nov 2003 09:10:17 -0000	1.20
  +++ AbstractWebContainer.java	23 Nov 2003 22:39:21 -0000	1.21
  @@ -78,6 +78,7 @@
   import javax.management.ObjectName;
   import javax.management.ReflectionException;
   import javax.transaction.UserTransaction;
  +import javax.transaction.TransactionManager;
   
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  @@ -110,6 +111,7 @@
   import org.apache.geronimo.xml.deployment.GeronimoWebAppLoader;
   import org.apache.geronimo.xml.deployment.LoaderUtil;
   import org.apache.geronimo.xml.deployment.WebAppLoader;
  +import org.apache.geronimo.transaction.manager.UserTransactionImpl;
   
   import org.w3c.dom.Document;
   import org.xml.sax.SAXException;
  @@ -151,7 +153,16 @@
       //this should move down to AbstractContainer
       private Map webAppMap = new HashMap();
   
  +    private TransactionManager transactionManager;
   
  +    /**
  +     * @param transactionManager
  +     * @jmx.managed-operation
  +     * @todo make GeronimoMBean support managed attributes
  +     */
  +    public void bindTransactionManager(TransactionManager transactionManager) {
  +        this.transactionManager = transactionManager;
  +    }
   
       /**
        * Constructor
  @@ -216,7 +227,7 @@
           DeploymentHelper deploymentHelper = new DeploymentHelper(url, goal.getType(), "WebApplication",
"web.xml", "geronimo-web.xml", "WEB-INF");
           URL geronimoDDURL = deploymentHelper.locateGeronimoDD();
           URL webDDURL = deploymentHelper.locateJ2eeDD();
  -        
  +
           // Is the specific URL deployable?
           if (null == geronimoDDURL) {
   //            log.info("Looking at and rejecting url " + url);
  @@ -280,7 +291,7 @@
               throw new DeploymentException(e);
           }
   
  -       
  +
           // Create a deployment plan for the webapp
           DeploymentPlan webappPlan = new DeploymentPlan();
           webappPlan.addTask(new RegisterMBeanInstance(server, webappName, webapp));
  @@ -299,7 +310,7 @@
           webapp.setWebDDObj (webAppDoc);
           // Set up the geronimo-web.xml POJO
           webapp.setGeronimoDDObj (geronimoWebAppDoc);
  -        
  +
           // Set up the ContextPath, which can come from:
           //  application.xml
           //  geronimo-web.xml
  @@ -317,7 +328,7 @@
   
           // Set up the ENC etc
           if(geronimoWebAppDoc != null) {
  -            webapp.setComponentContext(this.getComponentContext(geronimoWebAppDoc, null));
  +            webapp.setComponentContext(this.getComponentContext(geronimoWebAppDoc, new
UserTransactionImpl(transactionManager)));
           }
   
           // Add a task to start the webapp which will finish configuring it
  
  
  
  1.2       +16 -1     incubator-geronimo/modules/web/src/java/org/apache/geronimo/web/WebDeploymentPlanner.java
  
  Index: WebDeploymentPlanner.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/web/src/java/org/apache/geronimo/web/WebDeploymentPlanner.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- WebDeploymentPlanner.java	14 Nov 2003 16:27:34 -0000	1.1
  +++ WebDeploymentPlanner.java	23 Nov 2003 22:39:21 -0000	1.2
  @@ -59,6 +59,7 @@
   import java.util.Set;
   
   import javax.management.ObjectName;
  +import javax.transaction.TransactionManager;
   
   import org.apache.geronimo.kernel.deployment.AbstractDeploymentPlanner;
   import org.apache.geronimo.kernel.deployment.DeploymentException;
  @@ -80,17 +81,31 @@
        */
       private AbstractWebContainer webContainer;
   
  +    private TransactionManager transactionManager;
  +
       public static GeronimoMBeanInfo getGeronimoMBeanInfo() throws Exception {
           GeronimoMBeanInfo mbeanInfo = AbstractDeploymentPlanner.getGeronimoMBeanInfo(WebDeploymentPlanner.class.getName());
           mbeanInfo.addEndpoint(new GeronimoMBeanEndpoint("WebContainer",
                   AbstractWebContainer.class.getName(),
                   ObjectName.getInstance("jetty:role=WebContainer"), //hard coded for now...
                   true));
  +        mbeanInfo.addEndpoint(new GeronimoMBeanEndpoint("TransactionManager",
  +                TransactionManager.class.getName(),
  +                ObjectName.getInstance("geronimo.transaction:role=TransactionManager"),
//hard coded for now...
  +                true));
           return mbeanInfo;
       }
   
       public void setWebContainer(AbstractWebContainer webContainer) {
           this.webContainer = webContainer;
  +        webContainer.bindTransactionManager(transactionManager);
  +    }
  +
  +    public void setTransactionManager(TransactionManager transactionManager) {
  +        this.transactionManager = transactionManager;
  +        if (webContainer!= null) {
  +            webContainer.bindTransactionManager(transactionManager);
  +        }
       }
   
       protected boolean addURL(DeployURL deployURL, Set goals, Set plans) throws DeploymentException
{
  
  
  

Mime
View raw message