You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by jv...@apache.org on 2002/04/24 19:13:04 UTC
cvs commit: jakarta-turbine-3/src/test/org/apache/turbine/pipeline PipelineMapperTest.java
jvanzyl 02/04/24 10:13:04
Modified: . Tag: rundata_security_changes build.xml
src/java/org/apache/turbine Tag: rundata_security_changes
Turbine.java TurbineConstants.java
TurbineException.java TurbineRuntimeException.java
src/java/org/apache/turbine/modules Tag:
rundata_security_changes ModuleLoader.java
src/java/org/apache/turbine/pipeline Tag:
rundata_security_changes
DefaultSessionTimeoutValve.java
DefaultTargetValve.java JspRenderer.java
src/java/org/apache/turbine/services/pull Tag:
rundata_security_changes TurbinePullService.java
Added: . Tag: rundata_security_changes project.xml
src/java/org/apache/turbine/exception Tag:
rundata_security_changes
DefaultExceptionHandler.java
Removed: src/test/org/apache/turbine/pipeline Tag:
rundata_security_changes PipelineMapperTest.java
Log:
Porting some fixes over from the main branch. getting to compile again.
Revision Changes Path
No revision
No revision
1.20.2.24 +96 -424 jakarta-turbine-3/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-turbine-3/build.xml,v
retrieving revision 1.20.2.23
retrieving revision 1.20.2.24
diff -u -r1.20.2.23 -r1.20.2.24
--- build.xml 7 Mar 2002 14:10:22 -0000 1.20.2.23
+++ build.xml 24 Apr 2002 17:13:03 -0000 1.20.2.24
@@ -1,8 +1,6 @@
<?xml version="1.0"?>
-<!-- Build file for Turbine -->
-
-<project name="Turbine" default="jar" basedir=".">
+<project name="maven" default="maven:jar" basedir=".">
<!-- Give user a chance to override without editing this file
(and without typing -D each time they invoke a target) -->
@@ -12,432 +10,106 @@
<!-- Allow user defaults for this project -->
<property file="build.properties" />
<!-- Set default values for the build -->
- <property file="default.properties" />
+ <property file="project.properties" />
- <!-- W A R N I N G
-
- Put maven.jar in your ${ant.home}/lib directory
+ <!-- maven:start -->
- -->
-
<!-- ================================================================== -->
- <!-- I N I T I A L I Z E -->
+ <!-- D E L E G A T O R S -->
<!-- ================================================================== -->
- <!-- This deals with loading our path creation task that is used to: -->
- <!-- -->
- <!-- a) Construct a classpath from a descriptor file which allows us -->
- <!-- to store our dependencies externally and makes a build -->
- <!-- file reusable. -->
- <!-- -->
- <!-- b) Construct pattern sets that can be used for various task like -->
- <!-- copying a set of resources into a JAR for deployment. -->
- <!-- ================================================================== -->
-
- <target
- name="init">
-
- <taskdef
- name="create-path"
- classname="org.apache.maven.CreatePath">
- </taskdef>
-
- <taskdef
- name="create-patternset"
- classname="org.apache.maven.CreatePatternSet">
- </taskdef>
-
- <!-- Create Classpath -->
- <create-path rid="classpath" descriptor="${deps}" basedir="${lib.repo}"/>
- <!-- Source Directories -->
- <create-path rid="src.set" descriptor="${src.set}"/>
-
- <!-- Source Directories with Aspects -->
- <create-path rid="src.aspect.set" descriptor="${src.aspect.set}"/>
-
- </target>
-
- <!-- ================================================================== -->
- <!-- U P D A T E J A R S -->
- <!-- ================================================================== -->
-
- <target
- name="update-jars"
- description="o Update JARs required for building"
- depends="update-jars-proxy,update-jars-noproxy">
- </target>
-
- <target
- name="prepare.httpget">
-
- <taskdef
- name="httpget"
- className="org.apache.maven.update.Get">
- </taskdef>
- </target>
-
- <target
- name="update-jars-noproxy"
- unless="proxy.host"
- depends="prepare.httpget">
-
- <httpget
- baseUrl="http://jakarta.apache.org/turbine/jars/"
- dest="${lib.repo}"
- dependencyFile="project/deps.list"
- />
- </target>
-
- <target name="update-jars-proxy" if="proxy.host" depends="prepare.httpget">
- <httpget
- baseUrl="http://jakarta.apache.org/turbine/jars/"
- dest="${lib.repo}"
- dependencyFile="project/deps.list"
- proxyHost="${proxy.host}"
- proxyPort="${proxy.port}"
- />
- </target>
-
- <!-- ================================================================== -->
- <!-- E N V I R O N M E N T -->
- <!-- ================================================================== -->
-
- <target
- name="env"
- depends="init">
-
- <property name="classpath" refid="classpath"/>
-
- <echo>
- java.home = ${java.home}
- user.home = ${user.home}
- lib.repo = ${lib.repo}
-
- Classpath:
- ${classpath}
- </echo>
- </target>
-
- <!-- ================================================================== -->
- <!-- U S A G E -->
- <!-- ================================================================== -->
-
- <target
- name="usage">
-
- <echo message="use -projecthelp to see the available targets"/>
- </target>
-
- <!-- ================================================================== -->
- <!-- C O M P I L E -->
- <!-- ================================================================== -->
-
- <target
- name="compile"
- depends="javac.compile,aspectj.compile"
- description="o Compile project source code"/>
-
- <!-- ================================================================== -->
- <!-- J A V A C C O M P I L E -->
- <!-- ================================================================== -->
-
- <target
- name="javac.compile"
- unless="build.includes.aspects"
- depends="env"
- description="o Compile project source code with javac">
-
- <!-- Make sure the target directory exists -->
- <mkdir dir="${build.dest}"/>
-
- <javac
- destdir="${build.dest}"
- excludes="**/package.html"
- debug="${compile.debug}"
- deprecation="${compile.deprecation}"
- optimize="${compile.optimize}">
- <src>
- <path refid="src.set"/>
- </src>
- <classpath refid="classpath"/>
- </javac>
- </target>
-
- <!-- =================================================================== -->
- <!-- A S P E C T C O M P I L E -->
- <!-- =================================================================== -->
-
- <target
- name="aspectj.compile"
- if="build.includes.aspects"
- depends="env"
- description="o Compile project source code with AspectJ compiler">
-
- <taskdef
- name="ajc"
- classname="org.aspectj.tools.ant.taskdefs.Ajc"/>
-
- <ajc
- destdir="${build.dest}"
- excludes="**/package.html"
- debug="${compile.debug}"
- deprecation="${compile.deprecation}"
- optimize="${compile.optimize}">
-
- <src>
- <path refid="src.aspect.set"/>
- </src>
- <classpath>
- <path refid="classpath"/>
- <pathelement location="${aspectjrt.jar}"/>
- <pathelement location="${aspectjtools.jar}"/>
- </classpath>
- </ajc>
-
- </target>
-
- <!-- ================================================================== -->
- <!-- J A R R E S O U R C E S -->
- <!-- ================================================================== -->
-
- <target
- name="search-for-jar-resources">
- <echo message="jar.resources = ${jar.resources}"/>
- <available file="${jar.resources}" property="jar.resources.present"/>
- <echo message="jar.resources.present = ${jar.resources.present}"/>
- </target>
-
- <target
- name="jar-resources"
- if="jar.resources.present"
- depends="search-for-jar-resources">
-
- <!-- Copy any resources that must be present in the deployed
- JAR file.
- -->
-
- <!-- JAR Resources PatternSet -->
- <create-patternset rid="jar.resources.set" descriptor="${jar.resources}"/>
-
- <echo>
- Copy resources into destination directory for deployment
- in the JAR.
- </echo>
-
- <copy todir="${build.dest}">
- <fileset dir="${basedir}">
- <patternset refid="jar.resources.set"/>
- </fileset>
- </copy>
- </target>
-
- <!-- ================================================================== -->
- <!-- J A R -->
- <!-- ================================================================== -->
-
- <target
- name="jar"
- depends="compile,jar-resources"
- description="o Generates the ${project} JAR file (default)">
-
- <jar
- jarfile="${build.dir}/${final.name}.jar"
- basedir="${build.dest}"
- excludes="**/package.html"
- />
-
- </target>
-
- <!-- ================================================================== -->
- <!-- D I S T R I B U T I O N S -->
- <!-- ================================================================== -->
-
- <target
- name="dist"
- depends="jar,javadocs"
- description="o Create source and binary distributions">
-
- <property name="distDir" value="${build.dir}/${final.name}"/>
-
- <!-- B I N A R Y D I S T R I B U T I O N -->
-
- <echo>
- +-------------------------------------------------------+
- | C R E A T I N G B I N A R Y D I S T R I B U T I O N |
- +-------------------------------------------------------+
- </echo>
-
- <mkdir dir="${distDir}"/>
-
- <!-- Copy README and LICENSE -->
- <!--
- <copy todir="${distDir}" file="README.txt"/>
- <copy todir="${distDir}" file="LICENSE"/>
- -->
-
- <!-- Copy Jars -->
- <copy todir="${distDir}">
- <fileset dir="${build.dir}">
- <include name="**/*.jar"/>
- </fileset>
- </copy>
-
- <!-- Copy documentation -->
- <copy todir="${distDir}/docs">
- <fileset dir="${docs.dest}">
- <include name="**"/>
- </fileset>
- </copy>
-
- <!-- Create a tar.gz file -->
- <tar longfile="gnu" tarfile="${build.dir}/${final.name}.tar">
- <tarfileset dir="${build.dir}">
- <include name="${final.name}/**"/>
- </tarfileset>
- </tar>
-
- <gzip zipfile="${build.dir}/${final.name}.tar.gz" src="${build.dir}/${final.name}.tar"/>
- <delete file="${build.dir}/${final.name}.tar"/>
-
- <!-- Create a zip file -->
- <zip zipfile="${build.dir}/${final.name}.zip">
- <zipfileset dir="${build.dir}">
- <include name="${final.name}/**"/>
- </zipfileset>
- </zip>
-
- <!-- S O U R C E D I S T R I B U T I O N -->
-
- <echo>
- +-------------------------------------------------------+
- | C R E A T I N G S O U R C E D I S T R I B U T I O N |
- +-------------------------------------------------------+
- </echo>
-
- <delete>
- <fileset dir="${distDir}">
- <include name="**/*.jar"/>
- </fileset>
- </delete>
-
- <copy todir="${distDir}" file="default.properties"/>
- <copy todir="${distDir}" file="build.xml"/>
-
- <!-- Copy Source -->
- <copy todir="${distDir}/src">
- <fileset dir="${src.dir}">
- <include name="**/*.java"/>
- </fileset>
- </copy>
-
- <!-- Create a tar.gz file -->
- <tar longfile="gnu" tarfile="${build.dir}/${final.name}-src.tar">
- <tarfileset dir="${build.dir}">
- <include name="${final.name}/**"/>
- </tarfileset>
- </tar>
-
- <gzip zipfile="${build.dir}/${final.name}-src.tar.gz" src="${build.dir}/${final.name}-src.tar"/>
- <delete file="${build.dir}/${final.name}-src.tar"/>
-
- <!-- Create a zip file -->
- <zip zipfile="${build.dir}/${final.name}-src.zip">
- <zipfileset dir="${build.dir}">
- <include name="${final.name}/**"/>
- </zipfileset>
- </zip>
-
- </target>
-
- <!-- ================================================================== -->
- <!-- I N S T A L L J A R -->
- <!-- ================================================================== -->
-
- <target
- name="install-jar"
- depends="jar"
- description="o Installs JAR file in local ${lib.repo}">
-
- <copy todir="${lib.repo}" filtering="no">
- <fileset dir="${build.dir}">
- <include name="${final.name}.jar"/>
- </fileset>
- </copy>
- </target>
-
- <!-- ================================================================== -->
- <!-- D V S L D O C U M E N T A T I O N -->
- <!-- ================================================================== -->
-
- <target
- name="docs"
- depends="init"
- description="o Generate html project documentation xdoc sources">
-
- <taskdef name="dvsl" classname="org.apache.tools.dvsl.DVSLTask">
- <classpath>
- <path refid="classpath"/>
- </classpath>
- </taskdef>
-
- <!-- Make sure the target directory -->
- <mkdir dir="${docs.dest}"/>
-
- <dvsl
- basedir="${docs.src}"
- destdir="${docs.dest}/"
- extension=".html"
- style="${docs.src}/stylesheets/site.dvsl"
- excludes="**/project.xml,**/template.xml"
- includes="**/*.xml"
- />
- </target>
-
- <!-- ================================================================== -->
- <!-- J A V A D O C -->
- <!-- ================================================================== -->
-
- <target
- name="javadocs"
- depends="init"
- description="o Generates the Javadoc API documentation">
-
- <mkdir dir="${javadoc.destdir}"/>
-
- <!-- Get the year to display in the Javadocs -->
- <tstamp>
- <format property="year" pattern="${inception.year}-yyyy"/>
- </tstamp>
-
- <property
- name="copyright"
- value="Copyright &copy; ${year} ${organization}. All Rights Reserved."
- />
+ <target name="maven:site">
+ <ant antfile="${maven.home}/build-docs.xml" target="site"/>
+ </target>
+
+ <target name="maven:fo">
+ <ant antfile="${maven.home}/build-docs.xml" target="docs:fo"/>
+ </target>
+
+ <target name="maven:pdf">
+ <ant antfile="${maven.home}/build-docs.xml" target="docs:pdf"/>
+ </target>
+
+ <target name="maven:jar">
+ <ant antfile="${maven.home}/build-maven.xml" target="jar"/>
+ </target>
+
+ <target name="maven:install-jar">
+ <ant antfile="${maven.home}/build-maven.xml" target="install-jar"/>
+ </target>
+
+ <target name="maven:env">
+ <ant antfile="${maven.home}/build-maven.xml" target="env"/>
+ </target>
+
+ <target name="maven:docs">
+ <ant antfile="${maven.home}/build-docs.xml" target="docs"/>
+ </target>
+
+ <target name="maven:test">
+ <ant antfile="${maven.home}/build-test.xml" target="test"/>
+ </target>
+
+ <target name="maven:iutest">
+ <ant antfile="${maven.home}/build-iutest.xml" target="test"/>
+ </target>
+
+ <target name="maven:clean">
+ <ant antfile="${maven.home}/build-maven.xml" target="clean"/>
+ </target>
+
+ <target name="maven:metrics">
+ <ant antfile="${maven.home}/build-metrics.xml" target="metrics"/>
+ </target>
+
+ <target name="maven:dist">
+ <ant antfile="${maven.home}/build-maven.xml" target="dist"/>
+ </target>
+
+ <target name="maven:deploy-site">
+ <ant antfile="${maven.home}/build-docs.xml" target="deploy-site"/>
+ </target>
+
+ <target name="maven:gump-descriptor">
+ <ant antfile="${maven.home}/build-maven.xml" target="gump-descriptor"/>
+ </target>
+
+ <target name="maven:javadocs">
+ <ant antfile="${maven.home}/build-docs.xml" target="javadocs"/>
+ </target>
+
+ <target name="maven:compile">
+ <ant antfile="${maven.home}/build-maven.xml" target="compile"/>
+ </target>
+
+ <target name="maven:check-source">
+ <ant antfile="${maven.home}/build-maven.xml" target="check-source"/>
+ </target>
+
+ <target name="maven:update-jars">
+ <ant antfile="${maven.home}/build-maven.xml" target="update-jars"/>
+ </target>
+
+ <target name="maven:announce">
+ <ant antfile="${maven.home}/build-maven.xml" target="announce"/>
+ </target>
+
+ <target name="maven:update-descriptor">
+ <ant antfile="${maven.home}/build-maven.xml" target="update-descriptor"/>
+ </target>
+
+ <target name="maven:updates-available">
+ <ant antfile="${maven.home}/build-maven.xml" target="updates-available"/>
+ </target>
+
+ <target name="maven:validate-pom">
+ <ant antfile="${maven.home}/build-maven.xml" target="validate-pom"/>
+ </target>
+
+ <target name="maven:maven-update">
+ <ant antfile="${maven.home}/build-maven.xml" target="maven-update"/>
+ </target>
- <javadoc
- sourcepath="${src.dir}/java"
- packagenames="${package}.*"
- destdir="${javadoc.destdir}"
- author="${author}"
- private="${javadoc.private}"
- version="${javadoc.version}"
- use="${javadoc.use}"
- windowtitle="${javadoc.windowtitle}"
- doctitle="${javadoc.doctitle}"
- bottom="${copyright}">
- <classpath refid="classpath"/>
- </javadoc>
+ <!-- maven:end -->
- </target>
-
- <!-- ================================================================== -->
- <!-- C L E A N -->
- <!-- ================================================================== -->
-
- <target
- name="clean"
- description="o Cleans up the build directory">
-
- <delete dir="${build.dir}"/>
- </target>
</project>
No revision
No revision
1.22.2.1 +5 -1 jakarta-turbine-3/project.xml
Index: project.xml
===================================================================
RCS file: /home/cvs/jakarta-turbine-3/project.xml,v
retrieving revision 1.22
retrieving revision 1.22.2.1
diff -u -r1.22 -r1.22.2.1
--- project.xml 16 Apr 2002 22:24:01 -0000 1.22
+++ project.xml 24 Apr 2002 17:13:03 -0000 1.22.2.1
@@ -25,7 +25,11 @@
<issueTrackingUrl>http://nagoya.apache.org:8080/scarab/servlet/scarab/</issueTrackingUrl>
<siteAddress>jakarta.apache.org</siteAddress>
<siteDirectory>/www/jakarta.apache.org/turbine/turbine-3/</siteDirectory>
-
+
+ <cvsRoot>:pserver:anoncvs@.cvs.apache.org:/home/cvspublic</cvsRoot>
+ <cvsPassword>anoncvs</cvsPassword>
+ <cvsModule>jakarta-turbine-3</cvsModule>
+
<mailingLists>
<mailingList>
<name>Turbine User List</name>
No revision
No revision
1.24.2.5 +152 -86 jakarta-turbine-3/src/java/org/apache/turbine/Turbine.java
Index: Turbine.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-3/src/java/org/apache/turbine/Turbine.java,v
retrieving revision 1.24.2.4
retrieving revision 1.24.2.5
diff -u -r1.24.2.4 -r1.24.2.5
--- Turbine.java 13 Feb 2002 20:24:14 -0000 1.24.2.4
+++ Turbine.java 24 Apr 2002 17:13:03 -0000 1.24.2.5
@@ -55,33 +55,34 @@
*/
import java.io.File;
-import java.io.IOException;
-import java.io.PrintWriter;
import java.io.FileInputStream;
-import java.util.Enumeration;
+import java.io.IOException;
import java.util.Date;
-import java.util.Properties;
-import java.util.Vector;
import java.util.Iterator;
-import java.util.Hashtable;
+import java.util.Properties;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.apache.commons.util.StringUtils;
-import org.apache.commons.util.http.HttpUtils;
+
+import org.apache.commons.http.HttpUtils;
+import org.apache.commons.lang.Strings;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.logging.Log;
+import org.apache.commons.xo.Mapper;
+
import org.apache.fulcrum.ServiceManager;
import org.apache.fulcrum.TurbineServices;
-import org.apache.log4j.Category;
-import org.apache.stratum.configuration.Configuration;
-import org.apache.stratum.configuration.PropertiesConfiguration;
-import org.apache.stratum.xo.Mapper;
+
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.PropertiesConfiguration;
+
import org.apache.turbine.modules.ModuleLoader;
-import org.apache.turbine.pipeline.DefaultTargetValve;
import org.apache.turbine.pipeline.TurbinePipeline;
import org.apache.turbine.services.rundata.RunDataService;
+import org.apache.log4j.PropertyConfigurator;
/**
* Turbine is the main servlet for the entire system. It is <code>final</code>
@@ -123,12 +124,15 @@
* @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
* @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
* @author <a href="mailto:mpoeschl@marmot.at">Martin Poeschl</a>
- * @version $Id: Turbine.java,v 1.24.2.4 2002/02/13 20:24:14 jvanzyl Exp $
+ * @version $Id: Turbine.java,v 1.24.2.5 2002/04/24 17:13:03 jvanzyl Exp $
*/
public class Turbine
extends HttpServlet
implements TurbineConstants
{
+ private static final Log log
+ = LogFactory.getLog( Turbine.class );
+
/**
* In certain situations the init() method is called more than once,
* somtimes even concurrently. This causes bad things to happen,
@@ -168,7 +172,7 @@
{
if (!firstInit)
{
- Log.warn("Double initializaton of Turbine was attempted!");
+ log.warn("Double initializaton of Turbine was attempted!");
return;
}
// executing init will trigger some static initializers, so we have
@@ -178,18 +182,22 @@
try
{
// Setup static configuration (using default properties file).
- String trProps = config.getInitParameter(TurbineConfig.PROPERTIES_KEY);
- configure(config, config.getServletContext(), trProps);
+ ServletContext context = config.getServletContext();
+ String trProps =
+ findInitParameter(context, config,
+ TurbineConfig.PROPERTIES_KEY,
+ "TurbineResources.properties");
+ configure(config, context, trProps);
}
catch ( Exception e )
{
// save the exception to complain loudly later :-)
initFailure = e;
- Log.info("Turbine: init() failed: " + StringUtils.stackTrace(e));
- System.err.println(StringUtils.stackTrace(e));
+ System.err.println(Strings.stackTrace(e));
+ log.info("init failed: " + Strings.stackTrace(e));
return;
}
- Log.info("Turbine: init() Ready to Rumble!");
+ log.info("init complete, Ready to Rumble!");
}
}
@@ -230,8 +238,11 @@
// Shut down all Turbine Services.
TurbineServices.getInstance().shutdownServices();
System.gc();
+
+ // Allow turbine to be started back up again.
+ firstInit = true;
- Log.info("Turbine: Done shutting down!");
+ log.info("Done shutting down!");
}
/**
@@ -271,8 +282,7 @@
data.setRequest(req);
data.setResponse(res);
}
-
- Log.debug("Value of RunData: " + data);
+
// If this is the first invocation, perform some
// initialization. Certain services need RunData to initialize
@@ -354,7 +364,7 @@
}
catch (Exception e)
{
- Log.debug("Turbine.closeOutputStream: " + e.getMessage());
+ log.debug("closeOutputStream: " + e.getMessage());
}
}
@@ -368,8 +378,9 @@
* on the screen.
*
* @param data A Turbine RunData object.
+ * @param req Servlet request.
* @param res Servlet response.
- * @param e The exception to report.
+ * @param t The exception to report.
*/
private final void handleException(RunData data,
HttpServletRequest req,
@@ -378,8 +389,8 @@
throws ServletException
{
// make sure that the stack trace makes it the log
- Log.error("Turbine.handleException: " + t.getMessage());
- Log.error(t);
+ log.error("handleException: " + t.getMessage());
+ log.error(t);
if ( INTEGRATED.equals(configuration.getString(MODE)) ||
req.getAttribute(INTEGRATED_REQUEST_KEY) != null )
@@ -391,23 +402,19 @@
{
try
{
- // try again with a different target
- data.setTarget(configuration.getString("template.error","/Error.vm"));
- data.setStackTrace(StringUtils.stackTrace(t), t);
-
- // We act as a minimal Pipeline here to run the target
- // set above.
- new DefaultTargetValve().invoke(data, new NullValveContext());
+ exceptionHandler.handleException( data, t );
}
catch (Exception f)
{
+ log.error( "Failed to dispatch to exception handler", f );
+
String mimeType = "text/plain";
try
{
// TODO: Make output formatting more flexible --
// what's below was to remove the use of ECS.
- String trace = StringUtils.stackTrace(t);
+ String trace = Strings.stackTrace(t);
data.setStackTrace(trace,t);
data.getResponse().setContentType(data.getContentType());
data.getResponse().setStatus(data.getStatusCode());
@@ -432,8 +439,8 @@
}
catch (IOException ignored) {}
- Log.info ( data.getStackTrace() );
- Log.error ( e.getMessage(), e );
+ log.info ( data.getStackTrace() );
+ log.error ( e.getMessage(), e );
}
// Attempt to do *something* at this point...
catch ( Throwable reallyScrewedNow )
@@ -457,7 +464,7 @@
catch (Exception ignored)
{
}
- Log.error(reallyScrewedNow.getMessage(), reallyScrewedNow);
+ log.error(reallyScrewedNow.getMessage(), reallyScrewedNow);
}
}
}
@@ -531,6 +538,8 @@
private static Resolver resolver;
+ private static ExceptionHandler exceptionHandler;
+
private static Pipeline pipeline;
private static RunDataService runDataService;
@@ -540,8 +549,10 @@
* or by non-servlet applications for configuring Turbine. It loads
* the default resources from a properties file.
*
- * @param config Servlet initialization parameter.
+ * @param config Initialization parameters specific to the Turbine
+ * servlet.
* @param context Servlet container communication channel.
+ * Provides access to global initialization parameters.
* @param propsFile The abstract path to your
* <code>TurbineResources.properties</code> file (including file
* name), relative to web application root. Defaults to {@link
@@ -553,9 +564,12 @@
String propsFile)
throws Exception
{
+ try
+ {
// Set the application root. This defaults to the webapp
// context if not otherwise set.
- applicationRoot = config.getInitParameter(APPLICATION_ROOT);
+ applicationRoot =
+ findInitParameter(context, config, APPLICATION_ROOT, null);
if (applicationRoot == null || applicationRoot.equals(WEB_CONTEXT))
{
@@ -570,7 +584,7 @@
// runtime. Right now this creates the directories
// for logging but we might have more of these
// directories in the future.
- createRuntimeDirectories(config.getInitParameter(LOGGING_ROOT));
+ createRuntimeDirectories(context, config);
// Get the full path to the properties file.
if (propsFile == null)
@@ -591,10 +605,14 @@
p.load(new FileInputStream(propsPath));
p.setProperty(APPLICATION_ROOT, getApplicationRoot());
- // We are still using our Log facade but we
- // should move toward using log4j correctly.
- Log.setProperties(p);
- Log.init();
+ // FIXME: Configures log4j directly with the supplied properties. The
+ // plan is to eliminate this, and instead allow logging to be
+ // initialized by a component, which could init any logging
+ // mechanism supported by commons-logging. However it is
+ // important that logging be intialized early, so we will need
+ // to address that in the component loader.
+
+ PropertyConfigurator.configure(p);
// We want to save the ServletConfig and
// ServletContext so that we can share these objects
@@ -608,7 +626,7 @@
setTurbineServletContext(context);
// Get the instance of the service manager
- ServiceManager serviceManager = TurbineServices.getManager();
+ ServiceManager serviceManager = TurbineServices.getInstance();
// Set the service managers application root. In our
// case it is the webapp context.
@@ -647,12 +665,21 @@
// set up the resolver, should be done before the pipeline
String resolverClass;
resolverClass = configuration.getString(RESOLVER,
- "org.apache.turbine.pipeline.DefaultResolver");
+ "org.apache.turbine.pipeline.DefaultResolver");
- Log.debug("[Turbine] Using Resolver: " + resolverClass);
+ log.debug("Using Resolver: " + resolverClass);
resolver = (Resolver) Class.forName(resolverClass).newInstance();
resolver.init();
+ // Create the error handler
+
+ String exceptionHandlerClass =
+ configuration.getString( EXCEPTION_HANDLER,
+ "org.apache.turbine.exception.DefaultExceptionHandler" );
+
+ exceptionHandler = ( ExceptionHandler )
+ Class.forName( exceptionHandlerClass ).newInstance();
+
// Set some system properties
Configuration systemProperties = configuration.subset(SYSTEM);
@@ -662,7 +689,7 @@
{
String name = (String) k.next();
String value = systemProperties.getString(name);
- Log.debug("[Turbine] System Property: " + name + " => " + value);
+ log.debug("System Property: " + name + " => " + value);
System.getProperties().setProperty(name, value);
}
}
@@ -673,8 +700,7 @@
Class pipelineClass = Class.forName
(configuration.getString("pipeline.default", STANDARD_PIPELINE));
- Log.debug("[Turbine] Using Pipeline: " + pipelineClass.getName());
-
+ log.debug("Using Pipeline: " + pipelineClass.getName());
if (TurbinePipeline.class.isAssignableFrom(pipelineClass))
{
// Turbine's standard Pipeline implementation uses
@@ -682,9 +708,8 @@
String descriptorPath = configuration.getString(
"pipeline.default.descriptor", TurbinePipeline.CLASSIC_PIPELINE);
- Log.debug("[Turbine] Using descriptor path: " + descriptorPath);
+ log.debug("Using descriptor path: " + descriptorPath);
Mapper m = new Mapper();
- m.setDebug(true);
pipeline = (Pipeline) m.map(descriptorPath,pipelineClass.getName());
}
else
@@ -695,30 +720,44 @@
pipeline = (Pipeline) pipelineClass.newInstance();
}
+ log.debug("Initializing pipeline");
pipeline.initialize();
+ log.debug("Getting rundataservice: ");
// Setup the RunData service for the application
runDataService = (RunDataService) TurbineServices.getInstance()
.getService(RunDataService.SERVICE_NAME);
+ log.debug("RunDataService: " + runDataService);
+ }
+ catch (Throwable e)
+ {
+ e.printStackTrace();
+ log.error(e);
+ throw new TurbineException(e);
+ }
}
/**
* Create any directories that might be needed during
* runtime. Right now this includes:
*
- * i) directories for logging
+ * <ul>
+ *
+ * <li>The directory to write the log files to (relative to the
+ * web application root), or <code>null</code> for the default of
+ * <code>/logs</code>. The directory is specified via the {@link
+ * TurbineConstants#LOGGING_ROOT} parameter.</li>
*
- * @param path The directory to write log files to (relative to
- * the web application root), or <code>null</code> for the default
- * of <code>/logs</code>.
+ * </ul>
+ *
+ * @param context Global initialization parameters.
+ * @param config Initialization parameters specific to the Turbine
+ * servlet.
*/
- private static void createRuntimeDirectories(String path)
+ private static void createRuntimeDirectories(ServletContext context,
+ ServletConfig config)
{
- if (StringUtils.isEmpty(path))
- {
- path = "/logs";
- }
-
+ String path = findInitParameter(context, config, LOGGING_ROOT, "/logs");
File logDir = new File(getRealPath(path));
if (!logDir.exists())
{
@@ -731,6 +770,49 @@
}
/**
+ * Finds the specified servlet configuration/initialization
+ * parameter, looking first for a servlet-specific parameter, then
+ * for a global parameter, and using the provided default if not
+ * found.
+ */
+ protected static final String findInitParameter(ServletContext context,
+ ServletConfig config,
+ String name,
+ String defaultValue)
+ {
+ String path = null;
+
+ // Try the name as provided first.
+ boolean usingNamespace = name.startsWith(CONFIG_NAMESPACE);
+ while (true)
+ {
+ path = config.getInitParameter(name);
+ if (Strings.isEmpty(path))
+ {
+ path = context.getInitParameter(name);
+ if (Strings.isEmpty(path))
+ {
+ // The named parameter didn't yield a value.
+ if (usingNamespace)
+ {
+ path = defaultValue;
+ }
+ else
+ {
+ // Try again using Turbine's namespace.
+ name = CONFIG_NAMESPACE + '.' + name;
+ usingNamespace = true;
+ continue;
+ }
+ }
+ }
+ break;
+ }
+
+ return path;
+ }
+
+ /**
* Get the ModuleLoader for this Turbine webapp.
* Eventually we will want to be able to grab a ModuleLoader
* by app name, or app identifier.
@@ -756,7 +838,7 @@
* it can be utilized by object instances that do not
* have direct access to RunData.
*
- * @param RunData
+ * @param data
*/
public static synchronized void saveServletInfo(RunData data)
{
@@ -769,11 +851,11 @@
/**
* Set the application root for the webapp.
*
- * @param String app root
+ * @param val New app root.
*/
- public static void setApplicationRoot(String v)
+ public static void setApplicationRoot(String val)
{
- applicationRoot = v;
+ applicationRoot = val;
}
/**
@@ -789,7 +871,7 @@
/**
* Get the expanded path relative to the app root.
*
- * @param String path.
+ * @param path Relative path to translate.
*/
public static String getRealPath(String path)
{
@@ -841,7 +923,7 @@
/**
* Set the servlet config for this turbine webapp.
*
- * @param ServletConfig
+ * @param s New servlet config
*/
public static void setTurbineServletConfig(ServletConfig s)
{
@@ -861,7 +943,7 @@
/**
* Set the servlet context for this turbine webapp.
*
- * @param ServletContext
+ * @param s New servlet context.
*/
public static void setTurbineServletContext(ServletContext s)
{
@@ -911,22 +993,6 @@
Date expiryDate = new Date( System.currentTimeMillis() + expiry );
data.getResponse().setHeader(
"Expires", HttpUtils.formatHttpDate(expiryDate));
- }
- }
-
- /**
- * A skeleton {@link org.apache.turbine.ValveContext}
- * implementation to assist in invoking DefaultTargetValve in
- * {@link #handleException(RunData, HttpServletRequest,
- * HttpServletResponse, Throwable)}.
- */
- protected final class NullValveContext implements ValveContext
- {
- /**
- * No-op implementation of ValveContext interface.
- */
- public void invokeNext(RunData ignored)
- {
}
}
}
1.12.2.2 +27 -56 jakarta-turbine-3/src/java/org/apache/turbine/TurbineConstants.java
Index: TurbineConstants.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-3/src/java/org/apache/turbine/TurbineConstants.java,v
retrieving revision 1.12.2.1
retrieving revision 1.12.2.2
diff -u -r1.12.2.1 -r1.12.2.2
--- TurbineConstants.java 8 Feb 2002 02:49:04 -0000 1.12.2.1
+++ TurbineConstants.java 24 Apr 2002 17:13:03 -0000 1.12.2.2
@@ -65,6 +65,18 @@
public interface TurbineConstants
{
/**
+ * <p>The prefix used to denote the namespace reserved for and
+ * used by Turbine-specific configuration parameters (such as
+ * those passed in via servlet container's config file
+ * (<code>server.xml</code>), or the web app deployment descriptor
+ * (<code>web.xml</code>).</p>
+ *
+ * <p>For example, a parameter in the Turbine namespace would be
+ * <code>org.apache.turbine.loggingRoot</code>.</p>
+ */
+ public static final String CONFIG_NAMESPACE = "org.apache.turbine";
+
+ /**
* The logging facility which captures output from Peers.
*/
public static final String SQL_LOG_FACILITY = "sql";
@@ -107,7 +119,8 @@
/**
* The size of the actions cache if module caching is on.
*/
- public static final String SCHEDULED_JOB_CACHE_SIZE = "scheduledjob.cache.size";
+ public static final String SCHEDULED_JOB_CACHE_SIZE =
+ "scheduledjob.cache.size";
/**
* The fully qualified class name of the default {@link
@@ -124,6 +137,11 @@
public static final String MODULE_PACKAGES = "module.packages";
/**
+ * Configuration key for the ExceptionHandler that Turbine will use.
+ */
+ public static final String EXCEPTION_HANDLER = "exceptionHandler.default";
+
+ /**
* what resolver Turbine will use
*/
public static final String RESOLVER = "resolver.default";
@@ -132,58 +150,8 @@
* what will the resolver cache (replaces the <module.cache> property)
*/
public static final String RESOLVER_MODULE_CACHE = "resolver.cache.module";
- public static final String RESOLVER_TEMPLATE_CACHE = "resolver.cache.template";
-
- /**
- * JDBC database driver.
- */
- public static final String DB_DRIVER = "database.default.driver";
-
- /**
- * JDBC database URL.
- */
- public static final String DB_URL = "database.default.url";
-
- /**
- * JDBC username.
- */
- public static final String DB_USERNAME = "database.default.username";
-
- /**
- * JDBC password.
- */
- public static final String DB_PASSWORD = "database.default.password";
-
- /**
- * Maximum number of connections to pool.
- */
- public static final String DB_MAXCONNECTIONS = "database.maxConnections";
-
- /**
- * Expiry time of database connections.
- */
- public static final String DB_EXPIRYTIME = "database.expiryTime";
-
- /**
- * How long a connection request will wait before giving up.
- */
- public static final String DB_CONNECTION_WAIT_TIMEOUT = "database.connectionWaitTimeout";
-
- /**
- * How often the PoolBrokerServer logs the status of the pool.
- */
- public static final String DB_CONNECTION_LOG_INTERVAL = "database.logInterval";
-
- /**
- * Database adaptor.
- */
- public static final String DB_ADAPTOR = "database.adaptor";
-
- /**
- * Indicates that the id broker will generate more ids
- * if the demand is high.
- */
- public static final String DB_IDBROKER_CLEVERQUANTITY = "database.idbroker.cleverquantity";
+ public static final String RESOLVER_TEMPLATE_CACHE =
+ "resolver.cache.template";
/**
* Home page template.
@@ -230,12 +198,14 @@
/**
* Actions that performs session validation.
*/
- public static final String ACTION_SESSION_VALIDATOR = "action.sessionvalidator";
+ public static final String ACTION_SESSION_VALIDATOR =
+ "action.sessionvalidator";
/**
* I don't think this is being used, is it?
*/
- public static final String ACTION_ACCESS_CONTROLLER = "action.accesscontroller";
+ public static final String ACTION_ACCESS_CONTROLLER =
+ "action.accesscontroller";
/**
* Default layout.
@@ -265,7 +235,8 @@
/**
* Message to display when screens variable invalid.
*/
- public static final String LOGIN_MESSAGE_NOSCREEN = "login.message.noscreen";
+ public static final String LOGIN_MESSAGE_NOSCREEN =
+ "login.message.noscreen";
/**
* Message to display when a user logs out.
1.1.1.1.2.1 +1 -1 jakarta-turbine-3/src/java/org/apache/turbine/TurbineException.java
Index: TurbineException.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-3/src/java/org/apache/turbine/TurbineException.java,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.1
diff -u -r1.1.1.1 -r1.1.1.1.2.1
--- TurbineException.java 16 Aug 2001 04:41:34 -0000 1.1.1.1
+++ TurbineException.java 24 Apr 2002 17:13:03 -0000 1.1.1.1.2.1
@@ -54,7 +54,7 @@
* <http://www.apache.org/>.
*/
-import org.apache.commons.util.exception.NestableException;
+import org.apache.commons.lang.exception.NestableException;
/**
* The base class of all regular exceptions thrown by Torque.
1.1.1.1.2.1 +3 -2 jakarta-turbine-3/src/java/org/apache/turbine/TurbineRuntimeException.java
Index: TurbineRuntimeException.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-3/src/java/org/apache/turbine/TurbineRuntimeException.java,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.1
diff -u -r1.1.1.1 -r1.1.1.1.2.1
--- TurbineRuntimeException.java 16 Aug 2001 04:41:34 -0000 1.1.1.1
+++ TurbineRuntimeException.java 24 Apr 2002 17:13:03 -0000 1.1.1.1.2.1
@@ -54,7 +54,7 @@
* <http://www.apache.org/>.
*/
-import org.apache.commons.util.exception.NestableRuntimeException;
+import org.apache.commons.lang.exception.NestableRuntimeException;
/**
* This is a base class of runtime exeptions thrown by Turbine.
@@ -62,7 +62,8 @@
* @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a>
* @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
*/
-public class TurbineRuntimeException extends NestableRuntimeException
+public class TurbineRuntimeException
+ extends NestableRuntimeException
{
public TurbineRuntimeException()
{
No revision
No revision
1.3.2.1 +1 -1 jakarta-turbine-3/src/java/org/apache/turbine/exception/DefaultExceptionHandler.java
Index: DefaultExceptionHandler.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-3/src/java/org/apache/turbine/exception/DefaultExceptionHandler.java,v
retrieving revision 1.3
retrieving revision 1.3.2.1
diff -u -r1.3 -r1.3.2.1
--- DefaultExceptionHandler.java 7 Mar 2002 23:46:44 -0000 1.3
+++ DefaultExceptionHandler.java 24 Apr 2002 17:13:04 -0000 1.3.2.1
@@ -67,7 +67,7 @@
* by the 'template.error' configuration property.
*
* @author <a href="mailto:james@jamestaylor.org">James Taylor</a>
- * @version $Id: DefaultExceptionHandler.java,v 1.3 2002/03/07 23:46:44 jmcnally Exp $
+ * @version $Id: DefaultExceptionHandler.java,v 1.3.2.1 2002/04/24 17:13:04 jvanzyl Exp $
*/
public class DefaultExceptionHandler implements ExceptionHandler
{
No revision
No revision
1.7.2.2 +2 -2 jakarta-turbine-3/src/java/org/apache/turbine/modules/ModuleLoader.java
Index: ModuleLoader.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-3/src/java/org/apache/turbine/modules/ModuleLoader.java,v
retrieving revision 1.7.2.1
retrieving revision 1.7.2.2
diff -u -r1.7.2.1 -r1.7.2.2
--- ModuleLoader.java 8 Feb 2002 02:49:05 -0000 1.7.2.1
+++ ModuleLoader.java 24 Apr 2002 17:13:04 -0000 1.7.2.2
@@ -59,7 +59,7 @@
import java.util.List;
import java.util.Vector;
import java.util.Map;
-import org.apache.stratum.configuration.Configuration;
+import org.apache.commons.configuration.Configuration;
import org.apache.turbine.RunData;
import org.apache.turbine.Turbine;
import org.apache.turbine.TurbineException;
@@ -75,7 +75,7 @@
*
* @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
* @author <a href="mailto:mpoeschl@marmot.at">Martin Poeschl</a>
- * @version $Id: ModuleLoader.java,v 1.7.2.1 2002/02/08 02:49:05 jvanzyl Exp $
+ * @version $Id: ModuleLoader.java,v 1.7.2.2 2002/04/24 17:13:04 jvanzyl Exp $
*/
public class ModuleLoader
{
No revision
No revision
1.3.2.2 +2 -2 jakarta-turbine-3/src/java/org/apache/turbine/pipeline/DefaultSessionTimeoutValve.java
Index: DefaultSessionTimeoutValve.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-3/src/java/org/apache/turbine/pipeline/DefaultSessionTimeoutValve.java,v
retrieving revision 1.3.2.1
retrieving revision 1.3.2.2
diff -u -r1.3.2.1 -r1.3.2.2
--- DefaultSessionTimeoutValve.java 8 Feb 2002 02:49:05 -0000 1.3.2.1
+++ DefaultSessionTimeoutValve.java 24 Apr 2002 17:13:04 -0000 1.3.2.2
@@ -65,14 +65,14 @@
import org.apache.turbine.ValveContext;
import org.apache.log4j.Category;
-import org.apache.stratum.configuration.Configuration;
+import org.apache.commons.configuration.Configuration;
/**
* Implements the action portion of the "Turbine classic" processing
* pipeline (from the Turbine 2.x series).
*
* @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
- * @version $Id: DefaultSessionTimeoutValve.java,v 1.3.2.1 2002/02/08 02:49:05 jvanzyl Exp $
+ * @version $Id: DefaultSessionTimeoutValve.java,v 1.3.2.2 2002/04/24 17:13:04 jvanzyl Exp $
*/
public class DefaultSessionTimeoutValve
extends AbstractValve
1.8.2.3 +2 -2 jakarta-turbine-3/src/java/org/apache/turbine/pipeline/DefaultTargetValve.java
Index: DefaultTargetValve.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-3/src/java/org/apache/turbine/pipeline/DefaultTargetValve.java,v
retrieving revision 1.8.2.2
retrieving revision 1.8.2.3
diff -u -r1.8.2.2 -r1.8.2.3
--- DefaultTargetValve.java 8 Feb 2002 02:49:05 -0000 1.8.2.2
+++ DefaultTargetValve.java 24 Apr 2002 17:13:04 -0000 1.8.2.3
@@ -69,7 +69,7 @@
import org.apache.turbine.modules.Module;
import org.apache.log4j.Category;
-import org.apache.stratum.configuration.Configuration;
+import org.apache.commons.configuration.Configuration;
/**
* Implements the RunData target portion of the "Turbine classic"
@@ -80,7 +80,7 @@
* @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
* @author <a href="mailto:mikeh@apache.org">Mike Haberman</a>
* @author <a href="mailto:james@jamestaylor.org">James Taylor</a>
- * @version $Id: DefaultTargetValve.java,v 1.8.2.2 2002/02/08 02:49:05 jvanzyl Exp $
+ * @version $Id: DefaultTargetValve.java,v 1.8.2.3 2002/04/24 17:13:04 jvanzyl Exp $
*/
public class DefaultTargetValve
extends AbstractValve
1.1.2.1 +3 -3 jakarta-turbine-3/src/java/org/apache/turbine/pipeline/JspRenderer.java
Index: JspRenderer.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-3/src/java/org/apache/turbine/pipeline/JspRenderer.java,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
--- JspRenderer.java 22 Jan 2002 13:50:46 -0000 1.1
+++ JspRenderer.java 24 Apr 2002 17:13:04 -0000 1.1.2.1
@@ -68,13 +68,13 @@
import org.apache.turbine.TurbineException;
import org.apache.log4j.Category;
-import org.apache.commons.util.StringUtils;
+import org.apache.commons.lang.Strings;
/**
* Valve to call the JspRenderer.
*
* @author <a href="mailto:jvanzyl@zenplex.com">Jason van Zyl</a>
- * @version $Id: JspRenderer.java,v 1.1 2002/01/22 13:50:46 jvanzyl Exp $
+ * @version $Id: JspRenderer.java,v 1.1.2.1 2002/04/24 17:13:04 jvanzyl Exp $
*/
public class JspRenderer
{
@@ -172,7 +172,7 @@
}
catch(Exception e)
{
- log.error(StringUtils.stackTrace(e));
+ log.error(Strings.stackTrace(e));
}
}
}
No revision
No revision
1.9.2.3 +2 -2 jakarta-turbine-3/src/java/org/apache/turbine/services/pull/TurbinePullService.java
Index: TurbinePullService.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-3/src/java/org/apache/turbine/services/pull/TurbinePullService.java,v
retrieving revision 1.9.2.2
retrieving revision 1.9.2.3
diff -u -r1.9.2.2 -r1.9.2.3
--- TurbinePullService.java 8 Feb 2002 02:49:05 -0000 1.9.2.2
+++ TurbinePullService.java 24 Apr 2002 17:13:04 -0000 1.9.2.3
@@ -71,7 +71,7 @@
import org.apache.turbine.TemplateContext;
import org.apache.turbine.modules.DefaultTemplateContext;
-import org.apache.stratum.configuration.Configuration;
+import org.apache.commons.configuration.Configuration;
/**
* <p>
@@ -144,7 +144,7 @@
*
* @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
* @author <a href="mailto:sean@informage.net">Sean Legassick</a>
- * @version $Id: TurbinePullService.java,v 1.9.2.2 2002/02/08 02:49:05 jvanzyl Exp $
+ * @version $Id: TurbinePullService.java,v 1.9.2.3 2002/04/24 17:13:04 jvanzyl Exp $
*/
public class TurbinePullService
extends BaseService
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>