1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/db/XMLBridge.java Wed Apr 27 01:27:09 2016 +0800 1.3 @@ -0,0 +1,244 @@ 1.4 +/* 1.5 + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. Oracle designates this 1.11 + * particular file as subject to the "Classpath" exception as provided 1.12 + * by Oracle in the LICENSE file that accompanied this code. 1.13 + * 1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.17 + * version 2 for more details (a copy is included in the LICENSE file that 1.18 + * accompanied this code). 1.19 + * 1.20 + * You should have received a copy of the GNU General Public License version 1.21 + * 2 along with this work; if not, write to the Free Software Foundation, 1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.23 + * 1.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.25 + * or visit www.oracle.com if you need additional information or have any 1.26 + * questions. 1.27 + */ 1.28 + 1.29 +package com.sun.xml.internal.ws.spi.db; 1.30 + 1.31 +import java.io.InputStream; 1.32 +import java.io.OutputStream; 1.33 + 1.34 +import javax.xml.bind.JAXBException; 1.35 +import javax.xml.bind.attachment.AttachmentMarshaller; 1.36 +import javax.xml.bind.attachment.AttachmentUnmarshaller; 1.37 +import javax.xml.namespace.NamespaceContext; 1.38 +import javax.xml.stream.XMLStreamReader; 1.39 +import javax.xml.stream.XMLStreamWriter; 1.40 +import javax.xml.transform.Result; 1.41 +import javax.xml.transform.Source; 1.42 + 1.43 +import com.sun.istack.internal.NotNull; 1.44 +import com.sun.istack.internal.Nullable; 1.45 +import org.w3c.dom.Node; 1.46 +import org.xml.sax.ContentHandler; 1.47 + 1.48 +/** 1.49 + * The XMLBridge is a Glassfish JAXWS side of Glassfish JAXB Bridge. 1.50 + * 1.51 + * Mini-marshaller/unmarshaller that is specialized for a particular 1.52 + * element name and a type. 1.53 + * 1.54 + * <p> 1.55 + * Instances of this class is stateless and multi-thread safe. 1.56 + * They are reentrant. 1.57 + * 1.58 + * <p> 1.59 + * All the marshal operation generates fragments. 1.60 + * 1.61 + * <p> 1.62 + * <b>Subject to change without notice</b>. 1.63 + * 1.64 + * @since JAXB 2.0 EA1 1.65 + * @author Kohsuke Kawaguchi 1.66 + * @author shih-chang.chen@oracle.com 1.67 + */ 1.68 +public interface XMLBridge<T> { 1.69 + /** 1.70 + * Gets the {@link BindingContext} to which this object belongs. 1.71 + * 1.72 + * @since 2.1 1.73 + */ 1.74 + public @NotNull BindingContext context(); 1.75 + 1.76 + /** 1.77 + * 1.78 + * @throws JAXBException 1.79 + * if there was an error while marshalling. 1.80 + * 1.81 + * @since 2.0 EA1 1.82 + */ 1.83 +// public void marshal(T object,XMLStreamWriter output) throws JAXBException; 1.84 + 1.85 + public void marshal(T object,XMLStreamWriter output, AttachmentMarshaller am) throws JAXBException; 1.86 + 1.87 + /** 1.88 + * Marshals the specified type object with the implicit element name 1.89 + * associated with this instance of {@link Bond}. 1.90 + * 1.91 + * @param nsContext 1.92 + * if this marshalling is done to marshal a subelement, this {@link NamespaceContext} 1.93 + * represents in-scope namespace bindings available for that element. Can be null, 1.94 + * in which case JAXB assumes no in-scope namespaces. 1.95 + * @throws JAXBException 1.96 + * if there was an error while marshalling. 1.97 + * 1.98 + * @since 2.0 EA1 1.99 + */ 1.100 +// public void marshal(T object,OutputStream output, NamespaceContext nsContext) throws JAXBException; 1.101 + 1.102 + /** 1.103 + * @since 2.0.2 1.104 + */ 1.105 + public void marshal(T object,OutputStream output, NamespaceContext nsContext, AttachmentMarshaller am) throws JAXBException ; 1.106 +// 1.107 +//// public void marshal(@NotNull BridgeContext context,T object,OutputStream output, NamespaceContext nsContext) throws JAXBException; 1.108 +// 1.109 +// public void marshal(@NotNull Marshaller m,T object,OutputStream output, NamespaceContext nsContext) throws JAXBException; 1.110 + 1.111 + 1.112 + public void marshal(T object,Node output) throws JAXBException ; 1.113 +// 1.114 +//// public void marshal(@NotNull BridgeContext context,T object,Node output) throws JAXBException ; 1.115 +// 1.116 +// public void marshal(@NotNull Marshaller m,T object,Node output) throws JAXBException; 1.117 + 1.118 + 1.119 + /** 1.120 + * @since 2.0 EA4 1.121 + */ 1.122 +// public void marshal(T object, ContentHandler contentHandler) throws JAXBException; 1.123 + /** 1.124 + * @since 2.0.2 1.125 + */ 1.126 + public void marshal(T object, ContentHandler contentHandler, AttachmentMarshaller am) throws JAXBException ; 1.127 + 1.128 +//// public void marshal(@NotNull BridgeContext context,T object, ContentHandler contentHandler) throws JAXBException; 1.129 +// 1.130 +// public void marshal(@NotNull Marshaller m,T object, ContentHandler contentHandler) throws JAXBException; 1.131 + 1.132 + /** 1.133 + * @since 2.0 EA4 1.134 + */ 1.135 + public void marshal(T object, Result result) throws JAXBException; 1.136 + 1.137 +//// public void marshal(@NotNull BridgeContext context,T object, Result result) throws JAXBException; 1.138 +// public void marshal(@NotNull Marshaller m,T object, Result result) throws JAXBException; 1.139 + 1.140 + 1.141 + 1.142 + /** 1.143 + * Unmarshals the specified type object. 1.144 + * 1.145 + * @param in 1.146 + * the parser must be pointing at a start tag 1.147 + * that encloses the XML type that this {@link Bond} is 1.148 + * instanciated for. 1.149 + * 1.150 + * @return 1.151 + * never null. 1.152 + * 1.153 + * @throws JAXBException 1.154 + * if there was an error while unmarshalling. 1.155 + * 1.156 + * @since 2.0 EA1 1.157 + */ 1.158 +// public @NotNull T unmarshal(@NotNull XMLStreamReader in) throws JAXBException ; 1.159 + /** 1.160 + * @since 2.0.3 1.161 + */ 1.162 + public @NotNull T unmarshal(@NotNull XMLStreamReader in, @Nullable AttachmentUnmarshaller au) throws JAXBException; 1.163 +// public @NotNull T unmarshal(@NotNull BridgeContext context, @NotNull XMLStreamReader in) throws JAXBException ; 1.164 +// public @NotNull T unmarshal(@NotNull Unmarshaller u, @NotNull XMLStreamReader in) throws JAXBException; 1.165 + 1.166 + /** 1.167 + * Unmarshals the specified type object. 1.168 + * 1.169 + * @param in 1.170 + * the parser must be pointing at a start tag 1.171 + * that encloses the XML type that this {@link Bond} is 1.172 + * instanciated for. 1.173 + * 1.174 + * @return 1.175 + * never null. 1.176 + * 1.177 + * @throws JAXBException 1.178 + * if there was an error while unmarshalling. 1.179 + * 1.180 + * @since 2.0 EA1 1.181 + */ 1.182 +// public @NotNull T unmarshal(@NotNull Source in) throws JAXBException ; 1.183 + /** 1.184 + * @since 2.0.3 1.185 + */ 1.186 + public @NotNull T unmarshal(@NotNull Source in, @Nullable AttachmentUnmarshaller au) throws JAXBException; 1.187 +// public @NotNull T unmarshal(@NotNull BridgeContext context, @NotNull Source in) throws JAXBException; 1.188 +// public @NotNull T unmarshal(@NotNull Unmarshaller u, @NotNull Source in) throws JAXBException; 1.189 + 1.190 + /** 1.191 + * Unmarshals the specified type object. 1.192 + * 1.193 + * @param in 1.194 + * the parser must be pointing at a start tag 1.195 + * that encloses the XML type that this {@link XMLBridge} is 1.196 + * instanciated for. 1.197 + * 1.198 + * @return 1.199 + * never null. 1.200 + * 1.201 + * @throws JAXBException 1.202 + * if there was an error while unmarshalling. 1.203 + * 1.204 + * @since 2.0 EA1 1.205 + */ 1.206 + public @NotNull T unmarshal(@NotNull InputStream in) throws JAXBException ; 1.207 + 1.208 +// public @NotNull T unmarshal(@NotNull BridgeContext context, @NotNull InputStream in) throws JAXBException ; 1.209 + 1.210 +// public @NotNull T unmarshal(@NotNull Unmarshaller u, @NotNull InputStream in) throws JAXBException; 1.211 + 1.212 + /** 1.213 + * Unmarshals the specified type object. 1.214 + * 1.215 + * @param n 1.216 + * Node to be unmarshalled. 1.217 + * 1.218 + * @return 1.219 + * never null. 1.220 + * 1.221 + * @throws JAXBException 1.222 + * if there was an error while unmarshalling. 1.223 + * 1.224 + * @since 2.0 FCS 1.225 + */ 1.226 +// public @NotNull T unmarshal(@NotNull Node n) throws JAXBException ; 1.227 + /** 1.228 + * @since 2.0.3 1.229 + */ 1.230 + public @NotNull T unmarshal(@NotNull Node n, @Nullable AttachmentUnmarshaller au) throws JAXBException; 1.231 +// public @NotNull T unmarshal(@NotNull BridgeContext context, @NotNull Node n) throws JAXBException; 1.232 +// public @NotNull T unmarshal(@NotNull Unmarshaller context, @NotNull Node n) throws JAXBException; 1.233 + 1.234 + /** 1.235 + * Gets the {@link TypeInfo} from which this bridge was created. 1.236 + */ 1.237 + public TypeInfo getTypeInfo(); 1.238 + 1.239 + /** 1.240 + * This can be used to determine whether XMLStreamWriter or OutputStream is 1.241 + * prefered by the implementation. 1.242 + * 1.243 + * @return true if marshall to OutputStream is supported in the 1.244 + * implementation. 1.245 + */ 1.246 + public boolean supportOutputStream(); 1.247 +}