org.apache.cocoon.portal.coplet.adapter.impl
Class AbstractCopletAdapter

java.lang.Object
  extended byorg.apache.avalon.framework.logger.AbstractLogEnabled
      extended byorg.apache.cocoon.portal.impl.AbstractComponent
          extended byorg.apache.cocoon.portal.coplet.adapter.impl.AbstractCopletAdapter
All Implemented Interfaces:
Contextualizable, CopletAdapter, Disposable, Initializable, LogEnabled, Serviceable, ThreadSafe
Direct Known Subclasses:
PortletAdapter, URICopletAdapter, WSRPAdapter

public abstract class AbstractCopletAdapter
extends AbstractComponent
implements CopletAdapter

This is the abstract base adapter to use pipelines as coplets

Configuration

buffer Shall the content of the coplet be buffered? If a coplet is buffered, errors local to the coplet are caught and a not availability notice is delivered instead. Buffering does not cache responses for subsequent requests. boolean false
timeout Max time in seconds content delivery may take. After a timeout, a not availability notice is delivered. Setting a timeout automatically turns on buffering. int null

Version:
$Id: AbstractCopletAdapter.java 322495 2005-10-16 17:52:43Z cziegeler $

Field Summary
 
Fields inherited from class org.apache.cocoon.portal.impl.AbstractComponent
context, manager, portalService
 
Fields inherited from interface org.apache.cocoon.portal.coplet.adapter.CopletAdapter
ROLE
 
Constructor Summary
AbstractCopletAdapter()
           
 
Method Summary
 void destroy(CopletInstanceData coplet)
          Destroy the coplet This method is invoked when a coplet instance will be destroyed For each coplet, this method is only invoked once.
protected  Object getConfiguration(CopletInstanceData coplet, String key)
          Get a configuration value First the coplet data is queried and if it doesn't provide an attribute with the given name, the coplet base data is used.
protected  Object getConfiguration(CopletInstanceData coplet, String key, Object defaultValue)
          Get a configuration value First the coplet data is queried and if it doesn't provide an attribute with the given name, the coplet base data is used.
 void init(CopletInstanceData coplet)
          Initialize the coplet This method is called immediately after a new instance is created.
 void login(CopletInstanceData coplet)
          User logs in to a coplet This method is invoked when a user logs in for each coplet instance of the user
 void logout(CopletInstanceData coplet)
          User logs out from a coplet This method is invoked when a user logs out for each coplet instance of this user.
protected  boolean renderErrorContent(CopletInstanceData coplet, ContentHandler handler, Exception error)
          Render the error content for a coplet
abstract  void streamContent(CopletInstanceData coplet, ContentHandler contentHandler)
          Implement this and not toSAX()
 void toSAX(CopletInstanceData coplet, ContentHandler contentHandler)
          This method streams the content of a coplet instance data.
 
Methods inherited from class org.apache.cocoon.portal.impl.AbstractComponent
contextualize, dispose, initialize, service
 
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

AbstractCopletAdapter

public AbstractCopletAdapter()
Method Detail

getConfiguration

protected Object getConfiguration(CopletInstanceData coplet,
                                  String key)
Get a configuration value First the coplet data is queried and if it doesn't provide an attribute with the given name, the coplet base data is used.


getConfiguration

protected Object getConfiguration(CopletInstanceData coplet,
                                  String key,
                                  Object defaultValue)
Get a configuration value First the coplet data is queried and if it doesn't provide an attribute with the given name, the coplet base data is used. If no value is found the default value is returned.


streamContent

public abstract void streamContent(CopletInstanceData coplet,
                                   ContentHandler contentHandler)
                            throws SAXException
Implement this and not toSAX()

Throws:
SAXException

toSAX

public void toSAX(CopletInstanceData coplet,
                  ContentHandler contentHandler)
           throws SAXException
This method streams the content of a coplet instance data. It handles buffering and timeout setting and calls streamContent(CopletInstanceData, ContentHandler) for creating the content.

Specified by:
toSAX in interface CopletAdapter
Throws:
SAXException
See Also:
CopletAdapter.toSAX(org.apache.cocoon.portal.coplet.CopletInstanceData, org.xml.sax.ContentHandler)

init

public void init(CopletInstanceData coplet)
Description copied from interface: CopletAdapter
Initialize the coplet This method is called immediately after a new instance is created. For each coplet, this method is only invoked once.

Specified by:
init in interface CopletAdapter
Parameters:
coplet - The coplet
See Also:
CopletAdapter.init(org.apache.cocoon.portal.coplet.CopletInstanceData)

destroy

public void destroy(CopletInstanceData coplet)
Description copied from interface: CopletAdapter
Destroy the coplet This method is invoked when a coplet instance will be destroyed For each coplet, this method is only invoked once.

Specified by:
destroy in interface CopletAdapter
Parameters:
coplet -
See Also:
CopletAdapter.destroy(org.apache.cocoon.portal.coplet.CopletInstanceData)

login

public void login(CopletInstanceData coplet)
Description copied from interface: CopletAdapter
User logs in to a coplet This method is invoked when a user logs in for each coplet instance of the user

Specified by:
login in interface CopletAdapter
See Also:
CopletAdapter.login(org.apache.cocoon.portal.coplet.CopletInstanceData)

logout

public void logout(CopletInstanceData coplet)
Description copied from interface: CopletAdapter
User logs out from a coplet This method is invoked when a user logs out for each coplet instance of this user.

Specified by:
logout in interface CopletAdapter
See Also:
CopletAdapter.logout(org.apache.cocoon.portal.coplet.CopletInstanceData)

renderErrorContent

protected boolean renderErrorContent(CopletInstanceData coplet,
                                     ContentHandler handler,
                                     Exception error)
                              throws SAXException
Render the error content for a coplet

Parameters:
coplet - The coplet instance data
handler - The content handler
error - The exception that occured
Returns:
True if the error content has been rendered, otherwise false
Throws:
SAXException


Copyright ? 1999-2005 The Apache Software Foundation. All Rights Reserved.