org.priha.core.namespace
Class NamespaceRegistryImpl

java.lang.Object
  extended by org.priha.core.namespace.NamespaceRegistryImpl
All Implemented Interfaces:
NamespaceMapper

public class NamespaceRegistryImpl
extends java.lang.Object
implements NamespaceMapper


Field Summary
protected  java.util.HashMap<java.lang.String,java.lang.String> m_nsmap
          Maps prefixes to URIs.
 
Constructor Summary
NamespaceRegistryImpl()
           
 
Method Summary
 java.lang.String fromQName(QName val)
          Turns a string of the form "{uri}name" to "prefix:name".
 java.lang.String getPrefix(java.lang.String uri)
           
 java.lang.String[] getPrefixes()
           
 java.lang.String getURI(java.lang.String prefix)
           
 java.lang.String[] getURIs()
           
 boolean hasMappings()
          Return true, if this NamespaceRegistryImpl has any mappings.
 void registerNamespace(java.lang.String prefix, java.lang.String uri)
           
 QName toQName(java.lang.String val)
          Turns a string of the form "prefix:name" to "{url}name"
 void unregisterNamespace(java.lang.String prefix)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_nsmap

protected java.util.HashMap<java.lang.String,java.lang.String> m_nsmap
Maps prefixes to URIs. Prefixes are always unique, therefore they are the keys

Constructor Detail

NamespaceRegistryImpl

public NamespaceRegistryImpl()
Method Detail

getPrefix

public java.lang.String getPrefix(java.lang.String uri)
                           throws NamespaceException
Throws:
NamespaceException

getPrefixes

public java.lang.String[] getPrefixes()
                               throws RepositoryException
Throws:
RepositoryException

getURI

public java.lang.String getURI(java.lang.String prefix)
                        throws NamespaceException
Throws:
NamespaceException

getURIs

public java.lang.String[] getURIs()
                           throws RepositoryException
Throws:
RepositoryException

registerNamespace

public void registerNamespace(java.lang.String prefix,
                              java.lang.String uri)
                       throws NamespaceException,
                              UnsupportedRepositoryOperationException,
                              AccessDeniedException,
                              RepositoryException
Throws:
NamespaceException
UnsupportedRepositoryOperationException
AccessDeniedException
RepositoryException

unregisterNamespace

public void unregisterNamespace(java.lang.String prefix)
                         throws NamespaceException,
                                UnsupportedRepositoryOperationException,
                                AccessDeniedException,
                                RepositoryException
Throws:
NamespaceException
UnsupportedRepositoryOperationException
AccessDeniedException
RepositoryException

toQName

public QName toQName(java.lang.String val)
              throws NamespaceException,
                     RepositoryException
Turns a string of the form "prefix:name" to "{url}name"

Specified by:
toQName in interface NamespaceMapper
Parameters:
val -
Returns:
Throws:
RepositoryException
NamespaceException - If the mapping cannot be accomplished.

fromQName

public java.lang.String fromQName(QName val)
                           throws NamespaceException
Turns a string of the form "{uri}name" to "prefix:name".

Specified by:
fromQName in interface NamespaceMapper
Parameters:
val -
Returns:
Throws:
NamespaceException - If the mapping is unknown.

hasMappings

public boolean hasMappings()
Return true, if this NamespaceRegistryImpl has any mappings.

Returns:
True, if there are any mappings to care about.