Copyright© 2008-2022 Sitevision AB, all rights reserved.
public interface NamespaceRegistry
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 in the registry.Workspace.getNamespaceRegistry()
Modifier and Type | Field and Description |
---|---|
static String |
NAMESPACE_EMPTY
A constant for the predefined namespace mapped by default to the prefix
"" (the empty prefix).
|
static String |
NAMESPACE_JCR
A constant for the predefined namespace mapped by default to the prefix
"jcr".
|
static String |
NAMESPACE_MIX
A constant for the predefined namespace mapped by default to the prefix
"mix".
|
static String |
NAMESPACE_NT
A constant for the predefined namespace mapped by default to the prefix
"nt".
|
static String |
NAMESPACE_XML
A constant for the predefined namespace mapped by default to the prefix
"xml".
|
static String |
PREFIX_EMPTY
A constant for the predefined namespace prefix "" (the empty prefix).
|
static String |
PREFIX_JCR
A constant for the predefined namespace prefix "jcr".
|
static String |
PREFIX_MIX
A constant for the predefined namespace prefix "mix".
|
static String |
PREFIX_NT
A constant for the predefined namespace prefix "nt".
|
static String |
PREFIX_XML
A constant for the predefined namespace prefix "xml".
|
Modifier and Type | Method and Description |
---|---|
String |
getPrefix(String uri)
Returns the prefix which is mapped to the given
uri . |
String[] |
getPrefixes()
Returns an array holding all currently registered prefixes.
|
String |
getURI(String prefix)
Returns the URI to which the given
prefix is mapped. |
String[] |
getURIs()
Returns an array holding all currently registered URIs.
|
void |
registerNamespace(String prefix,
String uri)
Sets a one-to-one mapping between
prefix and
uri in the global namespace registry of this repository. |
void |
unregisterNamespace(String prefix)
Removes a namespace mapping from the registry.
|
static final String PREFIX_JCR
static final String PREFIX_NT
static final String PREFIX_MIX
static final String PREFIX_XML
static final String PREFIX_EMPTY
static final String NAMESPACE_JCR
static final String NAMESPACE_NT
static final String NAMESPACE_MIX
static final String NAMESPACE_XML
static final String NAMESPACE_EMPTY
void registerNamespace(String prefix, String uri) throws NamespaceException, UnsupportedRepositoryOperationException, AccessDeniedException, RepositoryException
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
.
Sitevision note: Unsupported operation
prefix
- The prefix to be mapped.uri
- The URI to be mapped.NamespaceException
- If an attempt is made to re-assign a built-in
prefix to a new URI or, to register a namespace with a prefix that begins
with the characters "xml
" (in any combination of case) or,
An attempt is made to perform a prefix re-assignment that is forbidden
for implementation-specific reasons.UnsupportedRepositoryOperationException
- if this repository does
not support namespace registry changes.AccessDeniedException
- if the current session does not have
sufficent access to register the namespace.RepositoryException
- if another error occurs.void unregisterNamespace(String prefix) throws NamespaceException, UnsupportedRepositoryOperationException, AccessDeniedException, RepositoryException
Sitevision note: Unsupported operation
prefix
- The prefix of the mapping to be removed.NamespaceException
- if an attempt is made to unregister a built-in
namespace or a namespace that is not currently registered or a namespace
whose unregsitration is forbidden for implementation-specific reasons.UnsupportedRepositoryOperationException
- if this repository does
not support namespace registry changes.AccessDeniedException
- if the current session does not have
sufficent access to unregister the namespace.RepositoryException
- if another error occurs.String[] getPrefixes() throws RepositoryException
RepositoryException
- if an error occurs.String[] getURIs() throws RepositoryException
RepositoryException
- if an error occurs.String getURI(String prefix) throws NamespaceException, RepositoryException
prefix
is mapped.prefix
- a string.NamespaceException
- if a mapping with the specified
prefix
does not exist.RepositoryException
- if another error occurs.String getPrefix(String uri) throws NamespaceException, RepositoryException
uri
.uri
- a string.NamespaceException
- if a mapping with the specified
uri
does not exist.RepositoryException
- if another error occurs.Sitevision - Portal and Content Management Made Easy
Sitevision is an advanced Java enterprise portal product and a portlet container (JSR 286) that implements Java Content Repository (JSR 283).
Copyright© 2008-2022 Sitevision AB, all rights reserved.