Package com.alibaba.citrus.springext

Examples of com.alibaba.citrus.springext.Schema$Element


        // <xsd:include schemaLocation="contribution schema" />
        Set<String> includings = createTreeSet();

        for (Contribution contrib : configurationPoint.getContributions()) {
            Schema contribSchema = contrib.getSchemas().getVersionedSchema(version);

            if (contribSchema == null) {
                contribSchema = contrib.getSchemas().getMainSchema();
            }

            if (contribSchema != null) {
                includings.add(contribSchema.getName());
            }
        }

        for (String including : includings) {
            Element includeElement = schemaRoot.addElement("xsd:include");
View Full Code Here


                schema = setSchemaWithIncludes(schema, allIncludes);
            }

            // �ռ���ǰschema������elements
            // ���ڱ��е�schema������ܱ��滻������������ȷ��ȡ�����µ�schema����
            Schema newSchema = nameToSchemas.get(schema.getName());

            if (newSchema instanceof SchemaInternal) {
                ((SchemaInternal) newSchema).setElements(allElements);
            }
        }
View Full Code Here

            public InputStream getInputStream() throws IOException {
                return new ByteArrayInputStream(SchemaUtil.getSchemaContentWithIndirectIncludes(schema, allIncludes));
            }
        };

        Schema newSchema = new SchemaImpl(schema.getName(), schema.getVersion(), schema.getTargetNamespace(),
                schema.getPreferredNsPrefix(), schema.getSourceDescription(), sourceWithModifiedIncludes);

        addSchema(newSchema);

        return newSchema;
View Full Code Here

        return includes;
    }

    private void getAllIncludesDepthFirst(Schema schema, Map<String, Schema> includes) {
        for (String include : schema.getIncludes()) {
            Schema includedSchema = findIncludedSchema(include, schema.getName());
            getAllIncludesDepthFirst(includedSchema, includes);
        }

        includes.put(schema.getName(), schema);
    }
View Full Code Here

    }

    public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
        log.trace("Trying to locate XML entity {} as configuration points schema.", systemId);

        Schema schema = schemas.findSchema(systemId);

        if (schema == null) {
            if (defaultEntityResolver != null) {
                return defaultEntityResolver.resolveEntity(publicId, systemId);
            } else {
                return null;
            }
        }

        log.debug("Found XML schema for systemId {}: {}", systemId, schema);

        return new InputSource(schema.getInputStream());
    }
View Full Code Here

        // <xsd:include schemaLocation="contribution schema" />
        Set<String> includings = createTreeSet();

        for (Contribution contrib : configurationPoint.getContributions()) {
            Schema contribSchema = contrib.getSchemas().getVersionedSchema(version);

            if (contribSchema == null) {
                contribSchema = contrib.getSchemas().getMainSchema();
            }

            if (contribSchema != null) {
                includings.add(contribSchema.getName());
            }
        }

        for (String including : includings) {
            Element includeElement = schemaRoot.addElement("xsd:include");
View Full Code Here

            }

            private String getNewSchemaLocation(String schemaLocation, String namespace, String systemId) {
                // 根据指定的schemaLocation判断
                if (schemaLocation != null) {
                    Schema schema = schemas.findSchema(schemaLocation);

                    if (schema != null) {
                        return normalizedPrefix + schema.getName();
                    } else {
                        return schemaLocation; // 返回原本的location,但可能是错误的!
                    }
                }

                // 再根据namespace判断
                if (namespace != null) {
                    Set<Schema> nsSchemas = schemas.getNamespaceMappings().get(namespace);

                    if (nsSchemas != null && !nsSchemas.isEmpty()) {
                        // 首先,在所有相同ns的schema中查找版本相同的schema。
                        String versionedExtension = getVersionedExtension(systemId);

                        if (versionedExtension != null) {
                            for (Schema schema : nsSchemas) {
                                if (schema.getName().endsWith(versionedExtension)) {
                                    return normalizedPrefix + schema.getName();
                                }
                            }
                        }

                        // 其次,选择第一个默认的schema,其顺序是:beans.xsd、beans-2.5.xsd、beans-2.0.xsd
View Full Code Here

    @Override
    protected void finishProcessIncludes() {
        if (includedSchemaInfoMap != null) {
            for (final IncludedSchemaInfo includedSchemaInfo : includedSchemaInfoMap.values()) {
                Schema includedSchema = includedSchemaInfo.getIncludedSchema();

                includedSchema.transform(SchemaUtil.getAnyElementTransformer(getConfigurationPoints(), new AnyElementVisitor() {
                    public void visitAnyElement(ConfigurationPoint cp) {
                        for (Contribution contribution : includedSchemaInfo) {
                            if (cp instanceof ConfigurationPointImpl) {
                                ((ConfigurationPointImpl) cp).addDependingContribution(contribution);
                            }
View Full Code Here

        }

        private String getNewSchemaLocation(String schemaLocation, String namespace, String systemId) {
            // ����ָ����schemaLocation�ж�
            if (schemaLocation != null) {
                Schema schema = schemas.findSchema(schemaLocation);

                if (schema != null) {
                    return prefix + schema.getName();
                } else {
                    return schemaLocation; // ����ԭ����location���������Ǵ���ģ�
                }
            }

            // �ٸ���namespace�ж�
            if (namespace != null) {
                Set<Schema> nsSchemas = nsToSchemas.get(namespace);

                if (nsSchemas != null && !nsSchemas.isEmpty()) {
                    // ���ȣ���������ͬns��schema�в��Ұ汾��ͬ��schema��
                    String versionedExtension = getVersionedExtension(systemId);

                    if (versionedExtension != null) {
                        for (Schema schema : nsSchemas) {
                            if (schema.getName().endsWith(versionedExtension)) {
                                return prefix + schema.getName();
                            }
                        }
                    }

                    // ��Σ�ѡ���һ��Ĭ�ϵ�schema����˳���ǣ�beans.xsd��beans-2.5.xsd��beans-2.0.xsd
View Full Code Here

            // 收集当前schema的所有elements
            schema.setElements(allElements.values());
        }

        for (Map.Entry<String, SchemaIncludes> entry : nameToSchemaIncludes.entrySet()) {
            Schema schema = nameToSchemas.get(entry.getKey());
            SchemaIncludes si = entry.getValue();

            // 立即执行以下所有的transformer,以防在多线程环境下出错。
            if (si.removeAllIncludes) {
                schema.transform(getTransformerWhoRemovesIncludes(), true);
            } else if (si.allIncludes != null) {
                schema.transform(getTransformerWhoAddsIndirectIncludes(si.allIncludes), true);
            }
        }

        finishProcessIncludes();
    }
View Full Code Here

TOP

Related Classes of com.alibaba.citrus.springext.Schema$Element

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.