com.sun.tools.internal.ws.wsdl.framework.TWSDLParserContextImpl Java Examples

The following examples show how to use com.sun.tools.internal.ws.wsdl.framework.TWSDLParserContextImpl. 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: WSDLParser.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private Definitions parseDefinitions(TWSDLParserContextImpl context, Document root) {
    context.pushWSDLLocation();
    context.setWSDLLocation(context.getDocument().getSystemId());

    new Internalizer(forest, options, errReceiver).transform();

    Definitions definitions = parseDefinitionsNoImport(context, root);
    if(definitions == null){
        Locator locator = forest.locatorTable.getStartLocation(root.getDocumentElement());
        errReceiver.error(locator, WsdlMessages.PARSING_NOT_AWSDL(locator.getSystemId()));

    }
    processImports(context);
    context.popWSDLLocation();
    return definitions;
}
 
Example #2
Source File: WSDLParser.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private Definitions parseDefinitions(TWSDLParserContextImpl context, Document root) {
    context.pushWSDLLocation();
    context.setWSDLLocation(context.getDocument().getSystemId());

    new Internalizer(forest, options, errReceiver).transform();

    Definitions definitions = parseDefinitionsNoImport(context, root);
    if(definitions == null){
        Locator locator = forest.locatorTable.getStartLocation(root.getDocumentElement());
        errReceiver.error(locator, WsdlMessages.PARSING_NOT_AWSDL(locator.getSystemId()));

    }
    processImports(context);
    context.popWSDLLocation();
    return definitions;
}
 
Example #3
Source File: WSDLParser.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private WSDLDocument buildWSDLDocument(){
    /**
     * Currently we are working off first WSDL document
     * TODO: add support of creating WSDLDocument from fromjava.collection of WSDL documents
     */

    String location = forest.getRootWSDL();

    //It means that WSDL is not found, an error might have been reported, lets try to recover
    if(location == null)
        return null;

    Document root = forest.get(location);

    if(root == null)
        return null;

    WSDLDocument document = new WSDLDocument(forest, errReceiver);
    document.setSystemId(location);
    TWSDLParserContextImpl context = new TWSDLParserContextImpl(forest, document, listeners, errReceiver);

    Definitions definitions = parseDefinitions(context, root);
    document.setDefinitions(definitions);
    return document;
}
 
Example #4
Source File: WSDLParser.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private Definitions parseDefinitions(TWSDLParserContextImpl context, Document root) {
    context.pushWSDLLocation();
    context.setWSDLLocation(context.getDocument().getSystemId());

    new Internalizer(forest, options, errReceiver).transform();

    Definitions definitions = parseDefinitionsNoImport(context, root);
    if(definitions == null){
        Locator locator = forest.locatorTable.getStartLocation(root.getDocumentElement());
        errReceiver.error(locator, WsdlMessages.PARSING_NOT_AWSDL(locator.getSystemId()));

    }
    processImports(context);
    context.popWSDLLocation();
    return definitions;
}
 
Example #5
Source File: WSDLParser.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private WSDLDocument buildWSDLDocument(){
    /**
     * Currently we are working off first WSDL document
     * TODO: add support of creating WSDLDocument from fromjava.collection of WSDL documents
     */

    String location = forest.getRootWSDL();

    //It means that WSDL is not found, an error might have been reported, lets try to recover
    if(location == null)
        return null;

    Document root = forest.get(location);

    if(root == null)
        return null;

    WSDLDocument document = new WSDLDocument(forest, errReceiver);
    document.setSystemId(location);
    TWSDLParserContextImpl context = new TWSDLParserContextImpl(forest, document, listeners, errReceiver);

    Definitions definitions = parseDefinitions(context, root);
    document.setDefinitions(definitions);
    return document;
}
 
Example #6
Source File: WSDLParser.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private WSDLDocument buildWSDLDocument(){
    /**
     * Currently we are working off first WSDL document
     * TODO: add support of creating WSDLDocument from fromjava.collection of WSDL documents
     */

    String location = forest.getRootWSDL();

    //It means that WSDL is not found, an error might have been reported, lets try to recover
    if(location == null)
        return null;

    Document root = forest.get(location);

    if(root == null)
        return null;

    WSDLDocument document = new WSDLDocument(forest, errReceiver);
    document.setSystemId(location);
    TWSDLParserContextImpl context = new TWSDLParserContextImpl(forest, document, listeners, errReceiver);

    Definitions definitions = parseDefinitions(context, root);
    document.setDefinitions(definitions);
    return document;
}
 
Example #7
Source File: WSDLParser.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private Definitions parseDefinitions(TWSDLParserContextImpl context, Document root) {
    context.pushWSDLLocation();
    context.setWSDLLocation(context.getDocument().getSystemId());

    new Internalizer(forest, options, errReceiver).transform();

    Definitions definitions = parseDefinitionsNoImport(context, root);
    if(definitions == null){
        Locator locator = forest.locatorTable.getStartLocation(root.getDocumentElement());
        errReceiver.error(locator, WsdlMessages.PARSING_NOT_AWSDL(locator.getSystemId()));

    }
    processImports(context);
    context.popWSDLLocation();
    return definitions;
}
 
Example #8
Source File: WSDLParser.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private WSDLDocument buildWSDLDocument(){
    /**
     * Currently we are working off first WSDL document
     * TODO: add support of creating WSDLDocument from fromjava.collection of WSDL documents
     */

    String location = forest.getRootWSDL();

    //It means that WSDL is not found, an error might have been reported, lets try to recover
    if(location == null)
        return null;

    Document root = forest.get(location);

    if(root == null)
        return null;

    WSDLDocument document = new WSDLDocument(forest, errReceiver);
    document.setSystemId(location);
    TWSDLParserContextImpl context = new TWSDLParserContextImpl(forest, document, listeners, errReceiver);

    Definitions definitions = parseDefinitions(context, root);
    document.setDefinitions(definitions);
    return document;
}
 
Example #9
Source File: WSDLParser.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private Definitions parseDefinitions(TWSDLParserContextImpl context, Document root) {
    context.pushWSDLLocation();
    context.setWSDLLocation(context.getDocument().getSystemId());

    new Internalizer(forest, options, errReceiver).transform();

    Definitions definitions = parseDefinitionsNoImport(context, root);
    if(definitions == null){
        Locator locator = forest.locatorTable.getStartLocation(root.getDocumentElement());
        errReceiver.error(locator, WsdlMessages.PARSING_NOT_AWSDL(locator.getSystemId()));

    }
    processImports(context);
    context.popWSDLLocation();
    return definitions;
}
 
Example #10
Source File: WSDLParser.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private Import parseImport(
    TWSDLParserContextImpl context,
    Definitions definitions,
    Element e) {
    context.push();
    context.registerNamespaces(e);
    Import anImport = new Import(forest.locatorTable.getStartLocation(e));
    String namespace =
        Util.getRequiredAttribute(e, Constants.ATTR_NAMESPACE);
    anImport.setNamespace(namespace);
    String location = Util.getRequiredAttribute(e, Constants.ATTR_LOCATION);
    anImport.setLocation(location);

    // according to the schema in the WSDL 1.1 spec, an import can have a documentation element
    boolean gotDocumentation = false;

    for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) {
        Element e2 = Util.nextElement(iter);
        if (e2 == null)
            break;

        if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_DOCUMENTATION)) {
            if (gotDocumentation) {
                errReceiver.error(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_ONLY_ONE_DOCUMENTATION_ALLOWED(e.getLocalName()));
            }
            gotDocumentation = true;
            anImport.setDocumentation(getDocumentationFor(e2));
        } else {
            errReceiver.error(forest.locatorTable.getStartLocation(e2), WsdlMessages.PARSING_INVALID_ELEMENT(e2.getTagName(),
                e2.getNamespaceURI()));
        }
    }
    context.pop();
    context.fireDoneParsingEntity(WSDLConstants.QNAME_IMPORT, anImport);
    return anImport;
}
 
Example #11
Source File: WSDLParser.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private MessagePart parseMessagePart(TWSDLParserContextImpl context, Element e) {
    context.push();
    context.registerNamespaces(e);
    MessagePart part = new MessagePart(forest.locatorTable.getStartLocation(e));
    String partName = Util.getRequiredAttribute(e, Constants.ATTR_NAME);
    part.setName(partName);

    String elementAttr =
        XmlUtil.getAttributeOrNull(e, Constants.ATTR_ELEMENT);
    String typeAttr = XmlUtil.getAttributeOrNull(e, Constants.ATTR_TYPE);

    if (elementAttr != null) {
        if (typeAttr != null) {
            errReceiver.error(context.getLocation(e), WsdlMessages.PARSING_ONLY_ONE_OF_ELEMENT_OR_TYPE_REQUIRED(partName));

        }

        part.setDescriptor(context.translateQualifiedName(context.getLocation(e), elementAttr));
        part.setDescriptorKind(SchemaKinds.XSD_ELEMENT);
    } else if (typeAttr != null) {
        part.setDescriptor(context.translateQualifiedName(context.getLocation(e), typeAttr));
        part.setDescriptorKind(SchemaKinds.XSD_TYPE);
    } else {
        // XXX-NOTE - this is wrong; for extensibility purposes,
        // any attribute can be specified on a <part> element, so
        // we need to put an extensibility hook here
        errReceiver.warning(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_ELEMENT_OR_TYPE_REQUIRED(partName));
    }

    context.pop();
    context.fireDoneParsingEntity(WSDLConstants.QNAME_PART, part);
    return part;
}
 
Example #12
Source File: WSDLParser.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private Import parseImport(
    TWSDLParserContextImpl context,
    Definitions definitions,
    Element e) {
    context.push();
    context.registerNamespaces(e);
    Import anImport = new Import(forest.locatorTable.getStartLocation(e));
    String namespace =
        Util.getRequiredAttribute(e, Constants.ATTR_NAMESPACE);
    anImport.setNamespace(namespace);
    String location = Util.getRequiredAttribute(e, Constants.ATTR_LOCATION);
    anImport.setLocation(location);

    // according to the schema in the WSDL 1.1 spec, an import can have a documentation element
    boolean gotDocumentation = false;

    for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) {
        Element e2 = Util.nextElement(iter);
        if (e2 == null)
            break;

        if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_DOCUMENTATION)) {
            if (gotDocumentation) {
                errReceiver.error(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_ONLY_ONE_DOCUMENTATION_ALLOWED(e.getLocalName()));
            }
            gotDocumentation = true;
            anImport.setDocumentation(getDocumentationFor(e2));
        } else {
            errReceiver.error(forest.locatorTable.getStartLocation(e2), WsdlMessages.PARSING_INVALID_ELEMENT(e2.getTagName(),
                e2.getNamespaceURI()));
        }
    }
    context.pop();
    context.fireDoneParsingEntity(WSDLConstants.QNAME_IMPORT, anImport);
    return anImport;
}
 
Example #13
Source File: WSDLParser.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private boolean handleExtension(
    TWSDLParserContextImpl context,
    TWSDLExtensible entity,
    Element e) {
    TWSDLExtensionHandler h =
         (TWSDLExtensionHandler) extensionHandlers.get(e.getNamespaceURI());
    if (h == null) {
        context.fireIgnoringExtension(e, (Entity) entity);
        errReceiver.warning(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_UNKNOWN_EXTENSIBILITY_ELEMENT_OR_ATTRIBUTE(e.getLocalName(), e.getNamespaceURI()));
        return false;
    } else {
        return h.doHandleExtension(context, entity, e);
    }
}
 
Example #14
Source File: WSDLParser.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private boolean handleExtension(
    TWSDLParserContextImpl context,
    TWSDLExtensible entity,
    Element e) {
    TWSDLExtensionHandler h =
         (TWSDLExtensionHandler) extensionHandlers.get(e.getNamespaceURI());
    if (h == null) {
        context.fireIgnoringExtension(e, (Entity) entity);
        errReceiver.warning(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_UNKNOWN_EXTENSIBILITY_ELEMENT_OR_ATTRIBUTE(e.getLocalName(), e.getNamespaceURI()));
        return false;
    } else {
        return h.doHandleExtension(context, entity, e);
    }
}
 
Example #15
Source File: WSDLParser.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private Import parseImport(
    TWSDLParserContextImpl context,
    Definitions definitions,
    Element e) {
    context.push();
    context.registerNamespaces(e);
    Import anImport = new Import(forest.locatorTable.getStartLocation(e));
    String namespace =
        Util.getRequiredAttribute(e, Constants.ATTR_NAMESPACE);
    anImport.setNamespace(namespace);
    String location = Util.getRequiredAttribute(e, Constants.ATTR_LOCATION);
    anImport.setLocation(location);

    // according to the schema in the WSDL 1.1 spec, an import can have a documentation element
    boolean gotDocumentation = false;

    for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) {
        Element e2 = Util.nextElement(iter);
        if (e2 == null)
            break;

        if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_DOCUMENTATION)) {
            if (gotDocumentation) {
                errReceiver.error(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_ONLY_ONE_DOCUMENTATION_ALLOWED(e.getLocalName()));
            }
            gotDocumentation = true;
            anImport.setDocumentation(getDocumentationFor(e2));
        } else {
            errReceiver.error(forest.locatorTable.getStartLocation(e2), WsdlMessages.PARSING_INVALID_ELEMENT(e2.getTagName(),
                e2.getNamespaceURI()));
        }
    }
    context.pop();
    context.fireDoneParsingEntity(WSDLConstants.QNAME_IMPORT, anImport);
    return anImport;
}
 
Example #16
Source File: WSDLParser.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private MessagePart parseMessagePart(TWSDLParserContextImpl context, Element e) {
    context.push();
    context.registerNamespaces(e);
    MessagePart part = new MessagePart(forest.locatorTable.getStartLocation(e));
    String partName = Util.getRequiredAttribute(e, Constants.ATTR_NAME);
    part.setName(partName);

    String elementAttr =
        XmlUtil.getAttributeOrNull(e, Constants.ATTR_ELEMENT);
    String typeAttr = XmlUtil.getAttributeOrNull(e, Constants.ATTR_TYPE);

    if (elementAttr != null) {
        if (typeAttr != null) {
            errReceiver.error(context.getLocation(e), WsdlMessages.PARSING_ONLY_ONE_OF_ELEMENT_OR_TYPE_REQUIRED(partName));

        }

        part.setDescriptor(context.translateQualifiedName(context.getLocation(e), elementAttr));
        part.setDescriptorKind(SchemaKinds.XSD_ELEMENT);
    } else if (typeAttr != null) {
        part.setDescriptor(context.translateQualifiedName(context.getLocation(e), typeAttr));
        part.setDescriptorKind(SchemaKinds.XSD_TYPE);
    } else {
        // XXX-NOTE - this is wrong; for extensibility purposes,
        // any attribute can be specified on a <part> element, so
        // we need to put an extensibility hook here
        errReceiver.warning(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_ELEMENT_OR_TYPE_REQUIRED(partName));
    }

    context.pop();
    context.fireDoneParsingEntity(WSDLConstants.QNAME_PART, part);
    return part;
}
 
Example #17
Source File: WSDLParser.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private Import parseImport(
    TWSDLParserContextImpl context,
    Definitions definitions,
    Element e) {
    context.push();
    context.registerNamespaces(e);
    Import anImport = new Import(forest.locatorTable.getStartLocation(e));
    String namespace =
        Util.getRequiredAttribute(e, Constants.ATTR_NAMESPACE);
    anImport.setNamespace(namespace);
    String location = Util.getRequiredAttribute(e, Constants.ATTR_LOCATION);
    anImport.setLocation(location);

    // according to the schema in the WSDL 1.1 spec, an import can have a documentation element
    boolean gotDocumentation = false;

    for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) {
        Element e2 = Util.nextElement(iter);
        if (e2 == null)
            break;

        if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_DOCUMENTATION)) {
            if (gotDocumentation) {
                errReceiver.error(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_ONLY_ONE_DOCUMENTATION_ALLOWED(e.getLocalName()));
            }
            gotDocumentation = true;
            anImport.setDocumentation(getDocumentationFor(e2));
        } else {
            errReceiver.error(forest.locatorTable.getStartLocation(e2), WsdlMessages.PARSING_INVALID_ELEMENT(e2.getTagName(),
                e2.getNamespaceURI()));
        }
    }
    context.pop();
    context.fireDoneParsingEntity(WSDLConstants.QNAME_IMPORT, anImport);
    return anImport;
}
 
Example #18
Source File: WSDLParser.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private boolean handleExtension(
    TWSDLParserContextImpl context,
    TWSDLExtensible entity,
    Element e) {
    TWSDLExtensionHandler h =
         (TWSDLExtensionHandler) extensionHandlers.get(e.getNamespaceURI());
    if (h == null) {
        context.fireIgnoringExtension(e, (Entity) entity);
        errReceiver.warning(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_UNKNOWN_EXTENSIBILITY_ELEMENT_OR_ATTRIBUTE(e.getLocalName(), e.getNamespaceURI()));
        return false;
    } else {
        return h.doHandleExtension(context, entity, e);
    }
}
 
Example #19
Source File: WSDLParser.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private boolean handleExtension(
    TWSDLParserContextImpl context,
    TWSDLExtensible entity,
    Element e) {
    TWSDLExtensionHandler h =
         (TWSDLExtensionHandler) extensionHandlers.get(e.getNamespaceURI());
    if (h == null) {
        context.fireIgnoringExtension(e, (Entity) entity);
        errReceiver.warning(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_UNKNOWN_EXTENSIBILITY_ELEMENT_OR_ATTRIBUTE(e.getLocalName(), e.getNamespaceURI()));
        return false;
    } else {
        return h.doHandleExtension(context, entity, e);
    }
}
 
Example #20
Source File: WSDLParser.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private MessagePart parseMessagePart(TWSDLParserContextImpl context, Element e) {
    context.push();
    context.registerNamespaces(e);
    MessagePart part = new MessagePart(forest.locatorTable.getStartLocation(e));
    String partName = Util.getRequiredAttribute(e, Constants.ATTR_NAME);
    part.setName(partName);

    String elementAttr =
        XmlUtil.getAttributeOrNull(e, Constants.ATTR_ELEMENT);
    String typeAttr = XmlUtil.getAttributeOrNull(e, Constants.ATTR_TYPE);

    if (elementAttr != null) {
        if (typeAttr != null) {
            errReceiver.error(context.getLocation(e), WsdlMessages.PARSING_ONLY_ONE_OF_ELEMENT_OR_TYPE_REQUIRED(partName));

        }

        part.setDescriptor(context.translateQualifiedName(context.getLocation(e), elementAttr));
        part.setDescriptorKind(SchemaKinds.XSD_ELEMENT);
    } else if (typeAttr != null) {
        part.setDescriptor(context.translateQualifiedName(context.getLocation(e), typeAttr));
        part.setDescriptorKind(SchemaKinds.XSD_TYPE);
    } else {
        // XXX-NOTE - this is wrong; for extensibility purposes,
        // any attribute can be specified on a <part> element, so
        // we need to put an extensibility hook here
        errReceiver.warning(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_ELEMENT_OR_TYPE_REQUIRED(partName));
    }

    context.pop();
    context.fireDoneParsingEntity(WSDLConstants.QNAME_PART, part);
    return part;
}
 
Example #21
Source File: WSDLParser.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private void processImports(TWSDLParserContextImpl context) {
    for(String location : forest.getExternalReferences()){
        if (!context.getDocument().isImportedDocument(location)){
            Document doc = forest.get(location);
            if(doc == null)
                continue;
            Definitions importedDefinitions = parseDefinitionsNoImport(context, doc);
            if(importedDefinitions == null)
                continue;
            context.getDocument().addImportedEntity(importedDefinitions);
            context.getDocument().addImportedDocument(location);
        }
    }
}
 
Example #22
Source File: WSDLParser.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private void processImports(TWSDLParserContextImpl context) {
    for(String location : forest.getExternalReferences()){
        if (!context.getDocument().isImportedDocument(location)){
            Document doc = forest.get(location);
            if(doc == null)
                continue;
            Definitions importedDefinitions = parseDefinitionsNoImport(context, doc);
            if(importedDefinitions == null)
                continue;
            context.getDocument().addImportedEntity(importedDefinitions);
            context.getDocument().addImportedDocument(location);
        }
    }
}
 
Example #23
Source File: WSDLParser.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private boolean handleExtension(
    TWSDLParserContextImpl context,
    TWSDLExtensible entity,
    Element e) {
    TWSDLExtensionHandler h =
         (TWSDLExtensionHandler) extensionHandlers.get(e.getNamespaceURI());
    if (h == null) {
        context.fireIgnoringExtension(e, (Entity) entity);
        errReceiver.warning(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_UNKNOWN_EXTENSIBILITY_ELEMENT_OR_ATTRIBUTE(e.getLocalName(), e.getNamespaceURI()));
        return false;
    } else {
        return h.doHandleExtension(context, entity, e);
    }
}
 
Example #24
Source File: WSDLParser.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private void processImports(TWSDLParserContextImpl context) {
    for(String location : forest.getExternalReferences()){
        if (!context.getDocument().isImportedDocument(location)){
            Document doc = forest.get(location);
            if(doc == null)
                continue;
            Definitions importedDefinitions = parseDefinitionsNoImport(context, doc);
            if(importedDefinitions == null)
                continue;
            context.getDocument().addImportedEntity(importedDefinitions);
            context.getDocument().addImportedDocument(location);
        }
    }
}
 
Example #25
Source File: WSDLParser.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private boolean handleExtension(
    TWSDLParserContextImpl context,
    TWSDLExtensible entity,
    Element e) {
    TWSDLExtensionHandler h =
         (TWSDLExtensionHandler) extensionHandlers.get(e.getNamespaceURI());
    if (h == null) {
        context.fireIgnoringExtension(e, (Entity) entity);
        errReceiver.warning(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_UNKNOWN_EXTENSIBILITY_ELEMENT_OR_ATTRIBUTE(e.getLocalName(), e.getNamespaceURI()));
        return false;
    } else {
        return h.doHandleExtension(context, entity, e);
    }
}
 
Example #26
Source File: WSDLParser.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private void processImports(TWSDLParserContextImpl context) {
    for(String location : forest.getExternalReferences()){
        if (!context.getDocument().isImportedDocument(location)){
            Document doc = forest.get(location);
            if(doc == null)
                continue;
            Definitions importedDefinitions = parseDefinitionsNoImport(context, doc);
            if(importedDefinitions == null)
                continue;
            context.getDocument().addImportedEntity(importedDefinitions);
            context.getDocument().addImportedDocument(location);
        }
    }
}
 
Example #27
Source File: WSDLParser.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private Import parseImport(
    TWSDLParserContextImpl context,
    Definitions definitions,
    Element e) {
    context.push();
    context.registerNamespaces(e);
    Import anImport = new Import(forest.locatorTable.getStartLocation(e));
    String namespace =
        Util.getRequiredAttribute(e, Constants.ATTR_NAMESPACE);
    anImport.setNamespace(namespace);
    String location = Util.getRequiredAttribute(e, Constants.ATTR_LOCATION);
    anImport.setLocation(location);

    // according to the schema in the WSDL 1.1 spec, an import can have a documentation element
    boolean gotDocumentation = false;

    for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) {
        Element e2 = Util.nextElement(iter);
        if (e2 == null)
            break;

        if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_DOCUMENTATION)) {
            if (gotDocumentation) {
                errReceiver.error(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_ONLY_ONE_DOCUMENTATION_ALLOWED(e.getLocalName()));
            }
            gotDocumentation = true;
            anImport.setDocumentation(getDocumentationFor(e2));
        } else {
            errReceiver.error(forest.locatorTable.getStartLocation(e2), WsdlMessages.PARSING_INVALID_ELEMENT(e2.getTagName(),
                e2.getNamespaceURI()));
        }
    }
    context.pop();
    context.fireDoneParsingEntity(WSDLConstants.QNAME_IMPORT, anImport);
    return anImport;
}
 
Example #28
Source File: WSDLParser.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private boolean handleExtension(
    TWSDLParserContextImpl context,
    TWSDLExtensible entity,
    Element e) {
    TWSDLExtensionHandler h =
         (TWSDLExtensionHandler) extensionHandlers.get(e.getNamespaceURI());
    if (h == null) {
        context.fireIgnoringExtension(e, (Entity) entity);
        errReceiver.warning(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_UNKNOWN_EXTENSIBILITY_ELEMENT_OR_ATTRIBUTE(e.getLocalName(), e.getNamespaceURI()));
        return false;
    } else {
        return h.doHandleExtension(context, entity, e);
    }
}
 
Example #29
Source File: WSDLParser.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private MessagePart parseMessagePart(TWSDLParserContextImpl context, Element e) {
    context.push();
    context.registerNamespaces(e);
    MessagePart part = new MessagePart(forest.locatorTable.getStartLocation(e));
    String partName = Util.getRequiredAttribute(e, Constants.ATTR_NAME);
    part.setName(partName);

    String elementAttr =
        XmlUtil.getAttributeOrNull(e, Constants.ATTR_ELEMENT);
    String typeAttr = XmlUtil.getAttributeOrNull(e, Constants.ATTR_TYPE);

    if (elementAttr != null) {
        if (typeAttr != null) {
            errReceiver.error(context.getLocation(e), WsdlMessages.PARSING_ONLY_ONE_OF_ELEMENT_OR_TYPE_REQUIRED(partName));

        }

        part.setDescriptor(context.translateQualifiedName(context.getLocation(e), elementAttr));
        part.setDescriptorKind(SchemaKinds.XSD_ELEMENT);
    } else if (typeAttr != null) {
        part.setDescriptor(context.translateQualifiedName(context.getLocation(e), typeAttr));
        part.setDescriptorKind(SchemaKinds.XSD_TYPE);
    } else {
        // XXX-NOTE - this is wrong; for extensibility purposes,
        // any attribute can be specified on a <part> element, so
        // we need to put an extensibility hook here
        errReceiver.warning(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_ELEMENT_OR_TYPE_REQUIRED(partName));
    }

    context.pop();
    context.fireDoneParsingEntity(WSDLConstants.QNAME_PART, part);
    return part;
}
 
Example #30
Source File: WSDLParser.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private Import parseImport(
    TWSDLParserContextImpl context,
    Definitions definitions,
    Element e) {
    context.push();
    context.registerNamespaces(e);
    Import anImport = new Import(forest.locatorTable.getStartLocation(e));
    String namespace =
        Util.getRequiredAttribute(e, Constants.ATTR_NAMESPACE);
    anImport.setNamespace(namespace);
    String location = Util.getRequiredAttribute(e, Constants.ATTR_LOCATION);
    anImport.setLocation(location);

    // according to the schema in the WSDL 1.1 spec, an import can have a documentation element
    boolean gotDocumentation = false;

    for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) {
        Element e2 = Util.nextElement(iter);
        if (e2 == null)
            break;

        if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_DOCUMENTATION)) {
            if (gotDocumentation) {
                errReceiver.error(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_ONLY_ONE_DOCUMENTATION_ALLOWED(e.getLocalName()));
            }
            gotDocumentation = true;
            anImport.setDocumentation(getDocumentationFor(e2));
        } else {
            errReceiver.error(forest.locatorTable.getStartLocation(e2), WsdlMessages.PARSING_INVALID_ELEMENT(e2.getTagName(),
                e2.getNamespaceURI()));
        }
    }
    context.pop();
    context.fireDoneParsingEntity(WSDLConstants.QNAME_IMPORT, anImport);
    return anImport;
}