Package org.apache.jackrabbit.util.name

Examples of org.apache.jackrabbit.util.name.NamespaceMapping


        try {
          if (contentType.equalsIgnoreCase(TEXT_XML)
                  || contentType.equalsIgnoreCase(APPLICATION_XML)) {
              return registerNodeTypes(new InputSource(in));
          } else if (contentType.equalsIgnoreCase(TEXT_X_JCR_CND)) {
              NamespaceMapping mapping = new NamespaceMapping(nsResolver);
              CompactNodeTypeDefReader reader = new CompactNodeTypeDefReader(
                      new InputStreamReader(in), "cnd input stream", mapping);

              Map nsMap = mapping.getPrefixToURIMapping();
              Iterator iterator = nsMap.entrySet().iterator();
              while (iterator.hasNext()) {
                  Map.Entry entry = (Map.Entry) iterator.next();
                  nsReg.safeRegisterNamespace(
                          (String) entry.getKey(), (String) entry.getValue());
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

                } catch (UnknownPrefixException e) {
                    throw new RepositoryException("Unknown namespace prefix", e);
                }
            } else if (contentType.equalsIgnoreCase(TEXT_X_JCR_CND)) {
                try {
                    NamespaceMapping mapping = new NamespaceMapping(nsResolver);
                    CompactNodeTypeDefReader reader = new CompactNodeTypeDefReader(
                            new InputStreamReader(in), "cnd input stream", mapping);

                    namespaceMap.putAll(mapping.getPrefixToURIMapping());

                    nodeTypeDefs.addAll(reader.getNodeTypeDefs());
                } catch (ParseException e) {
                    throw new IOException(e.getMessage());
                }
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

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

                    namespaceMap.putAll(mapping.getPrefixToURIMapping());

                    nodeTypeDefs.addAll(reader.getNodeTypeDefs());
                } catch (ParseException e) {
                    throw new IOException(e.getMessage());
                }
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

    private static final QName[] REQUIRED_NODE_TYPES = new QName[]{REQUIRED_NODE_TYPE_1, REQUIRED_NODE_TYPE_2};

    private NodeTypeDef modelNodeTypeDef;

    protected void setUp() throws Exception {
        NamespaceMapping namespaceMapping = new NamespaceMapping();
        namespaceMapping.setMapping(NS_PREFIX, NS_URI);
        InternalValue dv1 = InternalValue.create(DEFAULT_VALUE_1);
        InternalValue dv2 = InternalValue.create(DEFAULT_VALUE_2);
        ValueConstraint vc = ValueConstraint.create(PropertyType.LONG, VALUE_CONSTRAINT, namespaceMapping);
        InternalValue[] defaultValues = new InternalValue[]{dv1, dv2};
        ValueConstraint[] valueConstraints = new ValueConstraint[]{vc};
View Full Code Here

    public void testCompactNodeTypeDef() throws Exception {

        // Read in node type def from test file
        CompactNodeTypeDefReader cndReader = new CompactNodeTypeDefReader(new FileReader(TEST_FILE), TEST_FILE);
        List ntdList = cndReader.getNodeTypeDefs();
        NamespaceMapping nsm = cndReader.getNamespaceMapping();
        NodeTypeDef ntd = (NodeTypeDef)ntdList.get(0);

        // Test CND Reader by comparing imported NTD with model NTD.
        NodeTypeDefDiff diff = NodeTypeDefDiff.create(modelNodeTypeDef, ntd);
        if (diff.isModified()){
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

    private static final String DEFAULT_PREFIX = "test";

    public void testSchemaConverter() {
        try {
            NamespaceExtractor nse = new NamespaceExtractor(TEST_INPUT_FILE, DEFAULT_PREFIX);
            NamespaceMapping nsm = nse.getNamespaceMapping();

            SchemaConverter nts = new SchemaConverter(TEST_INPUT_FILE);
            List testList = nts.getNodeTypeDefs();

            CompactNodeTypeDefReader ntr = new CompactNodeTypeDefReader(new FileReader(MODEL_RESULT_FILE), MODEL_RESULT_FILE, nsm);
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.util.name.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.