quintonm 2003/03/08 22:58:43
Modified: src/java/org/apache/turbine/util TurbineConfig.java
Log:
- Style fixes
- misc javadoc updates
- getRealPath() now has one exit point
Revision Changes Path
1.12 +21 -16
jakarta-turbine-2/src/java/org/apache/turbine/util/TurbineConfig.java
Index: TurbineConfig.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/util/TurbineConfig.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- TurbineConfig.java 9 Mar 2003 02:54:11 -0000 1.11
+++ TurbineConfig.java 9 Mar 2003 06:58:43 -0000 1.12
@@ -73,32 +73,35 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.stratum.lifecycle.Disposable;
-import org.apache.stratum.lifecycle.Initializable;
+import org.apache.avalon.framework.activity.Disposable;
+import org.apache.avalon.framework.activity.Initializable;
import org.apache.turbine.Turbine;
/**
* A class used for initalization of Turbine without a servlet container.
- *
+ * <p>
* If you need to use Turbine outside of a servlet container, you can
- * use this class for initalization of the Turbine servlet.<br>
- *
+ * use this class for initalization of the Turbine servlet.
+ * <p>
* <blockquote><code><pre>
* TurbineConfig config = new TurbineConfig(".",
"/conf/TurbineResources.properties");
* </pre></code></blockquote>
- *
+ * <p>
* All paths referenced in TurbineResources.properties and the path to
* the properties file itself (the second argument) will be resolved
* relative to the directory given as the first argument of the constructor,
* here - the directory where application was started. Don't worry about
* discarding the references to objects created above. They are not needed,
* once everything is initialized.
- *
+ * <p>
* In order to initialize the Services Framework outside of the Turbine Servlet,
* you need to call the <code>init()</code> method. By default, this will
* initialize the Resource and Logging Services and any other services you
* have defined in your TurbineResources.properties file.
*
+ * @todo Make this class enforce the lifecycle contracts
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">Quinton McCombs</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Rafal Krzewski</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Jon S. Stevens</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Daniel Rall</a>
@@ -106,10 +109,7 @@
* @version $Id$
*/
public class TurbineConfig
- implements ServletConfig,
- ServletContext,
- Initializable,
- Disposable
+ implements ServletConfig, ServletContext, Initializable, Disposable
{
/**
* Servlet initialization parameter name for the path to
@@ -245,6 +245,8 @@
*/
public String getRealPath(String path)
{
+ String result = null;
+
File f = new File(root, path);
if (log.isDebugEnabled())
{
@@ -262,11 +264,14 @@
if (f.exists())
{
- return f.getPath();
+ result = f.getPath();
+ }
+ else
+ {
+ log.error("getRealPath(\"" + path + "\") is undefined, returning null");
}
- log.error("getRealPath(\"" + path + "\") is undefined, returning null");
- return null;
+ return result;
}
/**
@@ -354,7 +359,7 @@
*
* @param e an Exception.
* @param m a message.
- * @deprecated
+ * @deprecated use log(String,Throwable) instead
*/
public void log(Exception e, String m)
{
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]