author | coleenp |
Tue, 19 Dec 2017 15:56:28 -0500 | |
changeset 48405 | 5f1c30b80554 |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
31109
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
1 |
/* |
45678
65fdff10664d
8176508: Update JAX-WS RI integration to latest version
aefimov
parents:
35414
diff
changeset
|
2 |
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. |
31109
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
4 |
* |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. Oracle designates this |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
10 |
* |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
15 |
* accompanied this code). |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
16 |
* |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
20 |
* |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
22 |
* or visit www.oracle.com if you need additional information or have any |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
23 |
* questions. |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
24 |
*/ |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
25 |
|
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
26 |
package javax.xml.bind; |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
27 |
|
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
28 |
import java.util.Map; |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
29 |
|
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
30 |
/** |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
31 |
* <p>Factory that creates new <code>JAXBContext</code> instances. |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
32 |
* |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
33 |
* JAXBContextFactory can be located using {@link java.util.ServiceLoader#load(Class)} |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
34 |
* |
35342
42f5b2282cde
8136494: Update "@since 1.9" to "@since 9" to match java.version.specification
iris
parents:
32795
diff
changeset
|
35 |
* @since 9, JAXB 2.3 |
31109
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
36 |
*/ |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
37 |
public interface JAXBContextFactory { |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
38 |
|
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
39 |
/** |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
40 |
* <p> |
32795
5a5710ee05a0
8133651: replace some <tt> tags (obsolete in html5) in core-libs docs
avstepan
parents:
31109
diff
changeset
|
41 |
* Create a new instance of a {@code JAXBContext} class. |
31109
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
42 |
* |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
43 |
* <p> |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
44 |
* For semantics see {@link javax.xml.bind.JAXBContext#newInstance(Class[], java.util.Map)} |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
45 |
* |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
46 |
* @param classesToBeBound |
45678
65fdff10664d
8176508: Update JAX-WS RI integration to latest version
aefimov
parents:
35414
diff
changeset
|
47 |
* List of java classes to be recognized by the new {@link JAXBContext}. |
65fdff10664d
8176508: Update JAX-WS RI integration to latest version
aefimov
parents:
35414
diff
changeset
|
48 |
* Classes in {@code classesToBeBound} that are in named modules must be in a package |
65fdff10664d
8176508: Update JAX-WS RI integration to latest version
aefimov
parents:
35414
diff
changeset
|
49 |
* that is {@linkplain java.lang.Module#isOpen open} to at least the {@code java.xml.bind} module. |
31109
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
50 |
* Can be empty, in which case a {@link JAXBContext} that only knows about |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
51 |
* spec-defined classes will be returned. |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
52 |
* @param properties |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
53 |
* provider-specific properties. Can be null, which means the same thing as passing |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
54 |
* in an empty map. |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
55 |
* |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
56 |
* @return |
32795
5a5710ee05a0
8133651: replace some <tt> tags (obsolete in html5) in core-libs docs
avstepan
parents:
31109
diff
changeset
|
57 |
* A new instance of a {@code JAXBContext}. |
31109
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
58 |
* |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
59 |
* @throws JAXBException |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
60 |
* if an error was encountered while creating the |
45678
65fdff10664d
8176508: Update JAX-WS RI integration to latest version
aefimov
parents:
35414
diff
changeset
|
61 |
* {@code JAXBContext}, such as (but not limited to): |
65fdff10664d
8176508: Update JAX-WS RI integration to latest version
aefimov
parents:
35414
diff
changeset
|
62 |
* <ol> |
65fdff10664d
8176508: Update JAX-WS RI integration to latest version
aefimov
parents:
35414
diff
changeset
|
63 |
* <li>No JAXB implementation was discovered |
65fdff10664d
8176508: Update JAX-WS RI integration to latest version
aefimov
parents:
35414
diff
changeset
|
64 |
* <li>Classes use JAXB annotations incorrectly |
65fdff10664d
8176508: Update JAX-WS RI integration to latest version
aefimov
parents:
35414
diff
changeset
|
65 |
* <li>Classes have colliding annotations (i.e., two classes with the same type name) |
65fdff10664d
8176508: Update JAX-WS RI integration to latest version
aefimov
parents:
35414
diff
changeset
|
66 |
* <li>The JAXB implementation was unable to locate |
65fdff10664d
8176508: Update JAX-WS RI integration to latest version
aefimov
parents:
35414
diff
changeset
|
67 |
* provider-specific out-of-band information (such as additional |
65fdff10664d
8176508: Update JAX-WS RI integration to latest version
aefimov
parents:
35414
diff
changeset
|
68 |
* files generated at the development time.) |
65fdff10664d
8176508: Update JAX-WS RI integration to latest version
aefimov
parents:
35414
diff
changeset
|
69 |
* <li>{@code classesToBeBound} are not open to {@code java.xml.bind} module |
65fdff10664d
8176508: Update JAX-WS RI integration to latest version
aefimov
parents:
35414
diff
changeset
|
70 |
* </ol> |
31109
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
71 |
* |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
72 |
* @throws IllegalArgumentException |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
73 |
* if the parameter contains {@code null} (i.e., {@code newInstance(null,someMap);}) |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
74 |
* |
35342
42f5b2282cde
8136494: Update "@since 1.9" to "@since 9" to match java.version.specification
iris
parents:
32795
diff
changeset
|
75 |
* @since 9, JAXB 2.3 |
31109
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
76 |
*/ |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
77 |
JAXBContext createContext(Class<?>[] classesToBeBound, |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
78 |
Map<String, ?> properties ) throws JAXBException; |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
79 |
|
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
80 |
/** |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
81 |
* <p> |
32795
5a5710ee05a0
8133651: replace some <tt> tags (obsolete in html5) in core-libs docs
avstepan
parents:
31109
diff
changeset
|
82 |
* Create a new instance of a {@code JAXBContext} class. |
31109
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
83 |
* |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
84 |
* <p> |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
85 |
* For semantics see {@link javax.xml.bind.JAXBContext#newInstance(String, ClassLoader, java.util.Map)} |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
86 |
* |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
87 |
* <p> |
35414 | 88 |
* The interpretation of properties is up to implementations. Implementations must |
32795
5a5710ee05a0
8133651: replace some <tt> tags (obsolete in html5) in core-libs docs
avstepan
parents:
31109
diff
changeset
|
89 |
* throw {@code JAXBException} if it finds properties that it doesn't understand. |
31109
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
90 |
* |
45678
65fdff10664d
8176508: Update JAX-WS RI integration to latest version
aefimov
parents:
35414
diff
changeset
|
91 |
* @param contextPath |
65fdff10664d
8176508: Update JAX-WS RI integration to latest version
aefimov
parents:
35414
diff
changeset
|
92 |
* List of java package names that contain schema derived classes. |
65fdff10664d
8176508: Update JAX-WS RI integration to latest version
aefimov
parents:
35414
diff
changeset
|
93 |
* Classes in {@code classesToBeBound} that are in named modules must be in a package |
65fdff10664d
8176508: Update JAX-WS RI integration to latest version
aefimov
parents:
35414
diff
changeset
|
94 |
* that is {@linkplain java.lang.Module#isOpen open} to at least the {@code java.xml.bind} module. |
31109
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
95 |
* @param classLoader |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
96 |
* This class loader will be used to locate the implementation classes. |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
97 |
* @param properties |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
98 |
* provider-specific properties. Can be null, which means the same thing as passing |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
99 |
* in an empty map. |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
100 |
* |
32795
5a5710ee05a0
8133651: replace some <tt> tags (obsolete in html5) in core-libs docs
avstepan
parents:
31109
diff
changeset
|
101 |
* @return a new instance of a {@code JAXBContext} |
31109
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
102 |
* @throws JAXBException if an error was encountered while creating the |
45678
65fdff10664d
8176508: Update JAX-WS RI integration to latest version
aefimov
parents:
35414
diff
changeset
|
103 |
* {@code JAXBContext} such as |
65fdff10664d
8176508: Update JAX-WS RI integration to latest version
aefimov
parents:
35414
diff
changeset
|
104 |
* <ol> |
65fdff10664d
8176508: Update JAX-WS RI integration to latest version
aefimov
parents:
35414
diff
changeset
|
105 |
* <li>failure to locate either ObjectFactory.class or jaxb.index in the packages</li> |
65fdff10664d
8176508: Update JAX-WS RI integration to latest version
aefimov
parents:
35414
diff
changeset
|
106 |
* <li>an ambiguity among global elements contained in the contextPath</li> |
65fdff10664d
8176508: Update JAX-WS RI integration to latest version
aefimov
parents:
35414
diff
changeset
|
107 |
* <li>failure to locate a value for the context factory provider property</li> |
65fdff10664d
8176508: Update JAX-WS RI integration to latest version
aefimov
parents:
35414
diff
changeset
|
108 |
* <li>mixing schema derived packages from different providers on the same contextPath</li> |
65fdff10664d
8176508: Update JAX-WS RI integration to latest version
aefimov
parents:
35414
diff
changeset
|
109 |
* <li>packages are not open to {@code java.xml.bind} module</li> |
65fdff10664d
8176508: Update JAX-WS RI integration to latest version
aefimov
parents:
35414
diff
changeset
|
110 |
* </ol> |
35414 | 111 |
* |
35342
42f5b2282cde
8136494: Update "@since 1.9" to "@since 9" to match java.version.specification
iris
parents:
32795
diff
changeset
|
112 |
* @since 9, JAXB 2.3 |
31109
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
113 |
*/ |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
114 |
JAXBContext createContext(String contextPath, |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
115 |
ClassLoader classLoader, |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
116 |
Map<String, ?> properties ) throws JAXBException; |
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
117 |
|
a542f8dcbbf8
8072839: JAX-B Plugability Layer: using java.util.ServiceLoader
mkos
parents:
diff
changeset
|
118 |
} |