javax.wsdl.extensions.schema.Schema.getImports()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(11.6k)|赞(0)|评价(0)|浏览(141)

本文整理了Java中javax.wsdl.extensions.schema.Schema.getImports()方法的一些代码示例,展示了Schema.getImports()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Schema.getImports()方法的具体详情如下:
包路径:javax.wsdl.extensions.schema.Schema
类名称:Schema
方法名:getImports

Schema.getImports介绍

[英]Get a map of lists containing all the imports defined here. The map's keys are the namespaceURIs, and the map's values are lists. There is one list for each namespaceURI for which imports have been defined.
[中]获取包含此处定义的所有导入的列表映射。映射的键是namespaceuri,映射的值是列表。已定义导入的每个namespaceURI都有一个列表。

代码示例

代码示例来源:origin: wsdl4j/wsdl4j

Collection ic = schema.getImports().values();
Iterator importsIterator = ic.iterator();
while(importsIterator.hasNext())

代码示例来源:origin: Talend/components

private void processSchema(javax.wsdl.extensions.schema.Schema schema, Collection<String> namespaceList) throws Exception {
    for (Iterator itImp = schema.getImports().values().iterator(); itImp.hasNext();) {
      Collection imps = (Collection) itImp.next();
      for (Iterator itSi = imps.iterator(); itSi.hasNext();) {
        SchemaImport imp = (SchemaImport) itSi.next();
        String namespaceUri = imp.getNamespaceURI();
        namespaceList.add(namespaceUri);

        processSchema(imp.getReferencedSchema(), namespaceList);
      }
    }
  }
}

代码示例来源:origin: apache/cxf

private void fixSchema(Schema sc, String pfx) throws ParserConfigurationException {
  Document doc = DOMUtils.getEmptyDocument();
  Element el = doc.createElementNS(sc.getElementType().getNamespaceURI(),
            pfx + ":" + sc.getElementType().getLocalPart());
  sc.setElement(el);
  Map<String, List<String>> mp = CastUtils.cast(sc.getImports());
  for (Map.Entry<String, List<String>> ent : mp.entrySet()) {
    Element imp = doc.createElementNS(sc.getElementType().getNamespaceURI(),
                     pfx + ":import");
    el.appendChild(imp);
    imp.setAttribute("namespace", ent.getKey());
  }
}

代码示例来源:origin: apache/cxf

private void addWSDLSchemaImport(Schema wsdlSchema, String tns, File file) {
  if (!wsdlSchema.getImports().containsKey(tns)) {
    SchemaImport schemaimport = wsdlSchema.createImport();
    schemaimport.setNamespaceURI(tns);
    if (file != null && !ignoreImports) {
      schemaimport.setSchemaLocationURI(file.toURI().toString());
    }
    wsdlSchema.addImport(schemaimport);
  }
}

代码示例来源:origin: com.consol.citrus/citrus-core

/**
 * Recursively add all imported schemas as schema resource.
 * This is necessary when schema import are located in jar files. If they are not added immediately the reference to them is lost.
 *
 * @param schema
 */
protected void addImportedSchemas(Schema schema) throws WSDLException, IOException, TransformerException, TransformerFactoryConfigurationError {
  for (Object imports : schema.getImports().values()) {
    for (SchemaImport schemaImport : (Vector<SchemaImport>)imports) {
      // Prevent duplicate imports
      if (!importedSchemas.contains(schemaImport.getNamespaceURI())) {
        importedSchemas.add(schemaImport.getNamespaceURI());
        Schema referencedSchema = schemaImport.getReferencedSchema();
        if (referencedSchema != null) {
          ByteArrayOutputStream bos = new ByteArrayOutputStream();
          Source source = new DOMSource(referencedSchema.getElement());
          Result result = new StreamResult(bos);
          TransformerFactory.newInstance().newTransformer().transform(source, result);
          Resource schemaResource = new ByteArrayResource(bos.toByteArray());
          addImportedSchemas(referencedSchema);
          schemaResources.add(schemaResource);
        }
      }
    }
  }
}

代码示例来源:origin: org.mule.modules/mule-module-ws

Collection<List<SchemaReference>> schemaImportsCollection = schema.getImports().values();
Collection<SchemaReference> schemaIncludesCollection = schema.getIncludes();

代码示例来源:origin: org.switchyard.components/switchyard-component-soap

private static Boolean setMtomEnabled(Schema schema) {
  if (schema != null) {
    if (hasExpectedContentTypes(schema.getElement())) {
      return true;
    }
    for (List<SchemaImport> c : ((Map<String, List<SchemaImport>>)schema.getImports()).values()) {
      for (SchemaImport simport : c) {
        if (setMtomEnabled(simport.getReferencedSchema())) {
          return true;
        }
      }
    }
  }
  return false;
}

代码示例来源:origin: jboss-switchyard/components

private static Boolean setMtomEnabled(Schema schema) {
  if (schema != null) {
    if (hasExpectedContentTypes(schema.getElement())) {
      return true;
    }
    for (List<SchemaImport> c : ((Map<String, List<SchemaImport>>)schema.getImports()).values()) {
      for (SchemaImport simport : c) {
        if (setMtomEnabled(simport.getReferencedSchema())) {
          return true;
        }
      }
    }
  }
  return false;
}

代码示例来源:origin: org.objectweb.celtix/celtix-tools

@SuppressWarnings("unchecked")
private void addSchema(Schema schema) {
  Map<String, List> imports = schema.getImports();
  if (imports != null && imports.size() > 0) {
    Collection<String> importKeys = imports.keySet();
    for (String importNamespace : importKeys) {
      if (!isSchemaParsed(importNamespace + "?file=" + schema.getDocumentBaseURI())) {
        List<SchemaImport> schemaImports = imports.get(importNamespace);
        for (SchemaImport schemaImport : schemaImports) {
          Schema tempImport = schemaImport.getReferencedSchema();
          if (tempImport != null && !isSchemaImported(tempImport)) {
            addSchema(tempImport);
          }
        }
      }
    }
  }
  if (!isSchemaImported(schema)) {
    schemaList.add(schema);
  }
}

代码示例来源:origin: org.wso2.carbon.governance/org.wso2.carbon.governance.registry.extensions

if (extensionObject instanceof Schema) {
  schema = (Schema)extensionObject;
  if (schema.getImports().size() > 0) {
    SchemaImportImpl schemaImport =
        (SchemaImportImpl) ((Vector) schema.getImports().values()
            .toArray()[0]).firstElement();
    if (schemaImport.getReferencedSchema() != null) {

代码示例来源:origin: org.apache.servicemix/servicemix-common

private void parseSchemas(Definition def) throws Exception {
  if (def.getTypes() != null && def.getTypes().getExtensibilityElements() != null) {
    for (Iterator iter = def.getTypes().getExtensibilityElements().iterator(); iter.hasNext();) {
      ExtensibilityElement element = (ExtensibilityElement) iter.next();
      if (element instanceof javax.wsdl.extensions.schema.Schema) {
        javax.wsdl.extensions.schema.Schema schema = (javax.wsdl.extensions.schema.Schema) element;
        if (schema.getElement() != null) {
          schemas.read(schema.getElement(), getUri(schema.getDocumentBaseURI()));
        }
        for (Iterator itImp = schema.getImports().values().iterator(); itImp.hasNext();) {
          Collection imps = (Collection) itImp.next();
          for (Iterator itSi = imps.iterator(); itSi.hasNext();) {
            SchemaImport imp = (SchemaImport) itSi.next();
            schemas.read(imp.getSchemaLocationURI(), getUri(def.getDocumentBaseURI()));
          }
        }
      }
    }
  }
  if (def.getImports() != null) {
    for (Iterator itImp = def.getImports().values().iterator(); itImp.hasNext();) {
      Collection imps = (Collection) itImp.next();
      for (Iterator iter = imps.iterator(); iter.hasNext();) {
        Import imp = (Import) iter.next();
        parseSchemas(imp.getDefinition());
      }
    }
  }
}

代码示例来源:origin: org.apache.ode/ode-jbi

private void parseSchemas(Definition def) throws Exception {
  if (def.getTypes() != null && def.getTypes().getExtensibilityElements() != null) {
    for (Iterator iter = def.getTypes().getExtensibilityElements().iterator(); iter.hasNext();) {
      ExtensibilityElement element = (ExtensibilityElement) iter.next();
      if (element instanceof javax.wsdl.extensions.schema.Schema) {
        javax.wsdl.extensions.schema.Schema schema = (javax.wsdl.extensions.schema.Schema) element;
        if (schema.getElement() != null) {
          _schemas.read(schema.getElement(), getUri(schema.getDocumentBaseURI()));
        }
        for (Iterator itImp = schema.getImports().values().iterator(); itImp.hasNext();) {
          Collection imps = (Collection) itImp.next();
          for (Iterator itSi = imps.iterator(); itSi.hasNext();) {
            SchemaImport imp = (SchemaImport) itSi.next();
            _schemas.read(imp.getSchemaLocationURI(), getUri(def.getDocumentBaseURI()));
          }
        }
      }
    }
  }
  if (def.getImports() != null) {
    for (Iterator itImp = def.getImports().values().iterator(); itImp.hasNext();) {
      Collection imps = (Collection) itImp.next();
      for (Iterator iter = imps.iterator(); iter.hasNext();) {
        Import imp = (Import) iter.next();
        parseSchemas(imp.getDefinition());
      }
    }
  }
}

代码示例来源:origin: apache/cxf

Map<String, List<?>> imports = CastUtils.cast(schema.getImports());
if (imports != null && !imports.isEmpty()) {
  for (Map.Entry<String, List<?>> entry : imports.entrySet()) {

代码示例来源:origin: org.apache.cxf/cxf-rt-core

Map<String, List<?>> imports = CastUtils.cast(schema.getImports());
if (imports != null && imports.size() > 0) {
  Collection<String> importKeys = imports.keySet();

代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs

Map<String, List<?>> imports = CastUtils.cast(schema.getImports());
if (imports != null && imports.size() > 0) {
  Collection<String> importKeys = imports.keySet();

代码示例来源:origin: org.apache.servicemix/servicemix-http

private void mapSchema(Schema schema, String contextPath) {
  Map schemaImports = schema.getImports();
  for (Iterator iter = schemaImports.values().iterator(); iter.hasNext();) {
    List imps = (List) iter.next();
    for (Iterator iterator = imps.iterator(); iterator.hasNext();) {
      SchemaImport schemaImport = (SchemaImport) iterator.next();
      Schema schemaImp = schemaImport.getReferencedSchema();
      String schemaLoc = schemaImport.getSchemaLocationURI();
      if (schemaLoc != null && schemaImp != null && schemaImp.getElement() != null && !URI.create(schemaLoc).isAbsolute()) {
        schemaLoc = resolveRelativeURI(contextPath, schemaLoc);
        addResource(schemaLoc, schemaImp.getElement());
        // recursively map imported schemas
        mapSchema(schemaImp, getURIParent(schemaLoc));
      }
    }
  }
  List schemaIncludes = schema.getIncludes();
  for (Iterator iter = schemaIncludes.iterator(); iter.hasNext();) {
    SchemaReference schemaInclude = (SchemaReference) iter.next();
    Schema schemaImp = schemaInclude.getReferencedSchema();
    String schemaLoc = schemaInclude.getSchemaLocationURI();
    if (schemaLoc != null && schemaImp != null && schemaImp.getElement() != null && !URI.create(schemaLoc).isAbsolute()) {
      schemaLoc = resolveRelativeURI(contextPath, schemaLoc);
      addResource(schemaLoc, schemaImp.getElement());
      // recursively map included schemas
      mapSchema(schemaImp, getURIParent(schemaLoc));
    }
  }
}

代码示例来源:origin: reficio/soap-ws

if (schema.getImports() != null && schema.getImports().values() != null) {
  for (Object o : schema.getImports().values()) {
    for (Object oi : (Vector) o) {
      if (oi instanceof SchemaImport) {

代码示例来源:origin: org.apache.cxf/cxf-rt-databinding-jibx

Map<String, List<?>> imports = CastUtils.cast(schema.getImports());
if (imports != null && imports.size() > 0) {
  Collection<String> importKeys = imports.keySet();

代码示例来源:origin: apache/cxf

protected void updateSchemaImports(Bus bus,
                  Schema schema,
                  String docBase,
                  Map<String, SchemaReference> doneSchemas,
                  String base,
                  String parentResolved) {
  Collection<List<?>>  imports = CastUtils.cast((Collection<?>)schema.getImports().values());
  for (List<?> lst : imports) {
    List<SchemaImport> impLst = CastUtils.cast(lst);
    for (SchemaImport imp : impLst) {
      processSchemaReference(imp, bus, schema, docBase, doneSchemas, base, parentResolved);
    }
  }
  List<SchemaReference> includes = CastUtils.cast(schema.getIncludes());
  for (SchemaReference included : includes) {
    processSchemaReference(included, bus, schema, docBase, doneSchemas, base, parentResolved);
  }
  List<SchemaReference> redefines = CastUtils.cast(schema.getRedefines());
  for (SchemaReference included : redefines) {
    processSchemaReference(included, bus, schema, docBase, doneSchemas, base, parentResolved);
  }
}

代码示例来源:origin: org.apache.cxf/cxf-rt-frontend-simple

protected void updateSchemaImports(Bus bus,
                  Schema schema,
                  String docBase,
                  Map<String, SchemaReference> doneSchemas,
                  String base,
                  String parentResolved) {
  Collection<List<?>>  imports = CastUtils.cast((Collection<?>)schema.getImports().values());
  for (List<?> lst : imports) {
    List<SchemaImport> impLst = CastUtils.cast(lst);
    for (SchemaImport imp : impLst) {
      processSchemaReference(imp, bus, schema, docBase, doneSchemas, base, parentResolved);
    }
  }
  List<SchemaReference> includes = CastUtils.cast(schema.getIncludes());
  for (SchemaReference included : includes) {
    processSchemaReference(included, bus, schema, docBase, doneSchemas, base, parentResolved);
  }
  List<SchemaReference> redefines = CastUtils.cast(schema.getRedefines());
  for (SchemaReference included : redefines) {
    processSchemaReference(included, bus, schema, docBase, doneSchemas, base, parentResolved);
  }
}

相关文章