@ThreadSafe public class SystemNamespaceRegistry extends Object implements NamespaceRegistry
NamespaceRegistry
implementation that stores the namespaces in the '/jcr:system' area as individual nodes for each
namespace.NamespaceRegistry.Holder, NamespaceRegistry.Namespace
Modifier and Type | Field and Description |
---|---|
static Name |
GENERATED_PROPERTY_NAME |
static Name |
URI_PROPERTY_NAME |
Modifier and Type | Method and Description |
---|---|
String |
getDefaultNamespaceUri()
Return the namespace URI that is currently mapped to the empty prefix, or null if there is no current default namespace.
|
String |
getNamespaceForPrefix(String prefix)
Get the namespace URI for the supplied prefix.
|
Set<NamespaceRegistry.Namespace> |
getNamespaces()
Obtain a snapshot of all of the
namespaces registered at the time this method is called. |
String |
getPrefixForNamespaceUri(String namespaceUri,
boolean generateIfMissing)
Return the prefix used for the supplied namespace URI.
|
Set<String> |
getRegisteredNamespaceUris()
Obtain the set of namespaces that are registered.
|
boolean |
isRegisteredNamespaceUri(String namespaceUri)
Return whether there is a registered prefix for the supplied namespace URI.
|
protected boolean |
refreshFromSystem()
Refresh the node types from the stored representation.
|
void |
register(Iterable<NamespaceRegistry.Namespace> namespaces) |
void |
register(Map<String,String> namespaceUrisByPrefix)
Register a set of namespaces.
|
String |
register(String prefix,
String namespaceUri)
Register a new namespace using the supplied prefix, returning the namespace URI previously registered under that prefix.
|
String |
toString() |
boolean |
unregister(String namespaceUri)
Unregister the namespace with the supplied URI.
|
public static final Name URI_PROPERTY_NAME
public static final Name GENERATED_PROPERTY_NAME
protected boolean refreshFromSystem()
public String getNamespaceForPrefix(String prefix)
NamespaceRegistry
getNamespaceForPrefix
in interface NamespaceRegistry
prefix
- the namespace prefixpublic String getPrefixForNamespaceUri(String namespaceUri, boolean generateIfMissing)
NamespaceRegistry
getPrefixForNamespaceUri
in interface NamespaceRegistry
namespaceUri
- the namespace URIgenerateIfMissing
- true if the namespace URI has not already been registered and the method should auto-register the
namespace with a generated prefix, or false if the method should never auto-register the namespacenull
if the namespace has not been registered
and generateIfMissing
is false
NamespaceRegistry.isRegisteredNamespaceUri(String)
public boolean isRegisteredNamespaceUri(String namespaceUri)
NamespaceRegistry
isRegisteredNamespaceUri
in interface NamespaceRegistry
namespaceUri
- the namespace URIpublic String getDefaultNamespaceUri()
NamespaceRegistry
getDefaultNamespaceUri
in interface NamespaceRegistry
public void register(Iterable<NamespaceRegistry.Namespace> namespaces)
register
in interface NamespaceRegistry
public void register(Map<String,String> namespaceUrisByPrefix)
namespaceUrisByPrefix
- the map of new namespace URIs by their prefixpublic String register(String prefix, String namespaceUri)
NamespaceRegistry
register
in interface NamespaceRegistry
prefix
- the prefix for the namespace, or null if a namesapce prefix should be generated automaticallynamespaceUri
- the namespace URIpublic boolean unregister(String namespaceUri)
NamespaceRegistry
unregister
in interface NamespaceRegistry
namespaceUri
- the namespace URIpublic Set<String> getRegisteredNamespaceUris()
NamespaceRegistry
getRegisteredNamespaceUris
in interface NamespaceRegistry
public Set<NamespaceRegistry.Namespace> getNamespaces()
NamespaceRegistry
namespaces
registered at the time this method is called. The resulting
set is immutable, and will not reflect changes made to the registry.getNamespaces
in interface NamespaceRegistry
NamespaceRegistry.Namespace
objects reflecting a snapshot of the registry; never nullpublic String toString()
toString
in class Object
Object.toString()
Copyright © 2008–2016 JBoss, a division of Red Hat. All rights reserved.