craigmcc    02/03/04 17:55:03

  Modified:    catalina/src/share/org/apache/catalina/startup
                        HostConfig.java
               webapps/tomcat-docs/config host.xml
  Log:
  Separate the concepts of "autoDeploy" of applications in the appBase
  subdirectory from the concept of "liveDeploy" (checking for new apps in a
  background thread while Tomcat is running).  These can now be configured
  separately in the <Host> element.
  
  Default for both properties is "true" to mirror the previous behavior.
  
  Submitted by: Glenn Nielsen <[EMAIL PROTECTED]>
  
  Revision  Changes    Path
  1.18      +45 -10    
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/HostConfig.java
  
  Index: HostConfig.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- HostConfig.java   1 Mar 2002 03:04:44 -0000       1.17
  +++ HostConfig.java   5 Mar 2002 01:55:02 -0000       1.18
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v
 1.17 2002/03/01 03:04:44 craigmcc Exp $
  - * $Revision: 1.17 $
  - * $Date: 2002/03/01 03:04:44 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v
 1.18 2002/03/05 01:55:02 craigmcc Exp $
  + * $Revision: 1.18 $
  + * $Date: 2002/03/05 01:55:02 $
    *
    * ====================================================================
    *
  @@ -102,7 +102,7 @@
    *
    * @author Craig R. McClanahan
    * @author Remy Maucherat
  - * @version $Revision: 1.17 $ $Date: 2002/03/01 03:04:44 $
  + * @version $Revision: 1.18 $ $Date: 2002/03/05 01:55:02 $
    */
   
   public class HostConfig
  @@ -157,6 +157,13 @@
   
   
       /**
  +     * Should we monitor the <code>appBase</code> directory for new
  +     * applications and automatically deploy them?
  +     */
  +    private boolean liveDeploy = false;
  +
  +
  +    /**
        * The background thread.
        */
       private Thread thread = null;
  @@ -258,6 +265,28 @@
   
   
       /**
  +     * Return the live deploy flag for this component.
  +     */
  +    public boolean isLiveDeploy() {
  +
  +        return (this.liveDeploy);
  +
  +    }
  +
  +
  +    /**
  +     * Set the live deploy flag for this component.
  +     *
  +     * @param liveDeploy The new live deploy flag
  +     */
  +    public void setLiveDeploy(boolean liveDeploy) {
  +
  +        this.liveDeploy = liveDeploy;
  +
  +    }
  +
  +
  +    /**
        * Return the unpack WARs flag.
        */
       public boolean isUnpackWARs() {
  @@ -297,6 +326,7 @@
                   if (hostDebug > this.debug) {
                       this.debug = hostDebug;
                   }
  +                setLiveDeploy(((StandardHost) host).getLiveDeploy());
                   setUnpackWARs(((StandardHost) host).isUnpackWARs());
               }
           } catch (ClassCastException e) {
  @@ -746,7 +776,13 @@
           if (debug >= 1)
               log(sm.getString("hostConfig.start"));
   
  -        threadStart();
  +        if (host.getAutoDeploy()) {
  +            deployApps();
  +        }
  +
  +        if (isLiveDeploy()) {
  +            threadStart();
  +        }
   
       }
   
  @@ -869,15 +905,14 @@
           // Loop until the termination semaphore is set
           while (!threadDone) {
   
  +            // Wait for our check interval
  +            threadSleep();
  +
               // Deploy apps if the Host allows auto deploying
  -            if (host.getAutoDeploy())
  -                deployApps();
  +            deployApps();
   
               // Check for web.xml modification
               checkWebXmlLastModified();
  -
  -            // Wait for our check interval
  -            threadSleep();
   
           }
   
  
  
  
  1.11      +14 -8     jakarta-tomcat-4.0/webapps/tomcat-docs/config/host.xml
  
  Index: host.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/tomcat-docs/config/host.xml,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- host.xml  2 Mar 2002 16:38:58 -0000       1.10
  +++ host.xml  5 Mar 2002 01:55:03 -0000       1.11
  @@ -126,6 +126,14 @@
           will be used by default.</p>
         </attribute>
   
  +      <attribute name="liveDeploy" required="false">
  +        <p>This flag value indicates if new web applications, dropped in to
  +        the <code>appBase</code> directory while Tomcat is running, should
  +        be automatically deployed.  The flag's value defaults to true.  See
  +        <a href="#Automatic Application Deployment">Automatic Application
  +        Deployment</a> for more information.</p>
  +      </attribute>
  +
         <attribute name="unpackWARs" required="false">
           <p>Set to <code>true</code> if you want web applications that are
           placed in the <code>appBase</code> directory as web application
  @@ -227,10 +235,8 @@
   
       <p>If you are using the standard <strong>Host</strong> implementation,
       the following actions take place automatically when Catalina is first
  -    started.  All processing takes place in the <em>application base
  -    directory</em> that is configured by the <code>appBase</code> property.
  -    This behavior is enabled by setting the <code>autoDeploy</code> attribute
  -    to <code>true</code> (which is the default value):</p>
  +    started, if the <code>autoDeploy</code> property is set to
  +    <code>true</code> (which is the default value:</p>
       <ul>
       <li>Any XML file in this directory is assumed to contain a
           <a href="context.html">Context</a> element (and its associated
  @@ -259,10 +265,10 @@
       </ul>
   
       <p>In addition to the automatic deployment that occurs at startup time,
  -    you can also add new WAR files, directory, or XML configuration files
  -    into the <code>appBase</code> directory at any time, and the corresponding
  -    applications will be automatically deployed if the <code>autoDeploy</code>
  -    property is set to <code>true</code>.</p>
  +    you can also request that new XML configuration files, WAR files, or
  +    subdirectories (containing web applications) that are dropped in to the
  +    <code>appBase</code> directory while Tomcat is running will be
  +    automatically deployed, according to the rules described above.</p>
   
     </subsection>
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to