org.modeshape.jcr.api

## Interface NamespaceRegistry

- All Superinterfaces:
    NamespaceRegistry

      public interface NamespaceRegistry
      extends NamespaceRegistry

  An extension of JCR 2.0's `NamespaceRegistry` interface, with a few ModeShape-specific enhancements.

- - ### Field Summary

    - ### Fields inherited from interface javax.jcr.NamespaceRegistry

      `NAMESPACE_EMPTY, NAMESPACE_JCR, NAMESPACE_MIX, NAMESPACE_NT, NAMESPACE_XML, PREFIX_EMPTY, PREFIX_JCR, PREFIX_MIX, PREFIX_NT, PREFIX_XML`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `isRegisteredPrefix(String prefix)` Determine if there is a namespace registered with the supplied prefix.
    `boolean` | `isRegisteredUri(String uri)` Determine if there is a namespace registered with the supplied URI.
    `String` | `registerNamespace(String uri)` Get the prefix for a registered namespace with the supplied URI or, if no such namespace is registered, register it with a generated prefix and return that prefix.

    - ### Methods inherited from interface javax.jcr.NamespaceRegistry

      `getPrefix, getPrefixes, getURI, getURIs, registerNamespace, unregisterNamespace`

- - ### Method Detail

    - #### isRegisteredPrefix

          boolean isRegisteredPrefix(String prefix)
                                     throws RepositoryException

      Determine if there is a namespace registered with the supplied prefix.
      Parameters:
        `prefix` - the namespace prefix; may not be null
      Returns:
        true if an existing namespace is registered to use the supplied prefix, or false otherwise
      Throws:
        `RepositoryException` - if another error occurs.

    - #### isRegisteredUri

          boolean isRegisteredUri(String uri)
                                  throws RepositoryException

      Determine if there is a namespace registered with the supplied URI.
      Parameters:
        `uri` - the namespace URI; may not be null
      Returns:
        true if a namespace with the supplied URI is already registered, or false otherwise
      Throws:
        `RepositoryException` - if another error occurs.

    - #### registerNamespace

          String registerNamespace(String uri)
                                   throws UnsupportedRepositoryOperationException,
                                          AccessDeniedException,
                                          RepositoryException

      Get the prefix for a registered namespace with the supplied URI or, if no such namespace is registered, register it with a generated prefix and return that prefix.
      Parameters:
        `uri` - The URI of the namespace; may not be null
      Returns:
        the prefix of the already-registered namespace, or the newly-generated prefix if no such namespace was registered
      Throws:
        `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.

Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.