See: Description
Interface | Description |
---|---|
IConst |
Constant definitions for the WCM Pipeline package.
|
IPipelineService |
Interface for the WCM pipeline service.
|
IXsltPipelineService |
The XSLT-Pipeline is a specialized version of the pipeline.
|
Class | Description |
---|---|
PipelineServiceFactory |
Service factory for the service of this package.
|
RequestData |
Wrapper class contains DOM (of type
document ) or
InputStream . |
XsltPipelineServiceFactory |
Service factory for the service of this package.
|
Purpose
Detailed_Concept
Interfaces
Code_Samples
Implementation Notes
The publishing pipeline is the technical infrastructure that enables the transformation of resources from one format to another or from one layout to another. When a filter has been defined for a particular file extension, mime type or folder, it is the pipeline that actually executes the transformation process specified by the filter.
The pipeline package and other related packages offer interfaces that can be addressed by an application that wants to use the pipeline. Before introducing these interfaces, the following section gives you an overview of the architecture of the pipeline and explains how the pipeline works at a technical level. This background information makes it easier to understand the purpose of the interfaces in this package and the other related packages.
The pipeline is composed of three main components: the producer, the processor and the formatter. Each of these is responsible for executing a different part of the process that transforms a file from one form to another. The components are bound together by a supervisory instance, the pipeline controller, which coordinates and controls the work of the other components.
The graphic illustrates the main
pipeline components:
The producer is the first instance
that is called, when there is a request to process a resource with the
publishing pipeline. It fetches the content of the resource, prepares it
for further processing and passes it on to the processor. The processor
then carries out the actual transformation process and changes the
layout or format of the resource. Finally, the formatter prepares the
output. It processes the resource with a formatter program to generate
output with a particular format or it simply prepares an output stream
and passes it on to another instance. Depending on whether the resource
that is processed is an XML or non-XML file, the individual steps within
the process differ. The next sections explains the individual processing
steps of the publishing pipeline in detail, taking into account the
different approaches that are necessary for XML and non-XML resources.
The pipeline controller is an
internal component that is responsible for ensuring that the processing
steps executed by the pipeline are performed by the right component in
the right sequence. To do this, the controller needs instructions
encoded in XML. If the resource that is processed by the pipeline is
already an XML, the instructions can be included directly in this file.
If the resource has a different format, an additional empty XML is
required to store them. The manner in which the controller is supplied
with instructions can differ. Sometimes the instructions are already
included directly in the resource that is passed on to the pipeline,
sometimes they are provided by parameters of method calls and
occasionally they have to be fetched from other sources and subsequently
written into the XML file. The pipeline offers a mechanism called the default processor that acquires the processing information
for the Controller and writes it into the available XML file. Whenever
the controller registers that no instructions are available, it starts
the default processor and in this way is always able to obtain the
relevant processing information.
Typically, the instructions for the
controller specify the type of pipeline processor that is required, the
URL of the stylesheet that is to be applied to the document and the
formatter program that generates the output. The example here
shows instructions that inform the controller to start an XSLT
processor, to use the stylesheet page.xsl and
to run the formatter program that generates HTML.
<?wcm-process
type="xslt"?>
<?xml-stylesheet href="page.xsl" type="text/xsl?">
<?wcm-format
type="text/html"?>
Interfaces | Package |
IPipelineService XsltPipelineService |
com.sapportals.wcm.service.pipeline |
IProcessor |
com.sapportals.wcm.service.pipeline.processor |
IFormatter |
com.sapportals.wcm.service.pipeline.formatter |
IProducer |
com.sapportals.wcm.service.pipeline.producer |
IXmlParser IXslTransformer |
com.sapportals.wcm.service.pipeline.tools |
The sections that follow explain
the purpose of the above interfaces, introduce their most important
methods and summarize the steps that are necessary to use them in a
program.
Most transformations performed with the pipeline use the XSLT processor
to convert an XML file with an XSL stylesheet. For these
transformations, it is easiest to use the IXsltPipelineService interface because it is specialized for this process and
automates some of the steps. It handles the default processor and the
creation of processing instructions automatically. TheIPipelineService interface must be used for other
transformations like the formatting of an HTML with a cascading
stylesheet or for the implementation of a new pipeline service.
You can use the IPipelineService interface to program any type of transformation process,
regardless of the type of processor or formatter involved.
However, it requires that each step in the process is executed
explicitly. In contrast, the IXsltPipelineService, which can only be used for XSLT transformations,
performs most of the processing steps automatically. For this reason,
you always use the IXsltPipelineService for XSLT transformations and the IPipelineService interface for other transformations that do not involve XML
files. For example, if you want to change the layout of an html with a
CSS, then you use the IPipelineService. In the transformation process the producer converts the
non-XML file (eg. html) to a stream and passes it on to the stream
processor. This transforms the layout and passes the changed stream on
to a stream formatter.
When you use the IPipelineService interface, you must instantiate a
producer and supply XML instructions for the pipeline controller. To do
this, you instantiate a producer and a default processor. The
producer API provides classes that can be used to
instantiate different types of producers, the processor API
provides a class for a default processor.
The following
types of producers are available in the package com.sapportals.wcm.service.pipeline:
A class for a default
processor is available in the package com.sapportals.wcm.service.pipeline. The default processor is only required when no XML processing
instructions are available for the transformation process. It offers
methods to add processing instructions to an XML file that is provided
by the pipeline.
To use the IPipelineService interface for a transformation, proceed as follows:
If a formatter program to complete the transformation
process is not explicitly specified, then the handle method automatically calls a default formatter. A different
formatter is called, depending on the format of the content:
Interface |
Package |
Classes |
IProducer |
pipeline.producer |
ProducerFromResource
prepares content provided by a resource ProducerFromStream prepares content provides as a stream ProducerFromUrl prepares content provided as the target of a URL ProducerFromString prepares content provided by a string |
IProcessor |
pipeline.processor |
HTMLProcessor
merges HTML with a CSS XSLT Processor transforms an XML DOM with an XSL stylesheet |
IFormatter |
pipeline.formatter |
JaxpSerializeFormatter
generates text from an XML DOM StreamFormatter passes stream data on to another instance for output FOFormatter transforms an XML DOM into PDF |
IXmlParser |
pipeline.tools |
JaxpParser
checks validity of XML and creates the DOM from an XML |
IXslTransformer |
pipeline.tools |
JaxpTransformer
processes the DOM with a stylesheet |
Copyright 2018 SAP AG Complete Copyright Notice