org.apache.cocoon.transformation.helpers
Class DefaultIncludeCacheManager

java.lang.Object
  extended byorg.apache.cocoon.util.AbstractLogEnabled
      extended byorg.apache.cocoon.transformation.helpers.DefaultIncludeCacheManager
All Implemented Interfaces:
Disposable, IncludeCacheManager, Parameterizable, Serviceable, ThreadSafe

public final class DefaultIncludeCacheManager
extends org.apache.cocoon.util.AbstractLogEnabled
implements IncludeCacheManager, ThreadSafe, Serviceable, Disposable, Parameterizable

Default implementation of a IncludeCacheManager. This implementation requires a configuration, if preemptive loading is used: <parameter name="preemptive-loader-url" value="some url"/> This is a url inside cocoon, that contains the preemptive loader url; it must be specified absolute (with http://...) If this loader cannot be started, only an error is logged into the log, so actually cached content is never updated!

Since:
2.1
Version:
$Id: DefaultIncludeCacheManager.html 1304280 2012-03-23 11:18:01Z ilgrosso $

Field Summary
 
Fields inherited from interface org.apache.cocoon.transformation.helpers.IncludeCacheManager
ROLE
 
Constructor Summary
DefaultIncludeCacheManager()
           
 
Method Summary
 void dispose()
           
 IncludeCacheManagerSession getSession(Parameters pars)
          Create a session for this request.
 String load(String uri, IncludeCacheManagerSession session)
          This informs the manager that a URI should be "loaded".
 void parameterize(Parameters parameters)
           
 void service(ServiceManager manager)
           
 void stream(String uri, IncludeCacheManagerSession session, org.apache.cocoon.xml.XMLConsumer handler)
          Stream the content of the absolute URI.
 void terminateSession(IncludeCacheManagerSession session)
          Terminate the session.
 
Methods inherited from class org.apache.cocoon.util.AbstractLogEnabled
getLogger, setLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultIncludeCacheManager

public DefaultIncludeCacheManager()
Method Detail

getSession

public IncludeCacheManagerSession getSession(Parameters pars)
Description copied from interface: IncludeCacheManager
Create a session for this request. This should be invoked first and only one per request. It is required to terminate the session with IncludeCacheManager.terminateSession(IncludeCacheManagerSession)

Specified by:
getSession in interface IncludeCacheManager
Parameters:
pars - The configuration
Returns:
CacheManagerSession The session that should be used with all other commands.
See Also:
IncludeCacheManager.getSession(org.apache.avalon.framework.parameters.Parameters)

load

public String load(String uri,
                   IncludeCacheManagerSession session)
            throws IOException
Description copied from interface: IncludeCacheManager
This informs the manager that a URI should be "loaded".

Specified by:
load in interface IncludeCacheManager
Parameters:
uri - The URI to load (maybe relative)
session - The corresponding session created by IncludeCacheManager.getSession(Parameters)
Returns:
String The absolute URI that must be used for IncludeCacheManager.stream(String, IncludeCacheManagerSession, XMLConsumer)
Throws:
IOException
See Also:
IncludeCacheManager.load(java.lang.String, IncludeCacheManagerSession)

stream

public void stream(String uri,
                   IncludeCacheManagerSession session,
                   org.apache.cocoon.xml.XMLConsumer handler)
            throws IOException,
                   SAXException
Description copied from interface: IncludeCacheManager
Stream the content of the absolute URI. Depending on the configuration and state of the cache, the content is either taken from the cache, fetched etc.

Specified by:
stream in interface IncludeCacheManager
Parameters:
uri - The absolute URI returned by IncludeCacheManager.load(String, IncludeCacheManagerSession)
session - The current session
handler - The receiver of the SAX events
Throws:
SAXException
IOException
See Also:
IncludeCacheManager.stream(java.lang.String, IncludeCacheManagerSession, XMLConsumer)

terminateSession

public void terminateSession(IncludeCacheManagerSession session)
Description copied from interface: IncludeCacheManager
Terminate the session. This method must be executed at the end of the request.

Specified by:
terminateSession in interface IncludeCacheManager
Parameters:
session - The caching session.
See Also:
IncludeCacheManager.terminateSession(IncludeCacheManagerSession)

service

public void service(ServiceManager manager)
             throws ServiceException
Specified by:
service in interface Serviceable
Throws:
ServiceException
See Also:
Serviceable.service(org.apache.avalon.framework.service.ServiceManager)

dispose

public void dispose()
Specified by:
dispose in interface Disposable
See Also:
Disposable.dispose()

parameterize

public void parameterize(Parameters parameters)
                  throws ParameterException
Specified by:
parameterize in interface Parameterizable
Throws:
ParameterException
See Also:
Parameterizable.parameterize(org.apache.avalon.framework.parameters.Parameters)


Copyright 1999-2008 The Apache Software Foundation. All Rights Reserved.