You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by cr...@locus.apache.org on 2000/11/04 21:28:49 UTC

cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/core ContextManager.java

craigmcc    00/11/04 12:28:48

  Modified:    src/share/org/apache/tomcat/core Tag: tomcat_32
                        ContextManager.java
  Log:
  When configuring a <ContextManager>, allow the "work" and "home" attributes
  to be specified (or defaulted) in any order.
  
  Reported by: Mark Lewis <ma...@wingateweb.com>, TOMCAT-DEV, 01 Nov 2000
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.100.2.13 +26 -14    jakarta-tomcat/src/share/org/apache/tomcat/core/ContextManager.java
  
  Index: ContextManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ContextManager.java,v
  retrieving revision 1.100.2.12
  retrieving revision 1.100.2.13
  diff -u -r1.100.2.12 -r1.100.2.13
  --- ContextManager.java	2000/10/23 16:55:48	1.100.2.12
  +++ ContextManager.java	2000/11/04 20:28:47	1.100.2.13
  @@ -153,8 +153,13 @@
   
       /** Private workspace for this server
        */
  -    String workDir;
  +    String workDir = null;      // Initialized the first time we get it
   
  +    /** Configured workspace directory name (not absolutized yet)
  +     */
  +    String workDirProperty = null;
  +
  +
       /** The base directory where this instance runs.
        *  It can be different from the install directory to
        *  allow one install per system and multiple users
  @@ -196,7 +201,7 @@
        */
       public void setHome(String home) {
   	this.home=FileUtil.getCanonicalPath( home );
  -	logInt( "Setting home to " + this.home );
  +	if (debug>0) logInt( "Setting home to " + this.home );
       }
   
       /**
  @@ -286,24 +291,31 @@
        * WorkDir property - where all working files will be created
        */
       public void setWorkDir( String wd ) {
  -	if(debug>0) logInt("set work dir " + wd);
  -	// make it absolute
  -	File f=new File( wd );
  -	if( ! f.isAbsolute() ) {
  -	    File wdF=getAbsolute( f );
  -	    wd= wdF.getAbsolutePath();
  -	}
  -
  -	this.workDir=wd;
  +	if (debug>0) logInt("set work dir " + wd);
  +        this.workDirProperty = wd;      // Store only the string for now
       }
   
       /**
        * WorkDir property - where all working files will be created
        */
       public String getWorkDir() {
  -	if( workDir==null)
  -	    workDir=getHome() + File.separator + DEFAULT_WORK_DIR;
  -	return workDir;
  +
  +        // The first time this is called, calculate the right value
  +        if (this.workDir == null) {
  +            File f = null;
  +            if (this.workDirProperty == null)
  +                f = new File(DEFAULT_WORK_DIR);
  +            else
  +                f = new File(this.workDirProperty);
  +            if (!f.isAbsolute())
  +                f = getAbsolute(f);
  +            this.workDir = f.getAbsolutePath();
  +            if (debug>0) logInt("calc work dir " + this.workDir);
  +        }
  +
  +        // Return the calculated work directory value
  +        return (this.workDir);
  +
       }
   
       /**