[jboss-cvs] JBossAS SVN: r57678 - in trunk: server/src/main/org/jboss/web/deployers tomcat/src/main/org/jboss/web/tomcat/tc6/deployers

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sat Oct 14 23:17:18 EDT 2006


Author: scott.stark at jboss.org
Date: 2006-10-14 23:17:14 -0400 (Sat, 14 Oct 2006)
New Revision: 57678

Modified:
   trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployer.java
   trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/deployers/TomcatDeployer.java
Log:
Update javadoc

Modified: trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployer.java
===================================================================
--- trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployer.java	2006-10-15 00:38:01 UTC (rev 57677)
+++ trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployer.java	2006-10-15 03:17:14 UTC (rev 57678)
@@ -28,7 +28,6 @@
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Set;
 
 import javax.management.MBeanServer;
 import javax.management.ObjectName;
@@ -44,13 +43,22 @@
 import org.jboss.web.WebApplication;
 
 /** A template pattern class for web container integration into JBoss. This class
- should be subclasses by web container providers wishing to integrate their
- container into a JBoss server.
+ should be subclassed by web container providers wishing to integrate their
+ container into a JBoss server. The sole method to implement is: 
+ {@link #getDeployment(DeploymentUnit, WebMetaData)}. This is called from
+ within {@linkplain #deploy(DeploymentUnit, WebMetaData)} to translate the
+ WebMetaData into a AbstractWarDeployment bean that will be passed to the
+ {@link org.jboss.system.deployers.ServiceDeployer} by creating ServiceMetaData
+ for the AbstractWarDeployment in
+ {@link #deployWebModule(DeploymentUnit, WebMetaData, AbstractWarDeployment)}
+ 
+ The output of this deployer is a ServiceMetaData attachment. When this is
+ translated into a service instance by the ServiceDeployer, the
+ AbstractWarDeployment start/stop trigger the actual deployment/undeployment of
+ the web application.
 
- @see org.jboss.web.AbstractWebDeployer
+ @see org.jboss.web.deployers.AbstractWarDeployment
 
- @jmx:mbean extends="org.jboss.deployment.SubDeployerMBean"
-
  @author  Scott.Stark at jboss.org
  @author  Christoph.Jung at infor.de
  @author  Thomas.Diesler at arcor.de
@@ -63,11 +71,6 @@
    public static final String WEB_MODULE = "org.jboss.web.AbstractWebContainer.webModule";
    public static final String ERROR = "org.jboss.web.AbstractWebContainer.error";
 
-   /** The suffixes we accept, along with their relative order */
-   private static final String[] DEFAULT_ENHANCED_SUFFIXES = new String[] {
-         "500:.war"
-   };
-   
    /** A mapping of deployed warUrl strings to the WebApplication object */
    protected HashMap deploymentMap = new HashMap();
    /** The parent class loader first model flag */
@@ -93,7 +96,10 @@
       super(WebMetaData.class);
    }
 
-   
+   /**
+    * Overriden to set the relative order to COMPONENT_DEPLOYER+1
+    * @return COMPONENT_DEPLOYER+1
+    */
    @Override
    public int getRelativeOrder()
    {
@@ -235,11 +241,32 @@
       
    }
 
+   /**
+    * Get the AbstractWarDeployment bean for the deployment metadata. Subclasses
+    * override this method to provide a AbstractWarDeployment bean whose
+    * start/stop will control the deployment/undeployment of the web
+    * application.
+    * 
+    * @param unit - the deployment unit
+    * @param metaData - the input web application metadata
+    * @return the AbstractWarDeployment for the input WebMetaData
+    * @throws Exception - thrown on any failure
+    */
    public abstract AbstractWarDeployment getDeployment(DeploymentUnit unit, WebMetaData metaData)
       throws Exception;
 
    /**
-    * Deploy a web app based on the WebMetaData.
+    * Deploy a web app based on the WebMetaData. This calls
+    * {@link #getDeployment(DeploymentUnit, WebMetaData)} to obtain an
+    * AbstractWarDeployment bean that is wrapped in a ServiceMetaData by
+    * deployWebModule.
+    * 
+    * This will set the WebMetaData.contextRoot if it has not been set based
+    * on the war deployment name.
+    * 
+    * @see #deployWebModule(DeploymentUnit, WebMetaData, AbstractWarDeployment)
+    * @see #buildWebContext(String, String, WebMetaData)
+    * 
     * @param unit - the war for the deployment
     * @param metaData - the metadata for the deployment
     */
@@ -247,8 +274,7 @@
    public void deploy(DeploymentUnit unit, WebMetaData metaData)
       throws DeploymentException
    {
-      log.debug("Begin deploy");
-
+      log.debug("Begin deploy, "+metaData);
       try
       {
          /* TODO: This needs to be moved to a webservice deployer which updates the WebMetaData
@@ -304,7 +330,7 @@
    }
 
    /**
-    * Stop the associated web module 
+    * Stop the associated web module. Not sure this has a
     */
    @Override
    public void undeploy(DeploymentUnit unit, WebMetaData metaData)
@@ -350,8 +376,9 @@
       return deploymentMap.values().iterator();
    }
 
-   /** Use reflection to access a URL[] getURLs method so that non-URLClassLoader
-    *class loaders that support this method can provide info.
+   /** A utility method that uses reflection to access a URL[] getURLs method
+    * so that non-URLClassLoader class loaders that support this method can
+    * provide info.
     */
    public static URL[] getClassLoaderURLs(ClassLoader cl)
    {
@@ -428,6 +455,10 @@
       return webContext;
    }
 
+   /**
+    * TODO: The use of an MBeanServer needs to be removed
+    * @return
+    */
    @Deprecated
    protected MBeanServer getServer()
    {
@@ -435,10 +466,12 @@
    }
 
    /**
+    * Get the object name of the ServiceMetaData instance associated with
+    * the WebMetaData. This uses the pattern:
+    * "jboss.web.deployment:war="+metaData.getContextRoot()
     * 
-    * @param unit
-    * @param cmd
-    * @return
+    * @param metaData - the web app metaData
+    * @return "jboss.web.deployment:war="+metaData.getContextRoot();
     */
    protected String getObjectName(WebMetaData metaData)
    {
@@ -447,7 +480,17 @@
       return objectName;
    }
 
-   protected void deployWebModule(DeploymentUnit unit, WebMetaData metaData, AbstractWarDeployment deployment)
+   /**
+    * Called by deploy to create a ServiceMetaData instance that wraps the
+    * AbstractWarDeployment bean.
+    * 
+    * @param unit - the deployment unit
+    * @param metaData - the web app metadata passed to deploy
+    * @param deployment - the web app deployment bean created by getDeployment
+    * @throws Exception
+    */
+   protected void deployWebModule(DeploymentUnit unit, WebMetaData metaData,
+         AbstractWarDeployment deployment)
       throws Exception
    {
       log.debug("deployWebModule");
@@ -475,7 +518,7 @@
          }
          webModule.setDependencies(dependencies);
 
-         // TODO component
+         // TODO could create multiple components for the deployment
          unit.addAttachment(ServiceMetaData.class, webModule);
       }
       catch (Exception e)
@@ -484,13 +527,4 @@
       }
 
    }
-
-   private void addURLs(Set urlSet, URL[] urls)
-   {
-      for(int u = 0; u < urls.length; u ++)
-      {
-         URL url = urls[u];
-         urlSet.add(url.toExternalForm());
-      }
-   }
 }

Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/deployers/TomcatDeployer.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/deployers/TomcatDeployer.java	2006-10-15 00:38:01 UTC (rev 57677)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/deployers/TomcatDeployer.java	2006-10-15 03:17:14 UTC (rev 57678)
@@ -40,7 +40,6 @@
 import org.apache.catalina.connector.Connector;
 import org.apache.tomcat.util.modeler.Registry;
 import org.jboss.deployers.spi.deployer.DeploymentUnit;
-import org.jboss.deployment.SubDeployerExt;
 import org.jboss.metadata.WebMetaData;
 import org.jboss.security.plugins.JaasSecurityManagerServiceMBean;
 import org.jboss.system.server.Server;
@@ -52,12 +51,12 @@
 
 
 /**
- * An implementation of the AbstractWebContainer for the Jakarta TomcatDeployer
- * servlet container. It has no code dependency on tomcat - only the new JMX
- * model is used.
- * <p/>
- * TomcatDeployer is organized as a set of mbeans - just like jboss.
- *
+ * A concrete implementation of the AbstractWarDeployer that creates
+ * {@link #TomcatDeployment} instances as the web application bean
+ * representation.
+ * 
+ * @see #getDeployment(DeploymentUnit, WebMetaData)
+ * 
  * @author Scott.Stark at jboss.org
  * @author Costin Manolache
  * @author Wonne.Keysers at realsoftware.be
@@ -78,8 +77,7 @@
    public static final String DEFAULT_CACHE_NAME =
       "jboss.cache:service=TomcatClusteringCache";
 
-   // XXX We could make this configurable - so it can support other containers
-   // that provide JMX-based deployment.
+   /** The web app context implementation class */
    private String contextClassName =
       "org.apache.catalina.core.StandardContext";
 
@@ -167,9 +165,6 @@
    /** */
    private String[] filteredPackages;
 
-   /** Hold a proxy reference to myself, used when registering to MainDeployer */
-   private SubDeployerExt thisProxy;
-
    public TomcatDeployer()
    {
    }
@@ -407,6 +402,9 @@
       this.filteredPackages = pkgs;
    }
 
+   /**
+    * Start the deployer. This sets up the tomcat core.
+    */
    public void start()
       throws Exception
    {
@@ -569,6 +567,9 @@
       super.stop();
    }
 
+   /**
+    * Start the tomcat service connectors.
+    */
    public void startConnectors() throws Exception
    {
       MBeanServer server = super.getServer();
@@ -589,6 +590,9 @@
       */
    }
 
+   /**
+    * Stop the tomcat service connectors.
+    */
    public void stopConnectors() throws Exception
    {
       MBeanServer server = super.getServer();
@@ -604,6 +608,10 @@
       }
    }
 
+   /**
+    * Used to receive notification of the server start msg so the tomcat
+    * connectors can be started after all web apps are deployed.
+    */
    public void handleNotification(Notification msg, Object handback)
    {
       String type = msg.getType();
@@ -684,9 +692,10 @@
    }
 
    /**
-    * Create a tomcat war deployment for the deployment unit/metaData.
-    * @param unit
-    * @param metaData
+    * Create a tomcat war deployment bean for the deployment unit/metaData.
+    * @param unit - the current web app deployment unit
+    * @param metaData - the parsed metdata for the web app deployment
+    * @return TomcatDeployment instnace
     */
    @Override
    public AbstractWarDeployment getDeployment(DeploymentUnit unit, WebMetaData metaData)




More information about the jboss-cvs-commits mailing list