| javax.jcr.NamespaceRegistry
NamespaceRegistry | public interface NamespaceRegistry (Code) | | Each repository has a single, persistent namespace registry represented by
the NamespaceRegistry object, accessed via Workspace.getNamespaceRegistry().
The namespace registry contains the default prefixes of the registered
namespaces. The namespace registry may contain namespaces that are not used
in repository content, and there may be repository content with namespaces
that are not included n the registry.
See Also: Workspace.getNamespaceRegistry |
Method Summary | |
public String | getPrefix(String uri) Returns the prefix which is mapped to the given uri . | public String[] | getPrefixes() Returns an array holding all currently registered prefixes. | public String | getURI(String prefix) Returns the URI to which the given prefix is mapped. | public String[] | getURIs() Returns an array holding all currently registered URIs. | public void | registerNamespace(String prefix, String uri) Sets a one-to-one mapping between prefix and uri
in the global namespace registry of this repository.
Assigning a new prefix to a URI that already exists in the namespace
registry erases the old prefix. | public void | unregisterNamespace(String prefix) Removes a namespace mapping from the registry. |
registerNamespace | public void registerNamespace(String prefix, String uri) throws NamespaceException, UnsupportedRepositoryOperationException, AccessDeniedException, RepositoryException(Code) | | Sets a one-to-one mapping between prefix and uri
in the global namespace registry of this repository.
Assigning a new prefix to a URI that already exists in the namespace
registry erases the old prefix. In general this can almost always be done,
though an implementation is free to prevent particular remappings by
throwing a NamespaceException .
On the other hand, taking a prefix that is already assigned to a URI and
re-assigning it to a new URI in effect unregisters that URI. Therefore,
the same restrictions apply to this operation as to
NamespaceRegistry.unregisterNamespace :
-
Attempting to re-assign a built-in prefix (
jcr ,
nt , mix , sv , xml , or
the empty prefix) to a new URI will throw a
NamespaceException .
-
Attempting to register a namespace with a prefix that begins with the
characters "
xml " (in any combination of case) will throw a
NamespaceException .
-
An implementation may prevent the re-assignment of any other namespace prefixes for
implementation-specific reasons by throwing a
NamespaceException .
In a level 1 implementation, this method always throws an
UnsupportedRepositoryOperationException .
If the session associated with the Workspace object through which this registry was acquired does not have sufficient permissions to register the
namespace an AccessDeniedException is thrown.
A RepositoryException is thrown if another error occurs.
Parameters: prefix - The prefix to be mapped. Parameters: uri - The URI to be mapped. throws: NamespaceException - if an illegal attempt is made to register a mapping. throws: UnsupportedRepositoryOperationException - in a level 1 implementation throws: AccessDeniedException - if the session associated with the Workspace object through which this registry was acquired does not have sufficient permissions to register the namespace. throws: RepositoryException - if another error occurs. |
unregisterNamespace | public void unregisterNamespace(String prefix) throws NamespaceException, UnsupportedRepositoryOperationException, AccessDeniedException, RepositoryException(Code) | | Removes a namespace mapping from the registry. The following restriction apply:
-
Attempting to unregister a built-in namespace (
jcr , nt ,
mix , sv , xml or the empty namespace) will
throw a NamespaceException .
-
An attempt to unregister a namespace that is not currently registered will throw a
NamespaceException .
-
An implementation may prevent the unregistering of any other namespace for
implementation-specific reasons by throwing a
NamespaceException .
In a level 1 implementation, this method always throws an
UnsupportedRepositoryOperationException .
If the session associated with the Workspace object through which this registry was acquired
does not have sufficient permissions to unregister the
namespace an AccessDeniedException is thrown.
A RepositoryException is thrown if another error occurs.
Parameters: prefix - The prefix of the mapping to be removed. throws: NamespaceException - if an illegal attempt is made to remove a mapping. throws: UnsupportedRepositoryOperationException - in a level 1 implementation throws: AccessDeniedException - if the session associated with the Workspace object through which this registry was acquired does not have sufficient permissionsto unregister the namespace. throws: RepositoryException - if another error occurs. |
|
|