org.apache.jackrabbit.core
Class NamespaceRegistryImpl

java.lang.Object
  extended by org.apache.jackrabbit.core.NamespaceRegistryImpl
All Implemented Interfaces:
NamespaceRegistry, NamespaceEventListener, StringIndex

public class NamespaceRegistryImpl
extends Object
implements NamespaceRegistry, NamespaceEventListener, StringIndex

A NamespaceRegistryImpl ...


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
NamespaceRegistryImpl(FileSystem fs)
          Protected constructor: Constructs a new instance of this class.
 
Method Summary
 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. stable prefix).
 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. stable prefix) for the given namespace URI.
 void unregisterNamespace(String prefix)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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

stringToIndex

public int stringToIndex(String uri)
Returns the index (i.e. stable prefix) for the given namespace URI.

Specified by:
stringToIndex in interface StringIndex
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 interface StringIndex
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 interface NamespaceRegistry
Throws:
NamespaceException
UnsupportedRepositoryOperationException
AccessDeniedException
RepositoryException

unregisterNamespace

public void unregisterNamespace(String prefix)
                         throws NamespaceException,
                                UnsupportedRepositoryOperationException,
                                AccessDeniedException,
                                RepositoryException

Specified by:
unregisterNamespace in interface NamespaceRegistry
Throws:
NamespaceException
UnsupportedRepositoryOperationException
AccessDeniedException
RepositoryException

getPrefixes

public String[] getPrefixes()
                     throws RepositoryException

Specified by:
getPrefixes in interface NamespaceRegistry
Throws:
RepositoryException

getURIs

public String[] getURIs()
                 throws RepositoryException

Specified by:
getURIs in interface NamespaceRegistry
Throws:
RepositoryException

getURI

public String getURI(String prefix)
              throws NamespaceException

Specified by:
getURI in interface NamespaceRegistry
Throws:
NamespaceException

getPrefix

public String getPrefix(String uri)
                 throws NamespaceException

Specified by:
getPrefix in interface NamespaceRegistry
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 interface NamespaceEventListener
Parameters:
oldPrefix - old prefix. if null this is a fresh mapping
newPrefix - new prefix. if null this is an unmap operation
uri - uri to map prefix to
Throws:
RepositoryException - if an error occurs


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