HTMLParsingTransformerFactory.java 1.42 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.Reference
 *  org.apache.felix.scr.annotations.Service
 *  org.apache.sling.commons.html.HtmlParser
 *  org.apache.sling.rewriter.Transformer
 *  org.apache.sling.rewriter.TransformerFactory
 */
package com.day.cq.rewriter.xml;

import com.day.cq.rewriter.xml.HTMLParsingTransformer;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Property;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.Service;
import org.apache.sling.commons.html.HtmlParser;
import org.apache.sling.rewriter.Transformer;
import org.apache.sling.rewriter.TransformerFactory;

@Component
@Service(value={TransformerFactory.class})
@Property(name="pipeline.type", value={"htmlparser"})
public class HTMLParsingTransformerFactory
implements TransformerFactory {
    @Reference
    private HtmlParser htmlParser;

    public Transformer createTransformer() {
        return new HTMLParsingTransformer(this.htmlParser);
    }

    protected void bindHtmlParser(HtmlParser htmlParser) {
        this.htmlParser = htmlParser;
    }

    protected void unbindHtmlParser(HtmlParser htmlParser) {
        if (this.htmlParser == htmlParser) {
            this.htmlParser = null;
        }
    }
}