|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.modeshape.connector.jcr.JcrNamespaceRegistry
public class JcrNamespaceRegistry
This represents the NamespaceRegistry
implementation mirroring a supplied JCR Session. This registry is used by a
custom context to create Name and Path objects from JCR Session values, and it ensures that any namespace used is also in the
connector's normal NamespaceRegistry.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.modeshape.graph.property.NamespaceRegistry |
---|
NamespaceRegistry.Namespace |
Method Summary | |
---|---|
protected void |
ensureRegisteredInConnector(String prefix,
String uri)
|
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. |
void |
register(Iterable<NamespaceRegistry.Namespace> namespaces)
|
String |
register(String prefix,
String namespaceUri)
Register a new namespace using the supplied prefix, returning the namespace URI previously registered under that prefix. |
boolean |
unregister(String namespaceUri)
Unregister the namespace with the supplied URI. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public String getDefaultNamespaceUri()
getDefaultNamespaceUri
in interface NamespaceRegistry
NamespaceRegistry.getDefaultNamespaceUri()
public String getNamespaceForPrefix(String prefix)
This method is most commonly used in this connector, because it is called to create Name
and Path
objects
given the string representation returned by the remote JCR session.
getNamespaceForPrefix
in interface NamespaceRegistry
prefix
- the namespace prefix
NamespaceRegistry.getNamespaceForPrefix(java.lang.String)
protected void ensureRegisteredInConnector(String prefix, String uri)
public Set<NamespaceRegistry.Namespace> getNamespaces()
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 nullNamespaceRegistry.getNamespaces()
public String getPrefixForNamespaceUri(String namespaceUri, boolean generateIfMissing)
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 namespace
null
if the namespace has not been registered
and generateIfMissing
is false
NamespaceRegistry.getPrefixForNamespaceUri(java.lang.String, boolean)
public Set<String> getRegisteredNamespaceUris()
getRegisteredNamespaceUris
in interface NamespaceRegistry
NamespaceRegistry.getRegisteredNamespaceUris()
public boolean isRegisteredNamespaceUri(String namespaceUri)
isRegisteredNamespaceUri
in interface NamespaceRegistry
namespaceUri
- the namespace URI
NamespaceRegistry.isRegisteredNamespaceUri(java.lang.String)
public void register(Iterable<NamespaceRegistry.Namespace> namespaces)
register
in interface NamespaceRegistry
NamespaceRegistry.register(java.lang.Iterable)
public String register(String prefix, String namespaceUri)
register
in interface NamespaceRegistry
prefix
- the prefix for the namespace, or null if a namesapce prefix should be generated automaticallynamespaceUri
- the namespace URI
NamespaceRegistry.register(java.lang.String, java.lang.String)
public boolean unregister(String namespaceUri)
unregister
in interface NamespaceRegistry
namespaceUri
- the namespace URI
NamespaceRegistry.unregister(java.lang.String)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |