You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jb...@apache.org on 2003/11/23 23:39:21 UTC

cvs commit: incubator-geronimo/modules/web/src/java/org/apache/geronimo/web AbstractWebContainer.java WebDeploymentPlanner.java

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 {
  
  
  

Re: Abbreviations in method's names - all capitals?

Posted by Jacek Laskowski <ja...@hp.com>.
Jeremy Boynes wrote:

> Simplest thing is probably just to identify them - an IDE should be able 
> to rename the methods as easily as applying a patch.

Here's the list (after you've fixed the J2EE breakage):

* Jmx == JMX
./modules/core/src/java/org/apache/geronimo/enterprise/deploy/server/JmxProgressObject.java
./modules/core/src/java/org/apache/geronimo/enterprise/deploy/server/JmxServerConnection.java

* Jndi == JNDI

Loads of them; it's not easy to type them in as it'd not simplify the task

* Ejb == EJB

Even more

> Jeremy

Jacek


Re: Abbreviations in method's names - all capitals?

Posted by Jeremy Boynes <je...@coredevelopers.net>.
Jacek Laskowski wrote:

> Jeremy Boynes wrote:
> 
>> Nah, this method name does not follow our coding standard - 
>> unfortunately, you can probably find several examples of this.
> 
> 
> Shall I create a patch for the examples and create a issue report or is 
> it being taken care of? It's used in a very few places - 5 or so.
> 

Simplest thing is probably just to identify them - an IDE should be able 
to rename the methods as easily as applying a patch.

Thanks - things like this are irritating and easily slip through.

--
Jeremy


Re: Abbreviations in method's names - all capitals?

Posted by Jacek Laskowski <ja...@hp.com>.
Jeremy Boynes wrote:

> Nah, this method name does not follow our coding standard - 
> unfortunately, you can probably find several examples of this.

Shall I create a patch for the examples and create a issue report or is 
it being taken care of? It's used in a very few places - 5 or so.

> Jeremy

Jacek



Re: Abbreviations in method's names - all capitals?

Posted by Jeremy Boynes <je...@coredevelopers.net>.
Jacek Laskowski wrote:

> [snip]
> 
>>            URL webDDURL = deploymentHelper.locateJ2eeDD();
> 
> I've just noticed it and wonder what the rules are about methods' names 
>  that embody abbreviations like J2EE. I rememeber it's been agreed that 
> these ought to be written in capitals. What about the method's names? 
> The one above - o.a.g.kernel.deployment.DeploymentHelper.locateJ2eeDD() 
> - implies it's not the case as is with classes/intfs.
> 

Nah, this method name does not follow our coding standard - 
unfortunately, you can probably find several examples of this.

> Also, it's worth to say that 
> javax.enterprise.deploy.model.J2eeApplicationObject.java is written in a 
> different manner, but that's another story as it's a standard class.
> 

That's one we have to live with

--
Jeremy


Abbreviations in method's names - all capitals?

Posted by Jacek Laskowski <ja...@hp.com>.
jboynes@apache.org wrote:
> 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
[snip]
>            URL webDDURL = deploymentHelper.locateJ2eeDD();
[snip]

Hi,

I've just noticed it and wonder what the rules are about methods' names 
  that embody abbreviations like J2EE. I rememeber it's been agreed that 
these ought to be written in capitals. What about the method's names? 
The one above - o.a.g.kernel.deployment.DeploymentHelper.locateJ2eeDD() 
- implies it's not the case as is with classes/intfs.

Also, it's worth to say that 
javax.enterprise.deploy.model.J2eeApplicationObject.java is written in a 
different manner, but that's another story as it's a standard class.

Jacek