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

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


    public NodeTypeDef readNodeTypeDef() throws JournalException {
        try {
            StringReader sr = new StringReader(readString());

            CompactNodeTypeDefReader reader = new CompactNodeTypeDefReader(
                    sr, "(internal)", new NamespaceMapping(nsResolver));
            List ntds = reader.getNodeTypeDefs();
            if (ntds.size() != 1) {
                throw new JournalException("Expected one node type definition: got " + ntds.size());
            }
            return (NodeTypeDef) ntds.get(0);
View Full Code Here


        CompactNodeTypeDefReader<QNodeTypeDefinition, NamespaceMapping> cndReader =
            new CompactNodeTypeDefReader<QNodeTypeDefinition, NamespaceMapping>(
                reader, TEST_FILE, new QItemDefinitionsBuilder());

        List<QNodeTypeDefinition> ntdList1 = cndReader.getNodeTypeDefinitions();
        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();
        CompactNodeTypeDefWriter.write(ntdList1, nsm, resolver, sw);
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<QNodeTypeDefinition, NamespaceMapping> reader =
                        new CompactNodeTypeDefReader<QNodeTypeDefinition, NamespaceMapping>(
                            new InputStreamReader(in), "cnd input stream", mapping,
                            new QItemDefinitionsBuilder());

                    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 QItemDefinitionsBuilder());

            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

                        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

        CompactNodeTypeDefReader<QNodeTypeDefinition, NamespaceMapping> cndReader =
            new CompactNodeTypeDefReader<QNodeTypeDefinition, NamespaceMapping>(
                reader, TEST_FILE, new QDefinitionBuilderFactory());

        List<QNodeTypeDefinition> ntdList1 = cndReader.getNodeTypeDefinitions();
        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();
        CompactNodeTypeDefWriter.write(ntdList1, nsm, resolver, sw);
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

    public NodeTypeDef readNodeTypeDef() throws JournalException {
        try {
            StringReader sr = new StringReader(readString());

            CompactNodeTypeDefReader reader = new CompactNodeTypeDefReader(
                    sr, "(internal)", new NamespaceMapping(nsResolver));
            List ntds = reader.getNodeTypeDefs();
            if (ntds.size() != 1) {
                throw new JournalException("Expected one node type definition: got " + ntds.size());
            }
            return (NodeTypeDef) ntds.get(0);
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.