SchemaGenerationHandlerImpl.java 1.89 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  com.adobe.xmp.schema.rng.parser.SchemaGenerationHandler
 *  com.adobe.xmp.schema.rng.parser.exceptions.RNGParseException
 */
package com.adobe.xmp.schema.service.impl;

import com.adobe.xmp.schema.rng.parser.SchemaGenerationHandler;
import com.adobe.xmp.schema.rng.parser.exceptions.RNGParseException;
import com.adobe.xmp.schema.service.SchemaService;
import java.util.logging.Level;
import java.util.logging.Logger;

public class SchemaGenerationHandlerImpl
implements SchemaGenerationHandler {
    private boolean ignoreErrors;
    private final Logger LOG = Logger.getLogger("XMPSchemaService");
    private SchemaService.INamespaceCallback namespaceCallback = null;

    public SchemaGenerationHandlerImpl(boolean ignoreErrors, SchemaService.INamespaceCallback namespaceCallback) {
        this.ignoreErrors = ignoreErrors;
        this.namespaceCallback = namespaceCallback;
    }

    public void startRefTraversal(String refName) {
    }

    public void endRefTraversal(String refName) {
    }

    public void startSchemaConstruction(String ns, String prefix) {
        if (this.namespaceCallback != null) {
            this.namespaceCallback.notify(ns, prefix);
        }
    }

    public void startPropertyConstruction(String ns, String localName, String prefix) {
        if (this.namespaceCallback != null) {
            this.namespaceCallback.notify(ns, prefix);
        }
    }

    public boolean ignoreErrorInConstructingProperty(String ns, String localName, RNGParseException ex) {
        this.printErrorReport("Encountered error for  : (" + localName + " , " + ns + "). Error message is " + ex.getMessage());
        return this.ignoreErrors;
    }

    private void printErrorReport(String message) {
        StringBuilder str = new StringBuilder();
        this.LOG.log(Level.WARNING, str.append(message).toString());
    }
}