src/share/jaxws_classes/com/sun/tools/internal/ws/api/wsdl/TWSDLExtensionHandler.java

changeset 0
373ffda63c9a
child 637
9c07ef4934dd
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/share/jaxws_classes/com/sun/tools/internal/ws/api/wsdl/TWSDLExtensionHandler.java	Wed Apr 27 01:27:09 2016 +0800
     1.3 @@ -0,0 +1,216 @@
     1.4 +/*
     1.5 + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
     1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 + *
     1.8 + * This code is free software; you can redistribute it and/or modify it
     1.9 + * under the terms of the GNU General Public License version 2 only, as
    1.10 + * published by the Free Software Foundation.  Oracle designates this
    1.11 + * particular file as subject to the "Classpath" exception as provided
    1.12 + * by Oracle in the LICENSE file that accompanied this code.
    1.13 + *
    1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.17 + * version 2 for more details (a copy is included in the LICENSE file that
    1.18 + * accompanied this code).
    1.19 + *
    1.20 + * You should have received a copy of the GNU General Public License version
    1.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.23 + *
    1.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.25 + * or visit www.oracle.com if you need additional information or have any
    1.26 + * questions.
    1.27 + */
    1.28 +
    1.29 +package com.sun.tools.internal.ws.api.wsdl;
    1.30 +
    1.31 +import com.sun.tools.internal.ws.wsdl.document.WSDLConstants;
    1.32 +import org.w3c.dom.Element;
    1.33 +
    1.34 +/**
    1.35 + * JAXWS WSDL parser {@link com.sun.tools.internal.ws.wsdl.parser.WSDLParser} will call an {@link TWSDLExtensionHandler} registered
    1.36 + * with it for the WSDL extensibility elements thats not already defined in the WSDL 1.1 spec, such as SOAP or MIME.
    1.37 + *
    1.38 + * @author Vivek Pandey
    1.39 + * @deprecated This class is deprecated, will be removed in JAX-WS 2.2 RI.
    1.40 + */
    1.41 +public abstract class TWSDLExtensionHandler {
    1.42 +    /**
    1.43 +     * Gives the namespace of an extensibility element.
    1.44 +     * <p/>
    1.45 +     * For example a soap 1.1 XXExtensionHandler would return <code>""http://schemas.xmlsoap.org/wsdl/soap/"</code>
    1.46 +     */
    1.47 +    public String getNamespaceURI() {
    1.48 +        return null;
    1.49 +    }
    1.50 +
    1.51 +    /**
    1.52 +     * This interface is called during WSDL parsing on detecting any wsdl extension.
    1.53 +     *
    1.54 +     * @param context Parser context that will be passed on by the wsdl parser
    1.55 +     * @param parent  The Parent element within which the extensibility element is defined
    1.56 +     * @param e       The extensibility elemenet
    1.57 +     * @return false if there was some error during the extension handling otherwise returns true. If returned false
    1.58 +     *         then the WSDL parser can abort if the wsdl extensibility element had <code>required</code> attribute set to true
    1.59 +     */
    1.60 +    public boolean doHandleExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
    1.61 +        if (parent.getWSDLElementName().equals(WSDLConstants.QNAME_DEFINITIONS)) {
    1.62 +            return handleDefinitionsExtension(context, parent, e);
    1.63 +        } else if (parent.getWSDLElementName().equals(WSDLConstants.QNAME_TYPES)) {
    1.64 +            return handleTypesExtension(context, parent, e);
    1.65 +        } else if (parent.getWSDLElementName().equals(WSDLConstants.QNAME_PORT_TYPE)) {
    1.66 +            return handlePortTypeExtension(context, parent, e);
    1.67 +        } else if (
    1.68 +            parent.getWSDLElementName().equals(WSDLConstants.QNAME_BINDING)) {
    1.69 +            return handleBindingExtension(context, parent, e);
    1.70 +        } else if (
    1.71 +            parent.getWSDLElementName().equals(WSDLConstants.QNAME_OPERATION)) {
    1.72 +            return handleOperationExtension(context, parent, e);
    1.73 +        } else if (parent.getWSDLElementName().equals(WSDLConstants.QNAME_INPUT)) {
    1.74 +            return handleInputExtension(context, parent, e);
    1.75 +        } else if (
    1.76 +            parent.getWSDLElementName().equals(WSDLConstants.QNAME_OUTPUT)) {
    1.77 +            return handleOutputExtension(context, parent, e);
    1.78 +        } else if (parent.getWSDLElementName().equals(WSDLConstants.QNAME_FAULT)) {
    1.79 +            return handleFaultExtension(context, parent, e);
    1.80 +        } else if (
    1.81 +            parent.getWSDLElementName().equals(WSDLConstants.QNAME_SERVICE)) {
    1.82 +            return handleServiceExtension(context, parent, e);
    1.83 +        } else if (parent.getWSDLElementName().equals(WSDLConstants.QNAME_PORT)) {
    1.84 +            return handlePortExtension(context, parent, e);
    1.85 +        } else {
    1.86 +            return false;
    1.87 +        }
    1.88 +    }
    1.89 +
    1.90 +    /**
    1.91 +     * Callback for <code>wsdl:portType</code>
    1.92 +     *
    1.93 +     * @param context Parser context that will be passed on by the wsdl parser
    1.94 +     * @param parent  The Parent element within which the extensibility element is defined
    1.95 +     * @param e       The extensibility elemenet
    1.96 +     * @return false if there was some error during the extension handling otherwise returns true. If returned false
    1.97 +     *         then the WSDL parser can abort if the wsdl extensibility element had <code>required</code> attribute set to true
    1.98 +     */
    1.99 +    public boolean handlePortTypeExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
   1.100 +        return false;
   1.101 +    }
   1.102 +
   1.103 +    /**
   1.104 +     * Callback for <code>wsdl:definitions</code>
   1.105 +     *
   1.106 +     * @param context Parser context that will be passed on by the wsdl parser
   1.107 +     * @param parent  The Parent element within which the extensibility element is defined
   1.108 +     * @param e       The extensibility elemenet
   1.109 +     * @return false if there was some error during the extension handling otherwise returns true. If returned false
   1.110 +     *         then the WSDL parser can abort if the wsdl extensibility element had <code>required</code> attribute set to true
   1.111 +     */
   1.112 +    public boolean handleDefinitionsExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
   1.113 +        return false;
   1.114 +    }
   1.115 +
   1.116 +    /**
   1.117 +     * Callback for <code>wsdl:type</code>
   1.118 +     *
   1.119 +     * @param context Parser context that will be passed on by the wsdl parser
   1.120 +     * @param parent  The Parent element within which the extensibility element is defined
   1.121 +     * @param e       The extensibility elemenet
   1.122 +     * @return false if there was some error during the extension handling otherwise returns true. If returned false
   1.123 +     *         then the WSDL parser can abort if the wsdl extensibility element had <code>required</code> attribute set to true
   1.124 +     */
   1.125 +    public boolean handleTypesExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
   1.126 +        return false;
   1.127 +    }
   1.128 +
   1.129 +    /**
   1.130 +     * Callback for <code>wsdl:binding</code>
   1.131 +     *
   1.132 +     * @param context Parser context that will be passed on by the wsdl parser
   1.133 +     * @param parent  The Parent element within which the extensibility element is defined
   1.134 +     * @param e       The extensibility elemenet
   1.135 +     * @return false if there was some error during the extension handling otherwise returns true. If returned false
   1.136 +     *         then the WSDL parser can abort if the wsdl extensibility element had <code>required</code> attribute set to true
   1.137 +     */
   1.138 +    public boolean handleBindingExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
   1.139 +        return false;
   1.140 +    }
   1.141 +
   1.142 +    /**
   1.143 +     * Callback for <code>wsdl:portType/wsdl:operation</code>.
   1.144 +     *
   1.145 +     * @param context Parser context that will be passed on by the wsdl parser
   1.146 +     * @param parent  The Parent element within which the extensibility element is defined
   1.147 +     * @param e       The extensibility elemenet
   1.148 +     * @return false if there was some error during the extension handling otherwise returns true. If returned false
   1.149 +     *         then the WSDL parser can abort if the wsdl extensibility element had <code>required</code> attribute set to true
   1.150 +     */
   1.151 +    public boolean handleOperationExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
   1.152 +        return false;
   1.153 +    }
   1.154 +
   1.155 +    /**
   1.156 +     * Callback for <code>wsdl:input</code>
   1.157 +     *
   1.158 +     * @param context Parser context that will be passed on by the wsdl parser
   1.159 +     * @param parent  The Parent element within which the extensibility element is defined
   1.160 +     * @param e       The extensibility elemenet
   1.161 +     * @return false if there was some error during the extension handling otherwise returns true. If returned false
   1.162 +     *         then the WSDL parser can abort if the wsdl extensibility element had <code>required</code> attribute set to true
   1.163 +     */
   1.164 +    public boolean handleInputExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
   1.165 +        return false;
   1.166 +    }
   1.167 +
   1.168 +    /**
   1.169 +     * Callback for <code>wsdl:output</code>
   1.170 +     *
   1.171 +     * @param context Parser context that will be passed on by the wsdl parser
   1.172 +     * @param parent  The Parent element within which the extensibility element is defined
   1.173 +     * @param e       The extensibility elemenet
   1.174 +     * @return false if there was some error during the extension handling otherwise returns true. If returned false
   1.175 +     *         then the WSDL parser can abort if the wsdl extensibility element had <code>required</code> attribute set to true
   1.176 +     */
   1.177 +    public boolean handleOutputExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
   1.178 +        return false;
   1.179 +    }
   1.180 +
   1.181 +    /**
   1.182 +     * Callback for <code>wsdl:fault</code>
   1.183 +     *
   1.184 +     * @param context Parser context that will be passed on by the wsdl parser
   1.185 +     * @param parent  The Parent element within which the extensibility element is defined
   1.186 +     * @param e       The extensibility elemenet
   1.187 +     * @return false if there was some error during the extension handling otherwise returns true. If returned false
   1.188 +     *         then the WSDL parser can abort if the wsdl extensibility element had <code>required</code> attribute set to true
   1.189 +     */
   1.190 +    public boolean handleFaultExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
   1.191 +        return false;
   1.192 +    }
   1.193 +
   1.194 +    /**
   1.195 +     * Callback for <code>wsdl:service</code>
   1.196 +     *
   1.197 +     * @param context Parser context that will be passed on by the wsdl parser
   1.198 +     * @param parent  The Parent element within which the extensibility element is defined
   1.199 +     * @param e       The extensibility elemenet
   1.200 +     * @return false if there was some error during the extension handling otherwise returns true. If returned false
   1.201 +     *         then the WSDL parser can abort if the wsdl extensibility element had <code>required</code> attribute set to true
   1.202 +     */
   1.203 +    public boolean handleServiceExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
   1.204 +        return false;
   1.205 +    }
   1.206 +
   1.207 +    /**
   1.208 +     * Callback for <code>wsdl:port</code>
   1.209 +     *
   1.210 +     * @param context Parser context that will be passed on by the wsdl parser
   1.211 +     * @param parent  The Parent element within which the extensibility element is defined
   1.212 +     * @param e       The extensibility elemenet
   1.213 +     * @return false if there was some error during the extension handling otherwise returns true. If returned false
   1.214 +     *         then the WSDL parser can abort if the wsdl extensibility element had <code>required</code> attribute set to true
   1.215 +     */
   1.216 +    public boolean handlePortExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
   1.217 +        return false;
   1.218 +    }
   1.219 +}

mercurial