cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject cvs commit: cocoon-2.1 cocoon.bat cocoon.sh
Date Wed, 19 Mar 2003 15:50:44 GMT
stefano     2003/03/19 07:50:44

  Modified:    .        cocoon.bat cocoon.sh
  Log:
  improved startup scripts:
  - reduced cut/paste
  - added servlet-profile action that turns on the internal JVM profiler (hprof)
  - allowed the script to be used independently on another location (useful to develop your
stuff without overlapping the usual build/webapp folder)
  
  Revision  Changes    Path
  1.3       +28 -14    cocoon-2.1/cocoon.bat
  
  Index: cocoon.bat
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/cocoon.bat,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- cocoon.bat	15 Mar 2003 12:53:01 -0000	1.2
  +++ cocoon.bat	19 Mar 2003 15:50:44 -0000	1.3
  @@ -7,6 +7,9 @@
   
   :: Configuration variables
   ::
  +:: COCOON_HOME
  +::   Folder that points to the root of the Cocoon distribution
  +::
   :: COCOON_LIB
   ::   Folder containing all the library files needed by the Cocoon CLI
   ::
  @@ -36,10 +39,6 @@
   goto end
   :gotJavaHome
   
  -:: ----- Set Up The Classpath --------------------------------------------------
  -
  -set CP=.\tools\loader
  -
   :: ----- Check System Properties -----------------------------------------------
   
   if not "%EXEC%" == "" goto gotExec
  @@ -50,8 +49,12 @@
   set EXEC=""
   :gotExec
   
  +if not "%COCOON_HOME%" == "" goto gotHome
  +set COCOON_HOME=.
  +:gotHome
  +
   if not "%COCOON_LIB%" == "" goto gotLib
  -set COCOON_LIB=build\webapp\WEB-INF\lib
  +set COCOON_LIB=%COCOON_HOME%\build\webapp\WEB-INF\lib
   :gotLib
   
   if not "%JETTY_PORT%" == "" goto gotJettyPort
  @@ -63,26 +66,32 @@
   :gotJettyAdminPort
   
   if not "%JETTY_WEBAPP%" == "" goto gotWebapp
  -set JETTY_WEBAPP=build/webapp
  +set JETTY_WEBAPP=%COCOON_HOME%\build\webapp
   :gotWebapp
   
   if not "%JAVA_DEBUG_PORT%" == "" goto gotDebugPort
   set JAVA_DEBUG_PORT=8000
   :gotDebugPort
   
  +:: ----- Set Up The Classpath --------------------------------------------------
  +
  +set CP=%COCOON_HOME%\tools\loader
  +
   :: ----- Check action ----------------------------------------------------------
   
   if ""%1"" == ""cli"" goto doCli
   if ""%1"" == ""servlet"" goto doServlet
  -if ""%1"" == ""servlet-admin"" goto doServletAdmin
  +if ""%1"" == ""servlet-admin"" goto doAdmin
   if ""%1"" == ""servlet-debug"" goto doDebug
  +IF ""%1"" == ""servlet-profile"" goto doProfile
   
   echo Usage: cocoon (action)
   echo actions:
   echo   cli             Run Cocoon from command line
   echo   servlet         Run Cocoon in a servlet container
   echo   servlet-admin   Run Cocoon in a servlet container and turn container web administration
on
  -echo   servlet-debug   Run Cocoon in a servlet container and turn remote debug on
  +echo   servlet-debug   Run Cocoon in a servlet container and turn on remote JVM debug
  +echo   servlet-profile Run Cocoon in a servlet container and turn on JVM profiling
   goto end
   
   :: ----- Cli -------------------------------------------------------------------
  @@ -99,19 +108,24 @@
   :: ----- Servlet ---------------------------------------------------------------
   
   :doServlet
  -%EXEC% %JAVA_HOME%\bin\java.exe %JAVA_OPT% -classpath %CP% -Djava.endorsed.dirs=lib\endorsed
-Dwebapp=%JETTY_WEBAPP% -Dorg.xml.sax.parser=org.apache.xerces.parsers.SAXParser -Djetty.port=%JETTY_PORT%
-Djetty.admin.port=%JETTY_ADMIN_PORT% -Dloader.jar.repositories=tools\jetty\lib,lib\endorsed
-Dloader.main.class=org.mortbay.jetty.Server Loader tools\jetty\conf\main.xml
  +%EXEC% %JAVA_HOME%\bin\java.exe %JAVA_OPT% -classpath %CP% -Djava.endorsed.dirs=%COCOON_HOME%\lib\endorsed
-Dwebapp=%JETTY_WEBAPP% -Dorg.xml.sax.parser=org.apache.xerces.parsers.SAXParser -Djetty.port=%JETTY_PORT%
-Djetty.admin.port=%JETTY_ADMIN_PORT% -Dloader.jar.repositories=%COCOON_HOME%\tools\jetty\lib,%COCOON_HOME%\lib\endorsed
-Dloader.main.class=org.mortbay.jetty.Server Loader %COCOON_HOME%\tools\jetty\conf\main.xml
   goto end
   
  -:: ----- Servlet with Admin ----------------------------------------------------
  +:: ----- Servlet with Administration Web Interface -----------------------------
   
  -:doServletAdmin
  -%EXEC% %JAVA_HOME%\bin\java.exe %JAVA_OPT% -classpath %CP% -Djava.endorsed.dirs=lib\endorsed
-Dwebapp=%JETTY_WEBAPP% -Dorg.xml.sax.parser=org.apache.xerces.parsers.SAXParser -Djetty.port=%JETTY_PORT%
-Djetty.admin.port=%JETTY_ADMIN_PORT% -Dloader.jar.repositories=tools\jetty\lib,lib\endorsed
-Dloader.main.class=org.mortbay.jetty.Server Loader tools\jetty\conf\main.xml tools\jetty\conf\admin.xml
  +:doAdmin
  +%EXEC% %JAVA_HOME%\bin\java.exe %JAVA_OPT% -classpath %CP% -Djava.endorsed.dirs=%COCOON_HOME%\lib\endorsed
-Dwebapp=%JETTY_WEBAPP% -Dorg.xml.sax.parser=org.apache.xerces.parsers.SAXParser -Djetty.port=%JETTY_PORT%
-Djetty.admin.port=%JETTY_ADMIN_PORT% -Dloader.jar.repositories=%COCOON_HOME%\tools\jetty\lib,%COCOON_HOME%\lib\endorsed
-Dloader.main.class=org.mortbay.jetty.Server Loader %COCOON_HOME%\tools\jetty\conf\main.xml
%COCOON_HOME%\tools\jetty\conf\admin.xml
   goto end
   
   :: ----- Servlet Debug ---------------------------------------------------------
   
   :doDebug
  -%EXEC% %JAVA_HOME%\bin\java.exe %JAVA_OPT% -Xdebug -Xrunjdwp:transport=dt_socket,address=%JAVA_DEBUG_PORT%,server=y,suspend=n
 -classpath %CP% -Djava.endorsed.dirs=lib\endorsed -Dwebapp=%JETTY_WEBAPP% -Dorg.xml.sax.parser=org.apache.xerces.parsers.SAXParser
-Djetty.port=%JETTY_PORT% -Djetty.admin.port=%JETTY_ADMIN_PORT% -Dloader.jar.repositories=tools\jetty\lib,lib\endorsed
-Dloader.main.class=org.mortbay.jetty.Server Loader tools\jetty\conf\main.xml
  +%EXEC% %JAVA_HOME%\bin\java.exe %JAVA_OPT% -Xdebug -Xrunjdwp:transport=dt_socket,address=%JAVA_DEBUG_PORT%,server=y,suspend=n
 -classpath %CP% -Djava.endorsed.dirs=%COCOON_HOME%\lib\endorsed -Dwebapp=%JETTY_WEBAPP% -Dorg.xml.sax.parser=org.apache.xerces.parsers.SAXParser
-Djetty.port=%JETTY_PORT% -Djetty.admin.port=%JETTY_ADMIN_PORT% -Dloader.jar.repositories=%COCOON_HOME%\tools\jetty\lib,%COCOON_HOME%\lib\endorsed
-Dloader.main.class=org.mortbay.jetty.Server Loader %COCOON_HOME%\tools\jetty\conf\main.xml
  +
  +:: ----- Servlet Profile ---------------------------------------------------------
  +
  +:doProfile
  +%EXEC% %JAVA_HOME%\bin\java.exe %JAVA_OPT% -Xrunhprof:heap=all,cpu=samples,thread=y,depth=3
-classpath %CP% -Djava.endorsed.dirs=%COCOON_HOME%\lib\endorsed -Dwebapp=%JETTY_WEBAPP% -Dorg.xml.sax.parser=org.apache.xerces.parsers.SAXParser
-Djetty.port=%JETTY_PORT% -Djetty.admin.port=%JETTY_ADMIN_PORT% -Dloader.jar.repositories=%COCOON_HOME%\tools\jetty\lib,%COCOON_HOME%\lib\endorsed
-Dloader.main.class=org.mortbay.jetty.Server Loader %COCOON_HOME%\tools\jetty\conf\main.xml
   
   :: ----- End -------------------------------------------------------------------
   
  
  
  
  1.2       +64 -23    cocoon-2.1/cocoon.sh
  
  Index: cocoon.sh
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/cocoon.sh,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- cocoon.sh	9 Mar 2003 00:01:33 -0000	1.1
  +++ cocoon.sh	19 Mar 2003 15:50:44 -0000	1.2
  @@ -7,6 +7,12 @@
   
   # Configuration variables
   #
  +# COCOON_HOME
  +#   The root of the Cocoon distribution
  +#
  +# COCOON_WEBAPP_HOME
  +#   The root of the Cocoon web application
  +#
   # COCOON_LIB
   #   Folder containing all the library files needed by the Cocoon CLI
   #
  @@ -16,8 +22,11 @@
   # JAVA_OPTIONS
   #   Extra options to pass to the JVM
   #
  -# JAVA_DEBUG_PORT
  -#   The location where the JVM debug server should listen to
  +# JAVA_DEBUG_ARGS
  +#   The command line arguments for the internal JVM debugger
  +#
  +# JAVA_PROFILE_ARGS
  +#   The command line arguments for the internal JVM profiler
   #
   # JETTY_PORT
   #   Override the default port for Jetty
  @@ -25,18 +34,17 @@
   # JETTY_ADMIN_PORT
   #   The port where the jetty web administration should bind
   #
  -# JETTY_WEBAPP
  -#   The directory where the webapp that jetty has to execute is located
  -#
  +
   
   usage()
   {
       echo "Usage: $0 (action)"
       echo "actions:"
  -    echo "  cli             Run Cocoon from command line"
  -    echo "  servlet         Run Cocoon in a servlet container"
  -    echo "  servlet-admin   Run Cocoon in a servlet container and turn container web administration
on"
  -    echo "  servlet-debug   Run Cocoon in a servlet container and turn remote debug on"
  +    echo "  cli               Run Cocoon from the command line"
  +    echo "  servlet           Run Cocoon in a servlet container"
  +    echo "  servlet-admin     Run Cocoon in a servlet container and turn on container web
administration"
  +    echo "  servlet-debug     Run Cocoon in a servlet container and turn on JVM remote
debug"
  +    echo "  servlet-profile   Run Cocoon in a servlet container and turn on JVM profiling"
       exit 1
   }
   
  @@ -53,47 +61,80 @@
     exit 1
   fi
   
  +if [ "$JAVA_OPTIONS" = "" ] ; then
  +  JAVA_OPTIONS='-Xms32M -Xmx512M'
  +fi
  +
  +if [ "$COCOON_HOME" = "" ] ; then
  +  COCOON_HOME='.'
  +fi
  +
  +if [ "$COCOON_WEBAPP_HOME" = "" ] ; then
  +  COCOON_WEBAPP_HOME=$COCOON_HOME/build/webapp
  +fi
  +
   if [ "$COCOON_LIB" = "" ] ; then
  -  COCOON_LIB=build/webapp/WEB-INF/lib
  +  COCOON_LIB=$COCOON_WEBAPP_HOME/WEB-INF/lib
   fi
   
   if [ "$JETTY_PORT" = "" ] ; then
  -  JETTY_PORT=8888
  +  JETTY_PORT='8888'
   fi
   
   if [ "$JETTY_ADMIN_PORT" = "" ] ; then
  -  JETTY_ADMIN_PORT=8889
  +  JETTY_ADMIN_PORT='8889'
   fi
   
  -if [ "$JETTY_WEBAPP" = "" ] ; then
  -  JETTY_WEBAPP=build/webapp
  +if [ "$JAVA_DEBUG_ARGS" = "" ] ; then
  +  JAVA_DEBUG_ARGS='-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n'
   fi
   
  -if [ "$JAVA_DEBUG_PORT" = "" ] ; then
  -  JAVA_DEBUG_PORT=8000
  +if [ "$JAVA_PROFILE_ARGS" = "" ] ; then
  +  JAVA_PROFILE_ARGS='-Xrunhprof:heap=all,cpu=samples,thread=y,depth=3'
   fi
   
  -# ----- Set Classpath ----------------------------------------------------------
  +# ----- Set Local Variables ( used to minimize cut/paste) ---------------------
  +
  +JAVA=$JAVA_HOME/bin/java
  +ENDORSED_LIBS=$COCOON_HOME/lib/endorsed
  +ENDORSED=-Djava.endorsed.dirs=$ENDORSED_LIBS
  +PARSER=-Dorg.xml.sax.parser=org.apache.xerces.parsers.SAXParser
  +LOADER=Loader
  +LOADER_LIB=$COCOON_HOME/tools/loader
   
  -CP=./tools/loader
  +CLI=-Dloader.main.class=org.apache.cocoon.Main
  +CLI_LIBRARIES=-Dloader.jar.repositories=$COCOON_LIB
  +
  +JETTY=-Dloader.main.class=org.mortbay.jetty.Server
  +JETTY_CONF=$COCOON_HOME/tools/jetty/conf
  +JETTY_MAIN=$JETTY_CONF/main.xml
  +JETTY_ADMIN=$JETTY_CONF/admin.xml
  +JETTY_WEBAPP=-Dwebapp=$COCOON_WEBAPP_HOME
  +JETTY_PORT_ARGS=-Djetty.port=$JETTY_PORT
  +JETTY_ADMIN_ARGS=-Djetty.admin.port=$JETTY_ADMIN_PORT
  +JETTY_LIBRARIES=-Dloader.jar.repositories=$COCOON_HOME/tools/jetty/lib,$ENDORSED_LIBS
   
   # ----- Do the action ----------------------------------------------------------
   
   case "$ACTION" in
     cli)
  -        $JAVA_HOME/bin/java $JAVA_OPT -classpath %CP% -Djava.endorsed.dirs=lib/endorsed
-Dloader.jar.repositories=%COCOON_LIB% -Dloader.main.class=org.apache.cocoon.Main Loader $ARGS
  +        $JAVA $JAVA_OPTIONS -cp $LOADER_LIB $ENDORSED $CLI_LIBRARIES $CLI $LOADER $ARGS
           ;;
   
     servlet)
  -        $JAVA_HOME/bin/java $JAVA_OPT -classpath $CP -Djava.endorsed.dirs=lib/endorsed
-Dwebapp=$JETTY_WEBAPP -Dorg.xml.sax.parser=org.apache.xerces.parsers.SAXParser -Djetty.port=$JETTY_PORT
-Djetty.admin.port=$JETTY_ADMIN_PORT -Dloader.jar.repositories=tools/jetty/lib,lib/endorsed
-Dloader.main.class=org.mortbay.jetty.Server Loader tools/jetty/conf/main.xml
  +        $JAVA $JAVA_OPTIONS -cp $LOADER_LIB $ENDORSED $PARSER $JETTY_PORT_ARGS $JETTY_LIBRARIES
$JETTY_WEBAPP $JETTY $LOADER $JETTY_MAIN
           ;;
   
     servlet-admin)
  -        $JAVA_HOME/bin/java $JAVA_OPT -classpath $CP -Djava.endorsed.dirs=lib/endorsed
-Dwebapp=$JETTY_WEBAPP -Dorg.xml.sax.parser=org.apache.xerces.parsers.SAXParser -Djetty.port=$JETTY_PORT
-Djetty.admin.port=$JETTY_ADMIN_PORT -Dloader.jar.repositories=tools/jetty/lib,lib/endorsed
-Dloader.main.class=org.mortbay.jetty.Server Loader tools/jetty/conf/main.xml tools/jetty/conf/admin.xml
  +        $JAVA $JAVA_OPTIONS -cp $LOADER_LIB $ENDORSED $PARSER $JETTY_PORT_ARGS $JETTY_ADMIN_ARGS
$JETTY_LIBRARIES $JETTY_WEBAPP $JETTY $LOADER $JETTY_MAIN $JETTY_ADMIN
           ;;
   
     servlet-debug)
  -        $JAVA_HOME/bin/java $JAVA_OPT -Xdebug -Xrunjdwp:transport=dt_socket,address=$JAVA_DEBUG_PORT,server=y,suspend=n
-classpath $CP -Djava.endorsed.dirs=lib/endorsed -Dwebapp=$JETTY_WEBAPP -Dorg.xml.sax.parser=org.apache.xerces.parsers.SAXParser
-Djetty.port=$JETTY_PORT -Djetty.admin.port=$JETTY_ADMIN_PORT -Dloader.jar.repositories=tools/jetty/lib,lib/endorsed
-Dloader.main.class=org.mortbay.jetty.Server Loader tools/jetty/conf/main.xml tools/jetty/conf/admin.xml
  +        $JAVA $JAVA_OPTIONS $JAVA_DEBUG_ARGS -cp $LOADER_LIB $ENDORSED $PARSER $JETTY_PORT_ARGS
$JETTY_LIBRARIES $JETTY_WEBAPP $JETTY $LOADER $JETTY_MAIN
  +        ;;
  +
  +  servlet-profile)
  +        $JAVA $JAVA_OPTIONS $JAVA_PROFILE_ARGS -cp $LOADER_LIB $ENDORSED $PARSER $JETTY_ARGS
$JETTY_LIBRARIES $JETTY_WEBAPP $JETTY $LOADER $JETTY_MAIN
           ;;
   
     *)
  
  
  

Mime
View raw message