Examples of NamespaceException


Examples of javax.jcr.NamespaceException

            AccessDeniedException, RepositoryException {
        if (prefix == null || uri == null) {
            throw new IllegalArgumentException("prefix/uri can not be null");
        }
        if (Name.NS_EMPTY_PREFIX.equals(prefix) || Name.NS_DEFAULT_URI.equals(uri)) {
            throw new NamespaceException("default namespace is reserved and can not be changed");
        }
        if (reservedURIs.contains(uri)) {
            throw new NamespaceException("failed to register namespace "
                    + prefix + " -> " + uri + ": reserved URI");
        }
        if (reservedPrefixes.contains(prefix)) {
            throw new NamespaceException("failed to register namespace "
                    + prefix + " -> " + uri + ": reserved prefix");
        }
        // special case: prefixes xml*
        if (prefix.toLowerCase().startsWith(Name.NS_XML_PREFIX)) {
            throw new NamespaceException("failed to register namespace "
                    + prefix + " -> " + uri + ": reserved prefix");
        }
        // check if the prefix is a valid XML prefix
        if (!XMLChar.isValidNCName(prefix)) {
            throw new NamespaceException("failed to register namespace "
                    + prefix + " -> " + uri + ": invalid prefix");
        }

        // check existing mappings
        String oldPrefix = uriToPrefix.get(uri);
        if (prefix.equals(oldPrefix)) {
            throw new NamespaceException("failed to register namespace "
                    + prefix + " -> " + uri + ": mapping already exists");
        }
        if (prefixToURI.containsKey(prefix)) {
            /**
             * prevent remapping of existing prefixes because this would in effect
             * remove the previously assigned namespace;
             * as we can't guarantee that there are no references to this namespace
             * (in names of nodes/properties/node types etc.) we simply don't allow it.
             */
            throw new NamespaceException("failed to register namespace "
                    + prefix + " -> " + uri
                    + ": remapping existing prefixes is not supported.");
        }

        if (oldPrefix != null) {
View Full Code Here

Examples of javax.jcr.NamespaceException

     */
    public void unregisterNamespace(String prefix)
            throws NamespaceException, UnsupportedRepositoryOperationException,
            AccessDeniedException, RepositoryException {
        if (reservedPrefixes.contains(prefix)) {
            throw new NamespaceException("reserved prefix: " + prefix);
        }
        if (!prefixToURI.containsKey(prefix)) {
            throw new NamespaceException("unknown prefix: " + prefix);
        }
        /**
         * as we can't guarantee that there are no references to the specified
         * namespace (in names of nodes/properties/node types etc.) we simply
         * don't allow it.
         */
        throw new NamespaceException("unregistering namespaces is not supported.");
    }
View Full Code Here

Examples of javax.jcr.NamespaceException

     * {@inheritDoc}
     */
    public String getURI(String prefix) throws NamespaceException {
        String uri = prefixToURI.get(prefix);
        if (uri == null) {
            throw new NamespaceException(prefix
                    + ": is not a registered namespace prefix.");
        }
        return uri;
    }
View Full Code Here

Examples of javax.jcr.NamespaceException

     * {@inheritDoc}
     */
    public String getPrefix(String uri) throws NamespaceException {
        String prefix = uriToPrefix.get(uri);
        if (prefix == null) {
            throw new NamespaceException(uri
                    + ": is not a registered namespace uri.");
        }
        return prefix;
    }
View Full Code Here

Examples of javax.jcr.NamespaceException

            /**
             * as we can't guarantee that there are no references to the specified
             * namespace (in names of nodes/properties/node types etc.) we simply
             * don't allow it.
             */
            throw new NamespaceException("unregistering namespaces is not supported.");
        }

        if (oldPrefix != null) {
            // remove old prefix mapping
            prefixToURI.remove(oldPrefix);
View Full Code Here

Examples of net.sf.saxon.om.NamespaceException

        if (prefix.equals("xml")) return NamespaceConstant.XML_CODE;

    NamePool pool = getNamePool();
    int prefixCode = pool.getCodeForPrefix(prefix);
    if (prefixCode==-1) {
        throw new NamespaceException(prefix);
    }
    return getURICodeForPrefixCode(prefixCode);
    }
View Full Code Here

Examples of org.bladerunnerjs.aliasing.NamespaceException

    if(identifier == null)
    {
      String idMessage = (htmlAsset.assetLocation().assetContainer().isNamespaceEnforced()) ?
        "a namespaced ID of '" + NamespaceUtility.convertToNamespace(htmlAsset.assetLocation().requirePrefix()) + ".*'" : "an ID";
     
      throw new NamespaceException( "HTML template found without an identifier: '" +
          startTag.toString() + "'.  Root element should have " + idMessage + ".");
    }
   
    htmlAsset.assetLocation().assertIdentifierCorrectlyNamespaced(identifier);
   
    Asset assetWithDuplicateId = identifiers.get(identifier);
    if(assetWithDuplicateId == null){
      identifiers.put(identifier, htmlAsset);
    }else{
      throw new NamespaceException("HTML template found with a duplicate identifier: '" +
            identifier + "'. The same identifier is used for the file:\n'"
            + assetWithDuplicateId.getAssetPath()
            + "'.");
    }
  }
View Full Code Here

Examples of org.jboss.dna.graph.property.NamespaceException

                    localName = decoder.decode(localName);
                    // Look for a namespace match ...
                    String namespaceUri = this.namespaceRegistry.getNamespaceForPrefix(prefix);
                    // Fail if no namespace is found ...
                    if (namespaceUri == null) {
                        throw new NamespaceException(GraphI18n.noNamespaceRegisteredForPrefix.text(prefix));
                    }
                    return new BasicName(namespaceUri, localName);
                }
            }
            // If it doesn't fit the prefixed pattern, then try the internal pattern
View Full Code Here

Examples of org.jrdf.writer.NamespaceException

        URI uri = resource.getURI();
        String full = uri.toString();
        String partial = getPartialUri(full);
        String ns = uris.get(partial);
        if (ns == null) {
            throw new NamespaceException("Partial uri: " + partial + " is not mapped to a namespace.");
        }
        return full.replaceFirst(partial, ns + ":");
    }
View Full Code Here

Examples of org.modeshape.jcr.value.NamespaceException

                prefix = decoder.decode(prefix);
                // Look for a namespace match ...
                String namespaceUri = this.namespaceRegistryHolder.getNamespaceRegistry().getNamespaceForPrefix(prefix);
                // Fail if no namespace is found ...
                if (namespaceUri == null) {
                    throw new NamespaceException(GraphI18n.noNamespaceRegisteredForPrefix.text(prefix));
                }
                int nextIndexAfterColon = colonIndex + 1;
                String localName = nextIndexAfterColon < value.length() ? value.substring(nextIndexAfterColon) : "";
                localName = decoder.decode(localName);
                return new BasicName(namespaceUri, localName);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.