Package org.apache.jackrabbit.spi.commons.namespace

Examples of org.apache.jackrabbit.spi.commons.namespace.NamespaceMapping


                } catch (NameException e) {
                    throw new RepositoryException("Illegal JCR name", e);
                }
            } else if (contentType.equalsIgnoreCase(TEXT_X_JCR_CND)) {
                try {
                    NamespaceMapping mapping = new NamespaceMapping(session);

                    CompactNodeTypeDefReader<QNodeTypeDefinition, NamespaceMapping> reader =
                        new CompactNodeTypeDefReader<QNodeTypeDefinition, NamespaceMapping>(
                            new InputStreamReader(in), "cnd input stream", mapping,
                            new QDefinitionBuilderFactory());

                    namespaceMap.putAll(mapping.getPrefixToURIMapping());
                    for (QNodeTypeDefinition ntDef: reader.getNodeTypeDefinitions()) {
                        nodeTypeDefs.add(ntDef);
                    }
                } catch (ParseException e) {
                    IOException e2 = new IOException(e.getMessage());
View Full Code Here


                        InputStream in = is.getByteStream();
                        try {
                            Reader r = new InputStreamReader(in, "utf8");
                            CNDReader reader = ServiceProviderFactory.getProvider().getCNDReader();
                            // provide session namespaces
                            reader.read(r, is.getSystemId(), new NamespaceMapping(resolver));
                            nodeTypes.add(reader);
                            log.debug("Loaded nodetypes from {}.", repoPath);
                        } catch (IOException e1) {
                            log.error("Error while reading CND.", e1);
                        } finally {
View Full Code Here

     */
    public NodeTypeDef readNodeTypeDef() throws JournalException {
        try {
            StringReader sr = new StringReader(readString());
            CompactNodeTypeDefReader reader = new CompactNodeTypeDefReader(
                    sr, "(internal)", new NamespaceMapping(nsResolver));
            Collection<QNodeTypeDefinition> ntds = reader.getNodeTypeDefinitions();
            if (ntds.size() != 1) {
                throw new JournalException("Expected one node type definition: got " + ntds.size());
            }
            return new NodeTypeDef(ntds.iterator().next());
View Full Code Here

                } catch (NameException e) {
                    throw new RepositoryException("Illegal JCR name", e);
                }
            } else if (contentType.equalsIgnoreCase(TEXT_X_JCR_CND)) {
                try {
                    NamespaceMapping mapping = new NamespaceMapping(session);
                    CompactNodeTypeDefReader reader = new CompactNodeTypeDefReader(
                            new InputStreamReader(in), "cnd input stream", mapping);

                    namespaceMap.putAll(mapping.getPrefixToURIMapping());
                    for (QNodeTypeDefinition ntDef: reader.getNodeTypeDefinitions()) {
                        nodeTypeDefs.add(new NodeTypeDef(ntDef));
                    }
                } catch (ParseException e) {
                    IOException e2 = new IOException(e.getMessage());
View Full Code Here

        try {
            StringReader sr = new StringReader(readString());

            CompactNodeTypeDefReader<QNodeTypeDefinition, NamespaceMapping> reader =
                new CompactNodeTypeDefReader<QNodeTypeDefinition, NamespaceMapping>(
                    sr, "(internal)", new NamespaceMapping(nsResolver),
                    new QDefinitionBuilderFactory());

            Collection<QNodeTypeDefinition> ntds = reader.getNodeTypeDefinitions();
            if (ntds.size() != 1) {
                throw new JournalException("Expected one node type definition: got " + ntds.size());
View Full Code Here

                } catch (NameException e) {
                    throw new RepositoryException("Illegal JCR name", e);
                }
            } else if (contentType.equalsIgnoreCase(TEXT_X_JCR_CND)) {
                try {
                    NamespaceMapping mapping = new NamespaceMapping(context.getSessionImpl());

                    CompactNodeTypeDefReader<QNodeTypeDefinition, NamespaceMapping> reader =
                        new CompactNodeTypeDefReader<QNodeTypeDefinition, NamespaceMapping>(
                            new InputStreamReader(in), "cnd input stream", mapping,
                            new QDefinitionBuilderFactory());

                    namespaceMap.putAll(mapping.getPrefixToURIMapping());
                    for (QNodeTypeDefinition ntDef: reader.getNodeTypeDefinitions()) {
                        nodeTypeDefs.add(ntDef);
                    }
                } catch (ParseException e) {
                    IOException e2 = new IOException(e.getMessage());
View Full Code Here

                } catch (NameException e) {
                    throw new RepositoryException("Illegal JCR name", e);
                }
            } else if (contentType.equalsIgnoreCase(TEXT_X_JCR_CND)) {
                try {
                    NamespaceMapping mapping = new NamespaceMapping(session);
                    CompactNodeTypeDefReader reader = new CompactNodeTypeDefReader(
                            new InputStreamReader(in), "cnd input stream", mapping);

                    namespaceMap.putAll(mapping.getPrefixToURIMapping());

                    nodeTypeDefs.addAll(reader.getNodeTypeDefs());
                } catch (ParseException e) {
                    IOException e2 = new IOException(e.getMessage());
                    e2.initCause(e);
View Full Code Here

                } catch (NameException e) {
                    throw new RepositoryException("Illegal JCR name", e);
                }
            } else if (contentType.equalsIgnoreCase(TEXT_X_JCR_CND)) {
                try {
                    NamespaceMapping mapping = new NamespaceMapping(session);
                    CompactNodeTypeDefReader reader = new CompactNodeTypeDefReader(
                            new InputStreamReader(in), "cnd input stream", mapping);

                    namespaceMap.putAll(mapping.getPrefixToURIMapping());

                    nodeTypeDefs.addAll(reader.getNodeTypeDefs());
                } catch (ParseException e) {
                    IOException e2 = new IOException(e.getMessage());
                    e2.initCause(e);
View Full Code Here

     *
     * @param r
     * @throws ParseException
     */
    public CompactNodeTypeDefReader(Reader r, String systemId) throws ParseException {
        this(r, systemId, new NamespaceMapping());
    }
View Full Code Here

        Reader reader = new InputStreamReader(getClass().getClassLoader().getResourceAsStream(TEST_FILE));
        CompactNodeTypeDefReader cndReader = new CompactNodeTypeDefReader(reader, TEST_FILE,
                new QNodeTypeDefinitionsBuilderImpl());

        List ntdList1 = cndReader.getNodeTypeDefs();
        NamespaceMapping nsm = cndReader.getNamespaceMapping();
        NamePathResolver resolver = new DefaultNamePathResolver(nsm);

        // Put imported node type def back into CND form with CND writer
        StringWriter sw = new StringWriter();
        ValueFactory vf = new ValueFactoryQImpl(QValueFactoryImpl.getInstance(), resolver);
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.spi.commons.namespace.NamespaceMapping

Copyright © 2018 www.massapicom. 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.