コード例 #1
0
  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;
  }
コード例 #2
0
 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;
 }
コード例 #3
0
 public boolean handleInputExtension(
     TWSDLParserContext context, TWSDLExtensible parent, Element e) {
   if (XmlUtil.matchesTagNS(e, HTTPConstants.QNAME_URL_ENCODED)) {
     parent.addExtension(new HTTPUrlEncoded(context.getLocation(e)));
     return true;
   } else if (XmlUtil.matchesTagNS(e, HTTPConstants.QNAME_URL_REPLACEMENT)) {
     parent.addExtension(new HTTPUrlReplacement(context.getLocation(e)));
     return true;
   } else {
     Util.fail("parsing.invalidExtensionElement", e.getTagName(), e.getNamespaceURI());
     return false;
   }
 }
コード例 #4
0
  /**
   * @param context
   * @param parent
   * @param e
   */
  private boolean parseGlobalJAXWSBindings(
      TWSDLParserContext context, TWSDLExtensible parent, Element e) {
    context.push();
    context.registerNamespaces(e);

    JAXWSBinding jaxwsBinding = getJAXWSExtension(parent);
    if (jaxwsBinding == null) {
      jaxwsBinding = new JAXWSBinding(context.getLocation(e));
    }
    String attr = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.WSDL_LOCATION_ATTR);
    if (attr != null) {
      jaxwsBinding.setWsdlLocation(attr);
    }

    attr = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.NODE_ATTR);
    if (attr != null) {
      jaxwsBinding.setNode(attr);
    }

    attr = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.VERSION_ATTR);
    if (attr != null) {
      jaxwsBinding.setVersion(attr);
    }

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

      if (XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.PACKAGE)) {
        parsePackage(context, jaxwsBinding, e2);
        if ((jaxwsBinding.getJaxwsPackage() != null)
            && (jaxwsBinding.getJaxwsPackage().getJavaDoc() != null)) {
          ((Definitions) parent)
              .setDocumentation(new Documentation(jaxwsBinding.getJaxwsPackage().getJavaDoc()));
        }
      } else 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.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;
  }
コード例 #5
0
 /**
  * @param context
  * @param jaxwsBinding
  * @param e
  */
 private void parseClass(
     com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext context,
     JAXWSBinding jaxwsBinding,
     Element e) {
   String className = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.NAME_ATTR);
   String javaDoc = getJavaDoc(e);
   jaxwsBinding.setClassName(new CustomName(className, javaDoc));
 }
コード例 #6
0
  /**
   * @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));
  }
コード例 #7
0
 /**
  * @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)));
 }
コード例 #8
0
  @Override
  public boolean handlePortTypeExtension(
      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_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.CLASS)) {
          parseClass(context, jaxwsBinding, e2);
          if ((jaxwsBinding.getClassName() != null)
              && (jaxwsBinding.getClassName().getJavaDoc() != null)
              && (parent instanceof PortType)) {
            ((PortType) 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;
    }
  }
コード例 #9
0
  @Override
  public boolean handlePortExtension(
      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.PROVIDER)) {
          parseProvider(context, jaxwsBinding, e2);
        } else if (XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.METHOD)) {
          parseMethod(context, jaxwsBinding, e2);
          if ((jaxwsBinding.getMethodName() != null)
              && (jaxwsBinding.getMethodName().getJavaDoc() != null)) {
            ((Port) parent)
                .setDocumentation(new Documentation(jaxwsBinding.getMethodName().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;
    }
  }
コード例 #10
0
  private boolean handleBindingOperation(
      TWSDLParserContext context, BindingOperation operation, 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 if (XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.PARAMETER)) {
          parseParameter(context, jaxwsBinding, e2);
        } else {
          Util.fail("parsing.invalidExtensionElement", e2.getTagName(), e2.getNamespaceURI());
          return false;
        }
      }
      operation.addExtension(jaxwsBinding);
      context.pop();
      //            context.fireDoneParsingEntity(
      //                    JAXWSBindingsConstants.JAXWS_BINDINGS,
      //                    jaxwsBinding);
      return true;
    } else {
      Util.fail("parsing.invalidExtensionElement", e.getTagName(), e.getNamespaceURI());
      return false;
    }
  }
コード例 #11
0
 @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;
 }
コード例 #12
0
  public boolean handleBindingExtension(
      TWSDLParserContext context, TWSDLExtensible parent, Element e) {
    if (XmlUtil.matchesTagNS(e, HTTPConstants.QNAME_BINDING)) {
      context.push();
      context.registerNamespaces(e);

      HTTPBinding binding = new HTTPBinding(context.getLocation(e));

      String verb = Util.getRequiredAttribute(e, Constants.ATTR_VERB);
      binding.setVerb(verb);

      parent.addExtension(binding);
      context.pop();
      //            context.fireDoneParsingEntity(HTTPConstants.QNAME_BINDING, binding);
      return true;
    } else {
      Util.fail("parsing.invalidExtensionElement", e.getTagName(), e.getNamespaceURI());
      return false;
    }
  }
コード例 #13
0
  public boolean handlePortExtension(
      TWSDLParserContext context, TWSDLExtensible parent, Element e) {
    if (XmlUtil.matchesTagNS(e, HTTPConstants.QNAME_ADDRESS)) {
      context.push();
      context.registerNamespaces(e);

      HTTPAddress address = new HTTPAddress(context.getLocation(e));

      String location = Util.getRequiredAttribute(e, Constants.ATTR_LOCATION);
      address.setLocation(location);

      parent.addExtension(address);
      context.pop();
      //            context.fireDoneParsingEntity(HTTPConstants.QNAME_ADDRESS, address);
      return true;
    } else {
      Util.fail("parsing.invalidExtensionElement", e.getTagName(), e.getNamespaceURI());
      return false;
    }
  }
コード例 #14
0
 /**
  * Only skip the element if it is a <wsp:Policy/>, <wsp:PolicyReference/> or <wsp:UsingPolicy>
  * element.
  */
 private boolean handleExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
   return XmlUtil.matchesTagNS(e, NamespaceVersion.v1_5.asQName(XmlToken.Policy))
       || XmlUtil.matchesTagNS(e, NamespaceVersion.v1_5.asQName(XmlToken.PolicyReference))
       || XmlUtil.matchesTagNS(e, NamespaceVersion.v1_5.asQName(XmlToken.UsingPolicy));
 }
コード例 #15
0
 @Override
 protected XPathFactory initialValue() throws Exception {
   return XmlUtil.newXPathFactory(false);
 }