|
|
(27 intermediate revisions by 2 users not shown) |
Line 1: |
Line 1: |
− | {{EclipseLink_UserGuide
| + | See http://www.eclipse.org/eclipselink/documentation/2.4/moxy/dynamic_jaxb002.htm |
− | |info=y
| + | |
− | |eclipselink=y
| + | |
− | |eclipselinktype=MOXy
| + | |
− | |api=y
| + | |
− | |apis= * [http://www.eclipse.org/eclipselink/api/2.1/index.html?org/eclipse/persistence/jaxb/JAXBContextFactory.html *.jaxb.JAXBContextFactory]
| + | |
− | }}
| + | |
− | | + | |
− | =Specifying the EclipseLink Runtime=
| + | |
− | | + | |
− | In order to use EclipseLink Dynamic MOXy as your JAXB implementation, you must identify the EclipseLink <tt>DynamicJAXBContextFactory</tt> in your <tt>jaxb.properties</tt> file.
| + | |
− | | + | |
− | # Create a text file named <tt>jaxb.properties</tt>, specifying <tt>DynamicJAXBContextFactory</tt> as the factory used to build new <tt>JAXBContexts</tt>.
| + | |
− | javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContextFactory
| + | |
− | </source></div>
| + | |
− | # Copy the file to your application package (or any of your packages on your classpath).
| + | |
− | # Use the standard <tt>JAXBContext.newInstance(String contextPath)</tt> API to create a <tt>DynamicJAXBContext</tt>.<br>When this method is called, MOXy attempts to locate a <tt>jaxb.properties</tt> file on the classpath in the package specified by <tt>contextPath</tt>, and use the specified factory.<div><source lang="java">
| + | |
− | DynamicJAXBContext jaxbContext = (DynamicJAXBContext) JAXBContext.newInstance("mynamespace");
| + | |
− | </source></div>
| + | |
− | | + | |
− | Because you do not need to change any application code, you can easily switch between different JAXB implementations.
| + | |
− | | + | |
− | The <tt>JAXBContextFactory</tt> can
| + | |
− | * Create a <tt>JAXBContext</tt> from an array of Classes and a Properties object
| + | |
− | * Create a <tt>JAXBContext</tt> from a context path and a ClassLoader
| + | |
− | | + | |
− | | + | |
− | {{EclipseLink_MOXy
| + | |
− | |next= [[EclipseLink/UserGuide/MOXy/Runtime/Bootstrapping/From_Schema|From XML Schema]]
| + | |
− | |previous= [[EclipseLink/UserGuide/MOXy/Runtime/Bootstrapping_Dynamic|Dynamic JAXB Bootstrapping]]
| + | |
− | |up= [[EclipseLink/UserGuide/MOXy/Runtime/Bootstrapping_Dynamic|Dynamic JAXB Bootstrapping]]
| + | |
− | |version=2.2.0 - DRAFT}}
| + | |