Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "EclipseLink/Development/339373"

(Configuration)
Line 34: Line 34:
 
# A Map of Lists of Input Sources, keyed on package name. (Map<String, List<Object>>)
 
# A Map of Lists of Input Sources, keyed on package name. (Map<String, List<Object>>)
 
# Allow the list of Input Sources from #2 above to contain more than entry per package.
 
# Allow the list of Input Sources from #2 above to contain more than entry per package.
 +
 +
 +
Example:
 +
 +
<div style="width:700px">
 +
<source lang="java">
 +
 +
....
 +
 +
FileReader bindings1 = new FileReader("base-bindings.xml");
 +
FileReader bindings2 = new FileReader("override-bindings.xml");
 +
 +
List<Object> bindingsList = new ArrayList<Object>();
 +
bindingsList.add(bindings1);
 +
bindingsList.add(bindings2);
 +
 +
Map<String, Object> properties = new HashMap<String, Object>();
 +
properties.put(JAXBContextFactory.ECLIPSELINK_OXM_XML_KEY, bindingsList);
 +
 +
JAXBContext ctx = JAXBContext.newInstance(new Class[]{Employee.class}, properties);
 +
 +
....
 +
</source>
 +
</div>

Revision as of 14:41, 1 April 2011

Design Specification: Multiple Bindings File Support

ER 339373

Currently MOXy provides the ability to augment the annotation metadata with an XML bindings file. This enhancement request is for the ability to apply multiple binding files to a model.

Sample use case: 1. Initial metadata is specified with annotations. 2. Second version modifies the metadata with an XML bindings file. 3. Subsequent versions continue to modify the metadata with new bindings files.

With the metadata layered in this way a JAXBContext could be created to represent any version of the XML document.

Requirements

  1. Must provide an API to allow multiple bindings files to be passed into the context creation
  2. Be able to merge multiple bindings files into a single unified XmlBindings
  3. Must coincide with JPA rules for overrides with multiple orm .xml files.

Configuration

Currently MOXy allows external bindings files to be passed in through a map of properties. MOXy allows one bindings file per package. The files can be passed into through the properties in 3 formats

  1. A Map of Input Sources keyed on package name.
  2. A list of Input Sources, one per package.
  3. A single Input Source.

To support multiple bindings files for a single package, this will be changed to allow the following additional options:

  1. A Map of Lists of Input Sources, keyed on package name. (Map<String, List<Object>>)
  2. Allow the list of Input Sources from #2 above to contain more than entry per package.


Example:

....
 
FileReader bindings1 = new FileReader("base-bindings.xml");
FileReader bindings2 = new FileReader("override-bindings.xml");
 
List<Object> bindingsList = new ArrayList<Object>();
bindingsList.add(bindings1);
bindingsList.add(bindings2);
 
Map<String, Object> properties = new HashMap<String, Object>();
properties.put(JAXBContextFactory.ECLIPSELINK_OXM_XML_KEY, bindingsList);
 
JAXBContext ctx = JAXBContext.newInstance(new Class[]{Employee.class}, properties);
 
....

Back to the top