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:
037: package com.sun.xml.ws.wsdl.writer;
038:
039: import com.sun.istack.NotNull;
040: import com.sun.xml.txw2.TypedXmlWriter;
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.wsdl.writer.WSDLGenExtnContext;
044: import com.sun.xml.ws.api.wsdl.writer.WSDLGeneratorExtension;
045:
046: /**
047: * {@link WSDLGeneratorExtension} that delegates to
048: * multiple {@link WSDLGeneratorExtension}s.
049: *
050: * <p>
051: * This simplifies {@link WSDLGenerator} since it now
052: * only needs to work with one {@link WSDLGeneratorExtension}.
053: *
054: *
055: * @author Doug Kohlert
056: */
057: final class WSDLGeneratorExtensionFacade extends WSDLGeneratorExtension {
058: private final WSDLGeneratorExtension[] extensions;
059:
060: WSDLGeneratorExtensionFacade(WSDLGeneratorExtension... extensions) {
061: assert extensions != null;
062: this .extensions = extensions;
063: }
064:
065: public void start(WSDLGenExtnContext ctxt) {
066: for (WSDLGeneratorExtension e : extensions)
067: e.start(ctxt);
068: }
069:
070: public void end(@NotNull
071: WSDLGenExtnContext ctxt) {
072: for (WSDLGeneratorExtension e : extensions)
073: e.end(ctxt);
074: }
075:
076: public void addDefinitionsExtension(TypedXmlWriter definitions) {
077: for (WSDLGeneratorExtension e : extensions)
078: e.addDefinitionsExtension(definitions);
079: }
080:
081: public void addServiceExtension(TypedXmlWriter service) {
082: for (WSDLGeneratorExtension e : extensions)
083: e.addServiceExtension(service);
084: }
085:
086: public void addPortExtension(TypedXmlWriter port) {
087: for (WSDLGeneratorExtension e : extensions)
088: e.addPortExtension(port);
089: }
090:
091: public void addPortTypeExtension(TypedXmlWriter portType) {
092: for (WSDLGeneratorExtension e : extensions)
093: e.addPortTypeExtension(portType);
094: }
095:
096: public void addBindingExtension(TypedXmlWriter binding) {
097: for (WSDLGeneratorExtension e : extensions)
098: e.addBindingExtension(binding);
099: }
100:
101: public void addOperationExtension(TypedXmlWriter operation,
102: JavaMethod method) {
103: for (WSDLGeneratorExtension e : extensions)
104: e.addOperationExtension(operation, method);
105: }
106:
107: public void addBindingOperationExtension(TypedXmlWriter operation,
108: JavaMethod method) {
109: for (WSDLGeneratorExtension e : extensions)
110: e.addBindingOperationExtension(operation, method);
111: }
112:
113: public void addInputMessageExtension(TypedXmlWriter message,
114: JavaMethod method) {
115: for (WSDLGeneratorExtension e : extensions)
116: e.addInputMessageExtension(message, method);
117: }
118:
119: public void addOutputMessageExtension(TypedXmlWriter message,
120: JavaMethod method) {
121: for (WSDLGeneratorExtension e : extensions)
122: e.addOutputMessageExtension(message, method);
123: }
124:
125: public void addOperationInputExtension(TypedXmlWriter input,
126: JavaMethod method) {
127: for (WSDLGeneratorExtension e : extensions)
128: e.addOperationInputExtension(input, method);
129: }
130:
131: public void addOperationOutputExtension(TypedXmlWriter output,
132: JavaMethod method) {
133: for (WSDLGeneratorExtension e : extensions)
134: e.addOperationOutputExtension(output, method);
135: }
136:
137: public void addBindingOperationInputExtension(TypedXmlWriter input,
138: JavaMethod method) {
139: for (WSDLGeneratorExtension e : extensions)
140: e.addBindingOperationInputExtension(input, method);
141: }
142:
143: public void addBindingOperationOutputExtension(
144: TypedXmlWriter output, JavaMethod method) {
145: for (WSDLGeneratorExtension e : extensions)
146: e.addBindingOperationOutputExtension(output, method);
147: }
148:
149: public void addBindingOperationFaultExtension(TypedXmlWriter fault,
150: JavaMethod method, CheckedException ce) {
151: for (WSDLGeneratorExtension e : extensions)
152: e.addBindingOperationFaultExtension(fault, method, ce);
153: }
154:
155: public void addFaultMessageExtension(TypedXmlWriter message,
156: JavaMethod method, CheckedException ce) {
157: for (WSDLGeneratorExtension e : extensions)
158: e.addFaultMessageExtension(message, method, ce);
159: }
160:
161: public void addOperationFaultExtension(TypedXmlWriter fault,
162: JavaMethod method, CheckedException ce) {
163: for (WSDLGeneratorExtension e : extensions)
164: e.addOperationFaultExtension(fault, method, ce);
165: }
166: }
|