1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/api/wsdl/writer/WSDLGeneratorExtension.java Tue Mar 06 16:09:35 2012 -0800 1.3 @@ -0,0 +1,271 @@ 1.4 +/* 1.5 + * Copyright (c) 1997, 2010, 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.xml.internal.ws.api.wsdl.writer; 1.30 + 1.31 +import com.sun.istack.internal.NotNull; 1.32 +import com.sun.xml.internal.txw2.TypedXmlWriter; 1.33 +import com.sun.xml.internal.ws.api.WSBinding; 1.34 +import com.sun.xml.internal.ws.api.model.CheckedException; 1.35 +import com.sun.xml.internal.ws.api.model.JavaMethod; 1.36 +import com.sun.xml.internal.ws.api.model.SEIModel; 1.37 +import com.sun.xml.internal.ws.api.server.Container; 1.38 +import com.sun.xml.internal.ws.api.server.WSEndpoint; 1.39 + 1.40 +/** 1.41 + * This is a callback interface used to extend the WSDLGenerator. Implementors 1.42 + * of this interface can add their own WSDL extensions to the generated WSDL. 1.43 + * There are a number of methods that will be invoked allowing the extensions 1.44 + * to be generated on various WSDL elements. 1.45 + * <p/> 1.46 + * The JAX-WS WSDLGenerator uses TXW to serialize the WSDL out to XML. 1.47 + * More information about TXW can be located at 1.48 + * <a href="http://txw.dev.java.net">http://txw.dev.java.net</a>. 1.49 + */ 1.50 +public abstract class WSDLGeneratorExtension { 1.51 + /** 1.52 + * Called at the very beginning of the process. 1.53 + * <p/> 1.54 + * This method is invoked so that the root element can be manipulated before 1.55 + * any tags have been written. This allows to set e.g. namespace prefixes. 1.56 + * <p/> 1.57 + * Another purpose of this method is to let extensions know what model 1.58 + * we are generating a WSDL for. 1.59 + * 1.60 + * @param root This is the root element of the generated WSDL. 1.61 + * @param model WSDL is being generated from this {@link SEIModel}. 1.62 + * @param binding The binding for which we generate WSDL. the binding {@link WSBinding} represents a particular 1.63 + * configuration of JAXWS. This can be typically be overriden by 1.64 + * @param container The entry point to the external environment. 1.65 + * If this extension is used at the runtime to generate WSDL, you get a {@link Container} 1.66 + * that was given to {@link WSEndpoint#create}. 1.67 + * TODO: think about tool side 1.68 + * @deprecated 1.69 + */ 1.70 + public void start(@NotNull TypedXmlWriter root, @NotNull SEIModel model, @NotNull WSBinding binding, @NotNull Container container) { 1.71 + } 1.72 + 1.73 + /** 1.74 + * Called before writing </wsdl:defintions>. 1.75 + * 1.76 + * @param ctxt 1.77 + */ 1.78 + public void end(@NotNull WSDLGenExtnContext ctxt) { 1.79 + } 1.80 + 1.81 + /** 1.82 + * Called at the very beginning of the process. 1.83 + * <p/> 1.84 + * This method is invoked so that the root element can be manipulated before 1.85 + * any tags have been written. This allows to set e.g. namespace prefixes. 1.86 + * <p/> 1.87 + * Another purpose of this method is to let extensions know what model 1.88 + * we are generating a WSDL for. 1.89 + * 1.90 + * @param ctxt Provides the context for the generator extensions 1.91 + */ 1.92 + public void start(WSDLGenExtnContext ctxt) { 1.93 + } 1.94 + 1.95 + /** 1.96 + * This method is invoked so that extensions to a <code>wsdl:definitions</code> 1.97 + * element can be generated. 1.98 + * 1.99 + * @param definitions This is the <code>wsdl:defintions</code> element that the extension can be added to. 1.100 + */ 1.101 + public void addDefinitionsExtension(TypedXmlWriter definitions) { 1.102 + } 1.103 + 1.104 + /** 1.105 + * This method is invoked so that extensions to a <code>wsdl:service</code> 1.106 + * element can be generated. 1.107 + * 1.108 + * @param service This is the <code>wsdl:service</code> element that the extension can be added to. 1.109 + */ 1.110 + public void addServiceExtension(TypedXmlWriter service) { 1.111 + } 1.112 + 1.113 + /** 1.114 + * This method is invoked so that extensions to a <code>wsdl:port</code> 1.115 + * element can be generated. 1.116 + * 1.117 + * @param port This is the wsdl:port element that the extension can be added to. 1.118 + */ 1.119 + public void addPortExtension(TypedXmlWriter port) { 1.120 + } 1.121 + 1.122 + /** 1.123 + * This method is invoked so that extensions to a <code>wsdl:portType</code> 1.124 + * element can be generated. 1.125 + * <p/> 1.126 + * 1.127 + * @param portType This is the wsdl:portType element that the extension can be added to. 1.128 + */ 1.129 + public void addPortTypeExtension(TypedXmlWriter portType) { 1.130 + } 1.131 + 1.132 + /** 1.133 + * This method is invoked so that extensions to a <code>wsdl:binding</code> 1.134 + * element can be generated. 1.135 + * <p/> 1.136 + * <p/> 1.137 + * TODO: Some other information may need to be passed 1.138 + * 1.139 + * @param binding This is the wsdl:binding element that the extension can be added to. 1.140 + */ 1.141 + public void addBindingExtension(TypedXmlWriter binding) { 1.142 + } 1.143 + 1.144 + /** 1.145 + * This method is invoked so that extensions to a <code>wsdl:portType/wsdl:operation</code> 1.146 + * element can be generated. 1.147 + * 1.148 + * @param operation This is the wsdl:portType/wsdl:operation element that the 1.149 + * extension can be added to. 1.150 + * @param method {@link JavaMethod} which captures all the information to generate wsdl:portType/wsdl:operation 1.151 + */ 1.152 + public void addOperationExtension(TypedXmlWriter operation, JavaMethod method) { 1.153 + } 1.154 + 1.155 + 1.156 + /** 1.157 + * This method is invoked so that extensions to a <code>wsdl:binding/wsdl:operation</code> 1.158 + * element can be generated. 1.159 + * 1.160 + * @param operation This is the wsdl:binding/wsdl:operation element that the 1.161 + * extension can be added to. 1.162 + * @param method {@link JavaMethod} which captures all the information to generate wsdl:portType/wsdl:operation 1.163 + */ 1.164 + public void addBindingOperationExtension(TypedXmlWriter operation, JavaMethod method) { 1.165 + } 1.166 + 1.167 + /** 1.168 + * This method is invoked so that extensions to an input <code>wsdl:message</code> 1.169 + * element can be generated. 1.170 + * 1.171 + * @param message This is the input wsdl:message element that the 1.172 + * extension can be added to. 1.173 + * @param method {@link JavaMethod} which captures all the information to generate wsdl:portType/wsdl:operation 1.174 + */ 1.175 + public void addInputMessageExtension(TypedXmlWriter message, JavaMethod method) { 1.176 + } 1.177 + 1.178 + /** 1.179 + * This method is invoked so that extensions to an output <code>wsdl:message</code> 1.180 + * element can be generated. 1.181 + * 1.182 + * @param message This is the output wsdl:message element that the 1.183 + * extension can be added to. 1.184 + * @param method {@link JavaMethod} which captures all the information to generate wsdl:portType/wsdl:operation 1.185 + */ 1.186 + public void addOutputMessageExtension(TypedXmlWriter message, JavaMethod method) { 1.187 + } 1.188 + 1.189 + 1.190 + /** 1.191 + * This method is invoked so that extensions to a 1.192 + * <code>wsdl:portType/wsdl:operation/wsdl:input</code> 1.193 + * element can be generated. 1.194 + * 1.195 + * @param input This is the wsdl:portType/wsdl:operation/wsdl:input element that the 1.196 + * extension can be added to. 1.197 + * @param method {@link JavaMethod} which captures all the information to generate wsdl:portType/wsdl:operation 1.198 + */ 1.199 + public void addOperationInputExtension(TypedXmlWriter input, JavaMethod method) { 1.200 + } 1.201 + 1.202 + 1.203 + /** 1.204 + * This method is invoked so that extensions to a <code>wsdl:portType/wsdl:operation/wsdl:output</code> 1.205 + * element can be generated. 1.206 + * 1.207 + * @param output This is the wsdl:portType/wsdl:operation/wsdl:output element that the 1.208 + * extension can be added to. 1.209 + * @param method {@link JavaMethod} which captures all the information to generate wsdl:portType/wsdl:operation 1.210 + */ 1.211 + public void addOperationOutputExtension(TypedXmlWriter output, JavaMethod method) { 1.212 + } 1.213 + 1.214 + /** 1.215 + * This method is invoked so that extensions to a 1.216 + * <code>wsdl:binding/wsdl:operation/wsdl:input</code> 1.217 + * element can be generated. 1.218 + * 1.219 + * @param input This is the wsdl:binding/wsdl:operation/wsdl:input element that the 1.220 + * extension can be added to. 1.221 + * @param method {@link JavaMethod} which captures all the information to generate wsdl:portType/wsdl:operation 1.222 + */ 1.223 + public void addBindingOperationInputExtension(TypedXmlWriter input, JavaMethod method) { 1.224 + } 1.225 + 1.226 + 1.227 + /** 1.228 + * This method is invoked so that extensions to a <code>wsdl:binding/wsdl:operation/wsdl:output</code> 1.229 + * element can be generated. 1.230 + * 1.231 + * @param output This is the wsdl:binding/wsdl:operation/wsdl:output element that the 1.232 + * extension can be added to. 1.233 + * @param method {@link JavaMethod} which captures all the information to generate wsdl:portType/wsdl:operation 1.234 + */ 1.235 + public void addBindingOperationOutputExtension(TypedXmlWriter output, JavaMethod method) { 1.236 + } 1.237 + 1.238 + /** 1.239 + * This method is invoked so that extensions to a <code>wsdl:binding/wsdl:operation/wsdl:fault</code> 1.240 + * element can be generated. 1.241 + * 1.242 + * @param fault This is the wsdl:binding/wsdl:operation/wsdl:fault or wsdl:portType/wsdl:output/wsdl:operation/wsdl:fault 1.243 + * element that the extension can be added to. 1.244 + * @param method {@link JavaMethod} which captures all the information to generate wsdl:portType/wsdl:operation 1.245 + */ 1.246 + public void addBindingOperationFaultExtension(TypedXmlWriter fault, JavaMethod method, CheckedException ce) { 1.247 + } 1.248 + 1.249 + /** 1.250 + * This method is invoked so that extensions to a <code>wsdl:portType/wsdl:operation/wsdl:fault</code> 1.251 + * element can be generated. 1.252 + * 1.253 + * @param message This is the fault wsdl:message element that the 1.254 + * extension can be added to. 1.255 + * @param method {@link JavaMethod} which captures all the information to generate wsdl:portType/wsdl:operation 1.256 + * 1.257 + * @param ce {@link CheckedException} that abstracts wsdl:fault 1.258 + */ 1.259 + public void addFaultMessageExtension(TypedXmlWriter message, JavaMethod method, CheckedException ce) { 1.260 + } 1.261 + 1.262 + /** 1.263 + * This method is invoked so that extensions to a <code>wsdl:portType/wsdl:operation/wsdl:fault</code> 1.264 + * element can be generated. 1.265 + * 1.266 + * @param fault This is the wsdl:portType/wsdl:operation/wsdl:fault element that the 1.267 + * extension can be added to. 1.268 + * @param method {@link JavaMethod} which captures all the information to generate wsdl:portType/wsdl:operation 1.269 + * @param ce {@link CheckedException} that abstracts wsdl:fault 1.270 + */ 1.271 + public void addOperationFaultExtension(TypedXmlWriter fault, JavaMethod method, CheckedException ce) { 1.272 + } 1.273 + 1.274 +}