// Path: src/main/java/io/xspec/maven/xspecMavenPlugin/utils/QuietLogger.java
// public class QuietLogger extends SystemStreamLog {
//     private static QuietLogger INSTANCE;
//     
//     public static QuietLogger getLogger() {
//         if(INSTANCE==null) {
//             INSTANCE = new QuietLogger();
//         }
//         return INSTANCE;
//     }
//     
//     private QuietLogger() {
//         super();
//     }
// 
//     @Override
//     public boolean isDebugEnabled() {
//         return false;
//     }
// 
//     @Override
//     public void debug(CharSequence cs) { }
// 
//     @Override
//     public void debug(CharSequence cs, Throwable thrwbl) { }
// 
//     @Override
//     public void debug(Throwable thrwbl) { }
// 
//     @Override
//     public boolean isInfoEnabled() {
//         return false;
//     }
// 
//     @Override
//     public void info(CharSequence cs) { }
// 
//     @Override
//     public void info(CharSequence cs, Throwable thrwbl) { }
// 
//     @Override
//     public void info(Throwable thrwbl) { }
// 
//     @Override
//     public boolean isWarnEnabled() {
//         return false;
//     }
// 
//     @Override
//     public void warn(CharSequence cs) { }
// 
//     @Override
//     public void warn(CharSequence cs, Throwable thrwbl) { }
// 
//     @Override
//     public void warn(Throwable thrwbl) { }
// 
//     @Override
//     public boolean isErrorEnabled() {
//         return true;
//     }
//     
// }


import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.regex.Pattern;
import javax.xml.transform.Source;
import javax.xml.transform.TransformerException;
import javax.xml.transform.URIResolver;
import javax.xml.transform.stream.StreamSource;
import org.apache.maven.plugin.logging.Log;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xmlresolver.Catalog;
import org.xmlresolver.CatalogSource;
import com.google.common.base.CharMatcher;
import io.xspec.maven.xspecMavenPlugin.utils.QuietLogger;
import java.io.File;
import java.io.IOException;

    private boolean isCpProtocol(String href, String base) {
        return (href!=null && href.startsWith("cp:/")) ||
                (base!=null && base.startsWith("cp:/"));
    }

    private Source resolveToClasspath(String href, String base) {
        String fullUrl = isAbsolute(href) ? href : base+href;
        String path = removeCpPrefix(fullUrl);
        InputStream is = getClass().getResourceAsStream(path);
        if(is==null) {
            return null;
        }
        StreamSource ret = new StreamSource(is);
        String systemId = getClass().getResource(path).toExternalForm();
        log.warn(systemId);
        ret.setSystemId(normalizeUrl(systemId));
        return ret;
    }

    private boolean isAbsolute(String href) {
        return protocolPattern.matcher(href).matches();
    }

    private String removeCpPrefix(String fullUrl) {
        return fullUrl.substring(3);
    }

    private Log getLog() {
        if(LOG_ENABLE) return log;
// Path: src/main/java/io/xspec/maven/xspecMavenPlugin/utils/QuietLogger.java
// public class QuietLogger extends SystemStreamLog {
//     private static QuietLogger INSTANCE;
//     
//     public static QuietLogger getLogger() {
//         if(INSTANCE==null) {
//             INSTANCE = new QuietLogger();
//         }
//         return INSTANCE;
//     }
//     
//     private QuietLogger() {
//         super();
//     }
// 
//     @Override
//     public boolean isDebugEnabled() {
//         return false;
//     }
// 
//     @Override
//     public void debug(CharSequence cs) { }
// 
//     @Override
//     public void debug(CharSequence cs, Throwable thrwbl) { }
// 
//     @Override
//     public void debug(Throwable thrwbl) { }
// 
//     @Override
//     public boolean isInfoEnabled() {
//         return false;
//     }
// 
//     @Override
//     public void info(CharSequence cs) { }
// 
//     @Override
//     public void info(CharSequence cs, Throwable thrwbl) { }
// 
//     @Override
//     public void info(Throwable thrwbl) { }
// 
//     @Override
//     public boolean isWarnEnabled() {
//         return false;
//     }
// 
//     @Override
//     public void warn(CharSequence cs) { }
// 
//     @Override
//     public void warn(CharSequence cs, Throwable thrwbl) { }
// 
//     @Override
//     public void warn(Throwable thrwbl) { }
// 
//     @Override
//     public boolean isErrorEnabled() {
//         return true;
//     }
//     
// }


// Path: src/main/java/io/xspec/maven/xspecMavenPlugin/resolver/Resolver.java
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.regex.Pattern;
import javax.xml.transform.Source;
import javax.xml.transform.TransformerException;
import javax.xml.transform.URIResolver;
import javax.xml.transform.stream.StreamSource;
import org.apache.maven.plugin.logging.Log;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xmlresolver.Catalog;
import org.xmlresolver.CatalogSource;
import com.google.common.base.CharMatcher;
import io.xspec.maven.xspecMavenPlugin.utils.QuietLogger;
import java.io.File;
import java.io.IOException;


    private boolean isCpProtocol(String href, String base) {
        return (href!=null && href.startsWith("cp:/")) ||
                (base!=null && base.startsWith("cp:/"));
    }

    private Source resolveToClasspath(String href, String base) {
        String fullUrl = isAbsolute(href) ? href : base+href;
        String path = removeCpPrefix(fullUrl);
        InputStream is = getClass().getResourceAsStream(path);
        if(is==null) {
            return null;
        }
        StreamSource ret = new StreamSource(is);
        String systemId = getClass().getResource(path).toExternalForm();
        log.warn(systemId);
        ret.setSystemId(normalizeUrl(systemId));
        return ret;
    }

    private boolean isAbsolute(String href) {
        return protocolPattern.matcher(href).matches();
    }

    private String removeCpPrefix(String fullUrl) {
        return fullUrl.substring(3);
    }

    private Log getLog() {
        if(LOG_ENABLE) return log;
        return QuietLogger.getLogger();