Class OutputStreamRouter

  • All Implemented Interfaces:
    org.smooks.api.delivery.ContentHandler, org.smooks.api.delivery.ordering.Consumer, org.smooks.api.resource.visitor.sax.ng.AfterVisitor, org.smooks.api.resource.visitor.sax.ng.BeforeVisitor, org.smooks.api.resource.visitor.sax.ng.SaxNgVisitor, org.smooks.api.resource.visitor.Visitor

    @VisitAfterIf(condition="!parameters.containsKey(\'visitBefore\') || parameters.visitBefore.value != \'true\'")
    @VisitBeforeIf(condition="!parameters.containsKey(\'visitAfter\') || parameters.visitAfter.value != \'true\'")
    public class OutputStreamRouter
    extends Object
    implements org.smooks.api.resource.visitor.sax.ng.BeforeVisitor, org.smooks.api.resource.visitor.sax.ng.AfterVisitor, org.smooks.api.delivery.ordering.Consumer
    OutputStreamRouter is a fragment Visitor (DOM/SAX) that can be used to route context beans (BeanContext beans) an OutputStream.

    An OutputStreamRouter is used in combination with a concreate implementation of AbstractOutputStreamResource, for example a FileOutputStreamResource.

    Example configuration:

     <resource-config selector="orderItem">
        <resource>org.smooks.routing.io.OutputStreamRouter</resource>
        <param name="resourceName">refToResource</param>
        <param name="beanId">orderItem</param>
     </resource-config>
     

    Description of configuration properties:

    • beanId is key used search the execution context for the content to be written the OutputStream
    • resourceName is a reference to a previously configured AbstractOutputStreamResource
    • encoding is the encoding used when writing a characters to file
    Since:
    1.0
    Author:
    Daniel Bevenius
    • Constructor Detail

      • OutputStreamRouter

        public OutputStreamRouter()
    • Method Detail

      • initialize

        @PostConstruct
        public void initialize()
                        throws org.smooks.api.SmooksConfigException
        Throws:
        org.smooks.api.SmooksConfigException
      • consumes

        public boolean consumes​(Object object)
        Specified by:
        consumes in interface org.smooks.api.delivery.ordering.Consumer
      • visitBefore

        public void visitBefore​(Element element,
                                org.smooks.api.ExecutionContext executionContext)
                         throws org.smooks.api.SmooksException
        Specified by:
        visitBefore in interface org.smooks.api.resource.visitor.sax.ng.BeforeVisitor
        Throws:
        org.smooks.api.SmooksException
      • visitAfter

        public void visitAfter​(Element element,
                               org.smooks.api.ExecutionContext executionContext)
                        throws org.smooks.api.SmooksException
        Specified by:
        visitAfter in interface org.smooks.api.resource.visitor.sax.ng.AfterVisitor
        Throws:
        org.smooks.api.SmooksException
      • getResourceName

        public String getResourceName()