jvanzyl 01/06/14 07:42:13
Modified: src/java/org/apache/turbine/services/pull
TurbinePullService.java
Log:
- updating service as per notes.
Revision Changes Path
1.25 +34 -33
jakarta-turbine/src/java/org/apache/turbine/services/pull/TurbinePullService.java
Index: TurbinePullService.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/pull/TurbinePullService.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- TurbinePullService.java 2001/06/08 01:27:46 1.24
+++ TurbinePullService.java 2001/06/14 14:42:12 1.25
@@ -57,7 +57,6 @@
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import java.util.Properties;
import java.util.Vector;
import org.apache.velocity.VelocityContext;
@@ -65,18 +64,20 @@
import org.apache.turbine.om.security.User;
+import org.apache.turbine.util.RunData;
+
+import org.apache.turbine.services.BaseService;
import org.apache.turbine.services.InitializationException;
-import org.apache.turbine.services.TurbineBaseService;
import org.apache.turbine.services.TurbineServices;
import org.apache.turbine.services.pool.PoolService;
import org.apache.turbine.services.pull.ApplicationTool;
-import org.apache.turbine.services.resources.ResourceService;
-import org.apache.turbine.services.resources.TurbineResources;
-import org.apache.turbine.services.servlet.TurbineServlet;
-import org.apache.turbine.util.Log;
-import org.apache.turbine.util.RunData;
-import org.apache.turbine.util.ServletUtils;
+//!! this has to go away. there should be an interface
+// for Configuration in the commons. i don't even like
+// this here but is required for placing the tools
+// in the context. maybe we can get rid of needing
+// this all together.
+import org.apache.velocity.runtime.configuration.Configuration;
/**
* <p>
@@ -147,9 +148,10 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Sean Legassick</a>
- * @version $Id: TurbinePullService.java,v 1.24 2001/06/08 01:27:46 jon Exp $
+ * @version $Id: TurbinePullService.java,v 1.25 2001/06/14 14:42:12 jvanzyl Exp $
*/
-public class TurbinePullService extends TurbineBaseService
+public class TurbinePullService
+ extends BaseService
implements PullService
{
/**
@@ -192,8 +194,7 @@
private List persistentTools;
/**
- * The property tags that are used in conjunction with
- * TurbineResources.getOrderedValues(String) to get
+ * The property tags that are used in to get
* our list of tools to instantiate (one tag for each
* type of tool).
*/
@@ -243,7 +244,8 @@
/**
* Called the first time the Service is used.
*/
- public void init() throws InitializationException
+ public void init()
+ throws InitializationException
{
try
{
@@ -269,13 +271,11 @@
*/
private void initPull() throws Exception
{
- Properties props = getProperties();
-
/*
* Get the resources directory that is specificed
* in the TR.props or default to "/resources".
*/
- resourcesDirectory = TurbineResources.getString(
+ resourcesDirectory = getConfiguration().getString(
TOOL_RESOURCES_DIR,
TOOL_RESOURCES_DIR_DEFAULT);
@@ -286,24 +286,24 @@
* because a tool might need to know this value
* for it to initialize correctly.
*/
- absolutePathToResourcesDirectory =
- TurbineServlet.getRealPath(resourcesDirectory);
+ absolutePathToResourcesDirectory = getRealPath(resourcesDirectory);
/*
* Should we refresh the tool box on a per
* request basis.
*/
- refreshToolsPerRequest =
- new Boolean(properties.getProperty(
- TOOLS_PER_REQUEST_REFRESH)).booleanValue();
+ refreshToolsPerRequest = getConfiguration()
+ .getBoolean(TOOLS_PER_REQUEST_REFRESH);
/*
* Log the fact that the application tool box will
* be refreshed on a per request basis.
*/
if (refreshToolsPerRequest)
- Log.info("Pull Model tools will "
+ {
+ getCategory().info("Pull Model tools will "
+ "be refreshed on a per request basis.");
+ }
/*
* Make sure to set init true because Tools may make
@@ -326,6 +326,7 @@
*
* tool.persistent.ui =
org.apache.turbine.services.pull.util.PersistentUIManager
*/
+
globalTools = getTools(GLOBAL_TOOL);
requestTools = getTools(REQUEST_TOOL);
sessionTools = getTools(SESSION_TOOL);
@@ -347,10 +348,10 @@
private List getTools(String keyPrefix)
{
List classes = new ArrayList();
-
- ResourceService toolResources =
- TurbineResources.getResources(keyPrefix);
-
+
+ Configuration toolResources =
+ getConfiguration().subset(keyPrefix);
+
/*
* There might not be any tools for this prefix
* so return an empty list.
@@ -378,12 +379,12 @@
*/
classes.add(new ToolData(toolName, toolClassName, toolClass));
- Log.info("Instantiated tool class " + toolClassName
+ getCategory().info("Instantiated tool class " + toolClassName
+ " to add to the context as '$" + toolName + "'");
}
catch (Exception e)
{
- Log.error("Cannot find tool class " + toolClassName
+ getCategory().error("Cannot find tool class " + toolClassName
+ ", please check the name of the class.");
}
}
@@ -450,8 +451,8 @@
}
catch (Exception e)
{
- Log.error(
- "Could not instantiate tool " + toolData.toolClassName
+ getCategory().error(
+ "Could not instantiate tool " + toolData.toolClassName
+ " to add to the context" , e );
}
}
@@ -487,8 +488,8 @@
}
catch (Exception e)
{
- Log.error(
- "Could not instantiate tool " + toolData.toolClassName
+ getCategory().error(
+ "Could not instantiate tool " + toolData.toolClassName
+ " to add to the context",e);
}
}
@@ -558,7 +559,7 @@
}
catch (Exception e)
{
- Log.error(
+ getCategory().error(
"Could not instantiate tool " + toolData.toolClassName
+ " to add to the context");
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]