package eu.dnetlib.espas.sosservice;

import javax.xml.XMLConstants;
import javax.xml.namespace.NamespaceContext;
import java.util.Iterator;

public class SOSNamespace implements NamespaceContext {
    @Override
    public String getNamespaceURI(String s) {
        if (s == null) {
            throw new NullPointerException("Null prefix");

        } else if ("cea".equals(s)) {
            return "http://www.ivoa.net/xml/CEA/types/v1.2";

        }else if ("vt".equals(s)) {
            return "http://www.ivoa.net/xml/VOTable/v1.1";

        } else if ("uws".equals(s)) {
            return "http://www.ivoa.net/xml/UWS/v0.9.2";

        } else if ("skos".equals(s)) {
            return "http://www.w3.org/2004/02/skos/core#";

        } else if ("xlink".equals(s)) {
            return "http://www.w3.org/1999/xlink";

        } else if ("gml".equals(s)) {
            return "http://www.opengis.net/gml/3.2";

        } else if ("gmd".equals(s)) {
            return "http://www.isotc211.org/2005/gmd";

        } else if ("gmi".equals(s)) {
            return "http://www.isotc211.org/2005/gmi";

        } else if ("gco".equals(s)) {
            return "http://www.isotc211.org/2005/gco";

        } else if ("xsi".equals(s)) {
            return "http://www.w3.org/2001/XMLSchema-instance";

        } else if ("om".equals(s)) {
            return "http://www.opengis.net/om/2.0";

        }  else if ("csw".equals(s)) {
            return "http://www.opengis.net/cat/csw/2.0.2";

        }  else if ("dc".equals(s)) {
            return "http://purl.org/dc/elements/1.1/";

        } else if ("espas".equals(s)) {
            return "http://schemas.espas-fp7.eu/2.1";

        } else if ("xml".equals(s)) {
            return XMLConstants.XML_NS_URI;

        }

        return XMLConstants.DEFAULT_NS_PREFIX;
    }

    @Override
    // This method isn't necessary for XPath processing.
    public String getPrefix(String s) {
        throw new UnsupportedOperationException();
    }

    @Override
    // This method isn't necessary for XPath processing either.
    public Iterator getPrefixes(String s) {
        throw new UnsupportedOperationException();
    }
}
