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

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.portal.coplet.adapter.impl.AbstractCopletAdapter
All Implemented Interfaces:
Component, LogEnabled, Serviceable, ThreadSafe, CopletAdapter
Direct Known Subclasses:
PortletAdapter, URICopletAdapter

public abstract class AbstractCopletAdapter
extends AbstractLogEnabled
implements CopletAdapter, ThreadSafe, Serviceable

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

Field Summary
protected  ServiceManager manager
          The service manager
 
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
 void service(ServiceManager manager)
           
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.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
 

Field Detail

manager

protected ServiceManager manager
The service manager

Constructor Detail

AbstractCopletAdapter

public AbstractCopletAdapter()
Method Detail

service

public void service(ServiceManager manager)
             throws ServiceException
Specified by:
service in interface Serviceable
Throws:
ServiceException

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

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

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

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

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-2010 The Apache Software Foundation. All Rights Reserved.