tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cos...@apache.org
Subject cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup Bootstrap.java
Date Tue, 22 Oct 2002 20:25:29 GMT
costin      2002/10/22 13:25:29

  Modified:    catalina/src/share/org/apache/catalina/startup
                        Bootstrap.java
  Log:
  A bit of refactoring I had on my machine.
  
  I'm still confused on which file is actually used, and not sure
  if this is actually needed.
  
  Revision  Changes    Path
  1.4       +51 -36    jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/Bootstrap.java
  
  Index: Bootstrap.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/Bootstrap.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Bootstrap.java	18 Oct 2002 21:30:43 -0000	1.3
  +++ Bootstrap.java	22 Oct 2002 20:25:29 -0000	1.4
  @@ -90,42 +90,29 @@
   
   public final class Bootstrap {
   
  -
  -    // ------------------------------------------------------- Static Variables
  -
  -
       /**
        * Debugging detail level for processing the startup.
        */
  -    private static int debug = 0;
  +    protected int debug = 0;
  +    protected String args[];
   
  +    // Construct the class loaders we will need
  +    protected ClassLoader commonLoader = null;
  +    protected ClassLoader catalinaLoader = null;
  +    protected ClassLoader sharedLoader = null;
  +
  +    
  +    public void setDebug( int debug ) {
  +        this.debug=debug;
  +    }
   
  +    public void setArgs(String args[] ) {
  +        this.args=args;
  +    }
       // ----------------------------------------------------------- Main Program
   
  -
  -    /**
  -     * The main program for the bootstrap.
  -     *
  -     * @param args Command line arguments to be processed
  -     */
  -    public static void main(String args[]) {
  -
  -        // Set the debug flag appropriately
  -        for (int i = 0; i < args.length; i++)  {
  -            if ("-debug".equals(args[i]))
  -                debug = 1;
  -        }
  -        
  -        // Configure catalina.base from catalina.home if not yet set
  -        if (System.getProperty("catalina.base") == null)
  -            System.setProperty("catalina.base", getCatalinaHome());
  -
  -        // Construct the class loaders we will need
  -        ClassLoader commonLoader = null;
  -        ClassLoader catalinaLoader = null;
  -        ClassLoader sharedLoader = null;
  +    public void initClassLoaders() {
           try {
  -
               File unpacked[] = new File[1];
               File packed[] = new File[1];
               File packed2[] = new File[2];
  @@ -161,6 +148,23 @@
               System.exit(1);
   
           }
  +    }
  +
  +    // ----------------------------------------------------------- Main Program
  +
  +    public void execute() {
  +        // Set the debug flag appropriately
  +        for (int i = 0; i < args.length; i++)  {
  +            if ("-debug".equals(args[i]))
  +                setDebug( 1 );
  +        }
  +        
  +        // Configure catalina.base from catalina.home if not yet set
  +        if (System.getProperty("catalina.base") == null)
  +            System.setProperty("catalina.base", getCatalinaHome());
  +
  +        this.initClassLoaders();
  +
           Thread.currentThread().setContextClassLoader(catalinaLoader);
   
    
  @@ -205,14 +209,25 @@
               e.printStackTrace(System.out);
               System.exit(2);
           }
  +    }
  +
  +    /**
  +     * The main program for the bootstrap.
  +     *
  +     * @param args Command line arguments to be processed
  +     */
  +    public static void main(String args[]) {
  +        Bootstrap bootstrap=new Bootstrap();
   
  +        bootstrap.setArgs( args );
  +        bootstrap.execute();
       }
   
   
       /**
        * Get the value of the catalina.home environment variable.
        */
  -    private static String getCatalinaHome() {
  +    protected String getCatalinaHome() {
           return System.getProperty("catalina.home",
                                     System.getProperty("user.dir"));
       }
  @@ -221,7 +236,7 @@
       /**
        * Get the value of the catalina.base environment variable.
        */
  -    private static String getCatalinaBase() {
  +    protected String getCatalinaBase() {
           return System.getProperty("catalina.base", getCatalinaHome());
       }
   
  @@ -231,7 +246,7 @@
        *
        * @param message The message to be logged
        */
  -    private static void log(String message) {
  +    protected void log(String message) {
   
           System.out.print("Bootstrap: ");
           System.out.println(message);
  @@ -245,7 +260,7 @@
        * @param message The message to be logged
        * @param exception The exception to be logged
        */
  -    private static void log(String message, Throwable exception) {
  +    protected void log(String message, Throwable exception) {
   
           log(message);
           exception.printStackTrace(System.out);
  
  
  

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message