org.apache.cocoon.transformation.helpers
Class DefaultIncludeCacheManager

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.transformation.helpers.DefaultIncludeCacheManager
All Implemented Interfaces:
Disposable, Component, LogEnabled, Parameterizable, Serviceable, ThreadSafe, IncludeCacheManager

public final class DefaultIncludeCacheManager
extends AbstractLogEnabled
implements IncludeCacheManager, ThreadSafe, Serviceable, Disposable, Parameterizable, Component

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:
CVS $Id: DefaultIncludeCacheManager.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Carsten Ziegeler

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, XMLConsumer handler)
          Stream the content of the absolute URI.
 void terminateSession(IncludeCacheManagerSession session)
          Terminate the session.
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
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,
                   SourceException
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
SourceException
See Also:
IncludeCacheManager.load(java.lang.String, IncludeCacheManagerSession)

stream

public void stream(String uri,
                   IncludeCacheManagerSession session,
                   XMLConsumer handler)
            throws IOException,
                   SourceException,
                   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:
IOException
SourceException
SAXException
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-2010 The Apache Software Foundation. All Rights Reserved.