Tue, 06 Mar 2012 16:09:35 -0800
7150322: Stop using drop source bundles in jaxws
Reviewed-by: darcy, ohrstrom
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 */
26 package com.sun.xml.internal.ws.db.glassfish;
28 import java.io.InputStream;
29 import java.io.OutputStream;
31 import javax.xml.bind.JAXBException;
32 import javax.xml.bind.Marshaller;
33 import javax.xml.bind.Unmarshaller;
34 import javax.xml.bind.attachment.AttachmentMarshaller;
35 import javax.xml.bind.attachment.AttachmentUnmarshaller;
36 import javax.xml.namespace.NamespaceContext;
37 import javax.xml.stream.XMLStreamReader;
38 import javax.xml.stream.XMLStreamWriter;
39 import javax.xml.transform.Result;
40 import javax.xml.transform.Source;
42 import org.w3c.dom.Node;
43 import org.xml.sax.ContentHandler;
45 import com.sun.xml.internal.bind.api.JAXBRIContext;
46 import com.sun.xml.internal.ws.spi.db.BindingContext;
47 import com.sun.xml.internal.ws.spi.db.XMLBridge;
48 import com.sun.xml.internal.ws.spi.db.DatabindingException;
49 import com.sun.xml.internal.ws.spi.db.TypeInfo;
51 public class BridgeWrapper<T> implements XMLBridge<T> {
53 private JAXBRIContextWrapper parent;
54 private com.sun.xml.internal.bind.api.Bridge<T> bridge;
56 public BridgeWrapper(JAXBRIContextWrapper p, com.sun.xml.internal.bind.api.Bridge<T> b) {
57 parent = p;
58 bridge = b;
59 }
61 public BindingContext context() {
62 return parent;
63 }
65 com.sun.xml.internal.bind.api.Bridge getBridge() {
66 return bridge;
67 }
69 public boolean equals(Object obj) {
70 return bridge.equals(obj);
71 }
73 public JAXBRIContext getContext() {
74 return bridge.getContext();
75 }
77 public TypeInfo getTypeInfo() {
78 return parent.typeInfo(bridge.getTypeReference());
79 }
81 public int hashCode() {
82 return bridge.hashCode();
83 }
85 // public final void marshal(BridgeContext context, T object, ContentHandler contentHandler) throws JAXBException {
86 // bridge.marshal(context, object, contentHandler);
87 // }
88 //
89 // public final void marshal(BridgeContext context, T object, Node output) throws JAXBException {
90 // bridge.marshal(context, object, output);
91 // }
92 //
93 // public final void marshal(BridgeContext context, T object, OutputStream output, NamespaceContext nsContext) throws JAXBException {
94 // bridge.marshal(context, object, output, nsContext);
95 // }
96 //
97 // public final void marshal(BridgeContext context, T object, Result result) throws JAXBException {
98 // bridge.marshal(context, object, result);
99 // }
100 //
101 // public final void marshal(BridgeContext context, T object, XMLStreamWriter output) throws JAXBException {
102 // bridge.marshal(context, object, output);
103 // }
105 public void marshal(Marshaller m, T object, ContentHandler contentHandler) throws JAXBException {
106 bridge.marshal(m, object, contentHandler);
107 }
109 public void marshal(Marshaller m, T object, Node output) throws JAXBException {
110 bridge.marshal(m, object, output);
111 }
113 public void marshal(Marshaller m, T object, OutputStream output, NamespaceContext nsContext) throws JAXBException {
114 bridge.marshal(m, object, output, nsContext);
115 }
117 public void marshal(Marshaller m, T object, Result result) throws JAXBException {
118 bridge.marshal(m, object, result);
119 }
121 public void marshal(Marshaller m, T object, XMLStreamWriter output) throws JAXBException {
122 bridge.marshal(m, object, output);
123 // bridge.marshal(m, (T) convert(object), output);
124 }
126 public final void marshal(T object, ContentHandler contentHandler, AttachmentMarshaller am) throws JAXBException {
127 // bridge.marshal((T) convert(object), contentHandler, am);
128 bridge.marshal(object, contentHandler, am);
129 }
131 // Object convert(Object o) {
132 // return (o instanceof WrapperComposite)? convertWrapper((WrapperComposite)o) : o;
133 // }
134 //
135 // static CompositeStructure convertWrapper(WrapperComposite w) {
136 // CompositeStructure cs = new CompositeStructure();
137 // cs.values = w.values;
138 // cs.bridges = new Bridge[w.bridges.length];
139 // for (int i = 0; i < cs.bridges.length; i++)
140 // cs.bridges[i] = ((BridgeWrapper)w.bridges[i]).getBridge();
141 // return cs;
142 // }
144 public void marshal(T object, ContentHandler contentHandler) throws JAXBException {
145 bridge.marshal(object, contentHandler);
146 // bridge.marshal((T) convert(object), contentHandler);
147 }
149 public void marshal(T object, Node output) throws JAXBException {
150 bridge.marshal(object, output);
151 // bridge.marshal((T) convert(object), output);
152 }
154 public void marshal(T object, OutputStream output, NamespaceContext nsContext, AttachmentMarshaller am) throws JAXBException {
155 // bridge.marshal((T) convert(object), output, nsContext, am);
156 bridge.marshal(object, output, nsContext, am);
157 }
159 public void marshal(T object, OutputStream output, NamespaceContext nsContext) throws JAXBException {
160 bridge.marshal(object, output, nsContext);
161 // bridge.marshal((T) convert(object), output, nsContext);
162 }
164 public final void marshal(T object, Result result) throws JAXBException {
165 bridge.marshal(object, result);
166 }
168 public final void marshal(T object, XMLStreamWriter output,
169 AttachmentMarshaller am) throws JAXBException {
170 bridge.marshal(object, output, am);
171 }
173 public final void marshal(T object, XMLStreamWriter output)
174 throws JAXBException {
175 bridge.marshal(object, output);
176 }
178 public String toString() {
179 return BridgeWrapper.class.getName() + " : " + bridge.toString();
180 }
182 // public final T unmarshal(BridgeContext context, InputStream in)
183 // throws JAXBException {
184 // return bridge.unmarshal(context, in);
185 // }
186 //
187 // public final T unmarshal(BridgeContext context, Node n)
188 // throws JAXBException {
189 // return bridge.unmarshal(context, n);
190 // }
191 //
192 // public final T unmarshal(BridgeContext context, Source in)
193 // throws JAXBException {
194 // return bridge.unmarshal(context, in);
195 // }
196 //
197 // public final T unmarshal(BridgeContext context, XMLStreamReader in)
198 // throws JAXBException {
199 // return bridge.unmarshal(context, in);
200 // }
202 public final T unmarshal(InputStream in) throws JAXBException {
203 return bridge.unmarshal(in);
204 }
206 public final T unmarshal(Node n, AttachmentUnmarshaller au)
207 throws JAXBException {
208 return bridge.unmarshal(n, au);
209 }
211 public final T unmarshal(Node n) throws JAXBException {
212 return bridge.unmarshal(n);
213 }
215 public final T unmarshal(Source in, AttachmentUnmarshaller au)
216 throws JAXBException {
217 return bridge.unmarshal(in, au);
218 }
220 public final T unmarshal(Source in) throws DatabindingException {
221 try {
222 return bridge.unmarshal(in);
223 } catch (JAXBException e) {
224 throw new DatabindingException(e);
225 }
226 }
228 public T unmarshal(Unmarshaller u, InputStream in) throws JAXBException {
229 return bridge.unmarshal(u, in);
230 }
232 public T unmarshal(Unmarshaller context, Node n) throws JAXBException {
233 return bridge.unmarshal(context, n);
234 }
236 public T unmarshal(Unmarshaller u, Source in) throws JAXBException {
237 return bridge.unmarshal(u, in);
238 }
240 public T unmarshal(Unmarshaller u, XMLStreamReader in) throws JAXBException {
241 return bridge.unmarshal(u, in);
242 }
244 public final T unmarshal(XMLStreamReader in, AttachmentUnmarshaller au)
245 throws JAXBException {
246 return bridge.unmarshal(in, au);
247 }
249 public final T unmarshal(XMLStreamReader in) throws JAXBException {
250 return bridge.unmarshal(in);
251 }
253 public boolean supportOutputStream() {
254 return true;
255 }
256 }