HtmlParserFactory.java 2.14 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  org.apache.felix.scr.annotations.Component
 *  org.apache.felix.scr.annotations.Property
 *  org.apache.felix.scr.annotations.Service
 *  org.apache.sling.rewriter.Generator
 *  org.apache.sling.rewriter.GeneratorFactory
 *  org.apache.sling.rewriter.ProcessingComponentConfiguration
 *  org.apache.sling.rewriter.ProcessingContext
 */
package com.day.cq.rewriter.processor.impl;

import com.day.cq.rewriter.htmlparser.HtmlParser;
import com.day.cq.rewriter.processor.ProcessingComponentConfiguration;
import com.day.cq.rewriter.processor.ProcessingContext;
import com.day.cq.rewriter.processor.impl.ProcessingComponentConfigurationWrapper;
import com.day.cq.rewriter.processor.impl.ProcessingContextWrapper;
import java.io.IOException;
import java.io.PrintWriter;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Property;
import org.apache.felix.scr.annotations.Service;
import org.apache.sling.rewriter.Generator;
import org.apache.sling.rewriter.GeneratorFactory;
import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;

@Component
@Service(value={GeneratorFactory.class})
@Property(name="pipeline.type", value={"htmlparser"})
public class HtmlParserFactory
implements GeneratorFactory {
    public Generator createGenerator() {
        final HtmlParser parser = new HtmlParser();
        return new Generator(){

            public void init(org.apache.sling.rewriter.ProcessingContext context, org.apache.sling.rewriter.ProcessingComponentConfiguration config) throws IOException {
                parser.init(new ProcessingContextWrapper(context), new ProcessingComponentConfigurationWrapper(config));
            }

            public void setContentHandler(ContentHandler handler) {
                parser.setContentHandler(handler);
            }

            public PrintWriter getWriter() {
                return parser.getWriter();
            }

            public void finished() throws IOException, SAXException {
                parser.finished();
            }

            public void dispose() {
            }
        };
    }

}