|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.cocoon.pipeline.component.AbstractPipelineComponent org.apache.cocoon.stax.AbstractStAXPipelineComponent org.apache.cocoon.stax.AbstractStAXProducer org.apache.cocoon.stax.AbstractStAXTransformer
public abstract class AbstractStAXTransformer
Abstract transformer could/should be used for each StAXTransformer. This class implements the
default behavior of the StAXConsumer
and the StAXConsumer
interfaces.
Further more the AbstractStAXTransformer
contains the queuing for StAX-events. This
transformer abstracts the entire handling of nextEvent()
and peek()
behind a
template method produceEvents()
which saves all produced events in a buffer and handles
peek()
, nextEvent()
and hasNext()
.
Constructor Summary | |
---|---|
AbstractStAXTransformer()
|
Method Summary | |
---|---|
protected void |
addAllEventsToQueue(Collection<? extends XMLEvent> events)
Adds a Collection of XMLEvent s to an internal Queue . |
protected void |
addEventToQueue(XMLEvent event)
Add a specific XMLEvent to an internal Queue . |
protected StAXProducer |
getParent()
This StAXProducer is the parent of the module overwriting this
AbstractStAXTransformer . |
boolean |
hasNext()
Check if there are more events. |
void |
initiatePullProcessing()
Since the workflow in a pull pipeline is completely inverted compared to for example a SAX pipeline, this method is required to push the Starter.execute() to the Finisher which should start
processing. |
protected boolean |
isQueueEmpty()
Checks and returns if the internal Queue of XMLEvent s is empty. |
XMLEvent |
nextEvent()
Get the next XMLEvent |
XMLEvent |
peek()
Check the next XMLEvent without reading it from the stream. |
protected abstract 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 |
setParent(StAXProducer parent)
Used to connect a consumer to it's producer. |
Methods inherited from class org.apache.cocoon.stax.AbstractStAXProducer |
---|
getConsumer, setConsumer |
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 |
Constructor Detail |
---|
public AbstractStAXTransformer()
Method Detail |
---|
public final void initiatePullProcessing()
Starter.execute()
to the Finisher
which should start
processing.
initiatePullProcessing
in interface StAXConsumer
StAXConsumer.initiatePullProcessing()
public final void setParent(StAXProducer parent)
setParent
in interface StAXConsumer
StAXConsumer.setParent(StAXProducer)
public final boolean hasNext() throws XMLStreamException
hasNext
in interface StAXProducer
XMLStreamException
- Error which could occure during producing events.StAXProducer.hasNext()
public final XMLEvent nextEvent()
nextEvent
in interface StAXProducer
StAXProducer.nextEvent()
public final XMLEvent peek()
peek
in interface StAXProducer
StAXProducer.peek()
protected final void addEventToQueue(XMLEvent event)
XMLEvent
to an internal Queue
.
event
- which should be added to the queue.protected final StAXProducer getParent()
StAXProducer
is the parent of the module overwriting this
AbstractStAXTransformer
. It could be used in the produceEvents()
method to
pull events from the parent or ask if it still has some.
protected final void addAllEventsToQueue(Collection<? extends XMLEvent> events)
Collection
of XMLEvent
s to an internal Queue
.
events
- are a Collection
of XMLEvent
s which should be added to an
internal Queue
.protected final boolean isQueueEmpty()
Queue
of XMLEvent
s is empty.
Queue
of XMLEvent
s is empty.protected abstract void produceEvents() throws XMLStreamException
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.
XMLStreamException
- thrown if the StAXProducer.nextEvent()
or the
StAXProducer.peek()
method, called in the produceEvents()
method
throw any exceptions they have to be forwarded to the end of the pipeline.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |