org.apache.turbine.services.pull
Class TurbinePull

java.lang.Object
  |
  +--org.apache.turbine.services.pull.TurbinePull

public abstract class TurbinePull
extends java.lang.Object

This is a Facade class for PullService. This class provides static methods that call related methods of the implementation of the PullService used by the System, according to the settings in TurbineResources.

Version:
$Id: TurbinePull.java,v 1.1.1.1 2001/08/16 05:09:10 jvanzyl Exp $
Author:
Jason van Zyl, Daniel Rall

Constructor Summary
TurbinePull()
           
 
Method Summary
static java.lang.String getAbsolutePathToResourcesDirectory()
          Return the absolute path of resources directory where tools store resource information.
static org.apache.velocity.context.Context getGlobalContext()
          Get the ToolBox that was created by Pull Service during early initialization.
static java.lang.String getResourcesDirectory()
          Return the resources directory.
protected static PullService getService()
          Utility method for accessing the service implementation
static ApplicationTool getTool(org.apache.velocity.context.Context context, java.lang.String name)
          Helper method that allows you to easily get a tool from a Context.
static boolean isRegistered()
          Checks whether this service has been registered.
static void populateContext(org.apache.velocity.context.Context context, RunData data)
          Populate the given context with all request, session and persistent scope tools (it is assumed that the context already wraps the global context, and thus already contains the global tools).
static void refreshGlobalTools()
          Refresh the global tools.
static boolean refreshToolsPerRequest()
          Shoud we refresh the tools on each request.
static void releaseTools(org.apache.velocity.context.Context context)
          Release tool instances from the given context to the object pool
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Constructor Detail

TurbinePull

public TurbinePull()
Method Detail

getService

protected static PullService getService()
Utility method for accessing the service implementation
Returns:
a PullService implementation instance

getGlobalContext

public static final org.apache.velocity.context.Context getGlobalContext()
Get the ToolBox that was created by Pull Service during early initialization. This method is used by the various template services that are available for use in Turbine, but specifically the TurbineVelocityService.

isRegistered

public static final boolean isRegistered()
Checks whether this service has been registered. This is required by the TurbineVelocityService so it can determine whether to attempt to place the ToolBox in the context.

So users can use Turbine with templates in the traditional manner. If the Pull Service is not listed in TurbineResources.props, or no tools are specified the TurbineVelocityService will behave in its traditional manner.


getAbsolutePathToResourcesDirectory

public static final java.lang.String getAbsolutePathToResourcesDirectory()
Return the absolute path of resources directory where tools store resource information.

getResourcesDirectory

public static final java.lang.String getResourcesDirectory()
Return the resources directory. This is relative to the webapp context.

populateContext

public static void populateContext(org.apache.velocity.context.Context context,
                                   RunData data)
Populate the given context with all request, session and persistent scope tools (it is assumed that the context already wraps the global context, and thus already contains the global tools).
Parameters:
context - a Velocity Context to populate
data - a RunData object for request specific data

refreshGlobalTools

public static final void refreshGlobalTools()
Refresh the global tools. This is necessary for development work where tools depend on configuration information. The configuration information is typically cached after initialization but during development you might want the tool to refresh itself on each request.

If there are objects that don't implement application ApplicationTool then they won't be refreshed.


refreshToolsPerRequest

public static final boolean refreshToolsPerRequest()
Shoud we refresh the tools on each request. For development purposes.

releaseTools

public static void releaseTools(org.apache.velocity.context.Context context)
Release tool instances from the given context to the object pool
Parameters:
context - a Velocity Context to release tools from

getTool

public static ApplicationTool getTool(org.apache.velocity.context.Context context,
                                      java.lang.String name)
Helper method that allows you to easily get a tool from a Context. Essentially, it just does the cast to an Application tool for you.
Parameters:
context - a Velocity Context to get tools from
name - the name of the tool to get
Returns:
ApplicationTool null if no tool could be found


Copyright © 2000-2002 Apache Software Foundation. All Rights Reserved.