Package com.ibm.wsdl.extensions.schema

Examples of com.ibm.wsdl.extensions.schema.SchemaImpl


                }
                schemaInfo.setElement(e);
            }
           
            if (!useSchemaImports) {
                SchemaImpl schemaImpl = new SchemaImpl();
                schemaImpl.setRequired(true);
                schemaImpl.setElementType(WSDLConstants.SCHEMA_QNAME);
                schemaImpl.setElement(schemaInfo.getElement());
                types.addExtensibilityElement(schemaImpl);
            } else {
                //imports
                String name = baseFileName + "_schema" + (++xsdCount) + ".xsd";
                Element imp = XMLUtils.createElementNS(doc,
                                                       new QName("http://www.w3.org/2001/XMLSchema",
                                                                  "import"));
                imp.setAttribute("schemaLocation", name);
                imp.setAttribute("namespace", schemaInfo.getNamespaceURI());
                nd.appendChild(imp);
                              
                imports.put(name, schemaInfo);
            }
        }
        if (useSchemaImports) {
            SchemaImpl schemaImpl = new SchemaImpl();
            schemaImpl.setRequired(true);
            schemaImpl.setElementType(WSDLConstants.SCHEMA_QNAME);
            schemaImpl.setElement(nd);
            types.addExtensibilityElement(schemaImpl);
        }
        def.setTypes(types);
    }
View Full Code Here


  private void importTypes(Types types) {
    SchemaCompiler compiler = XJC.createSchemaCompiler();
    ErrorListener elForRun = new ConsoleErrorReporter();
    compiler.setErrorListener(elForRun);

    SchemaImpl impl = (SchemaImpl) types.getExtensibilityElements().get(0);
   
    S2JJAXBModel intermediateModel = this.compileModel(types, compiler, impl.getElement());
    Collection<? extends Mapping> mappings = intermediateModel.getMappings();

    for (Mapping mapping : mappings){
      this.importStructure(mapping);
    }
View Full Code Here

        doc.appendChild(nd);
       
        for (SchemaInfo schemaInfo : schemas) {
           
            if (!useSchemaImports) {
                SchemaImpl schemaImpl = new SchemaImpl();
                schemaImpl.setRequired(true);
                schemaImpl.setElementType(WSDLConstants.QNAME_SCHEMA);
                schemaImpl.setElement(schemaInfo.getElement());
                types.addExtensibilityElement(schemaImpl);
            } else {
                //imports
                String name = baseFileName + "_schema" + (++xsdCount) + ".xsd";
                Element imp = XMLUtils.createElementNS(doc,
                                                       new QName(WSDLConstants.NS_SCHEMA_XSD,
                                                                  "import"));
                imp.setAttribute("schemaLocation", name);
                imp.setAttribute("namespace", schemaInfo.getNamespaceURI());
                nd.appendChild(imp);
                              
                imports.put(name, schemaInfo);
            }

        }
        if (useSchemaImports) {
            SchemaImpl schemaImpl = new SchemaImpl();
            schemaImpl.setRequired(true);
            schemaImpl.setElementType(WSDLConstants.QNAME_SCHEMA);
            schemaImpl.setElement(nd);
            types.addExtensibilityElement(schemaImpl);
        }
        def.setTypes(types);
    }
View Full Code Here

  private void importTypes(Types types) {
    SchemaCompiler compiler = XJC.createSchemaCompiler();
    ErrorListener elForRun = new ConsoleErrorReporter();
    compiler.setErrorListener(elForRun);

    SchemaImpl impl = (SchemaImpl) types.getExtensibilityElements().get(0);
   
    S2JJAXBModel intermediateModel = this.compileModel(types, compiler, impl.getElement());
    Collection<? extends Mapping> mappings = intermediateModel.getMappings();

    for (Mapping mapping : mappings){
      this.importStructure(mapping);
    }
View Full Code Here

        Types types = definition.getTypes();
        List<?> schemaTypes = types.getExtensibilityElements();
       
        for (Object schemaObject : schemaTypes) {
            if (schemaObject instanceof SchemaImpl) {
                SchemaImpl schema = (SchemaImpl) schemaObject;

                inheritNamespaces(schema, definition);
               
                ByteArrayOutputStream bos = new ByteArrayOutputStream();
                Source source = new DOMSource(schema.getElement());
                Result result = new StreamResult(bos);
               
                TransformerFactory.newInstance().newTransformer().transform(source, result);
                Resource schemaResource = new ByteArrayResource(bos.toByteArray());
               
                schemas.add(schemaResource);
               
                if (definition.getTargetNamespace().equals(schema.getElement().getAttribute("targetNamespace"))) {
                    setXsd(schemaResource);
                }
            } else {
                log.warn("Found unsupported schema type implementation " + schemaObject.getClass());
            }
View Full Code Here

        doc.appendChild(nd);
       
        for (SchemaInfo schemaInfo : schemas) {
           
            if (!useSchemaImports) {
                SchemaImpl schemaImpl = new SchemaImpl();
                schemaImpl.setRequired(true);
                schemaImpl.setElementType(WSDLConstants.QNAME_SCHEMA);
                schemaImpl.setElement(schemaInfo.getElement());
                for (int x = 0; x < schemaInfo.getSchema().getIncludes().getCount(); x++) {
                    XmlSchemaExternal ext = (XmlSchemaExternal)schemaInfo.getSchema()
                        .getIncludes().getItem(x);
                    if (ext.getSchema() == null) {
                        continue;
                    }
                    if (ext instanceof XmlSchemaImport) {
                        SchemaImport imp = schemaImpl.createImport();
                        imp.setNamespaceURI(((XmlSchemaImport)ext).getNamespace());
                        imp.setSchemaLocationURI(((XmlSchemaImport)ext).getSchemaLocation());
                       
                        SchemaImpl schemaImpl2 = new SchemaImpl();
                        schemaImpl2.setRequired(true);
                        schemaImpl2.setElementType(WSDLConstants.QNAME_SCHEMA);
                        schemaImpl2.setDocumentBaseURI(ext.getSchema().getSourceURI());
                        try {
                            schemaImpl2.setElement(ext.getSchema().getSchemaDocument().getDocumentElement());
                        } catch (XmlSchemaSerializerException e) {
                            //ignore
                        }
                        imp.setReferencedSchema(schemaImpl2);

                        schemaImpl.addImport(imp);
                    } else if (ext instanceof XmlSchemaInclude) {
                        SchemaReference imp = schemaImpl.createInclude();
                        imp.setSchemaLocationURI(((XmlSchemaInclude)ext).getSchemaLocation());

                        SchemaImpl schemaImpl2 = new SchemaImpl();
                        schemaImpl2.setRequired(true);
                        schemaImpl2.setElementType(WSDLConstants.QNAME_SCHEMA);
                        schemaImpl2.setDocumentBaseURI(ext.getSchema().getSourceURI());
                        try {
                            schemaImpl2.setElement(ext.getSchema().getSchemaDocument().getDocumentElement());
                        } catch (XmlSchemaSerializerException e) {
                            //ignore
                        }
                        imp.setReferencedSchema(schemaImpl2);
                       
                        schemaImpl.addInclude(imp);
                    } else if (ext instanceof XmlSchemaRedefine) {
                        SchemaReference imp = schemaImpl.createRedefine();
                        imp.setSchemaLocationURI(((XmlSchemaRedefine)ext).getSchemaLocation());
                       
                        SchemaImpl schemaImpl2 = new SchemaImpl();
                        schemaImpl2.setRequired(true);
                        schemaImpl2.setElementType(WSDLConstants.QNAME_SCHEMA);
                        schemaImpl2.setDocumentBaseURI(ext.getSchema().getSourceURI());
                        try {
                            schemaImpl2.setElement(ext.getSchema().getSchemaDocument().getDocumentElement());
                        } catch (XmlSchemaSerializerException e) {
                            //ignore
                        }
                        imp.setReferencedSchema(schemaImpl2);
                       
                        schemaImpl.addRedefine(imp);
                    }
                }
                types.addExtensibilityElement(schemaImpl);
            } else {
                //imports
                String name = baseFileName + "_schema" + (++xsdCount) + ".xsd";
                Element imp = XMLUtils.createElementNS(doc,
                                                       new QName(WSDLConstants.NS_SCHEMA_XSD,
                                                                  "import"));
                imp.setAttribute("schemaLocation", name);
                imp.setAttribute("namespace", schemaInfo.getNamespaceURI());
                nd.appendChild(imp);
                              
                imports.put(name, schemaInfo);
            }

        }
        if (useSchemaImports) {
            SchemaImpl schemaImpl = new SchemaImpl();
            schemaImpl.setRequired(true);
            schemaImpl.setElementType(WSDLConstants.QNAME_SCHEMA);
            schemaImpl.setElement(nd);
            types.addExtensibilityElement(schemaImpl);
        }
        def.setTypes(types);
    }
View Full Code Here

        doc.appendChild(nd);
       
        for (SchemaInfo schemaInfo : schemas) {
           
            if (!useSchemaImports) {
                SchemaImpl schemaImpl = new SchemaImpl();
                schemaImpl.setRequired(true);
                schemaImpl.setElementType(WSDLConstants.SCHEMA_QNAME);
                schemaImpl.setElement(schemaInfo.getElement());
                types.addExtensibilityElement(schemaImpl);
            } else {
                //imports
                String name = baseFileName + "_schema" + (++xsdCount) + ".xsd";
                Element imp = XMLUtils.createElementNS(doc,
                                                       new QName(WSDLConstants.NU_SCHEMA_XSD,
                                                                  "import"));
                imp.setAttribute("schemaLocation", name);
                imp.setAttribute("namespace", schemaInfo.getNamespaceURI());
                nd.appendChild(imp);
                              
                imports.put(name, schemaInfo);
            }
            // add imports for those schemata which are inlined.
            addRequiredSchemaImports(schemaInfo);
        }
        if (useSchemaImports) {
            SchemaImpl schemaImpl = new SchemaImpl();
            schemaImpl.setRequired(true);
            schemaImpl.setElementType(WSDLConstants.SCHEMA_QNAME);
            schemaImpl.setElement(nd);
            types.addExtensibilityElement(schemaImpl);
        }
        def.setTypes(types);
    }
View Full Code Here

TOP

Related Classes of com.ibm.wsdl.extensions.schema.SchemaImpl

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.