|
1 /* |
|
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 * |
|
5 * This code is free software; you can redistribute it and/or modify it |
|
6 * under the terms of the GNU General Public License version 2 only, as |
|
7 * published by the Free Software Foundation. Oracle designates this |
|
8 * particular file as subject to the "Classpath" exception as provided |
|
9 * by Oracle in the LICENSE file that accompanied this code. |
|
10 * |
|
11 * This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 * version 2 for more details (a copy is included in the LICENSE file that |
|
15 * accompanied this code). |
|
16 * |
|
17 * You should have received a copy of the GNU General Public License version |
|
18 * 2 along with this work; if not, write to the Free Software Foundation, |
|
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 * |
|
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 * or visit www.oracle.com if you need additional information or have any |
|
23 * questions. |
|
24 */ |
|
25 |
|
26 package com.sun.xml.internal.ws.wsdl.writer; |
|
27 |
|
28 import com.sun.istack.internal.NotNull; |
|
29 import com.sun.xml.internal.txw2.TypedXmlWriter; |
|
30 import com.sun.xml.internal.ws.api.model.CheckedException; |
|
31 import com.sun.xml.internal.ws.api.model.JavaMethod; |
|
32 import com.sun.xml.internal.ws.api.wsdl.writer.WSDLGenExtnContext; |
|
33 import com.sun.xml.internal.ws.api.wsdl.writer.WSDLGeneratorExtension; |
|
34 |
|
35 /** |
|
36 * {@link WSDLGeneratorExtension} that delegates to |
|
37 * multiple {@link WSDLGeneratorExtension}s. |
|
38 * |
|
39 * <p> |
|
40 * This simplifies {@link WSDLGenerator} since it now |
|
41 * only needs to work with one {@link WSDLGeneratorExtension}. |
|
42 * |
|
43 * |
|
44 * @author Doug Kohlert |
|
45 */ |
|
46 final class WSDLGeneratorExtensionFacade extends WSDLGeneratorExtension { |
|
47 private final WSDLGeneratorExtension[] extensions; |
|
48 |
|
49 WSDLGeneratorExtensionFacade(WSDLGeneratorExtension... extensions) { |
|
50 assert extensions!=null; |
|
51 this.extensions = extensions; |
|
52 } |
|
53 |
|
54 public void start(WSDLGenExtnContext ctxt) { |
|
55 for (WSDLGeneratorExtension e : extensions) |
|
56 e.start(ctxt); |
|
57 } |
|
58 |
|
59 public void end(@NotNull WSDLGenExtnContext ctxt) { |
|
60 for (WSDLGeneratorExtension e : extensions) |
|
61 e.end(ctxt); |
|
62 } |
|
63 |
|
64 public void addDefinitionsExtension(TypedXmlWriter definitions) { |
|
65 for (WSDLGeneratorExtension e : extensions) |
|
66 e.addDefinitionsExtension(definitions); |
|
67 } |
|
68 |
|
69 public void addServiceExtension(TypedXmlWriter service) { |
|
70 for (WSDLGeneratorExtension e : extensions) |
|
71 e.addServiceExtension(service); |
|
72 } |
|
73 |
|
74 public void addPortExtension(TypedXmlWriter port) { |
|
75 for (WSDLGeneratorExtension e : extensions) |
|
76 e.addPortExtension(port); |
|
77 } |
|
78 |
|
79 public void addPortTypeExtension(TypedXmlWriter portType) { |
|
80 for (WSDLGeneratorExtension e : extensions) |
|
81 e.addPortTypeExtension(portType); |
|
82 } |
|
83 |
|
84 public void addBindingExtension(TypedXmlWriter binding) { |
|
85 for (WSDLGeneratorExtension e : extensions) |
|
86 e.addBindingExtension(binding); |
|
87 } |
|
88 |
|
89 public void addOperationExtension(TypedXmlWriter operation, JavaMethod method) { |
|
90 for (WSDLGeneratorExtension e : extensions) |
|
91 e.addOperationExtension(operation, method); |
|
92 } |
|
93 |
|
94 public void addBindingOperationExtension(TypedXmlWriter operation, JavaMethod method) { |
|
95 for (WSDLGeneratorExtension e : extensions) |
|
96 e.addBindingOperationExtension(operation, method); |
|
97 } |
|
98 |
|
99 public void addInputMessageExtension(TypedXmlWriter message, JavaMethod method) { |
|
100 for (WSDLGeneratorExtension e : extensions) |
|
101 e.addInputMessageExtension(message, method); |
|
102 } |
|
103 |
|
104 public void addOutputMessageExtension(TypedXmlWriter message, JavaMethod method) { |
|
105 for (WSDLGeneratorExtension e : extensions) |
|
106 e.addOutputMessageExtension(message, method); |
|
107 } |
|
108 |
|
109 public void addOperationInputExtension(TypedXmlWriter input, JavaMethod method) { |
|
110 for (WSDLGeneratorExtension e : extensions) |
|
111 e.addOperationInputExtension(input, method); |
|
112 } |
|
113 |
|
114 public void addOperationOutputExtension(TypedXmlWriter output, JavaMethod method) { |
|
115 for (WSDLGeneratorExtension e : extensions) |
|
116 e.addOperationOutputExtension(output, method); |
|
117 } |
|
118 |
|
119 public void addBindingOperationInputExtension(TypedXmlWriter input, JavaMethod method) { |
|
120 for (WSDLGeneratorExtension e : extensions) |
|
121 e.addBindingOperationInputExtension(input, method); |
|
122 } |
|
123 |
|
124 public void addBindingOperationOutputExtension(TypedXmlWriter output, JavaMethod method) { |
|
125 for (WSDLGeneratorExtension e : extensions) |
|
126 e.addBindingOperationOutputExtension(output, method); |
|
127 } |
|
128 |
|
129 public void addBindingOperationFaultExtension(TypedXmlWriter fault, JavaMethod method, CheckedException ce) { |
|
130 for (WSDLGeneratorExtension e : extensions) |
|
131 e.addBindingOperationFaultExtension(fault, method, ce); |
|
132 } |
|
133 |
|
134 public void addFaultMessageExtension(TypedXmlWriter message, JavaMethod method, CheckedException ce) { |
|
135 for (WSDLGeneratorExtension e : extensions) |
|
136 e.addFaultMessageExtension(message, method, ce); |
|
137 } |
|
138 |
|
139 public void addOperationFaultExtension(TypedXmlWriter fault, JavaMethod method, CheckedException ce) { |
|
140 for (WSDLGeneratorExtension e : extensions) |
|
141 e.addOperationFaultExtension(fault, method, ce); |
|
142 } |
|
143 } |