com.sun.xml.internal.ws.streaming.Attributes Java Examples

The following examples show how to use com.sun.xml.internal.ws.streaming.Attributes. 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: DeploymentDescriptorParser.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
protected ExternalMetadataFeature configureExternalMetadataReader(XMLStreamReader reader) {

        ExternalMetadataFeature.Builder featureBuilder = null;
        while (QNAME_EXT_METADA.equals(reader.getName())) {

            if (reader.getEventType() == XMLStreamConstants.START_ELEMENT) {
                Attributes attrs = XMLStreamReaderUtil.getAttributes(reader);
                String file = getAttribute(attrs, ATTR_FILE);
                if (file != null) {
                    if (featureBuilder == null) {
                        featureBuilder = ExternalMetadataFeature.builder();
                    }
                    featureBuilder.addFiles(new File(file));
                }

                String res = getAttribute(attrs, ATTR_RESOURCE);
                if (res != null) {
                    if (featureBuilder == null) {
                        featureBuilder = ExternalMetadataFeature.builder();
                    }
                    featureBuilder.addResources(res);
                }
            }

            XMLStreamReaderUtil.nextElementContent(reader);
        }

        return buildFeature(featureBuilder);
    }
 
Example #2
Source File: DeploymentDescriptorParser.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
protected String getMandatoryNonEmptyAttribute(XMLStreamReader reader, Attributes attributes,
                                               String name) {
    String value = getAttribute(attributes, name);
    if (value == null) {
        failWithLocalName("runtime.parser.missing.attribute", reader, name);
    } else if (value.equals("")) {
        failWithLocalName(
                "runtime.parser.invalidAttributeValue",
                reader,
                name);
    }
    return value;
}
 
Example #3
Source File: DeploymentDescriptorParser.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
protected String getMandatoryAttribute(XMLStreamReader reader, Attributes attrs, String name) {
    String value = getAttribute(attrs, name);
    if (value == null) {
        failWithLocalName("runtime.parser.missing.attribute", reader, name);
    }
    return value;
}
 
Example #4
Source File: DeploymentDescriptorParser.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Checks the deployment descriptor or {@link @WebServiceProvider} annotation
 * to see if it points to any WSDL. If so, returns the {@link SDDocumentSource}.
 *
 * @return The pointed WSDL, if any. Otherwise null.
 */
private SDDocumentSource getPrimaryWSDL(XMLStreamReader xsr, Attributes attrs, Class<?> implementorClass, MetadataReader metadataReader) {

    String wsdlFile = getAttribute(attrs, ATTR_WSDL);
    if (wsdlFile == null) {
        wsdlFile = EndpointFactory.getWsdlLocation(implementorClass, metadataReader);
    }

    if (wsdlFile != null) {
        if (!wsdlFile.startsWith(JAXWS_WSDL_DD_DIR)) {
            logger.log(Level.WARNING, "Ignoring wrong wsdl={0}. It should start with {1}. Going to generate and publish a new WSDL.", new Object[]{wsdlFile, JAXWS_WSDL_DD_DIR});
            return null;
        }

        URL wsdl;
        try {
            wsdl = loader.getResource('/' + wsdlFile);
        } catch (MalformedURLException e) {
            throw new LocatableWebServiceException(
                    ServerMessages.RUNTIME_PARSER_WSDL_NOT_FOUND(wsdlFile), e, xsr);
        }
        if (wsdl == null) {
            throw new LocatableWebServiceException(
                    ServerMessages.RUNTIME_PARSER_WSDL_NOT_FOUND(wsdlFile), xsr);
        }
        SDDocumentSource docInfo = docs.get(wsdl.toExternalForm());
        assert docInfo != null;
        return docInfo;
    }

    return null;
}
 
Example #5
Source File: DeploymentDescriptorParser.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
protected QName getQNameAttribute(Attributes attrs, String name) {
    String value = getAttribute(attrs, name);
    if (value == null || value.equals("")) {
        return null;
    } else {
        return QName.valueOf(value);
    }
}
 
Example #6
Source File: DeploymentDescriptorParser.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
protected String getAttribute(Attributes attrs, String name) {
    String value = attrs.getValue(name);
    if (value != null) {
        value = value.trim();
    }
    return value;
}
 
Example #7
Source File: DeploymentDescriptorParser.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Checks the deployment descriptor or {@link @WebServiceProvider} annotation
 * to see if it points to any WSDL. If so, returns the {@link SDDocumentSource}.
 *
 * @return The pointed WSDL, if any. Otherwise null.
 */
private SDDocumentSource getPrimaryWSDL(XMLStreamReader xsr, Attributes attrs, Class<?> implementorClass, MetadataReader metadataReader) {

    String wsdlFile = getAttribute(attrs, ATTR_WSDL);
    if (wsdlFile == null) {
        wsdlFile = EndpointFactory.getWsdlLocation(implementorClass, metadataReader);
    }

    if (wsdlFile != null) {
        if (!wsdlFile.startsWith(JAXWS_WSDL_DD_DIR)) {
            logger.log(Level.WARNING, "Ignoring wrong wsdl={0}. It should start with {1}. Going to generate and publish a new WSDL.", new Object[]{wsdlFile, JAXWS_WSDL_DD_DIR});
            return null;
        }

        URL wsdl;
        try {
            wsdl = loader.getResource('/' + wsdlFile);
        } catch (MalformedURLException e) {
            throw new LocatableWebServiceException(
                    ServerMessages.RUNTIME_PARSER_WSDL_NOT_FOUND(wsdlFile), e, xsr);
        }
        if (wsdl == null) {
            throw new LocatableWebServiceException(
                    ServerMessages.RUNTIME_PARSER_WSDL_NOT_FOUND(wsdlFile), xsr);
        }
        SDDocumentSource docInfo = docs.get(wsdl.toExternalForm());
        assert docInfo != null;
        return docInfo;
    }

    return null;
}
 
Example #8
Source File: DeploymentDescriptorParser.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
protected String getNonEmptyAttribute(XMLStreamReader reader, Attributes attrs, String name) {
    String value = getAttribute(attrs, name);
    if (value != null && value.equals("")) {
        failWithLocalName(
                "runtime.parser.invalidAttributeValue",
                reader,
                name);
    }
    return value;
}
 
Example #9
Source File: DeploymentDescriptorParser.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Checks the deployment descriptor or {@link @WebServiceProvider} annotation
 * to see if it points to any WSDL. If so, returns the {@link SDDocumentSource}.
 *
 * @return The pointed WSDL, if any. Otherwise null.
 */
private SDDocumentSource getPrimaryWSDL(XMLStreamReader xsr, Attributes attrs, Class<?> implementorClass, MetadataReader metadataReader) {

    String wsdlFile = getAttribute(attrs, ATTR_WSDL);
    if (wsdlFile == null) {
        wsdlFile = EndpointFactory.getWsdlLocation(implementorClass, metadataReader);
    }

    if (wsdlFile != null) {
        if (!wsdlFile.startsWith(JAXWS_WSDL_DD_DIR)) {
            logger.log(Level.WARNING, "Ignoring wrong wsdl={0}. It should start with {1}. Going to generate and publish a new WSDL.", new Object[]{wsdlFile, JAXWS_WSDL_DD_DIR});
            return null;
        }

        URL wsdl;
        try {
            wsdl = loader.getResource('/' + wsdlFile);
        } catch (MalformedURLException e) {
            throw new LocatableWebServiceException(
                    ServerMessages.RUNTIME_PARSER_WSDL_NOT_FOUND(wsdlFile), e, xsr);
        }
        if (wsdl == null) {
            throw new LocatableWebServiceException(
                    ServerMessages.RUNTIME_PARSER_WSDL_NOT_FOUND(wsdlFile), xsr);
        }
        SDDocumentSource docInfo = docs.get(wsdl.toExternalForm());
        assert docInfo != null;
        return docInfo;
    }

    return null;
}
 
Example #10
Source File: DeploymentDescriptorParser.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
protected String getAttribute(Attributes attrs, String name) {
    String value = attrs.getValue(name);
    if (value != null) {
        value = value.trim();
    }
    return value;
}
 
Example #11
Source File: DeploymentDescriptorParser.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
protected QName getQNameAttribute(Attributes attrs, String name) {
    String value = getAttribute(attrs, name);
    if (value == null || value.equals("")) {
        return null;
    } else {
        return QName.valueOf(value);
    }
}
 
Example #12
Source File: DeploymentDescriptorParser.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
protected String getNonEmptyAttribute(XMLStreamReader reader, Attributes attrs, String name) {
    String value = getAttribute(attrs, name);
    if (value != null && value.equals("")) {
        failWithLocalName(
                "runtime.parser.invalidAttributeValue",
                reader,
                name);
    }
    return value;
}
 
Example #13
Source File: DeploymentDescriptorParser.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
protected String getMandatoryAttribute(XMLStreamReader reader, Attributes attrs, String name) {
    String value = getAttribute(attrs, name);
    if (value == null) {
        failWithLocalName("runtime.parser.missing.attribute", reader, name);
    }
    return value;
}
 
Example #14
Source File: DeploymentDescriptorParser.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
protected String getMandatoryNonEmptyAttribute(XMLStreamReader reader, Attributes attributes,
                                               String name) {
    String value = getAttribute(attributes, name);
    if (value == null) {
        failWithLocalName("runtime.parser.missing.attribute", reader, name);
    } else if (value.equals("")) {
        failWithLocalName(
                "runtime.parser.invalidAttributeValue",
                reader,
                name);
    }
    return value;
}
 
Example #15
Source File: DeploymentDescriptorParser.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
protected ExternalMetadataFeature configureExternalMetadataReader(XMLStreamReader reader) {

        ExternalMetadataFeature.Builder featureBuilder = null;
        while (QNAME_EXT_METADA.equals(reader.getName())) {

            if (reader.getEventType() == XMLStreamConstants.START_ELEMENT) {
                Attributes attrs = XMLStreamReaderUtil.getAttributes(reader);
                String file = getAttribute(attrs, ATTR_FILE);
                if (file != null) {
                    if (featureBuilder == null) {
                        featureBuilder = ExternalMetadataFeature.builder();
                    }
                    featureBuilder.addFiles(new File(file));
                }

                String res = getAttribute(attrs, ATTR_RESOURCE);
                if (res != null) {
                    if (featureBuilder == null) {
                        featureBuilder = ExternalMetadataFeature.builder();
                    }
                    featureBuilder.addResources(res);
                }
            }

            XMLStreamReaderUtil.nextElementContent(reader);
        }

        return buildFeature(featureBuilder);
    }
 
Example #16
Source File: DeploymentDescriptorParser.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
protected ExternalMetadataFeature configureExternalMetadataReader(XMLStreamReader reader) {

        ExternalMetadataFeature.Builder featureBuilder = null;
        while (QNAME_EXT_METADA.equals(reader.getName())) {

            if (reader.getEventType() == XMLStreamConstants.START_ELEMENT) {
                Attributes attrs = XMLStreamReaderUtil.getAttributes(reader);
                String file = getAttribute(attrs, ATTR_FILE);
                if (file != null) {
                    if (featureBuilder == null) {
                        featureBuilder = ExternalMetadataFeature.builder();
                    }
                    featureBuilder.addFiles(new File(file));
                }

                String res = getAttribute(attrs, ATTR_RESOURCE);
                if (res != null) {
                    if (featureBuilder == null) {
                        featureBuilder = ExternalMetadataFeature.builder();
                    }
                    featureBuilder.addResources(res);
                }
            }

            XMLStreamReaderUtil.nextElementContent(reader);
        }

        return buildFeature(featureBuilder);
    }
 
Example #17
Source File: DeploymentDescriptorParser.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
protected String getMandatoryNonEmptyAttribute(XMLStreamReader reader, Attributes attributes,
                                               String name) {
    String value = getAttribute(attributes, name);
    if (value == null) {
        failWithLocalName("runtime.parser.missing.attribute", reader, name);
    } else if (value.equals("")) {
        failWithLocalName(
                "runtime.parser.invalidAttributeValue",
                reader,
                name);
    }
    return value;
}
 
Example #18
Source File: DeploymentDescriptorParser.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
protected String getMandatoryAttribute(XMLStreamReader reader, Attributes attrs, String name) {
    String value = getAttribute(attrs, name);
    if (value == null) {
        failWithLocalName("runtime.parser.missing.attribute", reader, name);
    }
    return value;
}
 
Example #19
Source File: DeploymentDescriptorParser.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
protected String getNonEmptyAttribute(XMLStreamReader reader, Attributes attrs, String name) {
    String value = getAttribute(attrs, name);
    if (value != null && value.equals("")) {
        failWithLocalName(
                "runtime.parser.invalidAttributeValue",
                reader,
                name);
    }
    return value;
}
 
Example #20
Source File: DeploymentDescriptorParser.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
protected QName getQNameAttribute(Attributes attrs, String name) {
    String value = getAttribute(attrs, name);
    if (value == null || value.equals("")) {
        return null;
    } else {
        return QName.valueOf(value);
    }
}
 
Example #21
Source File: DeploymentDescriptorParser.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
protected String getAttribute(Attributes attrs, String name) {
    String value = attrs.getValue(name);
    if (value != null) {
        value = value.trim();
    }
    return value;
}
 
Example #22
Source File: DeploymentDescriptorParser.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Checks the deployment descriptor or {@link @WebServiceProvider} annotation
 * to see if it points to any WSDL. If so, returns the {@link SDDocumentSource}.
 *
 * @return The pointed WSDL, if any. Otherwise null.
 */
private SDDocumentSource getPrimaryWSDL(XMLStreamReader xsr, Attributes attrs, Class<?> implementorClass, MetadataReader metadataReader) {

    String wsdlFile = getAttribute(attrs, ATTR_WSDL);
    if (wsdlFile == null) {
        wsdlFile = EndpointFactory.getWsdlLocation(implementorClass, metadataReader);
    }

    if (wsdlFile != null) {
        if (!wsdlFile.startsWith(JAXWS_WSDL_DD_DIR)) {
            logger.log(Level.WARNING, "Ignoring wrong wsdl={0}. It should start with {1}. Going to generate and publish a new WSDL.", new Object[]{wsdlFile, JAXWS_WSDL_DD_DIR});
            return null;
        }

        URL wsdl;
        try {
            wsdl = loader.getResource('/' + wsdlFile);
        } catch (MalformedURLException e) {
            throw new LocatableWebServiceException(
                    ServerMessages.RUNTIME_PARSER_WSDL_NOT_FOUND(wsdlFile), e, xsr);
        }
        if (wsdl == null) {
            throw new LocatableWebServiceException(
                    ServerMessages.RUNTIME_PARSER_WSDL_NOT_FOUND(wsdlFile), xsr);
        }
        SDDocumentSource docInfo = docs.get(wsdl.toExternalForm());
        assert docInfo != null;
        return docInfo;
    }

    return null;
}
 
Example #23
Source File: DeploymentDescriptorParser.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
protected ExternalMetadataFeature configureExternalMetadataReader(XMLStreamReader reader) {

        ExternalMetadataFeature.Builder featureBuilder = null;
        while (QNAME_EXT_METADA.equals(reader.getName())) {

            if (reader.getEventType() == XMLStreamConstants.START_ELEMENT) {
                Attributes attrs = XMLStreamReaderUtil.getAttributes(reader);
                String file = getAttribute(attrs, ATTR_FILE);
                if (file != null) {
                    if (featureBuilder == null) {
                        featureBuilder = ExternalMetadataFeature.builder();
                    }
                    featureBuilder.addFiles(new File(file));
                }

                String res = getAttribute(attrs, ATTR_RESOURCE);
                if (res != null) {
                    if (featureBuilder == null) {
                        featureBuilder = ExternalMetadataFeature.builder();
                    }
                    featureBuilder.addResources(res);
                }
            }

            XMLStreamReaderUtil.nextElementContent(reader);
        }

        return buildFeature(featureBuilder);
    }
 
Example #24
Source File: DeploymentDescriptorParser.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
protected String getMandatoryNonEmptyAttribute(XMLStreamReader reader, Attributes attributes,
                                               String name) {
    String value = getAttribute(attributes, name);
    if (value == null) {
        failWithLocalName("runtime.parser.missing.attribute", reader, name);
    } else if (value.equals("")) {
        failWithLocalName(
                "runtime.parser.invalidAttributeValue",
                reader,
                name);
    }
    return value;
}
 
Example #25
Source File: DeploymentDescriptorParser.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
protected String getMandatoryAttribute(XMLStreamReader reader, Attributes attrs, String name) {
    String value = getAttribute(attrs, name);
    if (value == null) {
        failWithLocalName("runtime.parser.missing.attribute", reader, name);
    }
    return value;
}
 
Example #26
Source File: DeploymentDescriptorParser.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
protected String getNonEmptyAttribute(XMLStreamReader reader, Attributes attrs, String name) {
    String value = getAttribute(attrs, name);
    if (value != null && value.equals("")) {
        failWithLocalName(
                "runtime.parser.invalidAttributeValue",
                reader,
                name);
    }
    return value;
}
 
Example #27
Source File: DeploymentDescriptorParser.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
protected QName getQNameAttribute(Attributes attrs, String name) {
    String value = getAttribute(attrs, name);
    if (value == null || value.equals("")) {
        return null;
    } else {
        return QName.valueOf(value);
    }
}
 
Example #28
Source File: DeploymentDescriptorParser.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
protected String getAttribute(Attributes attrs, String name) {
    String value = attrs.getValue(name);
    if (value != null) {
        value = value.trim();
    }
    return value;
}
 
Example #29
Source File: DeploymentDescriptorParser.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Checks the deployment descriptor or {@link @WebServiceProvider} annotation
 * to see if it points to any WSDL. If so, returns the {@link SDDocumentSource}.
 *
 * @return The pointed WSDL, if any. Otherwise null.
 */
private SDDocumentSource getPrimaryWSDL(XMLStreamReader xsr, Attributes attrs, Class<?> implementorClass, MetadataReader metadataReader) {

    String wsdlFile = getAttribute(attrs, ATTR_WSDL);
    if (wsdlFile == null) {
        wsdlFile = EndpointFactory.getWsdlLocation(implementorClass, metadataReader);
    }

    if (wsdlFile != null) {
        if (!wsdlFile.startsWith(JAXWS_WSDL_DD_DIR)) {
            logger.log(Level.WARNING, "Ignoring wrong wsdl={0}. It should start with {1}. Going to generate and publish a new WSDL.", new Object[]{wsdlFile, JAXWS_WSDL_DD_DIR});
            return null;
        }

        URL wsdl;
        try {
            wsdl = loader.getResource('/' + wsdlFile);
        } catch (MalformedURLException e) {
            throw new LocatableWebServiceException(
                    ServerMessages.RUNTIME_PARSER_WSDL_NOT_FOUND(wsdlFile), e, xsr);
        }
        if (wsdl == null) {
            throw new LocatableWebServiceException(
                    ServerMessages.RUNTIME_PARSER_WSDL_NOT_FOUND(wsdlFile), xsr);
        }
        SDDocumentSource docInfo = docs.get(wsdl.toExternalForm());
        assert docInfo != null;
        return docInfo;
    }

    return null;
}
 
Example #30
Source File: DeploymentDescriptorParser.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
protected ExternalMetadataFeature configureExternalMetadataReader(XMLStreamReader reader) {

        ExternalMetadataFeature.Builder featureBuilder = null;
        while (QNAME_EXT_METADA.equals(reader.getName())) {

            if (reader.getEventType() == XMLStreamConstants.START_ELEMENT) {
                Attributes attrs = XMLStreamReaderUtil.getAttributes(reader);
                String file = getAttribute(attrs, ATTR_FILE);
                if (file != null) {
                    if (featureBuilder == null) {
                        featureBuilder = ExternalMetadataFeature.builder();
                    }
                    featureBuilder.addFiles(new File(file));
                }

                String res = getAttribute(attrs, ATTR_RESOURCE);
                if (res != null) {
                    if (featureBuilder == null) {
                        featureBuilder = ExternalMetadataFeature.builder();
                    }
                    featureBuilder.addResources(res);
                }
            }

            XMLStreamReaderUtil.nextElementContent(reader);
        }

        return buildFeature(featureBuilder);
    }