ProcessorWrapper.java 1.91 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  org.apache.sling.rewriter.ProcessingContext
 *  org.apache.sling.rewriter.Processor
 *  org.apache.sling.rewriter.ProcessorConfiguration
 *  org.osgi.service.component.ComponentInstance
 */
package com.day.cq.rewriter.processor.impl;

import com.day.cq.rewriter.processor.ProcessingContext;
import com.day.cq.rewriter.processor.Processor;
import com.day.cq.rewriter.processor.ProcessorConfiguration;
import com.day.cq.rewriter.processor.impl.ProcessingContextWrapper;
import com.day.cq.rewriter.processor.impl.ProcessorConfigurationWrapper;
import java.io.IOException;
import java.io.PrintWriter;
import org.osgi.service.component.ComponentInstance;
import org.xml.sax.ContentHandler;

public class ProcessorWrapper
implements org.apache.sling.rewriter.Processor {
    private final Processor delegatee;
    private final ComponentInstance instance;

    public ProcessorWrapper(Processor t, ComponentInstance cI) {
        this.delegatee = t;
        this.instance = cI;
    }

    public void finished(boolean errorOccured) throws IOException {
        IOException exception = null;
        try {
            this.delegatee.finished();
        }
        catch (IOException ioe) {
            exception = ioe;
        }
        this.instance.dispose();
        if (exception != null) {
            throw exception;
        }
    }

    public ContentHandler getContentHandler() {
        return this.delegatee.getContentHandler();
    }

    public PrintWriter getWriter() {
        return this.delegatee.getWriter();
    }

    public void init(org.apache.sling.rewriter.ProcessingContext context, org.apache.sling.rewriter.ProcessorConfiguration config) throws IOException {
        this.delegatee.init(new ProcessingContextWrapper(context), new ProcessorConfigurationWrapper(config));
    }

    public String toString() {
        return this.delegatee.toString();
    }
}