javax.xml.ws.Holder Java Examples

The following examples show how to use javax.xml.ws.Holder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WSDLGenerator.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
     * Creates the {@link Result} object used by JAXB to generate a schema for the
     * namesapceUri namespace.
     * @param namespaceUri The namespace for the schema being generated
     * @param suggestedFileName the JAXB suggested file name for the schema file
     * @return the {@link Result} for JAXB to generate the schema into
     * @throws java.io.IOException thrown if on IO error occurs
     */
    public Result createOutputFile(String namespaceUri, String suggestedFileName) throws IOException {
        Result result;
        if (namespaceUri == null) {
            return null;
        }

        Holder<String> fileNameHolder = new Holder<String>();
        fileNameHolder.value = schemaPrefix + suggestedFileName;
        result = wsdlResolver.getSchemaOutput(namespaceUri, fileNameHolder);
//        System.out.println("schema file: "+fileNameHolder.value);
//        System.out.println("result: "+result);
        String schemaLoc;
        if (result == null)
            schemaLoc = fileNameHolder.value;
        else
            schemaLoc = relativize(result.getSystemId(), wsdlLocation);
        boolean isEmptyNs = namespaceUri.trim().equals("");
        if (!isEmptyNs) {
            com.sun.xml.internal.ws.wsdl.writer.document.xsd.Import _import = types.schema()._import();
            _import.namespace(namespaceUri);
            _import.schemaLocation(schemaLoc);
        }
        return result;
    }
 
Example #2
Source File: WSDLGenerator.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
     * Creates the {@link Result} object used by JAXB to generate a schema for the
     * namesapceUri namespace.
     * @param namespaceUri The namespace for the schema being generated
     * @param suggestedFileName the JAXB suggested file name for the schema file
     * @return the {@link Result} for JAXB to generate the schema into
     * @throws java.io.IOException thrown if on IO error occurs
     */
    public Result createOutputFile(String namespaceUri, String suggestedFileName) throws IOException {
        Result result;
        if (namespaceUri == null) {
            return null;
        }

        Holder<String> fileNameHolder = new Holder<String>();
        fileNameHolder.value = schemaPrefix + suggestedFileName;
        result = wsdlResolver.getSchemaOutput(namespaceUri, fileNameHolder);
//        System.out.println("schema file: "+fileNameHolder.value);
//        System.out.println("result: "+result);
        String schemaLoc;
        if (result == null)
            schemaLoc = fileNameHolder.value;
        else
            schemaLoc = relativize(result.getSystemId(), wsdlLocation);
        boolean isEmptyNs = namespaceUri.trim().equals("");
        if (!isEmptyNs) {
            com.sun.xml.internal.ws.wsdl.writer.document.xsd.Import _import = types.schema()._import();
            _import.namespace(namespaceUri);
            _import.schemaLocation(schemaLoc);
        }
        return result;
    }
 
Example #3
Source File: WSDLGenResolver.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Updates filename if the suggested filename need to be changed in
 * xsd:import. If there is already a schema document for the namespace
 * in the metadata, then it is not generated.
 *
 * return null if schema need not be generated
 *        Result the generated schema document
 */
public Result getSchemaOutput(String namespace, Holder<String> filename) {
    List<SDDocumentImpl> schemas = nsMapping.get(namespace);
    if (schemas != null) {
        if (schemas.size() > 1) {
            throw new ServerRtException("server.rt.err",
                "More than one schema for the target namespace "+namespace);
        }
        filename.value = schemas.get(0).getURL().toExternalForm();
        return null;            // Don't generate schema
    }

    URL url = createURL(filename.value);
    MutableXMLStreamBuffer xsb = new MutableXMLStreamBuffer();
    xsb.setSystemId(url.toExternalForm());
    SDDocumentSource sd = SDDocumentSource.create(url,xsb);
    newDocs.add(sd);

    XMLStreamBufferResult r = new XMLStreamBufferResult(xsb);
    r.setSystemId(filename.value);
    return r;
}
 
Example #4
Source File: WSDLGenResolver.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Updates filename if the suggested filename need to be changed in
 * xsd:import. If there is already a schema document for the namespace
 * in the metadata, then it is not generated.
 *
 * return null if schema need not be generated
 *        Result the generated schema document
 */
public Result getSchemaOutput(String namespace, Holder<String> filename) {
    List<SDDocumentImpl> schemas = nsMapping.get(namespace);
    if (schemas != null) {
        if (schemas.size() > 1) {
            throw new ServerRtException("server.rt.err",
                "More than one schema for the target namespace "+namespace);
        }
        filename.value = schemas.get(0).getURL().toExternalForm();
        return null;            // Don't generate schema
    }

    URL url = createURL(filename.value);
    MutableXMLStreamBuffer xsb = new MutableXMLStreamBuffer();
    xsb.setSystemId(url.toExternalForm());
    SDDocumentSource sd = SDDocumentSource.create(url,xsb);
    newDocs.add(sd);

    XMLStreamBufferResult r = new XMLStreamBufferResult(xsb);
    r.setSystemId(filename.value);
    return r;
}
 
Example #5
Source File: WSDLGenResolver.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Updates filename if the suggested filename need to be changed in
 * xsd:import. If there is already a schema document for the namespace
 * in the metadata, then it is not generated.
 *
 * return null if schema need not be generated
 *        Result the generated schema document
 */
public Result getSchemaOutput(String namespace, Holder<String> filename) {
    List<SDDocumentImpl> schemas = nsMapping.get(namespace);
    if (schemas != null) {
        if (schemas.size() > 1) {
            throw new ServerRtException("server.rt.err",
                "More than one schema for the target namespace "+namespace);
        }
        filename.value = schemas.get(0).getURL().toExternalForm();
        return null;            // Don't generate schema
    }

    URL url = createURL(filename.value);
    MutableXMLStreamBuffer xsb = new MutableXMLStreamBuffer();
    xsb.setSystemId(url.toExternalForm());
    SDDocumentSource sd = SDDocumentSource.create(url,xsb);
    newDocs.add(sd);

    XMLStreamBufferResult r = new XMLStreamBufferResult(xsb);
    r.setSystemId(filename.value);
    return r;
}
 
Example #6
Source File: WSDLGenerator.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
     * Creates the {@link Result} object used by JAXB to generate a schema for the
     * namesapceUri namespace.
     * @param namespaceUri The namespace for the schema being generated
     * @param suggestedFileName the JAXB suggested file name for the schema file
     * @return the {@link Result} for JAXB to generate the schema into
     * @throws java.io.IOException thrown if on IO error occurs
     */
    public Result createOutputFile(String namespaceUri, String suggestedFileName) throws IOException {
        Result result;
        if (namespaceUri == null) {
            return null;
        }

        Holder<String> fileNameHolder = new Holder<String>();
        fileNameHolder.value = schemaPrefix + suggestedFileName;
        result = wsdlResolver.getSchemaOutput(namespaceUri, fileNameHolder);
//        System.out.println("schema file: "+fileNameHolder.value);
//        System.out.println("result: "+result);
        String schemaLoc;
        if (result == null)
            schemaLoc = fileNameHolder.value;
        else
            schemaLoc = relativize(result.getSystemId(), wsdlLocation);
        boolean isEmptyNs = namespaceUri.trim().equals("");
        if (!isEmptyNs) {
            com.sun.xml.internal.ws.wsdl.writer.document.xsd.Import _import = types.schema()._import();
            _import.namespace(namespaceUri);
            _import.schemaLocation(schemaLoc);
        }
        return result;
    }
 
Example #7
Source File: WSDLGenResolver.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Updates filename if the suggested filename need to be changed in
 * xsd:import. If there is already a schema document for the namespace
 * in the metadata, then it is not generated.
 *
 * return null if schema need not be generated
 *        Result the generated schema document
 */
public Result getSchemaOutput(String namespace, Holder<String> filename) {
    List<SDDocumentImpl> schemas = nsMapping.get(namespace);
    if (schemas != null) {
        if (schemas.size() > 1) {
            throw new ServerRtException("server.rt.err",
                "More than one schema for the target namespace "+namespace);
        }
        filename.value = schemas.get(0).getURL().toExternalForm();
        return null;            // Don't generate schema
    }

    URL url = createURL(filename.value);
    MutableXMLStreamBuffer xsb = new MutableXMLStreamBuffer();
    xsb.setSystemId(url.toExternalForm());
    SDDocumentSource sd = SDDocumentSource.create(url,xsb);
    newDocs.add(sd);

    XMLStreamBufferResult r = new XMLStreamBufferResult(xsb);
    r.setSystemId(filename.value);
    return r;
}
 
Example #8
Source File: WSDLGenerator.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
     * Creates the {@link Result} object used by JAXB to generate a schema for the
     * namesapceUri namespace.
     * @param namespaceUri The namespace for the schema being generated
     * @param suggestedFileName the JAXB suggested file name for the schema file
     * @return the {@link Result} for JAXB to generate the schema into
     * @throws java.io.IOException thrown if on IO error occurs
     */
    public Result createOutputFile(String namespaceUri, String suggestedFileName) throws IOException {
        Result result;
        if (namespaceUri == null) {
            return null;
        }

        Holder<String> fileNameHolder = new Holder<String>();
        fileNameHolder.value = schemaPrefix + suggestedFileName;
        result = wsdlResolver.getSchemaOutput(namespaceUri, fileNameHolder);
//        System.out.println("schema file: "+fileNameHolder.value);
//        System.out.println("result: "+result);
        String schemaLoc;
        if (result == null)
            schemaLoc = fileNameHolder.value;
        else
            schemaLoc = relativize(result.getSystemId(), wsdlLocation);
        boolean isEmptyNs = namespaceUri.trim().equals("");
        if (!isEmptyNs) {
            com.sun.xml.internal.ws.wsdl.writer.document.xsd.Import _import = types.schema()._import();
            _import.namespace(namespaceUri);
            _import.schemaLocation(schemaLoc);
        }
        return result;
    }
 
Example #9
Source File: WSDLGenerator.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
     * Creates the {@link Result} object used by JAXB to generate a schema for the
     * namesapceUri namespace.
     * @param namespaceUri The namespace for the schema being generated
     * @param suggestedFileName the JAXB suggested file name for the schema file
     * @return the {@link Result} for JAXB to generate the schema into
     * @throws java.io.IOException thrown if on IO error occurs
     */
    public Result createOutputFile(String namespaceUri, String suggestedFileName) throws IOException {
        Result result;
        if (namespaceUri == null) {
            return null;
        }

        Holder<String> fileNameHolder = new Holder<String>();
        fileNameHolder.value = schemaPrefix + suggestedFileName;
        result = wsdlResolver.getSchemaOutput(namespaceUri, fileNameHolder);
//        System.out.println("schema file: "+fileNameHolder.value);
//        System.out.println("result: "+result);
        String schemaLoc;
        if (result == null)
            schemaLoc = fileNameHolder.value;
        else
            schemaLoc = relativize(result.getSystemId(), wsdlLocation);
        boolean isEmptyNs = namespaceUri.trim().equals("");
        if (!isEmptyNs) {
            com.sun.xml.internal.ws.wsdl.writer.document.xsd.Import _import = types.schema()._import();
            _import.namespace(namespaceUri);
            _import.schemaLocation(schemaLoc);
        }
        return result;
    }
 
Example #10
Source File: WSDLGenResolver.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Updates filename if the suggested filename need to be changed in
 * xsd:import. If there is already a schema document for the namespace
 * in the metadata, then it is not generated.
 *
 * return null if schema need not be generated
 *        Result the generated schema document
 */
public Result getSchemaOutput(String namespace, Holder<String> filename) {
    List<SDDocumentImpl> schemas = nsMapping.get(namespace);
    if (schemas != null) {
        if (schemas.size() > 1) {
            throw new ServerRtException("server.rt.err",
                "More than one schema for the target namespace "+namespace);
        }
        filename.value = schemas.get(0).getURL().toExternalForm();
        return null;            // Don't generate schema
    }

    URL url = createURL(filename.value);
    MutableXMLStreamBuffer xsb = new MutableXMLStreamBuffer();
    xsb.setSystemId(url.toExternalForm());
    SDDocumentSource sd = SDDocumentSource.create(url,xsb);
    newDocs.add(sd);

    XMLStreamBufferResult r = new XMLStreamBufferResult(xsb);
    r.setSystemId(filename.value);
    return r;
}
 
Example #11
Source File: WSDLGenerator.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
     * Creates the {@link Result} object used by JAXB to generate a schema for the
     * namesapceUri namespace.
     * @param namespaceUri The namespace for the schema being generated
     * @param suggestedFileName the JAXB suggested file name for the schema file
     * @return the {@link Result} for JAXB to generate the schema into
     * @throws java.io.IOException thrown if on IO error occurs
     */
    public Result createOutputFile(String namespaceUri, String suggestedFileName) throws IOException {
        Result result;
        if (namespaceUri == null) {
            return null;
        }

        Holder<String> fileNameHolder = new Holder<String>();
        fileNameHolder.value = schemaPrefix + suggestedFileName;
        result = wsdlResolver.getSchemaOutput(namespaceUri, fileNameHolder);
//        System.out.println("schema file: "+fileNameHolder.value);
//        System.out.println("result: "+result);
        String schemaLoc;
        if (result == null)
            schemaLoc = fileNameHolder.value;
        else
            schemaLoc = relativize(result.getSystemId(), wsdlLocation);
        boolean isEmptyNs = namespaceUri.trim().equals("");
        if (!isEmptyNs) {
            com.sun.xml.internal.ws.wsdl.writer.document.xsd.Import _import = types.schema()._import();
            _import.namespace(namespaceUri);
            _import.schemaLocation(schemaLoc);
        }
        return result;
    }
 
Example #12
Source File: WSDLGenResolver.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Updates filename if the suggested filename need to be changed in
 * xsd:import. If there is already a schema document for the namespace
 * in the metadata, then it is not generated.
 *
 * return null if schema need not be generated
 *        Result the generated schema document
 */
public Result getSchemaOutput(String namespace, Holder<String> filename) {
    List<SDDocumentImpl> schemas = nsMapping.get(namespace);
    if (schemas != null) {
        if (schemas.size() > 1) {
            throw new ServerRtException("server.rt.err",
                "More than one schema for the target namespace "+namespace);
        }
        filename.value = schemas.get(0).getURL().toExternalForm();
        return null;            // Don't generate schema
    }

    URL url = createURL(filename.value);
    MutableXMLStreamBuffer xsb = new MutableXMLStreamBuffer();
    xsb.setSystemId(url.toExternalForm());
    SDDocumentSource sd = SDDocumentSource.create(url,xsb);
    newDocs.add(sd);

    XMLStreamBufferResult r = new XMLStreamBufferResult(xsb);
    r.setSystemId(filename.value);
    return r;
}
 
Example #13
Source File: WSDLGenerator.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
     * Creates the {@link Result} object used by JAXB to generate a schema for the
     * namesapceUri namespace.
     * @param namespaceUri The namespace for the schema being generated
     * @param suggestedFileName the JAXB suggested file name for the schema file
     * @return the {@link Result} for JAXB to generate the schema into
     * @throws java.io.IOException thrown if on IO error occurs
     */
    public Result createOutputFile(String namespaceUri, String suggestedFileName) throws IOException {
        Result result;
        if (namespaceUri == null) {
            return null;
        }

        Holder<String> fileNameHolder = new Holder<String>();
        fileNameHolder.value = schemaPrefix + suggestedFileName;
        result = wsdlResolver.getSchemaOutput(namespaceUri, fileNameHolder);
//        System.out.println("schema file: "+fileNameHolder.value);
//        System.out.println("result: "+result);
        String schemaLoc;
        if (result == null)
            schemaLoc = fileNameHolder.value;
        else
            schemaLoc = relativize(result.getSystemId(), wsdlLocation);
        boolean isEmptyNs = namespaceUri.trim().equals("");
        if (!isEmptyNs) {
            com.sun.xml.internal.ws.wsdl.writer.document.xsd.Import _import = types.schema()._import();
            _import.namespace(namespaceUri);
            _import.schemaLocation(schemaLoc);
        }
        return result;
    }
 
Example #14
Source File: WSDLGenerator.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
     * Creates the {@link Result} object used by JAXB to generate a schema for the
     * namesapceUri namespace.
     * @param namespaceUri The namespace for the schema being generated
     * @param suggestedFileName the JAXB suggested file name for the schema file
     * @return the {@link Result} for JAXB to generate the schema into
     * @throws java.io.IOException thrown if on IO error occurs
     */
    public Result createOutputFile(String namespaceUri, String suggestedFileName) throws IOException {
        Result result;
        if (namespaceUri == null) {
            return null;
        }

        Holder<String> fileNameHolder = new Holder<String>();
        fileNameHolder.value = schemaPrefix + suggestedFileName;
        result = wsdlResolver.getSchemaOutput(namespaceUri, fileNameHolder);
//        System.out.println("schema file: "+fileNameHolder.value);
//        System.out.println("result: "+result);
        String schemaLoc;
        if (result == null)
            schemaLoc = fileNameHolder.value;
        else
            schemaLoc = relativize(result.getSystemId(), wsdlLocation);
        boolean isEmptyNs = namespaceUri.trim().equals("");
        if (!isEmptyNs) {
            com.sun.xml.internal.ws.wsdl.writer.document.xsd.Import _import = types.schema()._import();
            _import.namespace(namespaceUri);
            _import.schemaLocation(schemaLoc);
        }
        return result;
    }
 
Example #15
Source File: EndpointValueSetter.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
void put(Object obj, Object[] args) {
    Holder holder = new Holder();
    if (obj != null) {
        holder.value = obj;
    }
    args[idx] = holder;
}
 
Example #16
Source File: WSDLGenerator.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Performes the actual WSDL generation
 */
public void doGeneration() {
    XmlSerializer serviceWriter;
    XmlSerializer portWriter = null;
    String fileName = mangleName(model.getServiceQName().getLocalPart());
    Result result = wsdlResolver.getWSDL(fileName + DOT_WSDL);
    wsdlLocation = result.getSystemId();
    serviceWriter = new CommentFilter(ResultFactory.createSerializer(result));
    if (model.getServiceQName().getNamespaceURI().equals(model.getTargetNamespace())) {
        portWriter = serviceWriter;
        schemaPrefix = fileName + "_";
    } else {
        String wsdlName = mangleName(model.getPortTypeName().getLocalPart());
        if (wsdlName.equals(fileName))
            wsdlName += "PortType";
        Holder<String> absWSDLName = new Holder<String>();
        absWSDLName.value = wsdlName + DOT_WSDL;
        result = wsdlResolver.getAbstractWSDL(absWSDLName);

        if (result != null) {
            portWSDLID = result.getSystemId();
            if (portWSDLID.equals(wsdlLocation)) {
                portWriter = serviceWriter;
            } else {
                portWriter = new CommentFilter(ResultFactory.createSerializer(result));
            }
        } else {
            portWSDLID = absWSDLName.value;
        }
        schemaPrefix = new java.io.File(portWSDLID).getName();
        int idx = schemaPrefix.lastIndexOf('.');
        if (idx > 0)
            schemaPrefix = schemaPrefix.substring(0, idx);
        schemaPrefix = mangleName(schemaPrefix) + "_";
    }
    generateDocument(serviceWriter, portWriter);
}
 
Example #17
Source File: WrapperBeanGenerator.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected java.lang.reflect.Type getHolderValueType(java.lang.reflect.Type paramType) {
    if (paramType instanceof ParameterizedType) {
        ParameterizedType p = (ParameterizedType)paramType;
        if (p.getRawType().equals(Holder.class)) {
            return p.getActualTypeArguments()[0];
        }
    }
    return null;
}
 
Example #18
Source File: WSDLGenerator.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Performes the actual WSDL generation
 */
public void doGeneration() {
    XmlSerializer serviceWriter;
    XmlSerializer portWriter = null;
    String fileName = mangleName(model.getServiceQName().getLocalPart());
    Result result = wsdlResolver.getWSDL(fileName + DOT_WSDL);
    wsdlLocation = result.getSystemId();
    serviceWriter = new CommentFilter(ResultFactory.createSerializer(result));
    if (model.getServiceQName().getNamespaceURI().equals(model.getTargetNamespace())) {
        portWriter = serviceWriter;
        schemaPrefix = fileName + "_";
    } else {
        String wsdlName = mangleName(model.getPortTypeName().getLocalPart());
        if (wsdlName.equals(fileName))
            wsdlName += "PortType";
        Holder<String> absWSDLName = new Holder<String>();
        absWSDLName.value = wsdlName + DOT_WSDL;
        result = wsdlResolver.getAbstractWSDL(absWSDLName);

        if (result != null) {
            portWSDLID = result.getSystemId();
            if (portWSDLID.equals(wsdlLocation)) {
                portWriter = serviceWriter;
            } else {
                portWriter = new CommentFilter(ResultFactory.createSerializer(result));
            }
        } else {
            portWSDLID = absWSDLName.value;
        }
        schemaPrefix = new java.io.File(portWSDLID).getName();
        int idx = schemaPrefix.lastIndexOf('.');
        if (idx > 0)
            schemaPrefix = schemaPrefix.substring(0, idx);
        schemaPrefix = mangleName(schemaPrefix) + "_";
    }
    generateDocument(serviceWriter, portWriter);
}
 
Example #19
Source File: WSDLGenResolver.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Updates filename if the suggested filename need to be changed in
 * wsdl:import. If the metadata already contains abstract wsdl(i.e. a WSDL
 * which has the porttype), then the abstract wsdl shouldn't be generated
 *
 * return null if abstract WSDL need not be generated
 *        Result the abstract WSDL
 */
public Result getAbstractWSDL(Holder<String> filename) {
    if (abstractWsdl != null) {
        filename.value = abstractWsdl.getURL().toString();
        return null;                // Don't generate abstract WSDL
    }
    URL url = createURL(filename.value);
    MutableXMLStreamBuffer xsb = new MutableXMLStreamBuffer();
    xsb.setSystemId(url.toExternalForm());
    SDDocumentSource abstractWsdlSource = SDDocumentSource.create(url,xsb);
    newDocs.add(abstractWsdlSource);
    XMLStreamBufferResult r = new XMLStreamBufferResult(xsb);
    r.setSystemId(filename.value);
    return r;
}
 
Example #20
Source File: EndpointValueSetter.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
void put(Object obj, Object[] args) {
    Holder holder = new Holder();
    if (obj != null) {
        holder.value = obj;
    }
    args[idx] = holder;
}
 
Example #21
Source File: WSDLGenResolver.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Updates filename if the suggested filename need to be changed in
 * wsdl:import. If the metadata already contains abstract wsdl(i.e. a WSDL
 * which has the porttype), then the abstract wsdl shouldn't be generated
 *
 * return null if abstract WSDL need not be generated
 *        Result the abstract WSDL
 */
public Result getAbstractWSDL(Holder<String> filename) {
    if (abstractWsdl != null) {
        filename.value = abstractWsdl.getURL().toString();
        return null;                // Don't generate abstract WSDL
    }
    URL url = createURL(filename.value);
    MutableXMLStreamBuffer xsb = new MutableXMLStreamBuffer();
    xsb.setSystemId(url.toExternalForm());
    SDDocumentSource abstractWsdlSource = SDDocumentSource.create(url,xsb);
    newDocs.add(abstractWsdlSource);
    XMLStreamBufferResult r = new XMLStreamBufferResult(xsb);
    r.setSystemId(filename.value);
    return r;
}
 
Example #22
Source File: WSDLGenerator.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Performes the actual WSDL generation
 */
public void doGeneration() {
    XmlSerializer serviceWriter;
    XmlSerializer portWriter = null;
    String fileName = mangleName(model.getServiceQName().getLocalPart());
    Result result = wsdlResolver.getWSDL(fileName + DOT_WSDL);
    wsdlLocation = result.getSystemId();
    serviceWriter = new CommentFilter(ResultFactory.createSerializer(result));
    if (model.getServiceQName().getNamespaceURI().equals(model.getTargetNamespace())) {
        portWriter = serviceWriter;
        schemaPrefix = fileName + "_";
    } else {
        String wsdlName = mangleName(model.getPortTypeName().getLocalPart());
        if (wsdlName.equals(fileName))
            wsdlName += "PortType";
        Holder<String> absWSDLName = new Holder<String>();
        absWSDLName.value = wsdlName + DOT_WSDL;
        result = wsdlResolver.getAbstractWSDL(absWSDLName);

        if (result != null) {
            portWSDLID = result.getSystemId();
            if (portWSDLID.equals(wsdlLocation)) {
                portWriter = serviceWriter;
            } else {
                portWriter = new CommentFilter(ResultFactory.createSerializer(result));
            }
        } else {
            portWSDLID = absWSDLName.value;
        }
        schemaPrefix = new java.io.File(portWSDLID).getName();
        int idx = schemaPrefix.lastIndexOf('.');
        if (idx > 0)
            schemaPrefix = schemaPrefix.substring(0, idx);
        schemaPrefix = mangleName(schemaPrefix) + "_";
    }
    generateDocument(serviceWriter, portWriter);
}
 
Example #23
Source File: WSDLGenResolver.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Updates filename if the suggested filename need to be changed in
 * wsdl:import. If the metadata already contains abstract wsdl(i.e. a WSDL
 * which has the porttype), then the abstract wsdl shouldn't be generated
 *
 * return null if abstract WSDL need not be generated
 *        Result the abstract WSDL
 */
public Result getAbstractWSDL(Holder<String> filename) {
    if (abstractWsdl != null) {
        filename.value = abstractWsdl.getURL().toString();
        return null;                // Don't generate abstract WSDL
    }
    URL url = createURL(filename.value);
    MutableXMLStreamBuffer xsb = new MutableXMLStreamBuffer();
    xsb.setSystemId(url.toExternalForm());
    SDDocumentSource abstractWsdlSource = SDDocumentSource.create(url,xsb);
    newDocs.add(abstractWsdlSource);
    XMLStreamBufferResult r = new XMLStreamBufferResult(xsb);
    r.setSystemId(filename.value);
    return r;
}
 
Example #24
Source File: WrapperBeanGenerator.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected java.lang.reflect.Type getHolderValueType(java.lang.reflect.Type paramType) {
    if (paramType instanceof ParameterizedType) {
        ParameterizedType p = (ParameterizedType)paramType;
        if (p.getRawType().equals(Holder.class)) {
            return p.getActualTypeArguments()[0];
        }
    }
    return null;
}
 
Example #25
Source File: WrapperBeanGenerator.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected java.lang.reflect.Type getHolderValueType(java.lang.reflect.Type paramType) {
    if (paramType instanceof ParameterizedType) {
        ParameterizedType p = (ParameterizedType)paramType;
        if (p.getRawType().equals(Holder.class)) {
            return p.getActualTypeArguments()[0];
        }
    }
    return null;
}
 
Example #26
Source File: WSDLGenResolver.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Updates filename if the suggested filename need to be changed in
 * wsdl:import. If the metadata already contains abstract wsdl(i.e. a WSDL
 * which has the porttype), then the abstract wsdl shouldn't be generated
 *
 * return null if abstract WSDL need not be generated
 *        Result the abstract WSDL
 */
public Result getAbstractWSDL(Holder<String> filename) {
    if (abstractWsdl != null) {
        filename.value = abstractWsdl.getURL().toString();
        return null;                // Don't generate abstract WSDL
    }
    URL url = createURL(filename.value);
    MutableXMLStreamBuffer xsb = new MutableXMLStreamBuffer();
    xsb.setSystemId(url.toExternalForm());
    SDDocumentSource abstractWsdlSource = SDDocumentSource.create(url,xsb);
    newDocs.add(abstractWsdlSource);
    XMLStreamBufferResult r = new XMLStreamBufferResult(xsb);
    r.setSystemId(filename.value);
    return r;
}
 
Example #27
Source File: WrapperBeanGenerator.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected java.lang.reflect.Type getHolderValueType(java.lang.reflect.Type paramType) {
    if (paramType instanceof ParameterizedType) {
        ParameterizedType p = (ParameterizedType)paramType;
        if (p.getRawType().equals(Holder.class)) {
            return p.getActualTypeArguments()[0];
        }
    }
    return null;
}
 
Example #28
Source File: EndpointValueSetter.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
void put(Object obj, Object[] args) {
    Holder holder = new Holder();
    if (obj != null) {
        holder.value = obj;
    }
    args[idx] = holder;
}
 
Example #29
Source File: WSDLGenerator.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Performes the actual WSDL generation
 */
public void doGeneration() {
    XmlSerializer serviceWriter;
    XmlSerializer portWriter = null;
    String fileName = mangleName(model.getServiceQName().getLocalPart());
    Result result = wsdlResolver.getWSDL(fileName + DOT_WSDL);
    wsdlLocation = result.getSystemId();
    serviceWriter = new CommentFilter(ResultFactory.createSerializer(result));
    if (model.getServiceQName().getNamespaceURI().equals(model.getTargetNamespace())) {
        portWriter = serviceWriter;
        schemaPrefix = fileName + "_";
    } else {
        String wsdlName = mangleName(model.getPortTypeName().getLocalPart());
        if (wsdlName.equals(fileName))
            wsdlName += "PortType";
        Holder<String> absWSDLName = new Holder<String>();
        absWSDLName.value = wsdlName + DOT_WSDL;
        result = wsdlResolver.getAbstractWSDL(absWSDLName);

        if (result != null) {
            portWSDLID = result.getSystemId();
            if (portWSDLID.equals(wsdlLocation)) {
                portWriter = serviceWriter;
            } else {
                portWriter = new CommentFilter(ResultFactory.createSerializer(result));
            }
        } else {
            portWSDLID = absWSDLName.value;
        }
        schemaPrefix = new java.io.File(portWSDLID).getName();
        int idx = schemaPrefix.lastIndexOf('.');
        if (idx > 0)
            schemaPrefix = schemaPrefix.substring(0, idx);
        schemaPrefix = mangleName(schemaPrefix) + "_";
    }
    generateDocument(serviceWriter, portWriter);
}
 
Example #30
Source File: EndpointValueSetter.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Override
void put(Object obj, Object[] args) {
    Holder holder = new Holder();
    if (obj != null) {
        holder.value = obj;
    }
    args[idx] = holder;
}