001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common Development
008: * and Distribution License("CDDL") (collectively, the "License"). You
009: * may not use this file except in compliance with the License. You can obtain
010: * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
011: * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
012: * language governing permissions and limitations under the License.
013: *
014: * When distributing the software, include this License Header Notice in each
015: * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
016: * Sun designates this particular file as subject to the "Classpath" exception
017: * as provided by Sun in the GPL Version 2 section of the License file that
018: * accompanied this code. If applicable, add the following below the License
019: * Header, with the fields enclosed by brackets [] replaced by your own
020: * identifying information: "Portions Copyrighted [year]
021: * [name of copyright owner]"
022: *
023: * Contributor(s):
024: *
025: * If you wish your version of this file to be governed by only the CDDL or
026: * only the GPL Version 2, indicate your decision by adding "[Contributor]
027: * elects to include this software in this distribution under the [CDDL or GPL
028: * Version 2] license." If you don't indicate a single choice of license, a
029: * recipient has the option to distribute your version of this file under
030: * either the CDDL, the GPL Version 2 or to extend the choice of license to
031: * its licensees as provided above. However, if you add GPL Version 2 code
032: * and therefore, elected the GPL Version 2 license, then the option applies
033: * only if the new code is made subject to such option by the copyright
034: * holder.
035: */
036: package com.sun.xml.ws.api.wsdl.writer;
037:
038: import com.sun.istack.NotNull;
039: import com.sun.xml.txw2.TypedXmlWriter;
040: import com.sun.xml.ws.api.WSBinding;
041: import com.sun.xml.ws.api.model.CheckedException;
042: import com.sun.xml.ws.api.model.JavaMethod;
043: import com.sun.xml.ws.api.model.SEIModel;
044: import com.sun.xml.ws.api.server.Container;
045: import com.sun.xml.ws.api.server.WSEndpoint;
046:
047: /**
048: * This is a callback interface used to extend the WSDLGenerator. Implementors
049: * of this interface can add their own WSDL extensions to the generated WSDL.
050: * There are a number of methods that will be invoked allowing the extensions
051: * to be generated on various WSDL elements.
052: * <p/>
053: * The JAX-WS WSDLGenerator uses TXW to serialize the WSDL out to XML.
054: * More information about TXW can be located at
055: * <a href="http://txw.dev.java.net">http://txw.dev.java.net</a>.
056: */
057: public abstract class WSDLGeneratorExtension {
058: /**
059: * Called at the very beginning of the process.
060: * <p/>
061: * This method is invoked so that the root element can be manipulated before
062: * any tags have been written. This allows to set e.g. namespace prefixes.
063: * <p/>
064: * Another purpose of this method is to let extensions know what model
065: * we are generating a WSDL for.
066: *
067: * @param root This is the root element of the generated WSDL.
068: * @param model WSDL is being generated from this {@link SEIModel}.
069: * @param binding The binding for which we generate WSDL. the binding {@link WSBinding} represents a particular
070: * configuration of JAXWS. This can be typically be overriden by
071: * @param container The entry point to the external environment.
072: * If this extension is used at the runtime to generate WSDL, you get a {@link Container}
073: * that was given to {@link WSEndpoint#create}.
074: * TODO: think about tool side
075: * @deprecated
076: */
077: public void start(@NotNull
078: TypedXmlWriter root, @NotNull
079: SEIModel model, @NotNull
080: WSBinding binding, @NotNull
081: Container container) {
082: }
083:
084: /**
085: * Called before writing </wsdl:defintions>.
086: *
087: * @param ctxt
088: */
089: public void end(@NotNull
090: WSDLGenExtnContext ctxt) {
091: }
092:
093: /**
094: * Called at the very beginning of the process.
095: * <p/>
096: * This method is invoked so that the root element can be manipulated before
097: * any tags have been written. This allows to set e.g. namespace prefixes.
098: * <p/>
099: * Another purpose of this method is to let extensions know what model
100: * we are generating a WSDL for.
101: *
102: * @param ctxt Provides the context for the generator extensions
103: */
104: public void start(WSDLGenExtnContext ctxt) {
105: }
106:
107: /**
108: * This method is invoked so that extensions to a <code>wsdl:definitions</code>
109: * element can be generated.
110: *
111: * @param definitions This is the <code>wsdl:defintions</code> element that the extension can be added to.
112: */
113: public void addDefinitionsExtension(TypedXmlWriter definitions) {
114: }
115:
116: /**
117: * This method is invoked so that extensions to a <code>wsdl:service</code>
118: * element can be generated.
119: *
120: * @param service This is the <code>wsdl:service</code> element that the extension can be added to.
121: */
122: public void addServiceExtension(TypedXmlWriter service) {
123: }
124:
125: /**
126: * This method is invoked so that extensions to a <code>wsdl:port</code>
127: * element can be generated.
128: *
129: * @param port This is the wsdl:port element that the extension can be added to.
130: */
131: public void addPortExtension(TypedXmlWriter port) {
132: }
133:
134: /**
135: * This method is invoked so that extensions to a <code>wsdl:portType</code>
136: * element can be generated.
137: * <p/>
138: *
139: * @param portType This is the wsdl:portType element that the extension can be added to.
140: */
141: public void addPortTypeExtension(TypedXmlWriter portType) {
142: }
143:
144: /**
145: * This method is invoked so that extensions to a <code>wsdl:binding</code>
146: * element can be generated.
147: * <p/>
148: * <p/>
149: * TODO: Some other information may need to be passed
150: *
151: * @param binding This is the wsdl:binding element that the extension can be added to.
152: */
153: public void addBindingExtension(TypedXmlWriter binding) {
154: }
155:
156: /**
157: * This method is invoked so that extensions to a <code>wsdl:portType/wsdl:operation</code>
158: * element can be generated.
159: *
160: * @param operation This is the wsdl:portType/wsdl:operation element that the
161: * extension can be added to.
162: * @param method {@link JavaMethod} which captures all the information to generate wsdl:portType/wsdl:operation
163: */
164: public void addOperationExtension(TypedXmlWriter operation,
165: JavaMethod method) {
166: }
167:
168: /**
169: * This method is invoked so that extensions to a <code>wsdl:binding/wsdl:operation</code>
170: * element can be generated.
171: *
172: * @param operation This is the wsdl:binding/wsdl:operation element that the
173: * extension can be added to.
174: * @param method {@link JavaMethod} which captures all the information to generate wsdl:portType/wsdl:operation
175: */
176: public void addBindingOperationExtension(TypedXmlWriter operation,
177: JavaMethod method) {
178: }
179:
180: /**
181: * This method is invoked so that extensions to an input <code>wsdl:message</code>
182: * element can be generated.
183: *
184: * @param message This is the input wsdl:message element that the
185: * extension can be added to.
186: * @param method {@link JavaMethod} which captures all the information to generate wsdl:portType/wsdl:operation
187: */
188: public void addInputMessageExtension(TypedXmlWriter message,
189: JavaMethod method) {
190: }
191:
192: /**
193: * This method is invoked so that extensions to an output <code>wsdl:message</code>
194: * element can be generated.
195: *
196: * @param message This is the output wsdl:message element that the
197: * extension can be added to.
198: * @param method {@link JavaMethod} which captures all the information to generate wsdl:portType/wsdl:operation
199: */
200: public void addOutputMessageExtension(TypedXmlWriter message,
201: JavaMethod method) {
202: }
203:
204: /**
205: * This method is invoked so that extensions to a
206: * <code>wsdl:portType/wsdl:operation/wsdl:input</code>
207: * element can be generated.
208: *
209: * @param input This is the wsdl:portType/wsdl:operation/wsdl:input element that the
210: * extension can be added to.
211: * @param method {@link JavaMethod} which captures all the information to generate wsdl:portType/wsdl:operation
212: */
213: public void addOperationInputExtension(TypedXmlWriter input,
214: JavaMethod method) {
215: }
216:
217: /**
218: * This method is invoked so that extensions to a <code>wsdl:portType/wsdl:operation/wsdl:output</code>
219: * element can be generated.
220: *
221: * @param output This is the wsdl:portType/wsdl:operation/wsdl:output element that the
222: * extension can be added to.
223: * @param method {@link JavaMethod} which captures all the information to generate wsdl:portType/wsdl:operation
224: */
225: public void addOperationOutputExtension(TypedXmlWriter output,
226: JavaMethod method) {
227: }
228:
229: /**
230: * This method is invoked so that extensions to a
231: * <code>wsdl:binding/wsdl:operation/wsdl:input</code>
232: * element can be generated.
233: *
234: * @param input This is the wsdl:binding/wsdl:operation/wsdl:input element that the
235: * extension can be added to.
236: * @param method {@link JavaMethod} which captures all the information to generate wsdl:portType/wsdl:operation
237: */
238: public void addBindingOperationInputExtension(TypedXmlWriter input,
239: JavaMethod method) {
240: }
241:
242: /**
243: * This method is invoked so that extensions to a <code>wsdl:binding/wsdl:operation/wsdl:output</code>
244: * element can be generated.
245: *
246: * @param output This is the wsdl:binding/wsdl:operation/wsdl:output element that the
247: * extension can be added to.
248: * @param method {@link JavaMethod} which captures all the information to generate wsdl:portType/wsdl:operation
249: */
250: public void addBindingOperationOutputExtension(
251: TypedXmlWriter output, JavaMethod method) {
252: }
253:
254: /**
255: * This method is invoked so that extensions to a <code>wsdl:binding/wsdl:operation/wsdl:fault</code>
256: * element can be generated.
257: *
258: * @param fault This is the wsdl:binding/wsdl:operation/wsdl:fault or wsdl:portType/wsdl:output/wsdl:operation/wsdl:fault
259: * element that the extension can be added to.
260: * @param method {@link JavaMethod} which captures all the information to generate wsdl:portType/wsdl:operation
261: */
262: public void addBindingOperationFaultExtension(TypedXmlWriter fault,
263: JavaMethod method, CheckedException ce) {
264: }
265:
266: /**
267: * This method is invoked so that extensions to a <code>wsdl:portType/wsdl:operation/wsdl:fault</code>
268: * element can be generated.
269: *
270: * @param message This is the fault wsdl:message element that the
271: * extension can be added to.
272: * @param method {@link JavaMethod} which captures all the information to generate wsdl:portType/wsdl:operation
273: *
274: * @param ce {@link CheckedException} that abstracts wsdl:fault
275: */
276: public void addFaultMessageExtension(TypedXmlWriter message,
277: JavaMethod method, CheckedException ce) {
278: }
279:
280: /**
281: * This method is invoked so that extensions to a <code>wsdl:portType/wsdl:operation/wsdl:fault</code>
282: * element can be generated.
283: *
284: * @param fault This is the wsdl:portType/wsdl:operation/wsdl:fault element that the
285: * extension can be added to.
286: * @param method {@link JavaMethod} which captures all the information to generate wsdl:portType/wsdl:operation
287: * @param ce {@link CheckedException} that abstracts wsdl:fault
288: */
289: public void addOperationFaultExtension(TypedXmlWriter fault,
290: JavaMethod method, CheckedException ce) {
291: }
292:
293: }
|