Package org.apache.turbine.services.pull
Interface PullService
- All Known Implementing Classes:
TurbinePullService
The Pull Service manages the creation of application
tools that are available to all templates in a
Turbine application. By using the Pull Service you
can avoid having to make Screens to populate a
context for use in a particular template. The Pull
Service creates a set of tools, as specified in
the TR.props file.
These tools can have global scope, request scope,
authorized or session scope (i.e. stored in user temp hashmap)
or persistent scope (i.e. stored in user perm hashmap)
The standard way of referencing these global
tools is through the toolbox handle. This handle
is typically $toolbox, but can be specified in the
TR.props file.
So, for example, if you had a UI Manager tool
which created a set of UI attributes from a
properties file, and one of the properties
was 'bgcolor', then you could access this
UI attribute with $ui.bgcolor. The identifier
that is given to the tool, in this case 'ui', can
be specified as well.
- Version:
- $Id$
- Author:
- Jason van Zyl, Henning P. Schmiedehausen, Peter Courcoux
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Property Key for the authorized toolsstatic final String
Property Key for the global toolsstatic final String
Property Key for the persistent toolsstatic final String
Property Key for the request toolsstatic final String
The key under which this service is stored in TurbineServices.static final String
Property Key for the session toolsstatic final String
prefix for key used in the session to store session scope pull toolsstatic final String
Default value for the application tool resources.static final String
Property tag for application tool resources directorystatic final boolean
Default value for per request tool refreshingstatic final String
Property tag for per request tool refreshing (for obvious reasons has no effect for per-request tools) -
Method Summary
Modifier and TypeMethodDescriptionReturn the absolute path of the resources directory used by application tools.org.apache.velocity.context.Context
Get the context containing global tools that will be use as part of the Turbine Pull Model.Return the resources directory.void
populateContext
(org.apache.velocity.context.Context context, PipelineData pipelineData) Populate the given context with all request, session, authorized and persistent scope tools (it is assumed that the context already wraps the global context, and thus already contains the global tools).void
populateContext
(org.apache.velocity.context.Context context, RunData data) Populate the given context with all request, session, authorized and persistent scope tools (it is assumed that the context already wraps the global context, and thus already contains the global tools).void
releaseTools
(org.apache.velocity.context.Context context) Release tool instances from the given context to the object poolMethods inherited from interface org.apache.turbine.services.Initable
getInit, init, init, setInitableBroker, shutdown
Methods inherited from interface org.apache.turbine.services.Service
getConfiguration, getName, getProperties, setName, setServiceBroker
-
Field Details
-
SERVICE_NAME
The key under which this service is stored in TurbineServices.- See Also:
-
GLOBAL_TOOL
Property Key for the global tools- See Also:
-
REQUEST_TOOL
Property Key for the request tools- See Also:
-
SESSION_TOOL
Property Key for the session tools- See Also:
-
AUTHORIZED_TOOL
Property Key for the authorized tools- See Also:
-
PERSISTENT_TOOL
Property Key for the persistent tools- See Also:
-
TOOL_RESOURCES_DIR_KEY
Property tag for application tool resources directory- See Also:
-
TOOL_RESOURCES_DIR_DEFAULT
Default value for the application tool resources. This is relative to the webapp root- See Also:
-
TOOLS_PER_REQUEST_REFRESH_KEY
Property tag for per request tool refreshing (for obvious reasons has no effect for per-request tools)- See Also:
-
TOOLS_PER_REQUEST_REFRESH_DEFAULT
Default value for per request tool refreshing- See Also:
-
SESSION_TOOLS_ATTRIBUTE_PREFIX
prefix for key used in the session to store session scope pull tools- See Also:
-
-
Method Details
-
getGlobalContext
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.
-
populateContext
Populate the given context with all request, session, authorized 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 populatepipelineData
- a RunData object for request specific data
-
populateContext
Populate the given context with all request, session, authorized 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 populatedata
- a RunData object for request specific data
-
getAbsolutePathToResourcesDirectory
Return the absolute path of the resources directory used by application tools.- Returns:
- A directory path in the file system or null.
-
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.
-
releaseTools
Release tool instances from the given context to the object pool- Parameters:
context
- a Velocity Context to release tools from
-