当前位置: 首页>>代码示例>>Java>>正文


Java Schema类代码示例

本文整理汇总了Java中javax.wsdl.extensions.schema.Schema的典型用法代码示例。如果您正苦于以下问题:Java Schema类的具体用法?Java Schema怎么用?Java Schema使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Schema类属于javax.wsdl.extensions.schema包,在下文中一共展示了Schema类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findNamedElement

import javax.wsdl.extensions.schema.Schema; //导入依赖的package包/类
/**
 * Find a named <element> in the types section of the WSDL.
 *
 * @param elementName Name of element to find.
 * @return The element node.
 * @throws IllegalArgumentException if element cannot be found in the schema.
 */
protected Element findNamedElement(QName elementName) {

    Schema s = getSchema(elementName.getNamespaceURI());
    Element schemaRoot = s.getElement();
    List<Element> elements = DomUtils.getChildElementsByName(schemaRoot, WsdlUtils.ELEMENT_NAME);

    Element namedElement = null;
    for (Element e : elements) {
        String schemaElementName = e.getAttribute(WsdlUtils.NAME_ATTR);
        if (elementName.getLocalPart().equals(schemaElementName)) {
            namedElement = e;
            break;
        }
    }

    if (namedElement == null) {
        throw new IllegalArgumentException("Could not find element in schema!");
    }
    return namedElement;
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:28,代码来源:WsdlTypes.java

示例2: findNamedType

import javax.wsdl.extensions.schema.Schema; //导入依赖的package包/类
/**
 * Find a named &lt;complexType&gt; or &lt;simpleType&gt; in the types section of the WSDL.
 *
 * @param typeName Name of the type to find.
 * @return null if type not found.
 */
protected Element findNamedType(QName typeName) {

    Schema s = getSchema(typeName.getNamespaceURI());
    if (s == null) {
        return null;
    }

    Element schemaRoot = s.getElement();
    
    // get all simple and complex types defined at the top-level.
    //
    List<Element> types = DomUtils.getChildElementsByName(schemaRoot, WsdlUtils.COMPLEX_TYPE_NAME);
    types.addAll(DomUtils.getChildElementsByName(schemaRoot, WsdlUtils.SIMPLE_TYPE_NAME));

    Element namedType = null;
    for (Element t : types) {
        String schemaTypeName = t.getAttribute(WsdlUtils.NAME_ATTR);
        if (typeName.getLocalPart().equals(schemaTypeName)) {
            namedType = t;
            break;
        }
    }
    return namedType;
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:31,代码来源:WsdlTypes.java

示例3: getElementFormQualifiedNamespaces

import javax.wsdl.extensions.schema.Schema; //导入依赖的package包/类
/**
 * Build a list of schema target name spaces which are element form qualified.
 *
 * @return All target name spaces for schemas defined in the WSDL which are element form qualified.
 */
private List<String> getElementFormQualifiedNamespaces() {

    List<String> namespaces = new ArrayList<String>();
    List<ExtensibilityElement> schemas = getSchemas();
    
    for (ExtensibilityElement schema : schemas) {
        Element schemaElement = ((Schema)schema).getElement();

        if (schemaElement.hasAttribute(WsdlUtils.ELEMENT_FORM_DEFAULT_ATTR)) {
            String v = schemaElement.getAttribute(WsdlUtils.ELEMENT_FORM_DEFAULT_ATTR);
            if (WsdlUtils.ELEMENT_FORM_QUALIFIED.equalsIgnoreCase(v)) {
                namespaces.add(schemaElement.getAttribute(WsdlUtils.TARGET_NAMESPACE_ATTR));
            }
        }
    }
    return namespaces;
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:23,代码来源:WsdlTypes.java

示例4: getSchema

import javax.wsdl.extensions.schema.Schema; //导入依赖的package包/类
/**
 * Get the schema with the specified target namespace.
 *
 * @param targetNamespace target namespace of the schema to get.
 * @return null if not found.
 */
private Schema getSchema(String targetNamespace) {

    if (_types == null) {
        return null;
    }

    List<ExtensibilityElement> schemas = WsdlUtils.findExtensibilityElements(_types, "schema");

    for (ExtensibilityElement e : schemas) {
        Element schemaRoot = ((Schema) e).getElement();
        String tns = schemaRoot.getAttribute("targetNamespace");
        if (targetNamespace.equals(tns)) {
            return (Schema) e;
        }
    }
    return null;
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:24,代码来源:WsdlTypes.java

示例5: findNamedElement

import javax.wsdl.extensions.schema.Schema; //导入依赖的package包/类
/**
 * Find a named &lt;element&gt; in the types section of the WSDL.
 *
 * @param elementName Name of element to find.
 * @return The element node.
 * @throws KettleStepException If schema or element in schema can't be found for the given element name
 */
protected Element findNamedElement(QName elementName) throws KettleStepException {

    Element namedElement = null;
    Schema s = getSchema(elementName.getNamespaceURI());
    if (s == null) {
        throw new KettleStepException(BaseMessages.getString(PKG, "Wsdl.Error.MissingSchemaException", elementName));
    }
         
    Element schemaRoot = s.getElement();
    List<Element> elements = DomUtils.getChildElementsByName(schemaRoot, WsdlUtils.ELEMENT_NAME);

    for (Element e : elements) {
        String schemaElementName = e.getAttribute(WsdlUtils.NAME_ATTR);
        if (elementName.getLocalPart().equals(schemaElementName)) {
            namedElement = e;
            break;
        }
    }

    if (namedElement == null) {
          throw new KettleStepException(BaseMessages.getString(PKG, "Wsdl.Error.ElementMissingException", elementName));
    }
    return namedElement;
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:32,代码来源:WsdlTypes.java

示例6: findNamedType

import javax.wsdl.extensions.schema.Schema; //导入依赖的package包/类
/**
 * Find a named &lt;complexType&gt; or &lt;simpleType&gt; in the types section of the WSDL.
 *
 * @param typeName
 *          Name of the type to find.
 * @return null if type not found.
 */
protected Element findNamedType( QName typeName ) {

  Schema s = getSchema( typeName.getNamespaceURI() );
  if ( s == null ) {
    return null;
  }

  Element schemaRoot = s.getElement();

  // get all simple and complex types defined at the top-level.
  //
  List<Element> types = DomUtils.getChildElementsByName( schemaRoot, WsdlUtils.COMPLEX_TYPE_NAME );
  types.addAll( DomUtils.getChildElementsByName( schemaRoot, WsdlUtils.SIMPLE_TYPE_NAME ) );

  Element namedType = null;
  for ( Element t : types ) {
    String schemaTypeName = t.getAttribute( WsdlUtils.NAME_ATTR );
    if ( typeName.getLocalPart().equals( schemaTypeName ) ) {
      namedType = t;
      break;
    }
  }
  return namedType;
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:32,代码来源:WsdlTypes.java

示例7: getElementFormQualifiedNamespaces

import javax.wsdl.extensions.schema.Schema; //导入依赖的package包/类
/**
 * Build a list of schema target name spaces which are element form qualified.
 *
 * @return All target name spaces for schemas defined in the WSDL which are element form qualified.
 */
private List<String> getElementFormQualifiedNamespaces() {

  List<String> namespaces = new ArrayList<String>();
  List<ExtensibilityElement> schemas = getSchemas();

  for ( ExtensibilityElement schema : schemas ) {
    Element schemaElement = ( (Schema) schema ).getElement();

    if ( schemaElement.hasAttribute( WsdlUtils.ELEMENT_FORM_DEFAULT_ATTR ) ) {
      String v = schemaElement.getAttribute( WsdlUtils.ELEMENT_FORM_DEFAULT_ATTR );
      if ( WsdlUtils.ELEMENT_FORM_QUALIFIED.equalsIgnoreCase( v ) ) {
        namespaces.add( schemaElement.getAttribute( WsdlUtils.TARGET_NAMESPACE_ATTR ) );
      }
    }
  }
  return namespaces;
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:23,代码来源:WsdlTypes.java

示例8: getSchema

import javax.wsdl.extensions.schema.Schema; //导入依赖的package包/类
/**
 * Get the schema with the specified target namespace.
 *
 * @param targetNamespace
 *          target namespace of the schema to get.
 * @return null if not found.
 */
private Schema getSchema( String targetNamespace ) {

  if ( _types == null ) {
    return null;
  }

  List<ExtensibilityElement> schemas = WsdlUtils.findExtensibilityElements( _types, "schema" );

  for ( ExtensibilityElement e : schemas ) {
    Element schemaRoot = ( (Schema) e ).getElement();
    String tns = schemaRoot.getAttribute( "targetNamespace" );
    if ( targetNamespace.equals( tns ) ) {
      return (Schema) e;
    }
  }
  return null;
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:25,代码来源:WsdlTypes.java

示例9: setSchemaDocIntoWSDLTypes

import javax.wsdl.extensions.schema.Schema; //导入依赖的package包/类
public void setSchemaDocIntoWSDLTypes(Document doc) {
    try {

        Types wsdl_types = localDef.createTypes();
        Schema typesExt = (Schema) extensionRegistry.createExtension(Types.class, new QName(NameSpacesEnum.XML_SCH.getNameSpaceURI(), "schema"));
        typesExt.setElement((Element) doc.getFirstChild());
        wsdl_types.addExtensibilityElement(typesExt);
        localDef.setTypes(wsdl_types);

    } catch (Exception ex) {
        System.err.println(ex.getMessage());
    }
}
 
开发者ID:jolie,项目名称:jolie,代码行数:14,代码来源:WSDLDocCreator.java

示例10: setMtomEnabled

import javax.wsdl.extensions.schema.Schema; //导入依赖的package包/类
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;
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:16,代码来源:WSDLUtil.java

示例11: addXRoadExtensions

import javax.wsdl.extensions.schema.Schema; //导入依赖的package包/类
private void addXRoadExtensions(Definition definition) throws WSDLException {
  definition.addNamespace(XROAD_PREFIX, XROAD_NAMESPACE);

  Message message = definition.createMessage();
  message.setQName(new QName(definition.getTargetNamespace(), XROAD_HEADER));

  addXroadHeaderPart(definition, message, XTeeHeader.CLIENT);
  addXroadHeaderPart(definition, message, XTeeHeader.SERVICE);
  addXroadHeaderPart(definition, message, XTeeHeader.ID);
  addXroadHeaderPart(definition, message, XTeeHeader.USER_ID);
  addXroadHeaderPart(definition, message, XTeeHeader.PROTOCOL_VERSION);

  message.setUndefined(false);
  definition.addMessage(message);

  // Add XRoad schema import to the first schema
  for (Object ex : definition.getTypes().getExtensibilityElements()) {
    if (ex instanceof Schema) {
      Schema schema = (Schema) ex;
      Element xRoadImport =
          schema.getElement().getOwnerDocument().createElement(schema.getElement().getPrefix() == null
                                                                                                       ? "import"
                                                                                                       : schema.getElement().getPrefix()
                                                                                                           + ":import");
      xRoadImport.setAttribute("namespace", XROAD_NAMESPACE);
      xRoadImport.setAttribute("schemaLocation", XROAD_NAMESPACE);
      schema.getElement().insertBefore(xRoadImport, schema.getElement().getFirstChild());
      break;
    }
  }
}
 
开发者ID:nortal,项目名称:j-road,代码行数:32,代码来源:XTeeWsdlDefinition.java

示例12: readPackagesFromSchema

import javax.wsdl.extensions.schema.Schema; //导入依赖的package包/类
public Set<String> readPackagesFromSchema(Definition wsdlDefinition)
        throws SchemaReaderException {
    if (wsdlDefinition == null) {
        if (log.isDebugEnabled()) {
            log.debug("Invalid wsdl definition provided, NULL");
        }
        throw new SchemaReaderException(Messages.getMessage("SchemaReaderErr1"));
    }
    this.wsdlDefinition = wsdlDefinition;
    List<Schema> schemaList = new ArrayList<Schema>();
    Set<String> packageList = new TreeSet<String>();
    //Add WSDL TargetNamespace
    String namespace = wsdlDefinition.getTargetNamespace();
    List packages = JavaUtils.getPackagesFromNamespace(namespace);
    if (packages != null && packages.size() > 0) {
        packageList.addAll(packages);   
    }

    //Read All Schema Definition in wsdl;
    Types types = wsdlDefinition.getTypes();
    if (types == null) {
        if (log.isDebugEnabled()) {
            log.debug("WARNING: Could not find any Schema/Types from WSDL");
            log.debug("no packages will derived from WSDL schema");
        }
        return packageList;
    }
    List extensibilityElements = types.getExtensibilityElements();
    for (Object obj : extensibilityElements) {
        if (obj != null && isSchema((ExtensibilityElement)obj)) {
            Schema schema = (Schema)obj;
            //process schemas and read packages from them.
            processSchema(schema, schemaList, packageList);
        }
    }

    //Set always stores unique objects, so I dont have to worry about removing duplicates from this set.
    return packageList;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:40,代码来源:SchemaReaderImpl.java

示例13: processImport

import javax.wsdl.extensions.schema.Schema; //导入依赖的package包/类
private void processImport(SchemaImport si, List<Schema> schemaList, Set<String> packageList)
        throws SchemaReaderException {
    Schema refSchema = si.getReferencedSchema();
    if (refSchema != null) {
        processSchema(refSchema, schemaList, packageList);
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:8,代码来源:SchemaReaderImpl.java

示例14: readSchemaTargetnamespace

import javax.wsdl.extensions.schema.Schema; //导入依赖的package包/类
private String readSchemaTargetnamespace(Schema schema) {
    Node root = schema.getElement();
    if (root != null) {
        NamedNodeMap nodeMap = root.getAttributes();
        Node attributeNode = nodeMap.getNamedItem(SCHEMA_TARGETNAMESPACE);
        if (attributeNode != null) {
            return attributeNode.getNodeValue();
        }
    }
    return null;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:12,代码来源:SchemaReaderImpl.java

示例15: readSchemaBindingPackageName

import javax.wsdl.extensions.schema.Schema; //导入依赖的package包/类
private String readSchemaBindingPackageName(Schema schema) {

        /* JAXB Specification section 7.6 have following important points
           * 1) <schemaBindings> binding declaration have schema scope
           * 2) For inline annotation  a <schemaBindings> is valid only in the annotation element of the <schema> element.
           * 3) There must only be a single instance of <schemaBindings> declaration in the annotation element of the <schema> element.
           */

        //Get root node for schema.
        Node root = schema.getElement();
        if (root.hasChildNodes()) {

            //get all child nodes for schema
            NodeList list = root.getChildNodes();

            //search for JAXB schemaBinding customization in schema element definitions.
            for (int i = 0; i < list.getLength(); i++) {
                Node childNode = list.item(i);
                if (isElementName(JAXB_SCHEMA_BINDING, childNode)) {

                    //SchemaBinding has been defined, so lets look for package element.
                    NodeList schemaBindingNodeList = childNode.getChildNodes();
                    for (int j = 0; j < schemaBindingNodeList.getLength(); j++) {
                        Node schemaBindingNode = schemaBindingNodeList.item(j);
                        if (isElementName(JAXB_SCHEMA_BINDING_PACKAGE, schemaBindingNode)) {

                            //Package Element found, so lets read the package name attribute and return that.
                            NamedNodeMap nodeMap = schemaBindingNode.getAttributes();
                            Node attributeNode =
                                    nodeMap.getNamedItem(JAXB_SCHEMA_Binding_PACKAGENAME);
                            return attributeNode.getNodeValue();
                        }
                    }
                }
            }
        }
        return null;
    }
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:39,代码来源:SchemaReaderImpl.java


注:本文中的javax.wsdl.extensions.schema.Schema类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。