costin 01/02/01 20:26:22
Modified: src/share/org/apache/tomcat/modules/config ApacheConfig.java
Log:
Small change - generate the config when the server is fully
configured ( i.e. after auto loading webapps ).
Regenerate the apache config whenever a new context is added.
( it would be nice to send a restart signal to apache - but no time now )
Revision Changes Path
1.3 +34 -5
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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ApacheConfig.java 2001/01/28 21:30:35 1.2
+++ ApacheConfig.java 2001/02/02 04:26:21 1.3
@@ -93,20 +93,49 @@
return null;
}
- Log loghelper = new Log("tc_log", this);
+ /** 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 );
+ }
+ }
+
- public void engineStart(ContextManager cm) throws TomcatException {
+ Log loghelper = new Log("tc_log", this);
+
+ public void execute(ContextManager cm) throws TomcatException {
try {
String tomcatHome = cm.getHome();
String apacheHome = findApache();
int jkConnector = AJP12;
- //log("Tomcat home= " + tomcatHome);
-
FileWriter configW=new FileWriter(tomcatHome + APACHE_CONFIG);
PrintWriter pw=new PrintWriter(configW);
- PrintWriter mod_jk = new PrintWriter(new FileWriter(tomcatHome +
MOD_JK_CONFIG + "-auto"));
+
+
+ PrintWriter mod_jk = new PrintWriter(new FileWriter(tomcatHome +
MOD_JK_CONFIG + "-auto"));
+
+ log("Generating apache config = " + tomcatHome +
+ MOD_JK_CONFIG + "-auto" );
+
mod_jk.println("###################################################################");
mod_jk.println("# Auto generated configuration. Dated: " + new Date());
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]