org.apache.cocoon.portal.transformation
Class AbstractCopletTransformer

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.xml.AbstractXMLProducer
          extended by org.apache.cocoon.xml.AbstractXMLPipe
              extended by org.apache.cocoon.transformation.AbstractTransformer
                  extended by org.apache.cocoon.transformation.AbstractSAXTransformer
                      extended by org.apache.cocoon.portal.transformation.AbstractCopletTransformer
All Implemented Interfaces:
Poolable, Recyclable, Disposable, Component, Configurable, LogEnabled, Serviceable, SitemapModelComponent, Transformer, XMLPipe, XMLProducer, XMLConsumer, ContentHandler, LexicalHandler
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:
CVS $Id: AbstractCopletTransformer.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Carsten Ziegeler

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, emptyAttributes, 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
protected  PortalService getPortalService()
          Deprecated. Use directly the instance variable.
 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

getPortalService

protected PortalService getPortalService()
                                  throws SAXException
Deprecated. Use directly the instance variable.

Get the portal service.

Throws:
SAXException

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