The JAXBContext
provides the JAXB users anchor to the implmentation and hos generated classes. A JAXBContext is used to obtain instances of {@link javax.xml.bind.Marshaller}, {@link javax.xml.bind.Unmarshaller}, and {@link javax.xml.bind.Validator}. To obtain a JAXBContext, the application invokes
JAXBContext context = JAXBContext.newInstance("com.mycompany:com.mycompany.xml");The list of colon separated package names matches the list in the schemas used to generate classes. In other words: If you have a schema using package name "com.mycompany.xml", then this package name has to be part of the list.
The JAXBContext
class will scan the given list of packages for a file called jaxb.properties. This file contains the name of an instantiation class in the property {@link #JAXB_CONTEXT_FACTORY}. (See {@link #newInstance(String)} fordetails on how the class name is obtained.) Once such a file is found, the given class is loaded via {@link ClassLoader#loadClass(java.lang.String)}. The JAXBContext
class demands, that the created object has a method
public static JAXBContext createContext(String pPath, ClassLoader pClassLoader) throws JAXBException;This method is invoked with the same path and {@link ClassLoader} thanabove. See {@link #newInstance(String,ClassLoader)}} for details on the choice of the {@link ClassLoader}.
The created context will scan the same package path for implementation specific configuration details (in the case of the JaxMe
application a file called Configuration.xml in any of the packages) and do whatever else is required to initialize the runtime. In particular it will invoke {@link DatatypeConverter#setDatatypeConverter(DatatypeConverterInterface)}.
Purpose:Provide a EclipseLink implementation of the JAXBContext interface.
Responsibilities:
This is the EclipseLink JAXB 2.0 implementation of javax.xml.bind.JAXBContext. This class is created by the JAXBContextFactory and is used to create Marshallers, Unmarshallers, Validators, Binders and Introspectors. A JAXBContext can also be used to create Schema Files.
Bootstrapping: When bootstrapping the JAXBContext from a EclipseLink externalized metadata file(s) a number of input options are available. The externalized metadata file (one per package) is passed in through a property when creating the JAXBContext. The key used in the properties map is "eclipselink-oxm-xml". The externalized metadata file can be set in the properties map in one of three ways:
i) For a single externalized metadata file, one of the following can be set in the properties map:
ii) For multiple externalized metadata files where the package name is specified within each externalized metadata file, a List can be used. The entries in the List are to be one of the types listed in i) above.
iii) For multiple externalized metadata files where the package name is not specified in each externalized metadata file, a Map can be used. The key must be a String (package name) and each value in the Map (externalized metadata file) is to be one of the types listed in i) above.
Note that in each of the above cases the package name can be set via package-name attribute on the xml-bindings element in the externalized metadata file. If set, any java-type names in the given metadata file that do not contain the package name will have that package name prepended to it. Also note that a List or Map can be used for a single externalized metadata file.
@see javax.xml.bind.JAXBContext @see org.eclipse.persistence.jaxb.JAXBMarshaller @see org.eclipse.persistence.jaxb.JAXBUnmarshaller @see org.eclipse.persistence.jaxb.JAXBBinder @see org.eclipse.persistence.jaxb.JAXBIntrospector @see org.eclipse.persistence.jaxb.JAXBContextProperties @author mmacivor
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|