Thu, 31 Aug 2017 15:18:52 +0800
merge
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.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.istack.internal.NotNull;
44 import com.sun.xml.internal.bind.api.TypeReference;
45 import com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl;
46 import com.sun.xml.internal.bind.v2.runtime.MarshallerImpl;
47 import com.sun.xml.internal.ws.spi.db.BindingContext;
48 import com.sun.xml.internal.ws.spi.db.DatabindingException;
49 import com.sun.xml.internal.ws.spi.db.TypeInfo;
51 public class MarshallerBridge
52 extends com.sun.xml.internal.bind.api.Bridge
53 implements com.sun.xml.internal.ws.spi.db.XMLBridge {
55 protected MarshallerBridge(JAXBContextImpl context) {
56 super(context);
57 }
59 public void marshal(Marshaller m, Object object, XMLStreamWriter output) throws JAXBException {
60 m.setProperty(Marshaller.JAXB_FRAGMENT,true);
61 try {
62 m.marshal(object,output);
63 } finally {
64 m.setProperty(Marshaller.JAXB_FRAGMENT,false);
65 }
66 }
68 public void marshal(Marshaller m, Object object, OutputStream output, NamespaceContext nsContext) throws JAXBException {
69 m.setProperty(Marshaller.JAXB_FRAGMENT,true);
70 try {
71 ((MarshallerImpl)m).marshal(object,output,nsContext);
72 } finally {
73 m.setProperty(Marshaller.JAXB_FRAGMENT,false);
74 }
75 }
77 public void marshal(Marshaller m, Object object, Node output) throws JAXBException {
78 m.setProperty(Marshaller.JAXB_FRAGMENT,true);
79 try {
80 m.marshal(object,output);
81 } finally {
82 m.setProperty(Marshaller.JAXB_FRAGMENT,false);
83 }
84 }
86 public void marshal(Marshaller m, Object object, ContentHandler contentHandler) throws JAXBException {
87 m.setProperty(Marshaller.JAXB_FRAGMENT,true);
88 try {
89 m.marshal(object,contentHandler);
90 } finally {
91 m.setProperty(Marshaller.JAXB_FRAGMENT,false);
92 }
93 }
95 public void marshal(Marshaller m, Object object, Result result) throws JAXBException {
96 m.setProperty(Marshaller.JAXB_FRAGMENT,true);
97 try {
98 m.marshal(object,result);
99 } finally {
100 m.setProperty(Marshaller.JAXB_FRAGMENT,false);
101 }
102 }
104 public Object unmarshal(Unmarshaller u, XMLStreamReader in) {
105 throw new UnsupportedOperationException();
106 }
108 public Object unmarshal(Unmarshaller u, Source in) {
109 throw new UnsupportedOperationException();
110 }
112 public Object unmarshal(Unmarshaller u, InputStream in) {
113 throw new UnsupportedOperationException();
114 }
116 public Object unmarshal(Unmarshaller u, Node n) {
117 throw new UnsupportedOperationException();
118 }
120 public TypeInfo getTypeInfo() {
121 throw new UnsupportedOperationException();
122 }
123 public TypeReference getTypeReference() {
124 throw new UnsupportedOperationException();
125 }
126 public BindingContext context() {
127 throw new UnsupportedOperationException();
128 }
129 public boolean supportOutputStream() {
130 return true;
131 }
132 }