Package org.apache.sling.rewriter
Interface Generator
public interface Generator
The
Generator interface defines the start of a rewriter pipeline.
A generator is not a component managed by the container (OSGi). A
GeneratorFactory is a service managed by the container which creates
generator instances on demand.-
Method Summary
Modifier and TypeMethodDescriptionvoiddispose()Dispose the generator.voidfinished()Notify the generator that parsing is finished.Get the writer to write the output to.voidinit(ProcessingContext context, ProcessingComponentConfiguration config) Initialize this component.voidsetContentHandler(ContentHandler handler) Set the content handler the generator should stream to.
-
Method Details
-
init
Initialize this component.- Parameters:
context- The invocation context.config- The configuration for this component.- Throws:
IOException- in case of any problems
-
setContentHandler
Set the content handler the generator should stream to.- Parameters:
handler- A transformer or serializer.
-
getWriter
PrintWriter getWriter()Get the writer to write the output to.- Returns:
- A print writer.
-
finished
Notify the generator that parsing is finished.- Throws:
IOException- IOExceptionSAXException- SAXException
-
dispose
void dispose()Dispose the generator. This method is always invoked by the rewriter in order to allow the generator to release any resources etc. After this method has been called the instance is considered unusable.
-