// Path: src/main/java/net/technolords/micro/model/jaxb/Configuration.java
// public class Configuration {
//     private String type;
//     private String url;
//     private QueryGroups queryGroups;
//     private SimpleResource simpleResource;
//     private ResourceGroups resourceGroups;
//     private NamespaceList namespaceList;
//     private Map<String, String> cachedNamespaceMapping;
//     private Pattern pattern;
// 
//     @XmlAttribute(name = "type")
//     public String getType() {
//         return type;
//     }
// 
//     public void setType(String type) {
//         this.type = type;
//     }
// 
//     @XmlAttribute(name = "url")
//     public String getUrl() {
//         return url;
//     }
// 
//     public void setUrl(String url) {
//         this.url = url;
//     }
// 
//     @XmlElement (name = "query-groups")
//     public QueryGroups getQueryGroups() {
//         return queryGroups;
//     }
// 
//     public void setQueryGroups(QueryGroups queryGroups) {
//         this.queryGroups = queryGroups;
//     }
// 
//     @XmlElement(name = "resource")
//     public SimpleResource getSimpleResource() {
//         return simpleResource;
//     }
// 
//     public void setSimpleResource(SimpleResource simpleResource) {
//         this.simpleResource = simpleResource;
//     }
// 
//     @XmlElement(name = "resource-groups")
//     public ResourceGroups getResourceGroups() {
//         return resourceGroups;
//     }
// 
//     public void setResourceGroups(ResourceGroups resourceGroups) {
//         this.resourceGroups = resourceGroups;
//     }
// 
//     @XmlElement(name = "namespaces")
//     public NamespaceList getNamespaceList() {
//         return namespaceList;
//     }
// 
//     public void setNamespaceList(NamespaceList namespaceList) {
//         this.namespaceList = namespaceList;
//     }
// 
//     @XmlTransient
//     public Map<String, String> getCachedNamespaceMapping() {
//         return cachedNamespaceMapping;
//     }
// 
//     public void setCachedNamespaceMapping(Map<String, String> cachedNamespaceMapping) {
//         this.cachedNamespaceMapping = cachedNamespaceMapping;
//     }
// 
//     @XmlTransient
//     public Pattern getPattern() {
//         return pattern;
//     }
// 
//     public void setPattern(Pattern pattern) {
//         this.pattern = pattern;
//     }
// 
//     @Override
//     public boolean equals(Object obj) {
//         if(obj == null) {
//             return false;
//         }
//         if(!(obj instanceof Configuration)) {
//             return false;
//         }
//         Configuration ref = (Configuration) obj;
//         return (Objects.equals(this.getUrl(), ref.getUrl())
//                 && Objects.equals(this.getType(), ref.getType())
//                 && Objects.equals(this.getSimpleResource(), ref.getSimpleResource())
//         );
//     }
// }


import java.io.IOException;
import java.io.StringReader;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpression;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xml.sax.InputSource;
import net.technolords.micro.model.jaxb.Configuration;
package net.technolords.micro.input.xml;





public class XpathEvaluator {
    private final Logger LOGGER = LoggerFactory.getLogger(getClass());
    private ConfigurationToNamespaceContext configurationToNamespaceContext = null;
    private XPathFactory xPathFactory = null;

    /**
     * Auxiliary method that evaluates the given xpath expression with the given message.
     *
     * NOTE: currently only 'boolean' xpath expressions are supported. Meaning, any node list
     * selection or otherwise will fail. TODO: result typing, to support different xpath queries.
     *
     * @param xpathExpression
     *  The xpath expression to evaluate.
     * @param xmlMessage
     *  The xml message associated with the xpath evaluation.
     * @param configuration
     *  The configuration associated with the namespaces.
     *
     * @return
     *  The result of the xpath expression, which means it is either a match or not.
     *
     * @throws XPathExpressionException
     *  When evaluation the xpath expression fails.
     * @throws IOException
     *  When reading the input source fails.
     */
// Path: src/main/java/net/technolords/micro/model/jaxb/Configuration.java
// public class Configuration {
//     private String type;
//     private String url;
//     private QueryGroups queryGroups;
//     private SimpleResource simpleResource;
//     private ResourceGroups resourceGroups;
//     private NamespaceList namespaceList;
//     private Map<String, String> cachedNamespaceMapping;
//     private Pattern pattern;
// 
//     @XmlAttribute(name = "type")
//     public String getType() {
//         return type;
//     }
// 
//     public void setType(String type) {
//         this.type = type;
//     }
// 
//     @XmlAttribute(name = "url")
//     public String getUrl() {
//         return url;
//     }
// 
//     public void setUrl(String url) {
//         this.url = url;
//     }
// 
//     @XmlElement (name = "query-groups")
//     public QueryGroups getQueryGroups() {
//         return queryGroups;
//     }
// 
//     public void setQueryGroups(QueryGroups queryGroups) {
//         this.queryGroups = queryGroups;
//     }
// 
//     @XmlElement(name = "resource")
//     public SimpleResource getSimpleResource() {
//         return simpleResource;
//     }
// 
//     public void setSimpleResource(SimpleResource simpleResource) {
//         this.simpleResource = simpleResource;
//     }
// 
//     @XmlElement(name = "resource-groups")
//     public ResourceGroups getResourceGroups() {
//         return resourceGroups;
//     }
// 
//     public void setResourceGroups(ResourceGroups resourceGroups) {
//         this.resourceGroups = resourceGroups;
//     }
// 
//     @XmlElement(name = "namespaces")
//     public NamespaceList getNamespaceList() {
//         return namespaceList;
//     }
// 
//     public void setNamespaceList(NamespaceList namespaceList) {
//         this.namespaceList = namespaceList;
//     }
// 
//     @XmlTransient
//     public Map<String, String> getCachedNamespaceMapping() {
//         return cachedNamespaceMapping;
//     }
// 
//     public void setCachedNamespaceMapping(Map<String, String> cachedNamespaceMapping) {
//         this.cachedNamespaceMapping = cachedNamespaceMapping;
//     }
// 
//     @XmlTransient
//     public Pattern getPattern() {
//         return pattern;
//     }
// 
//     public void setPattern(Pattern pattern) {
//         this.pattern = pattern;
//     }
// 
//     @Override
//     public boolean equals(Object obj) {
//         if(obj == null) {
//             return false;
//         }
//         if(!(obj instanceof Configuration)) {
//             return false;
//         }
//         Configuration ref = (Configuration) obj;
//         return (Objects.equals(this.getUrl(), ref.getUrl())
//                 && Objects.equals(this.getType(), ref.getType())
//                 && Objects.equals(this.getSimpleResource(), ref.getSimpleResource())
//         );
//     }
// }


// Path: src/main/java/net/technolords/micro/input/xml/XpathEvaluator.java
import java.io.IOException;
import java.io.StringReader;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpression;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xml.sax.InputSource;
import net.technolords.micro.model.jaxb.Configuration;

package net.technolords.micro.input.xml;





public class XpathEvaluator {
    private final Logger LOGGER = LoggerFactory.getLogger(getClass());
    private ConfigurationToNamespaceContext configurationToNamespaceContext = null;
    private XPathFactory xPathFactory = null;

    /**
     * Auxiliary method that evaluates the given xpath expression with the given message.
     *
     * NOTE: currently only 'boolean' xpath expressions are supported. Meaning, any node list
     * selection or otherwise will fail. TODO: result typing, to support different xpath queries.
     *
     * @param xpathExpression
     *  The xpath expression to evaluate.
     * @param xmlMessage
     *  The xml message associated with the xpath evaluation.
     * @param configuration
     *  The configuration associated with the namespaces.
     *
     * @return
     *  The result of the xpath expression, which means it is either a match or not.
     *
     * @throws XPathExpressionException
     *  When evaluation the xpath expression fails.
     * @throws IOException
     *  When reading the input source fails.
     */
    public boolean evaluateXpathExpression(String xpathExpression, String xmlMessage, Configuration configuration) throws XPathExpressionException, IOException {