org.priha.core.namespace
Class NamespaceRegistryImpl
java.lang.Object
org.priha.core.namespace.NamespaceRegistryImpl
- All Implemented Interfaces:
- javax.jcr.NamespaceRegistry, NamespaceMapper
public class NamespaceRegistryImpl
- extends java.lang.Object
- implements javax.jcr.NamespaceRegistry, NamespaceMapper
Field Summary |
protected java.util.HashMap<java.lang.String,java.lang.String> |
m_nsmap
Maps prefixes to URIs. |
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 |
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
NamespaceRegistryImpl
public NamespaceRegistryImpl()
getPrefix
public java.lang.String getPrefix(java.lang.String uri)
throws javax.jcr.NamespaceException
- Specified by:
getPrefix
in interface javax.jcr.NamespaceRegistry
- Throws:
javax.jcr.NamespaceException
getPrefixes
public java.lang.String[] getPrefixes()
throws javax.jcr.RepositoryException
- Specified by:
getPrefixes
in interface javax.jcr.NamespaceRegistry
- Throws:
javax.jcr.RepositoryException
getURI
public java.lang.String getURI(java.lang.String prefix)
throws javax.jcr.NamespaceException
- Specified by:
getURI
in interface javax.jcr.NamespaceRegistry
- Throws:
javax.jcr.NamespaceException
getURIs
public java.lang.String[] getURIs()
throws javax.jcr.RepositoryException
- Specified by:
getURIs
in interface javax.jcr.NamespaceRegistry
- Throws:
javax.jcr.RepositoryException
registerNamespace
public void registerNamespace(java.lang.String prefix,
java.lang.String uri)
throws javax.jcr.NamespaceException,
javax.jcr.UnsupportedRepositoryOperationException,
javax.jcr.AccessDeniedException,
javax.jcr.RepositoryException
- Specified by:
registerNamespace
in interface javax.jcr.NamespaceRegistry
- Throws:
javax.jcr.NamespaceException
javax.jcr.UnsupportedRepositoryOperationException
javax.jcr.AccessDeniedException
javax.jcr.RepositoryException
unregisterNamespace
public void unregisterNamespace(java.lang.String prefix)
throws javax.jcr.NamespaceException,
javax.jcr.UnsupportedRepositoryOperationException,
javax.jcr.AccessDeniedException,
javax.jcr.RepositoryException
- Specified by:
unregisterNamespace
in interface javax.jcr.NamespaceRegistry
- Throws:
javax.jcr.NamespaceException
javax.jcr.UnsupportedRepositoryOperationException
javax.jcr.AccessDeniedException
javax.jcr.RepositoryException
toQName
public QName toQName(java.lang.String val)
throws javax.jcr.NamespaceException,
javax.jcr.RepositoryException
- Turns a string of the form "prefix:name" to "{url}name"
- Specified by:
toQName
in interface NamespaceMapper
- Parameters:
val
-
- Returns:
-
- Throws:
javax.jcr.RepositoryException
javax.jcr.NamespaceException
- If the mapping cannot be accomplished.
fromQName
public java.lang.String fromQName(QName val)
throws javax.jcr.NamespaceException
- Turns a string of the form "{uri}name" to "prefix:name".
- Specified by:
fromQName
in interface NamespaceMapper
- Parameters:
val
-
- Returns:
-
- Throws:
javax.jcr.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.