You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by co...@locus.apache.org on 2000/03/01 01:31:20 UTC

cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/startup Tomcat.java

costin      00/02/29 16:31:20

  Modified:    src/share/org/apache/tomcat/core ContextManager.java
               src/share/org/apache/tomcat/request SessionInterceptor.java
               src/share/org/apache/tomcat/session StandardSession.java
               src/share/org/apache/tomcat/startup Tomcat.java
  Log:
  - tested "valueUnbound" - seems to work.
  - tomcat stop will print "stop" instead of "start"
  - tomcat stop will not open any log files ( it used to override tomcat).
  
  Revision  Changes    Path
  1.56      +1 -0      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.55
  retrieving revision 1.56
  diff -u -r1.55 -r1.56
  --- ContextManager.java	2000/02/26 19:41:43	1.55
  +++ ContextManager.java	2000/03/01 00:31:19	1.56
  @@ -411,6 +411,7 @@
       public void addLogger(Logger logger) {
   	// Will use this later once I feel more sure what I want to do here.
   	// -akv
  +	firstLog=false;
   	cmLog=logger;
       }
   
  
  
  
  1.12      +1 -0      jakarta-tomcat/src/share/org/apache/tomcat/request/SessionInterceptor.java
  
  Index: SessionInterceptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/request/SessionInterceptor.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- SessionInterceptor.java	2000/02/17 12:13:18	1.11
  +++ SessionInterceptor.java	2000/03/01 00:31:19	1.12
  @@ -167,6 +167,7 @@
       public void contextShutdown( Context ctx )
   	throws TomcatException
       {
  +	if( ctx.getDebug() > 0 ) ctx.log("Removing sessions from " + ctx );
   	ctx.getSessionManager().removeSessions(ctx);
       }
   
  
  
  
  1.5       +7 -5      jakarta-tomcat/src/share/org/apache/tomcat/session/StandardSession.java
  
  Index: StandardSession.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/session/StandardSession.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- StandardSession.java	2000/02/14 04:59:41	1.4
  +++ StandardSession.java	2000/03/01 00:31:19	1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/session/StandardSession.java,v 1.4 2000/02/14 04:59:41 costin Exp $
  - * $Revision: 1.4 $
  - * $Date: 2000/02/14 04:59:41 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/session/StandardSession.java,v 1.5 2000/03/01 00:31:19 costin Exp $
  + * $Revision: 1.5 $
  + * $Date: 2000/03/01 00:31:19 $
    *
    * ====================================================================
    *
  @@ -93,7 +93,7 @@
    * HttpSession view of this instance back to a Session view.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.4 $ $Date: 2000/02/14 04:59:41 $
  + * @version $Revision: 1.5 $ $Date: 2000/03/01 00:31:19 $
    */
   
   final class StandardSession
  @@ -653,9 +653,11 @@
   	    if (object == null)
   		return;
   	    attributes.remove(name);
  -	    if (object instanceof HttpSessionBindingListener)
  +	    //	    System.out.println( "Removing attribute " + name );
  +	    if (object instanceof HttpSessionBindingListener) {
   		((HttpSessionBindingListener) object).valueUnbound
   		    (new HttpSessionBindingEvent((HttpSession) this, name));
  +	    }
   	}
   
       }
  
  
  
  1.15      +33 -12    jakarta-tomcat/src/share/org/apache/tomcat/startup/Tomcat.java
  
  Index: Tomcat.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/startup/Tomcat.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- Tomcat.java	2000/02/26 19:41:44	1.14
  +++ Tomcat.java	2000/03/01 00:31:20	1.15
  @@ -65,18 +65,21 @@
   	xh.addRule( "ContextManager/Connector", xh.setParent( "setContextManager") );
   	xh.addRule( "ContextManager/Connector", xh.addChild( "addServerConnector", "org.apache.tomcat.core.ServerConnector") );
   
  -	
  +	xh.addRule( "ContextManager/Connector/Parameter", xh.methodSetter("setProperty",2) );
  +	xh.addRule( "ContextManager/Connector/Parameter", xh.methodParam(0, "name") );
  +	xh.addRule( "ContextManager/Connector/Parameter", xh.methodParam(1, "value") );
  +    }
  +
  +    	
  +    void setLogHelper( XmlMapper xh ) {
   	xh.addRule("Server/Logger",
   		   xh.objectCreate("org.apache.tomcat.logging.TomcatLogger"));
   	xh.addRule("Server/Logger", xh.setProperties());
   	xh.addRule("Server/Logger", 
   		   xh.addChild("addLogger", "org.apache.tomcat.logging.Logger") );
  -
  -	xh.addRule( "ContextManager/Connector/Parameter", xh.methodSetter("setProperty",2) );
  -	xh.addRule( "ContextManager/Connector/Parameter", xh.methodParam(0, "name") );
  -	xh.addRule( "ContextManager/Connector/Parameter", xh.methodParam(1, "value") );
       }
       
  +
       public void execute(String args[] ) throws Exception {
   	if( ! processArgs( args ) ) {
   	    System.out.println("Wrong arguments");
  @@ -84,10 +87,17 @@
   	    return;
   	}
   
  +	if( doStop ) {
  +	    System.out.println("Stop tomcat");
  +	    stopTomcat(); // stop serving
  +	    return;
  +	}
  +
   	XmlMapper xh=new XmlMapper();
   	xh.setDebug( 0 );
   	ContextManager cm=new ContextManager();
   	setHelper( xh );
  +	setLogHelper( xh );
   
   	File f=new File(cm.getHome(), configFile);
   
  @@ -104,18 +114,13 @@
   	org.apache.tomcat.task.ApacheConfig apacheConfig=new  org.apache.tomcat.task.ApacheConfig();
   	apacheConfig.execute( cm );     
   
  -	if( doStop ) {
  -	    stopTomcat(cm); // stop serving
  -	    return;
  -	}
  -
  +	System.out.println("Starting tomcat. Check logs/tomcat.log for error messages ");
   	cm.init(); // set up contexts
   	cm.start(); // start serving
       }
       
       public static void main(String args[] ) {
   	try {
  -	    System.out.println("Starting tomcat. Check logs/tomcat.log for error messages ");
   	    Tomcat tomcat=new Tomcat();
   	    tomcat.execute( args );
   	} catch(Exception ex ) {
  @@ -133,7 +138,23 @@
        *  that will change when we add real callbacks ( it's equivalent
        *  with the previous RMI method from almost all points of view )
        */
  -    void stopTomcat( ContextManager cm ) {
  +    void stopTomcat() {
  +	XmlMapper xh=new XmlMapper();
  +	xh.setDebug( 0 );
  +	ContextManager cm=new ContextManager();
  +	setHelper( xh );
  +	// no log helper - we don't want stop to override the logs
  +
  +	File f=new File(cm.getHome(), configFile);
  +
  +	try {
  +	    xh.readXml(f,cm);
  +	} catch( Exception ex ) {
  +	    System.out.println("FATAL: configuration error" );
  +	    ex.printStackTrace();
  +	    System.exit(1);
  +	}
  +
   	// Find Ajp12 connector
   	int portInt=8007;
   	Enumeration enum=cm.getConnectors();