Package com.alibaba.citrus.springext

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


        ConfigurationPoint cp = cps.getConfigurationPointByName("my/services");
        VersionableSchemas schemas = cp.getSchemas();

        // cp - main schema
        Schema mainSchema = schemas.getMainSchema();

        assertEquals("http://www.alibaba.com/my/services", mainSchema.getTargetNamespace());
        assertEquals("svc", mainSchema.getNamespacePrefix()); // cps定义中指定了nsPrefix

        // cp - version 1.0 schema
        Schema versionedSchema_10 = schemas.getVersionedSchema("1.0");

        assertEquals("http://www.alibaba.com/my/services", versionedSchema_10.getTargetNamespace());
        assertEquals("svc", versionedSchema_10.getNamespacePrefix()); // cps定义中指定了nsPrefix

        // cp - version 2.0 schema
        Schema versionedSchema_20 = schemas.getVersionedSchema("2.0");

        assertEquals("http://www.alibaba.com/my/services", versionedSchema_20.getTargetNamespace());
        assertEquals("svc", versionedSchema_20.getNamespacePrefix()); // cps定义中指定了nsPrefix

        // cp - main schema, no nsPrefix specified
        cp = cps.getConfigurationPointByName("my/plugins");
        schemas = cp.getSchemas();
        mainSchema = schemas.getMainSchema();
View Full Code Here


                pluginSourceInfo.setSource(source, lineNumber);

                Resource schemaSource = getResource(classpathLocation, uri);

                if (schemaSource != null) {
                    Schema schema = SchemaImpl.createSpringPluggableSchema(
                            schemaName, version, true, desc, schemaSource,
                            new SourceInfoSupport<SpringSchemasSourceInfo>(pluginSourceInfo).setSource(schemaSource), toolingParameters);

                    nameToSchemaMappings.put(schemaName, schema);
                    uriToNameMappings.put(uri, schemaName);

                    String namespace = schema.getTargetNamespace();

                    if (namespace != null) {
                        namespaces.add(namespace);
                    }
                }
View Full Code Here

    public String getName() {
        return key.getName();
    }

    public String getAnnotation() {
        Schema schema = getSchemas().getMainSchema();

        if (schema != null) {
            Element element = schema.getElement(getName());

            if (element != null) {
                return element.getAnnotation();
            }
        }
View Full Code Here

    }

    public VersionableSchemas getSchemas() {
        if (schemas == null) {
            String mainName = configurationPoint.getName() + "/" + getName(); // configurationPointName/contributionName
            Schema mainSchema = loadMainSchema(mainName);
            Schema[] versionedSchemas = loadVersionedSchemas(mainName);

            schemas = new VersionableSchemasImpl(mainSchema, versionedSchemas);
        }
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

    public String getName() {
        return key.getName();
    }

    public String getAnnotation() {
        Schema schema = getSchemas().getMainSchema();

        if (schema != null) {
            Element element = schema.getElement(getName());

            if (element != null) {
                return element.getAnnotation();
            }
        }
View Full Code Here

    }

    public VersionableSchemas getSchemas() {
        if (schemas == null) {
            String mainName = configurationPoint.getName() + "/" + getName(); // configurationPointName/contributionName
            Schema mainSchema = loadMainSchema(mainName);
            Schema[] versionedSchemas = loadVersionedSchemas(mainName);

            schemas = new VersionableSchemasImpl(mainSchema, versionedSchemas);
        }
View Full Code Here

            Set<Schema> schemas = namespaceMappings.get(namespace);

            assertTrue(schemas != null, "%s not exist", namespace); // namespace必须存在

            Schema schema = null;

            if (!schemas.isEmpty()) {
                schema = schemas.iterator().next(); // 取得第一个schema作为main schema。
            }
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

        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

TOP

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

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.