tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lar...@apache.org
Subject cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/config ApacheConfig.java BaseJkConfig.java IISConfig.java NSConfig.java
Date Sat, 11 Aug 2001 03:37:28 GMT
larryi      01/08/10 20:37:28

  Modified:    src/share/org/apache/tomcat/modules/config ApacheConfig.java
                        BaseJkConfig.java IISConfig.java NSConfig.java
  Log:
  Hopefully finishes the refactoring.  IISConfig seems to be working for
  forwardAll and noRoot.  Needs more testing with respect to noRoot="false".
  Still need to get NSConfig handling forwardAll and noRoot.
  
  Revision  Changes    Path
  1.23      +7 -38     jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java
  
  Index: ApacheConfig.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- ApacheConfig.java	2001/08/10 20:55:38	1.22
  +++ ApacheConfig.java	2001/08/11 03:37:28	1.23
  @@ -1,4 +1,4 @@
  -/* $Id: ApacheConfig.java,v 1.22 2001/08/10 20:55:38 larryi Exp $
  +/* $Id: ApacheConfig.java,v 1.23 2001/08/11 03:37:28 larryi Exp $
    * ====================================================================
    *
    * The Apache Software License, Version 1.1
  @@ -146,7 +146,7 @@
       @author Costin Manolache
       @author Larry Isaacs
       @author Mel Martinez
  -	@version $Revision: 1.22 $ $Date: 2001/08/10 20:55:38 $
  +	@version $Revision: 1.23 $ $Date: 2001/08/11 03:37:28 $
    */
   public class ApacheConfig  extends BaseJkConfig { 
       
  @@ -186,33 +186,6 @@
       public ApacheConfig() {
       }
   
  -    // -------------------- Tomcat callbacks --------------------
  -    // ApacheConfig should be able to react to dynamic config changes,
  -    // and regenerate the config.
  -    
  -    /** Generate the apache configuration - only when the server is
  -     *  completely initialized ( before starting )
  -     */
  -    public void engineState( ContextManager cm, int state )
  -    	throws TomcatException
  -    {
  -	if( state != ContextManager.STATE_INIT )
  -	    return;
  -	execute( cm );
  -    }
  -
  -    public void contextInit(Context ctx)
  -	throws TomcatException
  -    {
  -	ContextManager cm=ctx.getContextManager();
  -    	if( cm.getState() >= ContextManager.STATE_INIT ) {
  -    	    // a context has been added after the server was started.
  -    	    // regenerate the config ( XXX send a restart signal to
  -    	    // the server )
  -    	    execute( cm );
  -    	}
  -    }
  -
       //-------------------- Properties --------------------
   
       /**
  @@ -282,14 +255,14 @@
       protected void initProperties(ContextManager cm) {
           super.initProperties(cm);
   	
  -	jkConfig=getConfigFile( jkConfig, configHome, MOD_JK_CONFIG);
  -	workersConfig=getConfigFile( workersConfig, configHome,
  +	jkConfig=FileUtil.getConfigFile( jkConfig, configHome, MOD_JK_CONFIG);
  +	workersConfig=FileUtil.getConfigFile( workersConfig, configHome,
   				     WORKERS_CONFIG);
   	if( modJk == null )
   	    modJk=new File(MOD_JK);
   	else
  -	    modJk=getConfigFile( modJk, configHome, MOD_JK );
  -	jkLog=getConfigFile( jkLog, configHome, JK_LOG_LOCATION);
  +	    modJk=FileUtil.getConfigFile( modJk, configHome, MOD_JK );
  +	jkLog=FileUtil.getConfigFile( jkLog, configHome, JK_LOG_LOCATION);
       }
   
       // -------------------- Generate config --------------------
  @@ -634,11 +607,7 @@
       private String getApacheDocBase(Context context)
       {
   	// Calculate the absolute path of the document base
  -	String docBase = context.getDocBase();
  -	if (!FileUtil.isAbsolute(docBase)){
  -	    docBase = tomcatHome + "/" + docBase;
  -	}
  -	docBase = FileUtil.patch(docBase);
  +	String docBase = getAbsoluteDocBase(context);
   	if (File.separatorChar == '\\') {
   	    // use separator preferred by Apache
   	    docBase = docBase.replace('\\','/');
  
  
  
  1.3       +46 -20    jakarta-tomcat/src/share/org/apache/tomcat/modules/config/BaseJkConfig.java
  
  Index: BaseJkConfig.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/BaseJkConfig.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BaseJkConfig.java	2001/08/10 20:55:38	1.2
  +++ BaseJkConfig.java	2001/08/11 03:37:28	1.3
  @@ -1,4 +1,4 @@
  -/* $Id: BaseJkConfig.java,v 1.2 2001/08/10 20:55:38 larryi Exp $
  +/* $Id: BaseJkConfig.java,v 1.3 2001/08/11 03:37:28 larryi Exp $
    * ====================================================================
    *
    * The Apache Software License, Version 1.1
  @@ -59,6 +59,7 @@
   package org.apache.tomcat.modules.config;
   
   import org.apache.tomcat.core.*;
  +import org.apache.tomcat.util.io.FileUtil;
   import java.io.*;
   
   import org.apache.tomcat.modules.server.Ajp13Interceptor;
  @@ -117,7 +118,7 @@
       <p>
       @author Costin Manolache
       @author Larry Isaacs
  -	@version $Revision: 1.2 $
  +	@version $Revision: 1.3 $
    */
   public class BaseJkConfig  extends BaseInterceptor { 
       protected File configHome = null;
  @@ -132,6 +133,41 @@
   
       protected String tomcatHome;
   
  +    // -------------------- Tomcat callbacks --------------------
  +    // Auto-config should be able to react to dynamic config changes,
  +    // and regenerate the config.
  +
  +    /** Generate the configuration - only when the server is
  +     *  completely initialized ( before starting )
  +     */
  +    public void engineState( ContextManager cm, int state )
  +         throws TomcatException
  +    {
  +        if( state != ContextManager.STATE_INIT )
  +            return;
  +        execute( cm );
  +    }
  +
  +    public void contextInit(Context ctx)
  +        throws TomcatException
  +    {
  +        ContextManager cm=ctx.getContextManager();
  +        if( cm.getState() >= ContextManager.STATE_INIT ) {
  +            // a context has been added after the server was started.
  +            // regenerate the config ( XXX send a restart signal to
  +            // the server )
  +            execute( cm );
  +        }
  +    }
  +
  +    /** Generate configuration files.  Override with method to generate
  +        web server specific configuration.
  +     */
  +    public void execute(ContextManager cm) throws TomcatException 
  +    {
  +    }
  +
  +
       //-------------------- Properties --------------------
   
       /** If false, we'll try to generate a config that will
  @@ -284,25 +320,15 @@
   
       // -------------------- General Utils --------------------
   
  -    protected File getConfigFile( File base, File configDir, String defaultF )
  +    protected String getAbsoluteDocBase(Context context)
       {
  -        if( base==null )
  -            base=new File( defaultF );
  -        if( ! base.isAbsolute() ) {
  -            if( configDir != null )
  -                base=new File( configDir, base.getPath());
  -            else
  -                base=new File( base.getAbsolutePath()); //??
  -        }
  -        File parent=new File(base.getParent());
  -        if(!parent.exists()){
  -            if(!parent.mkdirs()){
  -                throw new RuntimeException(
  -                    "Unable to create path to config file :"+
  -                    base.getAbsolutePath());
  -            }
  -        }
  -        return base;
  +	// Calculate the absolute path of the document base
  +	String docBase = context.getDocBase();
  +	if (!FileUtil.isAbsolute(docBase)){
  +	    docBase = tomcatHome + "/" + docBase;
  +	}
  +	docBase = FileUtil.patch(docBase);
  +        return docBase;
       }
   
   }
  
  
  
  1.7       +7 -21     jakarta-tomcat/src/share/org/apache/tomcat/modules/config/IISConfig.java
  
  Index: IISConfig.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/IISConfig.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- IISConfig.java	2001/08/10 20:55:38	1.6
  +++ IISConfig.java	2001/08/11 03:37:28	1.7
  @@ -128,7 +128,7 @@
       @author Costin Manolache
       @author Larry Isaacs
       @author Gal Shachor
  -	@version $Revision: 1.6 $
  +	@version $Revision: 1.7 $
    */
   public class IISConfig extends BaseJkConfig  { 
   
  @@ -144,11 +144,6 @@
       {
       }
   
  -    public void engineInit(ContextManager cm) throws TomcatException
  -    {
  -	execute( cm );
  -    }
  -
       //-------------------- Properties --------------------
       
       /**
  @@ -179,10 +174,10 @@
       protected void initProperties(ContextManager cm) {
           super.initProperties(cm);
   
  -	regConfig=getConfigFile( regConfig, configHome, ISAPI_REG_FILE);
  -	workersConfig=getConfigFile( workersConfig, configHome, WORKERS_CONFIG);
  -	uriConfig=getConfigFile( uriConfig, configHome, URI_WORKERS_MAP_CONFIG);
  -	jkLog=getConfigFile( jkLog, configHome, ISAPI_LOG_LOCATION);
  +	regConfig=FileUtil.getConfigFile( regConfig, configHome, ISAPI_REG_FILE);
  +	workersConfig=FileUtil.getConfigFile( workersConfig, configHome, WORKERS_CONFIG);
  +	uriConfig=FileUtil.getConfigFile( uriConfig, configHome, URI_WORKERS_MAP_CONFIG);
  +	jkLog=FileUtil.getConfigFile( jkLog, configHome, ISAPI_LOG_LOCATION);
       }
   
       // -------------------- Generate config --------------------
  @@ -203,6 +198,8 @@
   
               PrintWriter regfile = new PrintWriter(new FileWriter(regConfig));
               PrintWriter uri_worker = new PrintWriter(new FileWriter(uriConfig));      
 
  +    	    log("Generating IIS registry file = "+regConfig );
  +    	    log("Generating IIS URI worker map file = "+uriConfig );
   
               generateRegistrySettings(regfile);
   
  @@ -365,17 +362,6 @@
           }
           
           return sb.toString();
  -    }
  -
  -    private String getAbsoluteDocBase(Context context)
  -    {
  -	// Calculate the absolute path of the document base
  -	String docBase = context.getDocBase();
  -	if (!FileUtil.isAbsolute(docBase)){
  -	    docBase = tomcatHome + "/" + docBase;
  -	}
  -	docBase = FileUtil.patch(docBase);
  -        return docBase;
       }
   
   }
  
  
  
  1.5       +4 -9      jakarta-tomcat/src/share/org/apache/tomcat/modules/config/NSConfig.java
  
  Index: NSConfig.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/NSConfig.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- NSConfig.java	2001/08/10 03:57:07	1.4
  +++ NSConfig.java	2001/08/11 03:37:28	1.5
  @@ -124,7 +124,7 @@
       @author Costin Manolache
       @author Larry Isaacs
       @author Gal Shachor
  -	@version $Revision: 1.4 $
  +	@version $Revision: 1.5 $
    */
   public class NSConfig  extends BaseJkConfig { 
   
  @@ -140,11 +140,6 @@
       {
       }
   
  -    public void engineInit(ContextManager cm) throws TomcatException
  -    {
  -	execute( cm );
  -    }
  -    
       //-------------------- Properties --------------------
       
       /**
  @@ -167,9 +162,9 @@
       protected void initProperties(ContextManager cm) {
           super.initProperties(cm);
   
  -	objConfig=getConfigFile( objConfig, configHome, NS_CONFIG);
  -	workersConfig=getConfigFile( workersConfig, configHome, WORKERS_CONFIG);
  -	jkLog=getConfigFile( jkLog, configHome, NSAPI_LOG_LOCATION);
  +	objConfig=FileUtil.getConfigFile( objConfig, configHome, NS_CONFIG);
  +	workersConfig=FileUtil.getConfigFile( workersConfig, configHome, WORKERS_CONFIG);
  +	jkLog=FileUtil.getConfigFile( jkLog, configHome, NSAPI_LOG_LOCATION);
       }
   
       // -------------------- Generate config --------------------
  
  
  

Mime
View raw message