Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cocoon.stax.converter
Class SAXForStAXPipelineWrapper

    java.lang.Object
      org.apache.cocoon.pipeline.component.AbstractPipelineComponent
          org.apache.cocoon.stax.AbstractStAXPipelineComponent
              org.apache.cocoon.stax.AbstractStAXProducer
                  org.apache.cocoon.stax.AbstractStAXTransformer
                      org.apache.cocoon.stax.converter.SAXForStAXPipelineWrapper

All Implemented Interfaces:
  XMLEventConsumer, Consumer, PipelineComponent, Producer, StAXConsumer, StAXPipelineComponent, StAXProducer

    public class SAXForStAXPipelineWrapper

extends AbstractStAXTransformer
implements XMLEventConsumer

This class could be seen as the default implementation to use SAX components in StAX pipelines.

If an `XMLEvent` is pulled from the `SAXForStAXPipelineWrapper` by an `StAXConsumer` the `SAXForStAXPipelineWrapper` retrieves an `XMLEvent` from its `StAXConsumer` and translate it to an SAXEvent. Each event produced during calling the SAX-component are transformed to `XMLEvent`s and are stored internally. If the SAX-component produced at least one `XMLEvent` all produced `XMLEvent`s are returned. Otherwise the next event is pulled from the `StAXProducer` and the process is repeated.

Constructor Summary
`SAXForStAXPipelineWrapper(SAXProducer saxTransformer)` Constructs an Wrapper around an SAXTransformer and made it available to add it to an `Pipeline` only containing StAX- `PipelineComponent`s.

Method Summary
`void` | `add(XMLEvent event)`
`protected void` | `produceEvents()` Template method which has to produce at least one `XMLEvent` and should add this to the internal `Queue` with the `#add(XMLEvent)` and `#addAll(Collection)` methods.
`void` | `setConsumer(Consumer consumer)`

Methods inherited from class org.apache.cocoon.stax.AbstractStAXTransformer
`addAllEventsToQueue, addEventToQueue, getParent, hasNext, initiatePullProcessing, isQueueEmpty, nextEvent, peek, setParent`

Methods inherited from class org.apache.cocoon.stax.AbstractStAXProducer
`getConsumer`

Methods inherited from class org.apache.cocoon.pipeline.component.AbstractPipelineComponent
`finish, setConfiguration, setup`

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.pipeline.component.PipelineComponent
`finish, setConfiguration, setup`

Methods inherited from interface org.apache.cocoon.pipeline.component.PipelineComponent
`finish, setConfiguration, setup`

Constructor Detail

### SAXForStAXPipelineWrapper

    public SAXForStAXPipelineWrapper(SAXProducer saxTransformer)

  Constructs an Wrapper around an SAXTransformer and made it available to add it to an `Pipeline` only containing StAX- `PipelineComponent`s.

  Parameters:
    `The` - Transformer which should be wrapped. As an SAXTransformer it have to implement the `SAXProducer` and the `SAXConsumer` interface. Since no transformer interface exists at the moment at the cocoon-sax project this way is chosen. But this may be changed later.

Method Detail

### setConsumer

    public void setConsumer(Consumer consumer)

  Specified by:
    `setConsumer` in interface `Producer`
  Overrides:
    `setConsumer` in class `AbstractStAXProducer`
  See Also:
    `Producer.setConsumer(Consumer)`

### add

    public void add(XMLEvent event)
             throws XMLStreamException

  Specified by:
    `add` in interface `XMLEventConsumer`
  Throws:
    `XMLStreamException`
  See Also:
    `XMLEventConsumer.add(javax.xml.stream.events.XMLEvent)`

### produceEvents

    protected void produceEvents()
                          throws XMLStreamException

  Template method which has to produce at least one `XMLEvent` and should add this to the internal `Queue` with the `#add(XMLEvent)` and `#addAll(Collection)` methods. If no `XMLEvent` is added by this method to the internal `Queue` an exception is thrown.

  Specified by:
    `produceEvents` in class `AbstractStAXTransformer`
  Throws:
    `XMLStreamException` - thrown if the `StAXProducer.nextEvent()` or the `StAXProducer.peek()` method, called in the `AbstractStAXTransformer.produceEvents()` method throw any exceptions they have to be forwarded to the end of the pipeline.
  See Also:
    `AbstractStAXTransformer.produceEvents()`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright � 2008-2010 The Apache Software Foundation. All Rights Reserved.