org.apache.jackrabbit.name
Interface NamespaceResolver

All Known Implementing Classes:
AbstractNamespaceResolver

public interface NamespaceResolver

Interface for resolving namespace URIs and prefixes. Unlike the JCR NamespaceRegistry interface, this interface contains no functionality other than the basic namespace URI and prefix resolution methods. This interface is therefore used internally in many places where the full namespace registry is either not available or some other mechanism is used for resolving namespaces.


Method Summary
 String getJCRName(QName name)
          Returns the qualified name in the prefixed JCR name format.
 String getPrefix(String uri)
          Returns the prefix which is mapped to the given URI.
 QName getQName(String name)
          Parses the given prefixed JCR name into a qualified name.
 String getURI(String prefix)
          Returns the URI to which the given prefix is mapped.
 

Method Detail

getURI

public String getURI(String prefix)
              throws NamespaceException
Returns the URI to which the given prefix is mapped.

Parameters:
prefix - namespace prefix
Returns:
the namespace URI to which the given prefix is mapped.
Throws:
NamespaceException - if the prefix is unknown.

getPrefix

public String getPrefix(String uri)
                 throws NamespaceException
Returns the prefix which is mapped to the given URI.

Parameters:
uri - namespace URI
Returns:
the prefix mapped to the given URI.
Throws:
NamespaceException - if the URI is unknown.

getQName

public QName getQName(String name)
               throws IllegalNameException,
                      UnknownPrefixException
Parses the given prefixed JCR name into a qualified name.

Parameters:
name - the raw name, potentially prefixed.
Returns:
the QName instance for the raw name.
Throws:
IllegalNameException - if the given name is not a valid JCR name
UnknownPrefixException - if the JCR name prefix does not resolve

getJCRName

public String getJCRName(QName name)
                  throws NoPrefixDeclaredException
Returns the qualified name in the prefixed JCR name format.

Returns:
name the qualified name
Throws:
NoPrefixDeclaredException - if the namespace can not be resolved


Copyright © 2004-2006 The Apache Software Foundation. All Rights Reserved.