org.codehaus.plexus.summit.pull
Class DefaultPullService

java.lang.Object
  extended byorg.codehaus.plexus.logging.AbstractLogEnabled
      extended byorg.codehaus.plexus.summit.pull.DefaultPullService
All Implemented Interfaces:
org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable, org.codehaus.plexus.personality.plexus.lifecycle.phase.Disposable, org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable, org.codehaus.plexus.logging.LogEnabled, PullService

public class DefaultPullService
extends org.codehaus.plexus.logging.AbstractLogEnabled
implements PullService, org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable, org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable, org.codehaus.plexus.personality.plexus.lifecycle.phase.Disposable

This is a default implementation of the pull service. It takes avalon components and sticks them in the context. It supports global and request tools fully. Session tools are untested and may need further work.

Since:
Feb 12, 2003
Author:
Dan Diephouse

Field Summary
private  org.codehaus.plexus.PlexusContainer container
           
static java.lang.String GLOBAL_SCOPE
           
private  java.util.Map globalTools
           
static java.lang.String REQUEST_SCOPE
           
private  java.util.Map requestTools
           
static java.lang.String SESSION_SCOPE
           
private  java.util.Map sessionTools
           
private  java.util.List tools
           
 
Fields inherited from class org.codehaus.plexus.logging.AbstractLogEnabled
 
Fields inherited from interface org.codehaus.plexus.summit.pull.PullService
ROLE
 
Constructor Summary
DefaultPullService()
           
 
Method Summary
 void contextualize(org.codehaus.plexus.context.Context context)
           
 void dispose()
           
private  void disposeGlobalTools()
          Method releaseGlobalTools.
 void initialize()
           
 void populateContext(ViewContext 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).
protected  void populateWithGlobalTools(ViewContext context)
           
protected  void populateWithRequestTools(ViewContext context, RunData data)
           
protected  void populateWithSessionTools(ViewContext context, RunData data)
          An attempt to populate the session with tools.
 void releaseTools(ViewContext context)
          Release tool instances from the given context to the object pool
protected  void releaseTools(ViewContext context, java.util.Map tools)
           
protected  void setRequestRunData(java.lang.Object component, RunData data)
          Set the appropriate runtime data for components that extend RequestTool.
 
Methods inherited from class org.codehaus.plexus.logging.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GLOBAL_SCOPE

public static final java.lang.String GLOBAL_SCOPE
See Also:
Constant Field Values

REQUEST_SCOPE

public static final java.lang.String REQUEST_SCOPE
See Also:
Constant Field Values

SESSION_SCOPE

public static final java.lang.String SESSION_SCOPE
See Also:
Constant Field Values

globalTools

private java.util.Map globalTools

sessionTools

private java.util.Map sessionTools

requestTools

private java.util.Map requestTools

container

private org.codehaus.plexus.PlexusContainer container

tools

private java.util.List tools
Constructor Detail

DefaultPullService

public DefaultPullService()
Method Detail

contextualize

public void contextualize(org.codehaus.plexus.context.Context context)
                   throws org.codehaus.plexus.context.ContextException
Specified by:
contextualize in interface org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable
Throws:
org.codehaus.plexus.context.ContextException

initialize

public void initialize()
                throws org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException
Specified by:
initialize in interface org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable
Throws:
org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException

populateContext

public void populateContext(ViewContext context,
                            RunData data)
Description copied from interface: PullService
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).

Specified by:
populateContext in interface PullService
Parameters:
context - a ViewContext to populate
data - a RunData object for request specific data

populateWithGlobalTools

protected void populateWithGlobalTools(ViewContext context)

populateWithRequestTools

protected void populateWithRequestTools(ViewContext context,
                                        RunData data)

populateWithSessionTools

protected void populateWithSessionTools(ViewContext context,
                                        RunData data)
An attempt to populate the session with tools. This is largely untested and it is not clear yet how we are to know when to release() the components after the session expires.

Parameters:
context -
data -

setRequestRunData

protected void setRequestRunData(java.lang.Object component,
                                 RunData data)
Set the appropriate runtime data for components that extend RequestTool.

Parameters:
component -

releaseTools

public void releaseTools(ViewContext context)
Description copied from interface: PullService
Release tool instances from the given context to the object pool

Specified by:
releaseTools in interface PullService
Parameters:
context - a ViewContext to release tools from

releaseTools

protected void releaseTools(ViewContext context,
                            java.util.Map tools)
                     throws java.lang.Exception
Throws:
java.lang.Exception

dispose

public void dispose()
Specified by:
dispose in interface org.codehaus.plexus.personality.plexus.lifecycle.phase.Disposable

disposeGlobalTools

private void disposeGlobalTools()
                         throws java.lang.Exception
Method releaseGlobalTools.

Throws:
java.lang.Exception