com.sun.tools.internal.ws.wsdl.document.jaxws.JAXWSBindingsConstants Java Examples

The following examples show how to use com.sun.tools.internal.ws.wsdl.document.jaxws.JAXWSBindingsConstants. 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: JAXWSBindingExtensionHandler.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean handleOperationExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
    if(XmlUtil.matchesTagNS(e, JAXWSBindingsConstants.JAXWS_BINDINGS)){
        if(parent instanceof Operation){
            return handlePortTypeOperation(context, (Operation)parent, e);
        }else if(parent instanceof BindingOperation){
            return handleBindingOperation(context, (BindingOperation)parent, e);
        }
    }else {
        Util.fail(
            "parsing.invalidExtensionElement",
            e.getTagName(),
            e.getNamespaceURI());
        return false;
    }
    return false;
}
 
Example #2
Source File: DOMBuilder.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public void startElement(String namespaceURI, String localName, String qName, Attributes atts) {
    super.startElement(namespaceURI, localName, qName, atts);

    Element e = getCurrentElement();
    locatorTable.storeStartLocation( e, locator );

    // check if this element is an outer-most <jaxb:bindings>
    if( JAXWSBindingsConstants.JAXWS_BINDINGS.getNamespaceURI().equals(e.getNamespaceURI())
    &&  "bindings".equals(e.getLocalName()) ) {

        // if this is the root node (meaning that this file is an
        // external binding file) or if the parent is XML Schema element
        // (meaning that this is an "inlined" external binding)
        Node p = e.getParentNode();
        if( p instanceof Document) {
            outerMostBindings.add(e);   // remember this value
        }
    }
}
 
Example #3
Source File: DOMBuilder.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public void startElement(String namespaceURI, String localName, String qName, Attributes atts) {
    super.startElement(namespaceURI, localName, qName, atts);

    Element e = getCurrentElement();
    locatorTable.storeStartLocation( e, locator );

    // check if this element is an outer-most <jaxb:bindings>
    if( JAXWSBindingsConstants.JAXWS_BINDINGS.getNamespaceURI().equals(e.getNamespaceURI())
    &&  "bindings".equals(e.getLocalName()) ) {

        // if this is the root node (meaning that this file is an
        // external binding file) or if the parent is XML Schema element
        // (meaning that this is an "inlined" external binding)
        Node p = e.getParentNode();
        if( p instanceof Document) {
            outerMostBindings.add(e);   // remember this value
        }
    }
}
 
Example #4
Source File: WSDLParser.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public WSDLDocument parse() throws SAXException, IOException {
    // parse external binding files
    for (InputSource value : options.getWSDLBindings()) {
        errReceiver.pollAbort();
        Document root = forest.parse(value, false);
        if(root==null)       continue;   // error must have been reported
        Element binding = root.getDocumentElement();
        if (!Internalizer.fixNull(binding.getNamespaceURI()).equals(JAXWSBindingsConstants.NS_JAXWS_BINDINGS)
                || !binding.getLocalName().equals("bindings")){
                errReceiver.error(forest.locatorTable.getStartLocation(binding), WsdlMessages.PARSER_NOT_A_BINDING_FILE(
                    binding.getNamespaceURI(),
                    binding.getLocalName()));
            continue;
        }

        NodeList nl = binding.getElementsByTagNameNS(
            "http://java.sun.com/xml/ns/javaee", "handler-chains");
        for(int i = 0; i < nl.getLength(); i++){
            options.addHandlerChainConfiguration((Element) nl.item(i));
        }

    }
    return buildWSDLDocument();
}
 
Example #5
Source File: DOMBuilder.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public void startElement(String namespaceURI, String localName, String qName, Attributes atts) {
    super.startElement(namespaceURI, localName, qName, atts);

    Element e = getCurrentElement();
    locatorTable.storeStartLocation( e, locator );

    // check if this element is an outer-most <jaxb:bindings>
    if( JAXWSBindingsConstants.JAXWS_BINDINGS.getNamespaceURI().equals(e.getNamespaceURI())
    &&  "bindings".equals(e.getLocalName()) ) {

        // if this is the root node (meaning that this file is an
        // external binding file) or if the parent is XML Schema element
        // (meaning that this is an "inlined" external binding)
        Node p = e.getParentNode();
        if( p instanceof Document) {
            outerMostBindings.add(e);   // remember this value
        }
    }
}
 
Example #6
Source File: WSDLParser.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public WSDLDocument parse() throws SAXException, IOException {
    // parse external binding files
    for (InputSource value : options.getWSDLBindings()) {
        errReceiver.pollAbort();
        Document root = forest.parse(value, false);
        if(root==null)       continue;   // error must have been reported
        Element binding = root.getDocumentElement();
        if (!Internalizer.fixNull(binding.getNamespaceURI()).equals(JAXWSBindingsConstants.NS_JAXWS_BINDINGS)
                || !binding.getLocalName().equals("bindings")){
                errReceiver.error(forest.locatorTable.getStartLocation(binding), WsdlMessages.PARSER_NOT_A_BINDING_FILE(
                    binding.getNamespaceURI(),
                    binding.getLocalName()));
            continue;
        }

        NodeList nl = binding.getElementsByTagNameNS(
            "http://java.sun.com/xml/ns/javaee", "handler-chains");
        for(int i = 0; i < nl.getLength(); i++){
            options.addHandlerChainConfiguration((Element) nl.item(i));
        }

    }
    return buildWSDLDocument();
}
 
Example #7
Source File: WsimportOptions.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Exposing it as a public method to allow external tools such as NB to read from wsdl model and work on it.
 * TODO: WSDL model needs to be exposed - basically at tool time we need to use the runtimw wsdl model
 *
 * Binding files could be jaxws or jaxb. This method identifies jaxws and jaxb binding files and keeps them separately. jaxb binding files are given separately
 * to JAXB in {@link com.sun.tools.internal.ws.processor.modeler.wsdl.JAXBModelBuilder}
 *
 * @param receiver {@link ErrorReceiver}
 */
public final void parseBindings(ErrorReceiver receiver){
    for (InputSource is : bindingFiles) {
        XMLStreamReader reader =
                XMLStreamReaderFactory.create(is,true);
        XMLStreamReaderUtil.nextElementContent(reader);
        if (reader.getName().equals(JAXWSBindingsConstants.JAXWS_BINDINGS)) {
            jaxwsCustomBindings.add(new RereadInputSource(is));
        } else if (reader.getName().equals(JAXWSBindingsConstants.JAXB_BINDINGS) ||
                reader.getName().equals(new QName(SchemaConstants.NS_XSD, "schema"))) {
            jaxbCustomBindings.add(new RereadInputSource(is));
        } else {
            LocatorImpl locator = new LocatorImpl();
            locator.setSystemId(reader.getLocation().getSystemId());
            locator.setPublicId(reader.getLocation().getPublicId());
            locator.setLineNumber(reader.getLocation().getLineNumber());
            locator.setColumnNumber(reader.getLocation().getColumnNumber());
            receiver.warning(locator, ConfigurationMessages.CONFIGURATION_NOT_BINDING_FILE(is.getSystemId()));
        }
    }
}
 
Example #8
Source File: WSDLParser.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public WSDLDocument parse() throws SAXException, IOException {
    // parse external binding files
    for (InputSource value : options.getWSDLBindings()) {
        errReceiver.pollAbort();
        Document root = forest.parse(value, false);
        if(root==null)       continue;   // error must have been reported
        Element binding = root.getDocumentElement();
        if (!Internalizer.fixNull(binding.getNamespaceURI()).equals(JAXWSBindingsConstants.NS_JAXWS_BINDINGS)
                || !binding.getLocalName().equals("bindings")){
                errReceiver.error(forest.locatorTable.getStartLocation(binding), WsdlMessages.PARSER_NOT_A_BINDING_FILE(
                    binding.getNamespaceURI(),
                    binding.getLocalName()));
            continue;
        }

        NodeList nl = binding.getElementsByTagNameNS(
            "http://java.sun.com/xml/ns/javaee", "handler-chains");
        for(int i = 0; i < nl.getLength(); i++){
            options.addHandlerChainConfiguration((Element) nl.item(i));
        }

    }
    return buildWSDLDocument();
}
 
Example #9
Source File: JAXWSBindingExtensionHandler.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param context
 * @param jaxwsBinding
 * @param e
 */
private void parseParameter(com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext context, JAXWSBinding jaxwsBinding, Element e) {
    String part = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.PART_ATTR);
    Element msgPartElm = evaluateXPathNode(e.getOwnerDocument(), part, new NamespaceContextImpl(e));
    Node msgElm = msgPartElm.getParentNode();
    //MessagePart msgPart = new MessagePart();

    String partName = XmlUtil.getAttributeOrNull(msgPartElm, "name");
    String msgName = XmlUtil.getAttributeOrNull((Element)msgElm, "name");
    if ((partName == null) || (msgName == null)) {
        return;
    }

    String element = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.ELEMENT_ATTR);
    String name = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.NAME_ATTR);

    QName elementName = null;
    if(element != null){
        String uri = e.lookupNamespaceURI(XmlUtil.getPrefix(element));
        elementName = (uri == null)?null:new QName(uri, XmlUtil.getLocalPart(element));
    }

    jaxwsBinding.addParameter(new Parameter(msgName, partName, elementName, name));
}
 
Example #10
Source File: JAXWSBindingExtensionHandler.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean handleOperationExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
    if(XmlUtil.matchesTagNS(e, JAXWSBindingsConstants.JAXWS_BINDINGS)){
        if(parent instanceof Operation){
            return handlePortTypeOperation(context, (Operation)parent, e);
        }else if(parent instanceof BindingOperation){
            return handleBindingOperation(context, (BindingOperation)parent, e);
        }
    }else {
        Util.fail(
            "parsing.invalidExtensionElement",
            e.getTagName(),
            e.getNamespaceURI());
        return false;
    }
    return false;
}
 
Example #11
Source File: JAXWSBindingExtensionHandler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param context
 * @param jaxwsBinding
 * @param e
 */
private void parseParameter(com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext context, JAXWSBinding jaxwsBinding, Element e) {
    String part = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.PART_ATTR);
    Element msgPartElm = evaluateXPathNode(e.getOwnerDocument(), part, new NamespaceContextImpl(e));
    Node msgElm = msgPartElm.getParentNode();
    //MessagePart msgPart = new MessagePart();

    String partName = XmlUtil.getAttributeOrNull(msgPartElm, "name");
    String msgName = XmlUtil.getAttributeOrNull((Element)msgElm, "name");
    if ((partName == null) || (msgName == null)) {
        return;
    }

    String element = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.ELEMENT_ATTR);
    String name = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.NAME_ATTR);

    QName elementName = null;
    if(element != null){
        String uri = e.lookupNamespaceURI(XmlUtil.getPrefix(element));
        elementName = (uri == null)?null:new QName(uri, XmlUtil.getLocalPart(element));
    }

    jaxwsBinding.addParameter(new Parameter(msgName, partName, elementName, name));
}
 
Example #12
Source File: JAXWSBindingExtensionHandler.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean handleOperationExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
    if(XmlUtil.matchesTagNS(e, JAXWSBindingsConstants.JAXWS_BINDINGS)){
        if(parent instanceof Operation){
            return handlePortTypeOperation(context, (Operation)parent, e);
        }else if(parent instanceof BindingOperation){
            return handleBindingOperation(context, (BindingOperation)parent, e);
        }
    }else {
        Util.fail(
            "parsing.invalidExtensionElement",
            e.getTagName(),
            e.getNamespaceURI());
        return false;
    }
    return false;
}
 
Example #13
Source File: JAXWSBindingExtensionHandler.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param context
 * @param jaxwsBinding
 * @param e
 */
private void parseParameter(com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext context, JAXWSBinding jaxwsBinding, Element e) {
    String part = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.PART_ATTR);
    Element msgPartElm = evaluateXPathNode(e.getOwnerDocument(), part, new NamespaceContextImpl(e));
    Node msgElm = msgPartElm.getParentNode();
    //MessagePart msgPart = new MessagePart();

    String partName = XmlUtil.getAttributeOrNull(msgPartElm, "name");
    String msgName = XmlUtil.getAttributeOrNull((Element)msgElm, "name");
    if ((partName == null) || (msgName == null)) {
        return;
    }

    String element = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.ELEMENT_ATTR);
    String name = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.NAME_ATTR);

    QName elementName = null;
    if(element != null){
        String uri = e.lookupNamespaceURI(XmlUtil.getPrefix(element));
        elementName = (uri == null)?null:new QName(uri, XmlUtil.getLocalPart(element));
    }

    jaxwsBinding.addParameter(new Parameter(msgName, partName, elementName, name));
}
 
Example #14
Source File: JAXWSBindingExtensionHandler.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean handleOperationExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
    if(XmlUtil.matchesTagNS(e, JAXWSBindingsConstants.JAXWS_BINDINGS)){
        if(parent instanceof Operation){
            return handlePortTypeOperation(context, (Operation)parent, e);
        }else if(parent instanceof BindingOperation){
            return handleBindingOperation(context, (BindingOperation)parent, e);
        }
    }else {
        Util.fail(
            "parsing.invalidExtensionElement",
            e.getTagName(),
            e.getNamespaceURI());
        return false;
    }
    return false;
}
 
Example #15
Source File: JAXWSBindingExtensionHandler.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean handleOperationExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
    if(XmlUtil.matchesTagNS(e, JAXWSBindingsConstants.JAXWS_BINDINGS)){
        if(parent instanceof Operation){
            return handlePortTypeOperation(context, (Operation)parent, e);
        }else if(parent instanceof BindingOperation){
            return handleBindingOperation(context, (BindingOperation)parent, e);
        }
    }else {
        Util.fail(
            "parsing.invalidExtensionElement",
            e.getTagName(),
            e.getNamespaceURI());
        return false;
    }
    return false;
}
 
Example #16
Source File: Internalizer.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private boolean isGlobalBinding(Node bindings) {
    if (bindings.getNamespaceURI() == null) {
        errorReceiver.warning(forest.locatorTable.getStartLocation((Element) bindings), WsdlMessages.INVALID_CUSTOMIZATION_NAMESPACE(bindings.getLocalName()));
        return false;
    }
    return (bindings.getNamespaceURI().equals(JAXWSBindingsConstants.NS_JAXWS_BINDINGS) &&
            (bindings.getLocalName().equals("package") ||
                    bindings.getLocalName().equals("enableAsyncMapping") ||
                    bindings.getLocalName().equals("enableAdditionalSOAPHeaderMapping") ||
                    bindings.getLocalName().equals("enableWrapperStyle") ||
                    bindings.getLocalName().equals("enableMIMEContent")));
}
 
Example #17
Source File: JAXWSBindingExtensionHandler.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
    public boolean handleBindingExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
        if(XmlUtil.matchesTagNS(e, JAXWSBindingsConstants.JAXWS_BINDINGS)){
            context.push();
            context.registerNamespaces(e);
            JAXWSBinding jaxwsBinding = new JAXWSBinding(context.getLocation(e));

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

//                if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.ENABLE_ADDITIONAL_SOAPHEADER_MAPPING)){
//                    parseAdditionalSOAPHeaderMapping(context, jaxwsBinding, e2);
//                }else
                if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.ENABLE_MIME_CONTENT)){
                    parseMimeContent(context, jaxwsBinding, e2);
                }else{
                    Util.fail(
                        "parsing.invalidExtensionElement",
                        e2.getTagName(),
                        e2.getNamespaceURI());
                    return false;
                }
            }
            parent.addExtension(jaxwsBinding);
            context.pop();
//            context.fireDoneParsingEntity(
//                    JAXWSBindingsConstants.JAXWS_BINDINGS,
//                    jaxwsBinding);
            return true;
        }else {
            Util.fail(
                "parsing.invalidExtensionElement",
                e.getTagName(),
                e.getNamespaceURI());
            return false;
        }
    }
 
Example #18
Source File: JAXWSBindingExtensionHandler.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
    public boolean handleServiceExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
        if(XmlUtil.matchesTagNS(e, JAXWSBindingsConstants.JAXWS_BINDINGS)){
            context.push();
            context.registerNamespaces(e);
            JAXWSBinding jaxwsBinding = new JAXWSBinding(context.getLocation(e));

            for(Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();){
                Element e2 = Util.nextElement(iter);
                if (e2 == null) {
                    break;
                }
                if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.CLASS)){
                    parseClass(context, jaxwsBinding, e2);
                    if((jaxwsBinding.getClassName() != null) && (jaxwsBinding.getClassName().getJavaDoc() != null)){
                        ((Service)parent).setDocumentation(new Documentation(jaxwsBinding.getClassName().getJavaDoc()));
                    }
                }else{
                    Util.fail(
                        "parsing.invalidExtensionElement",
                        e2.getTagName(),
                        e2.getNamespaceURI());
                    return false;
                }
            }
            parent.addExtension(jaxwsBinding);
            context.pop();
//            context.fireDoneParsingEntity(
//                    JAXWSBindingsConstants.JAXWS_BINDINGS,
//                    jaxwsBinding);
            return true;
        }else {
            Util.fail(
                "parsing.invalidExtensionElement",
                e.getTagName(),
                e.getNamespaceURI());
            return false;
        }
    }
 
Example #19
Source File: JAXWSBindingExtensionHandler.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param context
 * @param jaxwsBinding
 * @param e
 */
private void parseMethod(com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext context, JAXWSBinding jaxwsBinding, Element e) {
    String methodName = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.NAME_ATTR);
    String javaDoc = getJavaDoc(e);
    CustomName name = new CustomName(methodName, javaDoc);
    jaxwsBinding.setMethodName(name);
}
 
Example #20
Source File: JAXWSBindingExtensionHandler.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param context
 * @param parent
 * @param e
 */
private void parsePackage(com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext context, JAXWSBinding parent, Element e) {
    //System.out.println("In handlePackageExtension: " + e.getNodeName());
    String packageName = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.NAME_ATTR);
    JAXWSBinding binding = (JAXWSBinding)parent;
    binding.setJaxwsPackage(new CustomName(packageName, getJavaDoc(e)));
}
 
Example #21
Source File: Internalizer.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private boolean isGlobalBinding(Node bindings) {
    if (bindings.getNamespaceURI() == null) {
        errorReceiver.warning(forest.locatorTable.getStartLocation((Element) bindings), WsdlMessages.INVALID_CUSTOMIZATION_NAMESPACE(bindings.getLocalName()));
        return false;
    }
    return (bindings.getNamespaceURI().equals(JAXWSBindingsConstants.NS_JAXWS_BINDINGS) &&
            (bindings.getLocalName().equals("package") ||
                    bindings.getLocalName().equals("enableAsyncMapping") ||
                    bindings.getLocalName().equals("enableAdditionalSOAPHeaderMapping") ||
                    bindings.getLocalName().equals("enableWrapperStyle") ||
                    bindings.getLocalName().equals("enableMIMEContent")));
}
 
Example #22
Source File: JAXWSBindingExtensionHandler.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param context
 * @param jaxwsBinding
 * @param e
 */
private void parseMethod(com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext context, JAXWSBinding jaxwsBinding, Element e) {
    String methodName = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.NAME_ATTR);
    String javaDoc = getJavaDoc(e);
    CustomName name = new CustomName(methodName, javaDoc);
    jaxwsBinding.setMethodName(name);
}
 
Example #23
Source File: JAXWSBindingExtensionHandler.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private String getJavaDoc(Element e){
    for(Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();){
        Element e2 = Util.nextElement(iter);
        if (e2 == null) {
            break;
        }
        if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.JAVADOC)){
            return XmlUtil.getTextForNode(e2);
        }
    }
    return null;
}
 
Example #24
Source File: WSDLInternalizationLogic.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Element refineWSDLTarget(Element target){
    // look for existing xs:annotation
    Element JAXWSBindings = DOMUtils.getFirstChildElement(target, JAXWSBindingsConstants.NS_JAXWS_BINDINGS, "bindings");
    if(JAXWSBindings==null)
        // none exists. need to make one
        JAXWSBindings = insertJAXWSBindingsElement(target, "bindings" );
    return JAXWSBindings;
}
 
Example #25
Source File: Internalizer.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private static Element[] getChildElements(Element parent) {
    ArrayList<Element> a = new ArrayList<Element>();
    NodeList children = parent.getChildNodes();
    for (int i = 0; i < children.getLength(); i++) {
        Node item = children.item(i);
        if (!(item instanceof Element)) {
            continue;
        }
        if (JAXWSBindingsConstants.NS_JAXWS_BINDINGS.equals(item.getNamespaceURI()) ||
                JAXWSBindingsConstants.NS_JAXB_BINDINGS.equals(item.getNamespaceURI())) {
            a.add((Element) item);
        }
    }
    return a.toArray(new Element[a.size()]);
}
 
Example #26
Source File: Internalizer.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static Element[] getChildElements(Element parent) {
    ArrayList<Element> a = new ArrayList<Element>();
    NodeList children = parent.getChildNodes();
    for (int i = 0; i < children.getLength(); i++) {
        Node item = children.item(i);
        if (!(item instanceof Element)) {
            continue;
        }
        if (JAXWSBindingsConstants.NS_JAXWS_BINDINGS.equals(item.getNamespaceURI()) ||
                JAXWSBindingsConstants.NS_JAXB_BINDINGS.equals(item.getNamespaceURI())) {
            a.add((Element) item);
        }
    }
    return a.toArray(new Element[a.size()]);
}
 
Example #27
Source File: VersionChecker.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void startElement(String namespaceURI, String localName, String qName, Attributes atts)
    throws SAXException {

    super.startElement(namespaceURI, localName, qName, atts);

    if(!seenRoot) {
        // if this is the root element
        seenRoot = true;
        rootTagStart = new LocatorImpl(locator);

        version = atts.getValue(JAXWSBindingsConstants.NS_JAXWS_BINDINGS,"version");
        if( namespaceURI.equals(JAXWSBindingsConstants.NS_JAXWS_BINDINGS) ) {
            String version2 = atts.getValue("","version");
            if( version!=null && version2!=null ) {
                // we have both @version and @jaxb:version. error.
                SAXParseException e = new SAXParseException(
                    WsdlMessages.INTERNALIZER_TWO_VERSION_ATTRIBUTES(), locator);
                getErrorHandler().error(e);
            }
            //According to JAXWS 2.0 spec, if version attribute is missing its assumed to be "2.0"
            if( version==null)
                version = (version2!=null)?version2:"2.0";
        }

    }

    if( JAXWSBindingsConstants.NS_JAXWS_BINDINGS.equals(namespaceURI)){
        seenBindings = true;
        if(version == null)
            version = "2.0";
    }

}
 
Example #28
Source File: JAXWSBindingExtensionHandler.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private String getJavaDoc(Element e){
    for(Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();){
        Element e2 = Util.nextElement(iter);
        if (e2 == null) {
            break;
        }
        if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.JAVADOC)){
            return XmlUtil.getTextForNode(e2);
        }
    }
    return null;
}
 
Example #29
Source File: JAXWSBindingExtensionHandler.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private boolean handlePortTypeOperation(TWSDLParserContext context, Operation parent, Element e) {
        context.push();
        context.registerNamespaces(e);
        JAXWSBinding jaxwsBinding = new JAXWSBinding(context.getLocation(e));

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

            if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.ENABLE_WRAPPER_STYLE)){
                parseWrapperStyle(context, jaxwsBinding, e2);
            }else if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.ENABLE_ASYNC_MAPPING)){
                parseAsynMapping(context, jaxwsBinding, e2);
            }else if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.METHOD)){
                parseMethod(context, jaxwsBinding, e2);
                if((jaxwsBinding.getMethodName() != null) && (jaxwsBinding.getMethodName().getJavaDoc() != null)){
                    parent.setDocumentation(new Documentation(jaxwsBinding.getMethodName().getJavaDoc()));
                }
            }else if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.PARAMETER)){
                parseParameter(context, jaxwsBinding, e2);
            }else{
                Util.fail(
                    "parsing.invalidExtensionElement",
                    e2.getTagName(),
                    e2.getNamespaceURI());
                return false;
            }
        }
        parent.addExtension(jaxwsBinding);
        context.pop();
//        context.fireDoneParsingEntity(
//                JAXWSBindingsConstants.JAXWS_BINDINGS,
//                jaxwsBinding);
        return true;
    }
 
Example #30
Source File: JAXWSBindingExtensionHandler.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private boolean handlePortTypeOperation(TWSDLParserContext context, Operation parent, Element e) {
        context.push();
        context.registerNamespaces(e);
        JAXWSBinding jaxwsBinding = new JAXWSBinding(context.getLocation(e));

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

            if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.ENABLE_WRAPPER_STYLE)){
                parseWrapperStyle(context, jaxwsBinding, e2);
            }else if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.ENABLE_ASYNC_MAPPING)){
                parseAsynMapping(context, jaxwsBinding, e2);
            }else if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.METHOD)){
                parseMethod(context, jaxwsBinding, e2);
                if((jaxwsBinding.getMethodName() != null) && (jaxwsBinding.getMethodName().getJavaDoc() != null)){
                    parent.setDocumentation(new Documentation(jaxwsBinding.getMethodName().getJavaDoc()));
                }
            }else if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.PARAMETER)){
                parseParameter(context, jaxwsBinding, e2);
            }else{
                Util.fail(
                    "parsing.invalidExtensionElement",
                    e2.getTagName(),
                    e2.getNamespaceURI());
                return false;
            }
        }
        parent.addExtension(jaxwsBinding);
        context.pop();
//        context.fireDoneParsingEntity(
//                JAXWSBindingsConstants.JAXWS_BINDINGS,
//                jaxwsBinding);
        return true;
    }