remm        2003/06/15 06:11:25

  Modified:    catalina/src/share/org/apache/catalina/startup
                        HostConfig.java
  Log:
  - Update the host properties, as discussed earlier:
    - liveDeploy -> autoDeploy: dynamic deployement of webapps put in the host
      appBase
    - autoDeploy -> deployOnStartup: Deploy webapps from appBase on startup
  - Neither of these have a good reason to be false by default (IMO).
  - Move context descriptors to
    $CATALINA_BASE/conf/<engine name>/<host name>, as proposed by Glenn.
  - This should make the feature secure, and I think there's no justification
    anymore for the deployXML flag.
  - Note: The manager webapp may need a few updates, which are in progress.
  
  Revision  Changes    Path
  1.14      +32 -39    
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java
  
  Index: HostConfig.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- HostConfig.java   15 Jun 2003 07:41:56 -0000      1.13
  +++ HostConfig.java   15 Jun 2003 13:11:25 -0000      1.14
  @@ -84,8 +84,10 @@
   import javax.naming.NamingException;
   import javax.naming.directory.DirContext;
   import org.apache.naming.resources.ResourceAttributes;
  +import org.apache.catalina.Container;
   import org.apache.catalina.Context;
   import org.apache.catalina.Deployer;
  +import org.apache.catalina.Engine;
   import org.apache.catalina.Host;
   import org.apache.catalina.Lifecycle;
   import org.apache.catalina.LifecycleEvent;
  @@ -160,13 +162,6 @@
   
   
       /**
  -     * Should we monitor the <code>appBase</code> directory for new
  -     * applications and automatically deploy them?
  -     */
  -    private boolean liveDeploy = false;
  -
  -
  -    /**
        * Should we unpack WAR files when auto-deploying applications in the
        * <code>appBase</code> directory?
        */
  @@ -297,28 +292,6 @@
   
   
       /**
  -     * 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() {
  @@ -400,7 +373,6 @@
                       this.debug = hostDebug;
                   }
                   setDeployXML(((StandardHost) host).isDeployXML());
  -                setLiveDeploy(((StandardHost) host).getLiveDeploy());
                   setUnpackWARs(((StandardHost) host).isUnpackWARs());
                   setXmlNamespaceAware(((StandardHost) host).getXmlNamespaceAware());
                   setXmlValidation(((StandardHost) host).getXmlValidation());
  @@ -438,6 +410,23 @@
   
   
       /**
  +     * Return a File object representing the "configuration root" directory
  +     * for our associated Host.
  +     */
  +    protected File configBase() {
  +
  +        File file = new File(System.getProperty("catalina.base"), "conf");
  +        Container parent = host.getParent();
  +        if ((parent != null) && (parent instanceof Engine)) {
  +            file = new File(file, parent.getName());
  +        }
  +        file = new File(file, host.getName());
  +        return (file);
  +
  +    }
  +
  +
  +    /**
        * Deploy applications for any directories or WAR files that are found
        * in our "application root" directory.
        */
  @@ -449,9 +438,13 @@
           File appBase = appBase();
           if (!appBase.exists() || !appBase.isDirectory())
               return;
  -        String files[] = appBase.list();
  +        File configBase = configBase();
  +        if (configBase.exists() && configBase.isDirectory()) {
  +            String configFiles[] = configBase.list();
  +            deployDescriptors(configBase, configFiles);
  +        }
   
  -        deployDescriptors(appBase, files);
  +        String files[] = appBase.list();
           deployWARs(appBase, files);
           deployDirectories(appBase, files);
   
  @@ -461,7 +454,7 @@
       /**
        * Deploy XML context descriptors.
        */
  -    protected void deployDescriptors(File appBase, String[] files) {
  +    protected void deployDescriptors(File configBase, String[] files) {
   
           if (!deployXML)
              return;
  @@ -474,7 +467,7 @@
                   continue;
               if (deployed.contains(files[i]))
                   continue;
  -            File dir = new File(appBase, files[i]);
  +            File dir = new File(configBase, files[i]);
               if (files[i].toLowerCase().endsWith(".xml")) {
   
                   deployed.add(files[i]);
  @@ -858,7 +851,7 @@
           if (log.isDebugEnabled())
               log.debug(sm.getString("hostConfig.start"));
   
  -        if (host.getAutoDeploy()) {
  +        if (host.getDeployOnStartup()) {
               deployApps();
           }
   
  
  
  

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

Reply via email to