tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Albretch Mueller" <cml...@acedsl.com>
Subject rfe
Date Sat, 28 May 2005 03:45:18 GMT
 I was wondering if any one other than me has had the need to use a run-time
'before-bootstrapping' and 'cleaning-after-at-the-very-end' type of
functionality.

 I have been using it all along in my webapps and I think it is really
useful to the point that, it should be included in the Tomcat as a
'standard' hack or extra functionality.

 I have used it primarily to:
 1._ read in at run time security sensitive settings that I am not
comfortable with declaring in server.xml, web.xml or in any other config
file in the file system (yes, I am a healthy paranoid (I have plenty of
reasons to be like that))
 2._ to create RAM based tables for session handling using hsqldb (you
should still save your sessions in the back end and reload them to the front
end ram based tables)

 This is what I have been doing the monkey way:

 1._ "gone to the source" org.apache.catalina.startup.BootStrap.main and
  1.1_ inserted my code right after the method signature to make sure
absolute nothing has been previously staged by the VM
  1.2_ with the necessary import declarations if needed
  1.3_ recompile and jarred everything as 'bootstrap02.jar'

 2._ removed 'bootstrap.jar' and placed 'bootstrap02.jar' in
$CATALINA_HOME/bin/

 3._ commented out the 'CLASSPATH' setting in catalina.[bat|sh]
rem set CLASSPATH=%CLASSPATH%;%CATALINA_HOME%\bin\bootstrap.jar
#
CLASSPATH="$CLASSPATH":"$CATALINA_HOME"/bin/bootstrap.jar:"$CATALINA_HOME"/b
in/commons-logging-api.jar

 changing 'bootstrap.jar' for 'bootstrap02.jar'

 4._ the line in which the JVM process is started

    exec "$_RUNJAVA" $JAVA_OPTS $CATALINA_OPTS \
      -classpath "$CLASSPATH" \
      -Dcatalina.base="$CATALINA_BASE" \
      -Dcatalina.home="$CATALINA_HOME" \
      -Djava.io.tmpdir="$CATALINA_TMPDIR" \
      org.apache.catalina.startup.Bootstrap "$@" start

 or something similar depending on how you startup TC should be echoed (this
should be standard too)

 Interface EntryExit{
  public boolean doFirst();
  public boolean doLast();
 }

 then a class -which name should be convened upon-, say '_firstandlast',
should implement the EntryExit interface and used at tomcat bootstrapping
process as a command object and then discarded.

 If possible, no trace should be left of this object in memory and only its
actions/secondary effects should be staged for this run time only. This is
not an object to keep around

 Then people could code around inside of the doFirst() method of this
command object, which will be invoked at startup and doLast() which will be
invoked when TC shuts down

 If TC does not find this object at startup/shutdown it simply bypasses the
step in either ...Bootstrap.class or at the very end of the code segment of
org.apache.catalina.startup.Catalina$CatalinaShutdownHook(?) when
_firstandlast.doLast() should be called.

 I guess I could just do it myself in TC source code, but it is better if we
just spec out the feature and tell our hearts for people keeping a mental
map of this code base to give it some thoughts and streamline this feature,
some issues would be security relating to differing contexts and class
loaders ones.

 lbrtchx



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


Mime
View raw message