Example #1
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;
   }
 }
 /**
  * Callback that gets called by the WSDL parser or any other extension handler on finding an
  * extensibility element that it can't understand.
  *
  * @param parent The Parent element within which the extensibility element is defined
  * @param e The extensibility elemenet
  * @return false if there was some error during the extension handling otherwise returns true. If
  *     returned false then the WSDL parser can abort if the wsdl extensibility element had <code>
  *     required</code> attribute set to true
  */
 public boolean doHandleExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
   if (parent.getWSDLElementName().equals(MIMEConstants.QNAME_PART)) {
     return handleMIMEPartExtension(context, parent, e);
   } else {
     return super.doHandleExtension(context, parent, e);
   }
 }
  /**
   * @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;
  }
  private static JAXWSBinding getJAXWSExtension(TWSDLExtensible extensible) {
    for (TWSDLExtension extension : extensible.extensions()) {
      if (extension.getClass().equals(JAXWSBinding.class)) {
        return (JAXWSBinding) extension;
      }
    }

    return null;
  }
  @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;
    }
  }
Example #6
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;
    }
  }
Example #7
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;
    }
  }
  @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;
    }
  }
  @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;
    }
  }