Fri, 24 Oct 2014 15:02:28 +0200
8054367: More references for endpoints
Summary: fix also reviewed by Iaroslav.Savytskyi@oracle.com, Alexander.Fomin@oracle.com
Reviewed-by: mullan, skoivu
ohair@286 | 1 | /* |
mkos@397 | 2 | * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
ohair@286 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
ohair@286 | 4 | * |
ohair@286 | 5 | * This code is free software; you can redistribute it and/or modify it |
ohair@286 | 6 | * under the terms of the GNU General Public License version 2 only, as |
ohair@286 | 7 | * published by the Free Software Foundation. Oracle designates this |
ohair@286 | 8 | * particular file as subject to the "Classpath" exception as provided |
ohair@286 | 9 | * by Oracle in the LICENSE file that accompanied this code. |
ohair@286 | 10 | * |
ohair@286 | 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
ohair@286 | 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
ohair@286 | 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
ohair@286 | 14 | * version 2 for more details (a copy is included in the LICENSE file that |
ohair@286 | 15 | * accompanied this code). |
ohair@286 | 16 | * |
ohair@286 | 17 | * You should have received a copy of the GNU General Public License version |
ohair@286 | 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
ohair@286 | 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
ohair@286 | 20 | * |
ohair@286 | 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ohair@286 | 22 | * or visit www.oracle.com if you need additional information or have any |
ohair@286 | 23 | * questions. |
ohair@286 | 24 | */ |
ohair@286 | 25 | |
ohair@286 | 26 | package com.sun.xml.internal.ws.spi.db; |
ohair@286 | 27 | |
ohair@286 | 28 | import java.io.IOException; |
ohair@286 | 29 | import java.util.Collection; |
ohair@286 | 30 | import java.util.List; |
ohair@286 | 31 | |
ohair@286 | 32 | import javax.xml.bind.JAXBContext; |
ohair@286 | 33 | import javax.xml.bind.JAXBException; |
ohair@286 | 34 | import javax.xml.bind.Marshaller; |
ohair@286 | 35 | import javax.xml.bind.SchemaOutputResolver; |
ohair@286 | 36 | import javax.xml.bind.Unmarshaller; |
ohair@286 | 37 | import javax.xml.bind.annotation.XmlAttachmentRef; |
ohair@286 | 38 | import javax.xml.namespace.QName; |
ohair@286 | 39 | |
ohair@286 | 40 | import com.sun.istack.internal.NotNull; |
ohair@286 | 41 | import com.sun.istack.internal.Nullable; |
ohair@286 | 42 | |
ohair@286 | 43 | /** |
ohair@286 | 44 | * {@link JAXBContext} enhanced with JAXB RI specific functionalities. |
ohair@286 | 45 | * |
ohair@286 | 46 | * <p> |
ohair@286 | 47 | * <b>Subject to change without notice</b>. |
ohair@286 | 48 | * |
ohair@286 | 49 | * @since 2.0 EA1 |
ohair@286 | 50 | * @author |
ohair@286 | 51 | * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) |
ohair@286 | 52 | * |
ohair@286 | 53 | * @author shih-chang.chen@oracle.com |
ohair@286 | 54 | */ |
ohair@286 | 55 | public interface BindingContext { |
ohair@286 | 56 | |
ohair@286 | 57 | //following are found in JAXBContext used by jaxws |
ohair@286 | 58 | abstract public Marshaller createMarshaller() throws JAXBException; |
ohair@286 | 59 | abstract public Unmarshaller createUnmarshaller() throws JAXBException; |
ohair@286 | 60 | abstract public JAXBContext getJAXBContext(); |
ohair@286 | 61 | abstract public Object newWrapperInstace(Class<?> wrapperType) |
ohair@286 | 62 | throws InstantiationException, IllegalAccessException; |
ohair@286 | 63 | |
ohair@286 | 64 | |
ohair@286 | 65 | |
ohair@286 | 66 | |
ohair@286 | 67 | |
ohair@286 | 68 | /** |
ohair@286 | 69 | * Returns true if this context includes a class |
ohair@286 | 70 | * that has {@link XmlAttachmentRef}. |
ohair@286 | 71 | * |
ohair@286 | 72 | * @since 2.1 |
ohair@286 | 73 | */ |
ohair@286 | 74 | public abstract boolean hasSwaRef(); |
ohair@286 | 75 | |
ohair@286 | 76 | /** |
ohair@286 | 77 | * If the given object is bound to an element in XML by JAXB, |
ohair@286 | 78 | * returns the element name. |
ohair@286 | 79 | * |
ohair@286 | 80 | * @return null |
ohair@286 | 81 | * if the object is not bound to an element. |
ohair@286 | 82 | * @throws JAXBException |
ohair@286 | 83 | * if the object is not known to this context. |
ohair@286 | 84 | * |
ohair@286 | 85 | * @since 2.0 EA1 |
ohair@286 | 86 | */ |
ohair@286 | 87 | public abstract @Nullable QName getElementName(@NotNull Object o) throws JAXBException; |
ohair@286 | 88 | |
ohair@286 | 89 | /** |
ohair@286 | 90 | * Allows to retrieve the element name based on Class. |
ohair@286 | 91 | * @param o |
ohair@286 | 92 | * @return |
ohair@286 | 93 | * @throws javax.xml.bind.JAXBException |
ohair@286 | 94 | * @since 2.1.10 |
ohair@286 | 95 | */ |
ohair@286 | 96 | public abstract @Nullable QName getElementName(@NotNull Class o) throws JAXBException; |
ohair@286 | 97 | |
ohair@286 | 98 | /** |
ohair@286 | 99 | * Creates a mini-marshaller/unmarshaller that can process a {@link TypeInfo}. |
ohair@286 | 100 | * |
ohair@286 | 101 | * @return |
alanb@368 | 102 | * null if the specified reference is not given to {@link BindingContext#newWrapperInstace(Class)}. |
ohair@286 | 103 | * |
ohair@286 | 104 | * @since 2.0 EA1 |
ohair@286 | 105 | */ |
ohair@286 | 106 | public abstract XMLBridge createBridge(@NotNull TypeInfo ref); |
ohair@286 | 107 | public abstract XMLBridge createFragmentBridge(); |
ohair@286 | 108 | |
ohair@286 | 109 | /** |
ohair@286 | 110 | * Creates a new {@link BridgeContext} instance. |
ohair@286 | 111 | * |
ohair@286 | 112 | * @return |
ohair@286 | 113 | * always a valid non-null instance. |
ohair@286 | 114 | * |
ohair@286 | 115 | * @since 2.0 EA1 |
ohair@286 | 116 | */ |
ohair@286 | 117 | // public abstract @NotNull BridgeContext createBridgeContext(); |
ohair@286 | 118 | |
ohair@286 | 119 | /** |
ohair@286 | 120 | * Gets a {@link PropertyAccessor} for the specified element property of the specified wrapper bean class. |
ohair@286 | 121 | * |
ohair@286 | 122 | * <p> |
ohair@286 | 123 | * This method is designed to assist the JAX-RPC RI fill in a wrapper bean (in the doc/lit/wrap mode.) |
ohair@286 | 124 | * In the said mode, a wrapper bean is supposed to only have properties that match elements, |
ohair@286 | 125 | * and for each element that appear in the content model there's one property. |
ohair@286 | 126 | * |
ohair@286 | 127 | * <p> |
ohair@286 | 128 | * Therefore, this method takes a wrapper bean and a tag name that identifies a property |
ohair@286 | 129 | * on the given wrapper bean, then returns a {@link PropertyAccessor} that allows the caller |
ohair@286 | 130 | * to set/get a value from the property of the bean. |
ohair@286 | 131 | * |
ohair@286 | 132 | * <p> |
ohair@286 | 133 | * This method is not designed for a performance. The caller is expected to cache the result. |
ohair@286 | 134 | * |
ohair@286 | 135 | * @param <B> |
ohair@286 | 136 | * type of the wrapper bean |
ohair@286 | 137 | * @param <V> |
ohair@286 | 138 | * type of the property of the bean |
ohair@286 | 139 | * @return |
ohair@286 | 140 | * always return non-null valid accessor object. |
ohair@286 | 141 | * @throws JAXBException |
ohair@286 | 142 | * if the specified wrapper bean is not bound by JAXB, or if it doesn't have an element property |
ohair@286 | 143 | * of the given name. |
ohair@286 | 144 | * |
ohair@286 | 145 | * @since 2.0 EA1 |
ohair@286 | 146 | */ |
ohair@286 | 147 | public abstract <B,V> PropertyAccessor<B,V> getElementPropertyAccessor( Class<B> wrapperBean, String nsUri, String localName ) |
ohair@286 | 148 | throws JAXBException; |
ohair@286 | 149 | |
ohair@286 | 150 | /** |
ohair@286 | 151 | * Gets the namespace URIs statically known to this {@link JAXBContext}. |
ohair@286 | 152 | * |
ohair@286 | 153 | * <p> |
ohair@286 | 154 | * When JAXB is used to marshal into sub-trees, it declares |
ohair@286 | 155 | * these namespace URIs at each top-level element that it marshals. |
ohair@286 | 156 | * |
ohair@286 | 157 | * To avoid repeated namespace declarations at sub-elements, the application |
ohair@286 | 158 | * may declare those namespaces at a higher level. |
ohair@286 | 159 | * |
ohair@286 | 160 | * @return |
ohair@286 | 161 | * always non-null. |
ohair@286 | 162 | * |
ohair@286 | 163 | * @since 2.0 EA2 |
ohair@286 | 164 | */ |
ohair@286 | 165 | public abstract @NotNull List<String> getKnownNamespaceURIs(); |
ohair@286 | 166 | |
ohair@286 | 167 | |
ohair@286 | 168 | /** |
ohair@286 | 169 | * Generates the schema documents from the model. |
ohair@286 | 170 | * |
ohair@286 | 171 | * <p> |
ohair@286 | 172 | * The caller can use the additionalElementDecls parameter to |
ohair@286 | 173 | * add element declarations to the generate schema. |
ohair@286 | 174 | * For example, if the JAX-RPC passes in the following entry: |
ohair@286 | 175 | * |
ohair@286 | 176 | * {foo}bar -> DeclaredType for java.lang.String |
ohair@286 | 177 | * |
ohair@286 | 178 | * then JAXB generates the following element declaration (in the schema |
ohair@286 | 179 | * document for the namespace "foo")" |
ohair@286 | 180 | * |
ohair@286 | 181 | * <xs:element name="bar" type="xs:string" /> |
ohair@286 | 182 | * |
ohair@286 | 183 | * This can be used for generating schema components necessary for WSDL. |
ohair@286 | 184 | * |
ohair@286 | 185 | * @param outputResolver |
ohair@286 | 186 | * this object controls the output to which schemas |
ohair@286 | 187 | * will be sent. |
ohair@286 | 188 | * |
ohair@286 | 189 | * @throws IOException |
ohair@286 | 190 | * if {@link SchemaOutputResolver} throws an {@link IOException}. |
ohair@286 | 191 | */ |
ohair@286 | 192 | public abstract void generateSchema(@NotNull SchemaOutputResolver outputResolver) throws IOException; |
ohair@286 | 193 | |
ohair@286 | 194 | /** |
ohair@286 | 195 | * Returns the name of the XML Type bound to the |
ohair@286 | 196 | * specified Java type. |
ohair@286 | 197 | * |
ohair@286 | 198 | * @param tr |
ohair@286 | 199 | * must not be null. This must be one of the {@link TypeInfo}s specified |
ohair@286 | 200 | * in the {@link BindingContext#newInstance} method. |
ohair@286 | 201 | * |
ohair@286 | 202 | * @throws IllegalArgumentException |
ohair@286 | 203 | * if the parameter is null or not a part of the {@link TypeInfo}s specified |
alanb@368 | 204 | * in the {@link BindingContext#newWrapperInstace(Class)} method. |
ohair@286 | 205 | * |
ohair@286 | 206 | * @return null |
ohair@286 | 207 | * if the referenced type is an anonymous and therefore doesn't have a name. |
ohair@286 | 208 | */ |
ohair@286 | 209 | public abstract QName getTypeName(@NotNull TypeInfo tr); |
ohair@286 | 210 | |
ohair@286 | 211 | /** |
ohair@286 | 212 | * Gets the build information of the JAXB runtime. |
ohair@286 | 213 | * |
ohair@286 | 214 | * @return |
ohair@286 | 215 | * may be null, if the runtime is loaded by a class loader that doesn't support |
ohair@286 | 216 | * the access to the manifest informatino. |
ohair@286 | 217 | */ |
ohair@286 | 218 | public abstract @NotNull String getBuildId(); |
ohair@286 | 219 | |
ohair@286 | 220 | /** |
ohair@286 | 221 | * The property that you can specify to {@link JAXBContext#newInstance} |
ohair@286 | 222 | * to reassign the default namespace URI to something else at the runtime. |
ohair@286 | 223 | * |
ohair@286 | 224 | * <p> |
ohair@286 | 225 | * The value of the property is {@link String}, and it is used as the namespace URI |
ohair@286 | 226 | * that succeeds the default namespace URI. |
ohair@286 | 227 | * |
ohair@286 | 228 | * @since 2.0 EA1 |
ohair@286 | 229 | */ |
ohair@286 | 230 | public static final String DEFAULT_NAMESPACE_REMAP = "com.sun.xml.internal.bind.defaultNamespaceRemap"; |
ohair@286 | 231 | |
ohair@286 | 232 | /** |
ohair@286 | 233 | * The property that you can specify to {@link JAXBContext#newInstance} |
ohair@286 | 234 | * to put additional JAXB type references into the {@link JAXBContext}. |
ohair@286 | 235 | * |
ohair@286 | 236 | * <p> |
ohair@286 | 237 | * The value of the property is {@link Collection}<{@link TypeInfo}>. |
ohair@286 | 238 | * Those {@link TypeInfo}s can then be used to create {@link XMLBridge}s. |
ohair@286 | 239 | * |
ohair@286 | 240 | * <p> |
ohair@286 | 241 | * This mechanism allows additional element declarations that were not a part of |
ohair@286 | 242 | * the schema into the created {@link JAXBContext}. |
ohair@286 | 243 | * |
ohair@286 | 244 | * @since 2.0 EA1 |
ohair@286 | 245 | */ |
ohair@286 | 246 | public static final String TYPE_REFERENCES = "com.sun.xml.internal.bind.typeReferences"; |
ohair@286 | 247 | |
ohair@286 | 248 | /** |
ohair@286 | 249 | * The property that you can specify to {@link JAXBContext#newInstance} |
ohair@286 | 250 | * and {@link Marshaller#setProperty(String, Object)} |
ohair@286 | 251 | * to enable the c14n marshalling support in the {@link JAXBContext}. |
ohair@286 | 252 | * |
ohair@286 | 253 | * @see C14nSupport_ArchitectureDocument |
ohair@286 | 254 | * @since 2.0 EA2 |
ohair@286 | 255 | */ |
ohair@286 | 256 | public static final String CANONICALIZATION_SUPPORT = "com.sun.xml.internal.bind.c14n"; |
ohair@286 | 257 | |
ohair@286 | 258 | /** |
ohair@286 | 259 | * The property that you can specify to {@link JAXBContext#newInstance} |
ohair@286 | 260 | * to allow unmarshaller to honor <tt>xsi:nil</tt> anywhere, even if they are |
ohair@286 | 261 | * not specifically allowed by the schema. |
ohair@286 | 262 | * |
ohair@286 | 263 | * @since 2.1.3 |
ohair@286 | 264 | */ |
ohair@286 | 265 | public static final String TREAT_EVERYTHING_NILLABLE = "com.sun.xml.internal.bind.treatEverythingNillable"; |
ohair@286 | 266 | |
ohair@286 | 267 | /** |
ohair@286 | 268 | * The property that you can specify to {@link JAXBContext#newInstance} |
ohair@286 | 269 | * to use alternative {@link RuntimeAnnotationReader} implementation. |
ohair@286 | 270 | * |
ohair@286 | 271 | * @since 2.1 EA2 |
ohair@286 | 272 | */ |
ohair@286 | 273 | // public static final String ANNOTATION_READER = RuntimeAnnotationReader.class.getName(); |
ohair@286 | 274 | |
ohair@286 | 275 | /** |
ohair@286 | 276 | * Marshaller/Unmarshaller property to enable XOP processing. |
ohair@286 | 277 | * |
ohair@286 | 278 | * @since 2.0 EA2 |
ohair@286 | 279 | */ |
ohair@286 | 280 | public static final String ENABLE_XOP = "com.sun.xml.internal.bind.XOP"; |
ohair@286 | 281 | |
ohair@286 | 282 | /** |
ohair@286 | 283 | * The property that you can specify to {@link JAXBContext#newInstance} |
ohair@286 | 284 | * to specify specific classes that replace the reference to generic classes. |
ohair@286 | 285 | * |
ohair@286 | 286 | * <p> |
ohair@286 | 287 | * See the release notes for more details about this feature. |
ohair@286 | 288 | * |
ohair@286 | 289 | * @since 2.1 EA2 |
ohair@286 | 290 | */ |
ohair@286 | 291 | public static final String SUBCLASS_REPLACEMENTS = "com.sun.xml.internal.bind.subclassReplacements"; |
ohair@286 | 292 | |
ohair@286 | 293 | /** |
ohair@286 | 294 | * The property that you can specify to {@link JAXBContext#newInstance} |
ohair@286 | 295 | * enable support of XmlAccessorFactory annotation in the {@link JAXBContext}. |
ohair@286 | 296 | * |
ohair@286 | 297 | * @since 2.1 EA2 |
ohair@286 | 298 | */ |
ohair@286 | 299 | public static final String XMLACCESSORFACTORY_SUPPORT = "com.sun.xml.internal.bind.XmlAccessorFactory"; |
ohair@286 | 300 | |
ohair@286 | 301 | /** |
ohair@286 | 302 | * Retains references to PropertyInfos. |
ohair@286 | 303 | * |
ohair@286 | 304 | * @since 2.1.10 |
ohair@286 | 305 | */ |
ohair@286 | 306 | public static final String RETAIN_REFERENCE_TO_INFO = "retainReferenceToInfo"; |
ohair@286 | 307 | |
ohair@286 | 308 | } |