org.apache.cocoon.portal.transformation
Class AbstractCopletTransformer

java.lang.Object
  extended byorg.apache.avalon.framework.logger.AbstractLogEnabled
      extended byorg.apache.cocoon.xml.AbstractXMLProducer
          extended byorg.apache.cocoon.xml.AbstractXMLPipe
              extended byorg.apache.cocoon.transformation.AbstractTransformer
                  extended byorg.apache.cocoon.transformation.AbstractSAXTransformer
                      extended byorg.apache.cocoon.portal.transformation.AbstractCopletTransformer
All Implemented Interfaces:
Configurable, ContentHandler, Disposable, LexicalHandler, LogEnabled, Poolable, Recyclable, Serviceable, SitemapModelComponent, Transformer, XMLConsumer, XMLConsumer, XMLPipe, XMLProducer
Direct Known Subclasses:
CopletTransformer, EventLinkTransformer, HTMLEventLinkTransformer, NewEventLinkTransformer

public abstract class AbstractCopletTransformer
extends AbstractSAXTransformer

Abstract transformer implementation that provides some useful methods and functionality. The portal service is stored in the instance variable portalService and can be used. There are some methods to fetch a coplet instance data. getCopletInstanceData() tries to get the instance associated with the current request and getCopletInstanceData(String) fetches an instance with a given id. If you want to get the coplet instance data associated with the current request, there are three possibilities how the transformer obtains the information required for getting the coplet instance data - or more precisly its id:

1) If it is used within a coplet pipeline and this pipeline is called using the "cocoon:" protocol, all required information is passed automatically.
2) The id can be passed to the transformer as sitemap paremeters in the following way:

<map:transform type="coplet">
 	    <map:parameter name="copletId" type="examplecoplet"/>
    </map:transform>
3) Any component can set the id as a string in the object model of the current request. This is the name of the key to be used: Constants.COPLET_ID_KEY.

Version:
$Id: AbstractCopletTransformer.java 322475 2005-10-16 14:26:44Z cziegeler $

Field Summary
static String COPLET_ID_PARAM
          Parameter name for the coplet id.
protected  PortalService portalService
          The portal service.
 
Fields inherited from class org.apache.cocoon.transformation.AbstractSAXTransformer
context, defaultNamespaceURI, EMPTY_ATTRIBUTES, ignoreEmptyCharacters, ignoreEventsCount, ignoreHooksCount, ignoreWhitespaces, manager, namespaceURI, objectModel, parameters, recorderStack, request, resolver, response, source, stack
 
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumer
 
Fields inherited from interface org.apache.cocoon.transformation.Transformer
ROLE
 
Constructor Summary
AbstractCopletTransformer()
           
 
Method Summary
 void dispose()
           
protected  CopletInstanceData getCopletInstanceData()
          Try to get the coplet instance data belonging to the current request
protected  CopletInstanceData getCopletInstanceData(String copletId)
          Try to get the coplet instance data with the given id
 void service(ServiceManager manager)
           
 
Methods inherited from class org.apache.cocoon.transformation.AbstractSAXTransformer
addRecorder, characters, comment, configure, endCDATA, endDocument, endDTD, endElement, endEntity, endParametersRecording, endParametersRecording, endPrefixMapping, endRecording, endSAXRecording, endSerializedXMLRecording, endTextRecording, endTransformingElement, findPrefixMapping, getMutableAttributes, ignorableWhitespace, processingInstruction, recycle, removeRecorder, sendEndElementEvent, sendEndElementEventNS, sendEndPrefixMapping, sendEvents, sendParametersEvents, sendStartElementEvent, sendStartElementEvent, sendStartElementEventNS, sendStartElementEventNS, sendStartPrefixMapping, sendTextEvent, setDocumentLocator, setup, setupTransforming, skippedEntity, startCDATA, startDocument, startDTD, startElement, startEntity, startParametersRecording, startPrefixMapping, startRecording, startSAXRecording, startSerializedXMLRecording, startTextRecording, startTransformingElement
 
Methods inherited from class org.apache.cocoon.xml.AbstractXMLProducer
setConsumer, setContentHandler, setLexicalHandler
 
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
 
Methods inherited from interface org.apache.cocoon.xml.XMLProducer
setConsumer
 

Field Detail

COPLET_ID_PARAM

public static final String COPLET_ID_PARAM
Parameter name for the coplet id.

See Also:
Constant Field Values

portalService

protected PortalService portalService
The portal service. @since 2.1.8

Constructor Detail

AbstractCopletTransformer

public AbstractCopletTransformer()
Method Detail

getCopletInstanceData

protected CopletInstanceData getCopletInstanceData()
                                            throws SAXException
Try to get the coplet instance data belonging to the current request

Returns:
The coplet instance data
Throws:
SAXException - If an errors occurs or the instance data is not available

getCopletInstanceData

protected CopletInstanceData getCopletInstanceData(String copletId)
                                            throws SAXException
Try to get the coplet instance data with the given id

Parameters:
copletId - The id of the coplet instance or null if this transformer is used inside a coplet pipeline
Returns:
The coplet instance data or null
Throws:
SAXException - If an error occurs

service

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

dispose

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


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