Skip to main content

Notice: This Wiki is now read only and edits are no longer 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/DBWS/MetadataSupport"

(Design document for adding JPA/JAXB metadata support to DBWS)
(JAXB Metadata support)
Line 5: Line 5:
  
 
=== JAXB Metadata support ===
 
=== JAXB Metadata support ===
The existing code utilizes the ObjectPersistenceWorkbenchXMLProject class to marshal the OX project at design time and unmarshal it at runtime.  The code will be change to instead use JAXB metadata for these operations.  The following pages contain information pertaining to EclipseLink support for JAXB annotations via XML metadata:
+
The existing DBWS builder code utilizes the <code>ObjectPersistenceWorkbenchXMLProject</code> class to marshal the OX project at design time and unmarshal it at runtime.  The code will be changed to instead use JAXB metadata for these operations.  The following pages contain information pertaining to EclipseLink's support for JAXB annotations via XML metadata:
 
*http://wiki.eclipse.org/EclipseLink/DesignDocs/277920
 
*http://wiki.eclipse.org/EclipseLink/DesignDocs/277920
 
*http://wiki.eclipse.org/EclipseLink/DesignDocs/293925
 
*http://wiki.eclipse.org/EclipseLink/DesignDocs/293925
 
*http://wiki.eclipse.org/EclipseLink/DesignDocs/293925/MOXyExtensions
 
*http://wiki.eclipse.org/EclipseLink/DesignDocs/293925/MOXyExtensions
 +
 +
The DBWS builder creates an OX project;  this project's descriptors - and each descriptor's mappings - will be used to generate one or more <code><xml-bindings></code> elements (one per package) that make up the JAXB metadata file.  Two classes are needed to accomplish this task:
 +
*<code>XmlBindingsModel</code> - used to create a JAXB context that can be used to marshal/unmarshal the metadata file.
 +
*<code>XmlBindingsGenerator</code> - generates one or more JAXB metadata files (one per package) based on a list of ClassDescriptor instances
 +
The generated metadata file will have the format:
 +
<source lang="xml">
 +
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 +
<xml-bindings-list xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/oxm">
 +
  <xml-bindings package-name="simpletable">
 +
    ...
 +
  </xml-bindings>
 +
  <xml-bindings package-name="complextable">
 +
    ...
 +
  </xml-bindings>
 +
  ...
 +
</xml-bindings-list>
 +
</source>
 +
 +
==== org.eclipse.persistence.internal.xr.XmlBindingsModel  ====
 +
The XmlBindingsModel class will be used to create a JAXBContext instance that is able to marshal and unmarshal the generated JAXB metadata file. 
 +
<source lang="java">
 +
/**
 +
* This class is responsible for holding a list of XmlBindings.
 +
*
 +
*/
 +
@XmlAccessorType(javax.xml.bind.annotation.XmlAccessType.FIELD)
 +
@XmlRootElement(name="xml-bindings-list", namespace="http://www.eclipse.org/eclipselink/xsds/persistence/oxm")
 +
public class XmlBindingsModel {
 +
    @XmlElement(name="xml-bindings", namespace="http://www.eclipse.org/eclipselink/xsds/persistence/oxm")
 +
    public List<XmlBindings> bindingsList;
 +
 +
    /**
 +
    * Return the list of XmlBindings
 +
    */
 +
    public List<XmlBindings> getBindingsList() {
 +
        return bindingsList;
 +
    }
 +
 +
    /**
 +
    * Set the list of XmlBindings.
 +
    */
 +
    public void setBindingsList(List<XmlBindings> bindingsList) {
 +
        this.bindingsList = bindingsList;
 +
    }
 +
}
 +
</source>
 +
==== org.eclipse.persistence.tools.dbws.XmlBindingsGenerator ====

Revision as of 13:09, 4 January 2013

Design document for adding JPA/JAXB metadata support to DBWS

The purpose of this document is to outline what changes are to be made to the DBWS code base to enable support for reading/writing JPA/JAXB metadata in place of EclipseLink deployment XML. This feature is required to resolve EclipseLink Bug 332227.

The DBWS builder constructs OR/OX projects, which are marshalled to a given output stream by the builder, and placed in the generated .war archive for use by the runtime. The builder currently utilizes the legacy EclipseLink deployment XML format to marshal/unmarshal these project files, but is required to move to the modern JPA/JAXB metadata format.

JAXB Metadata support

The existing DBWS builder code utilizes the ObjectPersistenceWorkbenchXMLProject class to marshal the OX project at design time and unmarshal it at runtime. The code will be changed to instead use JAXB metadata for these operations. The following pages contain information pertaining to EclipseLink's support for JAXB annotations via XML metadata:

The DBWS builder creates an OX project; this project's descriptors - and each descriptor's mappings - will be used to generate one or more <xml-bindings> elements (one per package) that make up the JAXB metadata file. Two classes are needed to accomplish this task:

  • XmlBindingsModel - used to create a JAXB context that can be used to marshal/unmarshal the metadata file.
  • XmlBindingsGenerator - generates one or more JAXB metadata files (one per package) based on a list of ClassDescriptor instances

The generated metadata file will have the format:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xml-bindings-list xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/oxm">
  <xml-bindings package-name="simpletable">
    ...
  </xml-bindings>
  <xml-bindings package-name="complextable">
    ...
  </xml-bindings>
  ...
</xml-bindings-list>

org.eclipse.persistence.internal.xr.XmlBindingsModel

The XmlBindingsModel class will be used to create a JAXBContext instance that is able to marshal and unmarshal the generated JAXB metadata file.

/**
 * This class is responsible for holding a list of XmlBindings.
 *
 */
@XmlAccessorType(javax.xml.bind.annotation.XmlAccessType.FIELD)
@XmlRootElement(name="xml-bindings-list", namespace="http://www.eclipse.org/eclipselink/xsds/persistence/oxm")
public class XmlBindingsModel {
    @XmlElement(name="xml-bindings", namespace="http://www.eclipse.org/eclipselink/xsds/persistence/oxm")
    public List<XmlBindings> bindingsList;
 
    /**
     * Return the list of XmlBindings
     */
    public List<XmlBindings> getBindingsList() {
        return bindingsList;
    }
 
    /**
     * Set the list of XmlBindings.
     */
    public void setBindingsList(List<XmlBindings> bindingsList) {
        this.bindingsList = bindingsList;
    }
}

org.eclipse.persistence.tools.dbws.XmlBindingsGenerator

Back to the top