org.apache.turbine.services.pull
Class TurbinePull

java.lang.Object
  extended byorg.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 534527 2007-05-02 16:10:59Z tv $
Author:
Jason van Zyl, Daniel Rall, Henning P. Schmiedehausen

Constructor Summary
TurbinePull()
           
 
Method Summary
static java.lang.String getAbsolutePathToResourcesDirectory()
          Return the absolute path of the resources directory used by application tools.
static org.apache.velocity.context.Context getGlobalContext()
          Get the context containing global tools that will be use as part of the Turbine Pull Model.
static java.lang.String getResourcesDirectory()
          Return the resources directory.
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()
          Deprecated. No longer needed as Pull and Velocity Service are now more separate.
static boolean refreshToolsPerRequest()
          Deprecated. No longer needed as Pull and Velocity Service are now more separate.
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, toString, wait, wait, wait
 

Constructor Detail

TurbinePull

public TurbinePull()
Method Detail

getService

public 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 context containing global tools that will be use as part of the Turbine Pull Model.

Returns:
A Context object which contains the Global Tool instances.

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 the resources directory used by application tools.

Returns:
A directory path in the file system or null.

getResourcesDirectory

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

Returns:
A directory path to the resources directory relative to the webapp root or null.

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()
Deprecated. No longer needed as Pull and Velocity Service are now more separate.

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 the ApplicationTool interface, then they won't be refreshed.


refreshToolsPerRequest

public static final boolean refreshToolsPerRequest()
Deprecated. No longer needed as Pull and Velocity Service are now more separate.

Shoud we refresh the tools on each request. For development purposes.

Returns:
true if we should refresh the tools on every request.

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-2008 Apache Software Foundation. All Rights Reserved.