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 void
externalRemap(String oldPrefix, String newPrefix, String uri)
Called when a namespace has been externally remapped.String
getPrefix(String uri)
String[]
getPrefixes()
String
getURI(String prefix)
String[]
getURIs()
String
indexToString(int idx)
Returns the namespace URI for a given index (i.e.boolean
isReservedURI(String uri)
Returnstrue
if the specified uri is one of the reserved URIs defined in this registry.void
registerNamespace(String prefix, String uri)
void
setEventChannel(NamespaceEventChannel eventChannel)
Set an event channel to inform about changes.int
stringToIndex(String uri)
Returns the index (i.e.void
unregisterNamespace(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)
Returnstrue
if the specified uri is one of the reserved URIs defined in this registry.- Parameters:
uri
- The URI to test.- Returns:
true
if the specified uri is reserved;false
otherwise.
-
stringToIndex
public int stringToIndex(String uri)
Returns the index (i.e. stable prefix) for the given namespace URI.- Specified by:
stringToIndex
in 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:
indexToString
in 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:
registerNamespace
in interfaceNamespaceRegistry
- Throws:
NamespaceException
UnsupportedRepositoryOperationException
AccessDeniedException
RepositoryException
-
unregisterNamespace
public void unregisterNamespace(String prefix) throws NamespaceException, UnsupportedRepositoryOperationException, AccessDeniedException, RepositoryException
- Specified by:
unregisterNamespace
in interfaceNamespaceRegistry
- Throws:
NamespaceException
UnsupportedRepositoryOperationException
AccessDeniedException
RepositoryException
-
getPrefixes
public String[] getPrefixes() throws RepositoryException
- Specified by:
getPrefixes
in interfaceNamespaceRegistry
- Throws:
RepositoryException
-
getURIs
public String[] getURIs() throws RepositoryException
- Specified by:
getURIs
in interfaceNamespaceRegistry
- Throws:
RepositoryException
-
getURI
public String getURI(String prefix) throws NamespaceException
- Specified by:
getURI
in interfaceNamespaceRegistry
- Throws:
NamespaceException
-
getPrefix
public String getPrefix(String uri) throws NamespaceException
- Specified by:
getPrefix
in 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:
externalRemap
in interfaceNamespaceEventListener
- Parameters:
oldPrefix
- old prefix. ifnull
this is a fresh mappingnewPrefix
- new prefix. ifnull
this is an unmap operationuri
- uri to map prefix to- Throws:
RepositoryException
- if an error occurs
-
-