org.apache.cocoon.portal.transformation
abstract public class: AbstractCopletTransformer [javadoc |
source]
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.cocoon.xml.AbstractXMLProducer
org.apache.cocoon.xml.AbstractXMLPipe
org.apache.cocoon.transformation.AbstractTransformer
org.apache.cocoon.transformation.AbstractSAXTransformer
org.apache.cocoon.portal.transformation.AbstractCopletTransformer
All Implemented Interfaces:
org.apache.avalon.framework.activity.Disposable, org.apache.avalon.framework.service.Serviceable, org.apache.avalon.framework.configuration.Configurable, Transformer, XMLPipe, org.apache.avalon.excalibur.pool.Recyclable, XMLProducer
Direct Known Subclasses:
NewEventLinkTransformer, EventLinkTransformer, CopletTransformer, HTMLEventLinkTransformer
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:
org.apache.cocoon.portal.Constants#COPLET_ID_KEY .
- author:
< - a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler
- version:
CVS - $Id: AbstractCopletTransformer.java 433543 2006-08-22 06:22:54Z crossley $
| Field Summary |
|---|
| public static final String | COPLET_ID_PARAM | Parameter name for the coplet id. |
| protected PortalService | portalService | The portal service. @since 2.1.8 |
| Fields inherited from org.apache.cocoon.transformation.AbstractSAXTransformer: |
|---|
| EMPTY_ATTRIBUTES, ignoreWhitespaces, ignoreEmptyCharacters, ignoreEventsCount, ignoreHooksCount, namespaceURI, defaultNamespaceURI, stack, recorderStack, request, response, context, objectModel, parameters, source, manager, resolver, emptyAttributes |
| Methods from org.apache.cocoon.transformation.AbstractSAXTransformer: |
|---|
|
addRecorder, characters, comment, configure, dispose, endCDATA, endDTD, endDocument, 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, service, setDocumentLocator, setup, setupTransforming, skippedEntity, startCDATA, startDTD, startDocument, startElement, startEntity, startParametersRecording, startPrefixMapping, startRecording, startSAXRecording, startSerializedXMLRecording, startTextRecording, startTransformingElement |
| Methods from org.apache.cocoon.xml.AbstractXMLPipe: |
|---|
|
characters, comment, endCDATA, endDTD, endDocument, endElement, endEntity, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startCDATA, startDTD, startDocument, startElement, startEntity, startPrefixMapping |
| Method from org.apache.cocoon.portal.transformation.AbstractCopletTransformer Detail: |
public void dispose() {
if ( this.portalService != null ) {
this.manager.release( this.portalService );
this.portalService = null;
}
super.dispose();
}
|
protected CopletInstanceData getCopletInstanceData() throws SAXException {
CopletInstanceData cid = this.getCopletInstanceData(null);
if ( cid == null ) {
throw new SAXException("Could not find coplet instance data for the current pipeline.");
}
return cid;
}
Try to get the coplet instance data belonging to the current request |
protected CopletInstanceData getCopletInstanceData(String copletId) throws SAXException {
final Map context = (Map)objectModel.get(ObjectModelHelper.PARENT_CONTEXT);
if ( copletId == null ) {
// determine coplet id
if (context != null) {
copletId = (String)context.get(Constants.COPLET_ID_KEY);
} else {
copletId = (String)objectModel.get(Constants.COPLET_ID_KEY);
if ( copletId == null ) {
try {
copletId = this.parameters.getParameter(COPLET_ID_PARAM);
} catch (ParameterException e) {
throw new SAXException("copletId must be passed as parameter or in the object model within the parent context.");
}
}
}
}
if (copletId == null) {
throw new SAXException("copletId must be passed as parameter or in the object model within the parent context.");
}
CopletInstanceData object = this.portalService.getComponentManager().getProfileManager().getCopletInstanceData( copletId );
return object;
}
Try to get the coplet instance data with the given id |
protected PortalService getPortalService() throws SAXException {
return this.portalService;
} Deprecated! Use - directly the instance variable.
|
public void service(ServiceManager manager) throws ServiceException {
super.service(manager);
this.portalService = (PortalService)this.manager.lookup(PortalService.ROLE);
}
|