Package org.apache.jackrabbit.core
Class NamespaceRegistryImpl
- java.lang.Object
-
- org.apache.jackrabbit.core.NamespaceRegistryImpl
-
- All Implemented Interfaces:
NamespaceRegistry,NamespaceEventListener,StringIndex
public class NamespaceRegistryImpl extends Object implements NamespaceRegistry, NamespaceEventListener, StringIndex
ANamespaceRegistryImpl...
-
-
Field Summary
-
Fields inherited from interface javax.jcr.NamespaceRegistry
NAMESPACE_EMPTY, NAMESPACE_JCR, NAMESPACE_MIX, NAMESPACE_NT, NAMESPACE_XML, PREFIX_EMPTY, PREFIX_JCR, PREFIX_MIX, PREFIX_NT, PREFIX_XML
-
-
Constructor Summary
Constructors Constructor Description NamespaceRegistryImpl(FileSystem fs)Protected constructor: Constructs a new instance of this class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexternalRemap(String oldPrefix, String newPrefix, String uri)Called when a namespace has been externally remapped.StringgetPrefix(String uri)String[]getPrefixes()StringgetURI(String prefix)String[]getURIs()StringindexToString(int idx)Returns the namespace URI for a given index (i.e.booleanisReservedURI(String uri)Returnstrueif the specified uri is one of the reserved URIs defined in this registry.voidregisterNamespace(String prefix, String uri)voidsetEventChannel(NamespaceEventChannel eventChannel)Set an event channel to inform about changes.intstringToIndex(String uri)Returns the index (i.e.voidunregisterNamespace(String prefix)
-
-
-
Constructor Detail
-
NamespaceRegistryImpl
public NamespaceRegistryImpl(FileSystem fs) throws RepositoryException
Protected constructor: Constructs a new instance of this class.- Parameters:
fs- repository file system- Throws:
RepositoryException
-
-
Method Detail
-
setEventChannel
public void setEventChannel(NamespaceEventChannel eventChannel)
Set an event channel to inform about changes.- Parameters:
eventChannel- event channel
-
isReservedURI
public boolean isReservedURI(String uri)
Returnstrueif the specified uri is one of the reserved URIs defined in this registry.- Parameters:
uri- The URI to test.- Returns:
trueif the specified uri is reserved;falseotherwise.
-
stringToIndex
public int stringToIndex(String uri)
Returns the index (i.e. stable prefix) for the given namespace URI.- Specified by:
stringToIndexin interfaceStringIndex- Parameters:
uri- namespace URI- Returns:
- namespace index
- Throws:
IllegalArgumentException- if the namespace is not registered
-
indexToString
public String indexToString(int idx)
Returns the namespace URI for a given index (i.e. stable prefix).- Specified by:
indexToStringin interfaceStringIndex- Parameters:
idx- namespace index- Returns:
- namespace URI
- Throws:
IllegalArgumentException- if the given index is invalid
-
registerNamespace
public void registerNamespace(String prefix, String uri) throws NamespaceException, UnsupportedRepositoryOperationException, AccessDeniedException, RepositoryException
- Specified by:
registerNamespacein interfaceNamespaceRegistry- Throws:
NamespaceExceptionUnsupportedRepositoryOperationExceptionAccessDeniedExceptionRepositoryException
-
unregisterNamespace
public void unregisterNamespace(String prefix) throws NamespaceException, UnsupportedRepositoryOperationException, AccessDeniedException, RepositoryException
- Specified by:
unregisterNamespacein interfaceNamespaceRegistry- Throws:
NamespaceExceptionUnsupportedRepositoryOperationExceptionAccessDeniedExceptionRepositoryException
-
getPrefixes
public String[] getPrefixes() throws RepositoryException
- Specified by:
getPrefixesin interfaceNamespaceRegistry- Throws:
RepositoryException
-
getURIs
public String[] getURIs() throws RepositoryException
- Specified by:
getURIsin interfaceNamespaceRegistry- Throws:
RepositoryException
-
getURI
public String getURI(String prefix) throws NamespaceException
- Specified by:
getURIin interfaceNamespaceRegistry- Throws:
NamespaceException
-
getPrefix
public String getPrefix(String uri) throws NamespaceException
- Specified by:
getPrefixin interfaceNamespaceRegistry- Throws:
NamespaceException
-
externalRemap
public void externalRemap(String oldPrefix, String newPrefix, String uri) throws RepositoryException
Called when a namespace has been externally remapped.- Specified by:
externalRemapin interfaceNamespaceEventListener- Parameters:
oldPrefix- old prefix. ifnullthis is a fresh mappingnewPrefix- new prefix. ifnullthis is an unmap operationuri- uri to map prefix to- Throws:
RepositoryException- if an error occurs
-
-