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, 2011, 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.attachment.AttachmentMarshaller;
33 import javax.xml.bind.attachment.AttachmentUnmarshaller;
34 import javax.xml.namespace.NamespaceContext;
35 import javax.xml.stream.XMLStreamReader;
36 import javax.xml.stream.XMLStreamWriter;
37 import javax.xml.transform.Result;
38 import javax.xml.transform.Source;
40 import org.w3c.dom.Node;
41 import org.xml.sax.ContentHandler;
43 import com.sun.xml.internal.bind.api.Bridge;
44 import com.sun.xml.internal.bind.api.CompositeStructure;
45 import com.sun.xml.internal.ws.spi.db.BindingContext;
46 import com.sun.xml.internal.ws.spi.db.XMLBridge;
47 import com.sun.xml.internal.ws.spi.db.TypeInfo;
48 import com.sun.xml.internal.ws.spi.db.WrapperComposite;
50 public class WrapperBridge<T> implements XMLBridge<T> {
52 private JAXBRIContextWrapper parent;
53 private com.sun.xml.internal.bind.api.Bridge<T> bridge;
55 public WrapperBridge(JAXBRIContextWrapper p, com.sun.xml.internal.bind.api.Bridge<T> b) {
56 parent = p;
57 bridge = b;
58 }
60 public BindingContext context() {
61 return parent;
62 }
64 public boolean equals(Object obj) {
65 return bridge.equals(obj);
66 }
68 public TypeInfo getTypeInfo() {
69 return parent.typeInfo(bridge.getTypeReference());
70 }
72 public int hashCode() {
73 return bridge.hashCode();
74 }
76 static CompositeStructure convert(Object o) {
77 WrapperComposite w = (WrapperComposite) o;
78 CompositeStructure cs = new CompositeStructure();
79 cs.values = w.values;
80 cs.bridges = new Bridge[w.bridges.length];
81 for (int i = 0; i < cs.bridges.length; i++)
82 cs.bridges[i] = ((BridgeWrapper)w.bridges[i]).getBridge();
83 return cs;
84 }
86 public final void marshal(T object, ContentHandler contentHandler, AttachmentMarshaller am) throws JAXBException {
87 bridge.marshal((T) convert(object), contentHandler, am);
88 // bridge.marshal(object, contentHandler, am);
89 }
91 public void marshal(T object, Node output) throws JAXBException {
92 throw new UnsupportedOperationException();
93 // bridge.marshal(object, output);
94 // bridge.marshal((T) convert(object), output);
95 }
97 public void marshal(T object, OutputStream output, NamespaceContext nsContext, AttachmentMarshaller am) throws JAXBException {
98 bridge.marshal((T) convert(object), output, nsContext, am);
99 }
101 public final void marshal(T object, Result result) throws JAXBException {
102 throw new UnsupportedOperationException();
103 // bridge.marshal(object, result);
104 }
106 public final void marshal(T object, XMLStreamWriter output, AttachmentMarshaller am) throws JAXBException {
107 bridge.marshal((T) convert(object), output, am);
108 }
110 public String toString() {
111 return BridgeWrapper.class.getName() + " : " + bridge.toString();
112 }
114 public final T unmarshal(InputStream in) throws JAXBException {
115 //EndpointArgumentsBuilder.RpcLit.readRequest
116 throw new UnsupportedOperationException();
117 // return bridge.unmarshal(in);
118 }
120 public final T unmarshal(Node n, AttachmentUnmarshaller au) throws JAXBException {
121 //EndpointArgumentsBuilder.RpcLit.readRequest
122 throw new UnsupportedOperationException();
123 // return bridge.unmarshal(n, au);
124 }
126 public final T unmarshal(Source in, AttachmentUnmarshaller au) throws JAXBException {
127 //EndpointArgumentsBuilder.RpcLit.readRequest
128 throw new UnsupportedOperationException();
129 // return bridge.unmarshal(in, au);
130 }
132 public final T unmarshal(XMLStreamReader in, AttachmentUnmarshaller au) throws JAXBException {
133 //EndpointArgumentsBuilder.RpcLit.readRequest
134 throw new UnsupportedOperationException();
135 // return bridge.unmarshal(in, au);
136 }
138 public boolean supportOutputStream() {
139 return true;
140 }
141 }