Skip navigation links

Oracle Beehive Java Content Repository Java API Reference
Release 2 (2.0.1.7)

E16653-03


oracle.ocs.jcr
Interface OracleNamespaceRegistry

All Superinterfaces:
javax.jcr.NamespaceRegistry

public interface OracleNamespaceRegistry
extends javax.jcr.NamespaceRegistry

OracleNamespaceRegistry represents the global persistent namespace registry of the JCR Repository.

Each repository has a single, persistent namespace registry represented by the OracleNamespaceRegistry object, accessed through the method OracleWorkspace.getNamespaceRegistry().

See Also:
OracleWorkspace.getNamespaceRegistry()

Method Summary
 java.lang.String getPrefix(java.lang.String uri)
          Returns the prefix to which the given URI is mapped.
 java.lang.String[] getPrefixes()
          Returns an array holding all currently registered prefixes.
 java.lang.String getURI(java.lang.String prefix)
          Returns the URI to which the given prefix is mapped.
 java.lang.String[] getURIs()
          Returns an array holding all currently registered URIs.
 void registerNamespace(java.lang.String prefix, java.lang.String uri)
          Sets a one-to-one mapping between prefix and URI in the namespace registry of this repository in the associated session.
 void unregisterNamespace(java.lang.String prefix)
          Removes a namespace mapping from the registry in the associated Session.

 

Method Detail

registerNamespace

void registerNamespace(java.lang.String prefix,
                       java.lang.String uri)
                       throws javax.jcr.NamespaceException,
                              javax.jcr.UnsupportedRepositoryOperationException,
                              javax.jcr.AccessDeniedException,
                              javax.jcr.RepositoryException

Sets a one-to-one mapping between prefix and URI in the namespace registry of this repository in the associated session.

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 to prevent particular remappings NamespaceException is thrown.

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:

A RepositoryException is thrown if another error occurs.

Specified by:
registerNamespace in interface javax.jcr.NamespaceRegistry
Parameters:
prefix - The prefix to be mapped.
uri - The URI to be mapped.
Throws:
javax.jcr.NamespaceException - if an illegal attempt is made to register a mapping.
javax.jcr.RepositoryException - if another error occurs.
javax.jcr.UnsupportedRepositoryOperationException
javax.jcr.AccessDeniedException

unregisterNamespace

void unregisterNamespace(java.lang.String prefix)
                         throws javax.jcr.NamespaceException,
                                javax.jcr.UnsupportedRepositoryOperationException,
                                javax.jcr.AccessDeniedException,
                                javax.jcr.RepositoryException

Removes a namespace mapping from the registry in the associated Session.

The following restriction apply:

Specified by:
unregisterNamespace in interface javax.jcr.NamespaceRegistry
Parameters:
prefix - The prefix of the mapping to be removed.
Throws:
javax.jcr.NamespaceException - if an illegal attempt is made to remove a mapping. to unregister the namespace.
javax.jcr.RepositoryException - if another error occurs.
javax.jcr.UnsupportedRepositoryOperationException
javax.jcr.AccessDeniedException

getPrefixes

java.lang.String[] getPrefixes()
                               throws javax.jcr.RepositoryException
Returns an array holding all currently registered prefixes.
Specified by:
getPrefixes in interface javax.jcr.NamespaceRegistry
Returns:
a string array
Throws:
javax.jcr.RepositoryException - if an error occurs.

getURIs

java.lang.String[] getURIs()
                           throws javax.jcr.RepositoryException
Returns an array holding all currently registered URIs.
Specified by:
getURIs in interface javax.jcr.NamespaceRegistry
Returns:
a string array
Throws:
javax.jcr.RepositoryException - if an error occurs.

getURI

java.lang.String getURI(java.lang.String prefix)
                        throws javax.jcr.NamespaceException,
                               javax.jcr.RepositoryException
Returns the URI to which the given prefix is mapped.
Specified by:
getURI in interface javax.jcr.NamespaceRegistry
Parameters:
prefix - a string
Returns:
a string
Throws:
javax.jcr.NamespaceException - if the prefix is unknown.
javax.jcr.RepositoryException - is another error occurs

getPrefix

java.lang.String getPrefix(java.lang.String uri)
                           throws javax.jcr.NamespaceException,
                                  javax.jcr.RepositoryException
Returns the prefix to which the given URI is mapped.
Specified by:
getPrefix in interface javax.jcr.NamespaceRegistry
Parameters:
uri - a string
Returns:
a string
Throws:
javax.jcr.NamespaceException - if the URI is unknown.
javax.jcr.RepositoryException - is another error occurs

Skip navigation links

Oracle Beehive Java Content Repository Java API Reference
Release 2 (2.0.1.7)

E16653-03


Copyright © 2008, 2012, Oracle. All rights reserved.