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/DesignDocs/293925"

(Testing)
 
(13 intermediate revisions by the same user not shown)
Line 80: Line 80:
  
 
=== OXM mapping support via XML external metadata ===
 
=== OXM mapping support via XML external metadata ===
 
+
Design for this portion of the project can be found [http://wiki.eclipse.org/EclipseLink/DesignDocs/293925/MOXyExtensions here].
The following OXM mappings will be supported via XML external metadata:
+
* [http://wiki.eclipse.org/EclipseLink/DesignDocs/293925#XML_Direct_Mapping XML Direct]
+
* [http://wiki.eclipse.org/EclipseLink/DesignDocs/293925#XML_Composite_Direct_Collection_Mapping XML Composite Direct Collection]
+
* [http://wiki.eclipse.org/EclipseLink/DesignDocs/293925#XML_Composite_Object_Mapping XML Composite Object]
+
* [http://wiki.eclipse.org/EclipseLink/DesignDocs/293925#XML_Composite_Collection_Mapping XML Composite Collection]
+
* [http://wiki.eclipse.org/EclipseLink/DesignDocs/293925#XML_Object_Reference_Mapping XML Object Reference]
+
* [http://wiki.eclipse.org/EclipseLink/DesignDocs/293925#XML_Collection_Reference_Mapping XML Collection Reference]
+
* [http://wiki.eclipse.org/EclipseLink/DesignDocs/293925#XML_Binary_Data_Mapping XML Binary Data]
+
* [http://wiki.eclipse.org/EclipseLink/DesignDocs/293925#XML_Binary_Data_Collection_Mapping XML Binary Data Collection]
+
* [http://wiki.eclipse.org/EclipseLink/DesignDocs/293925#XML_Any_Object_Mapping XML Any Object]
+
* [http://wiki.eclipse.org/EclipseLink/DesignDocs/293925#XML_Any_Collection_Mapping XML Any Collection]
+
* [http://wiki.eclipse.org/EclipseLink/DesignDocs/293925#XML_Fragment_Mapping XML Fragment]
+
* [http://wiki.eclipse.org/EclipseLink/DesignDocs/293925#XML_Fragment_Collection_Mapping XML Fragment Collection]
+
* [http://wiki.eclipse.org/EclipseLink/DesignDocs/293925#XML_Choice_Object_Mapping XML Choice Object]
+
* [http://wiki.eclipse.org/EclipseLink/DesignDocs/293925#XML_Choice_Collection_Mapping XML Choice Collection]
+
* [http://wiki.eclipse.org/EclipseLink/DesignDocs/293925#XML_Transformation_Mapping XML Transformation]
+
* [http://wiki.eclipse.org/EclipseLink/DesignDocs/293925#XML_Any_Attribute_Mapping XML Any Attribute]
+
 
+
==== XML Direct Mapping ====
+
<source lang="xml">
+
<xml-direct-mapping
+
xmlns="http://www.eclipse.org/eclipselink/xsds/persistence">
+
<attribute-name>String</attribute-name>
+
<read-only>false</read-only>
+
<get-method>String</get-method>
+
<set-method>String</set-method>
+
<properties>
+
<property name="String">
+
<value>Text</value>
+
</property>
+
<property name="String">
+
<value>Text</value>
+
</property>
+
</properties>
+
<field name="String"/>
+
<null-value>String</null-value>
+
<converter/>
+
<attribute-classification>String</attribute-classification>
+
<is-cdata>1</is-cdata>
+
<null-policy>
+
<xsi-nil-represents-null>false</xsi-nil-represents-null>
+
<empty-node-represents-null>false</empty-node-represents-null>
+
<null-representation-for-xml>XSI_NIL</null-representation-for-xml>
+
</null-policy>
+
</xml-direct-mapping>
+
</source>
+
 
+
==== XML Composite Direct Collection Mapping ====
+
 
+
<source lang="xml">
+
<xml-composite-direct-collection-mapping
+
xmlns="http://www.eclipse.org/eclipselink/xsds/persistence">
+
<attribute-name>String</attribute-name>
+
<read-only>false</read-only>
+
<get-method>String</get-method>
+
<set-method>String</set-method>
+
<properties>
+
<property name="String">
+
<value>Text</value>
+
</property>
+
<property name="String">
+
<value>Text</value>
+
</property>
+
</properties>
+
<field name="String"/>
+
<value-converter/>
+
<value-converter-class>String</value-converter-class>
+
<container>
+
<collection-type>String</collection-type>
+
</container>
+
<is-cdata>1</is-cdata>
+
</xml-composite-direct-collection-mapping>
+
</source>
+
 
+
==== XML Composite Object Mapping ====
+
 
+
<source lang="xml">
+
<xml-composite-object-mapping
+
xmlns="http://www.eclipse.org/eclipselink/xsds/persistence">
+
<attribute-name>String</attribute-name>
+
<read-only>false</read-only>
+
<get-method>String</get-method>
+
<set-method>String</set-method>
+
<properties>
+
<property name="String">
+
<value>Text</value>
+
</property>
+
<property name="String">
+
<value>Text</value>
+
</property>
+
</properties>
+
<reference-class>String</reference-class>
+
<field name="String"/>
+
<container-attribute>Text</container-attribute>
+
<container-get-method>Text</container-get-method>
+
<container-set-method>Text</container-set-method>
+
<null-policy>
+
<xsi-nil-represents-null>false</xsi-nil-represents-null>
+
<empty-node-represents-null>false</empty-node-represents-null>
+
<null-representation-for-xml>XSI_NIL</null-representation-for-xml>
+
</null-policy>
+
<keep-as-element-policy>String</keep-as-element-policy>
+
</xml-composite-object-mapping>
+
</source>
+
 
+
==== XML Composite Collection Mapping ====
+
 
+
<source lang="xml">
+
<xml-composite-collection-mapping
+
xmlns="http://www.eclipse.org/eclipselink/xsds/persistence">
+
<attribute-name>String</attribute-name>
+
<read-only>false</read-only>
+
<get-method>String</get-method>
+
<set-method>String</set-method>
+
<properties>
+
<property name="String">
+
<value>Text</value>
+
</property>
+
<property name="String">
+
<value>Text</value>
+
</property>
+
</properties>
+
<reference-class>String</reference-class>
+
<field name="String"/>
+
<container>
+
<collection-type>String</collection-type>
+
</container>
+
<container-attribute>Text</container-attribute>
+
<container-get-method>Text</container-get-method>
+
<container-set-method>Text</container-set-method>
+
<keep-as-element-policy>String</keep-as-element-policy>
+
</xml-composite-collection-mapping>
+
</source>
+
 
+
==== XML Object Reference Mapping ====
+
 
+
<source lang="xml">
+
<xml-object-reference-mapping
+
xmlns="http://www.eclipse.org/eclipselink/xsds/persistence">
+
<attribute-name>String</attribute-name>
+
<read-only>false</read-only>
+
<get-method>String</get-method>
+
<set-method>String</set-method>
+
<properties>
+
<property name="String">
+
<value>Text</value>
+
</property>
+
<property name="String">
+
<value>Text</value>
+
</property>
+
</properties>
+
<reference-class>String</reference-class>
+
<allow-null>true</allow-null>
+
<field-translations>
+
<field-translation>
+
<source-field name="String"/>
+
<target-field name="String"/>
+
</field-translation>
+
<field-translation>
+
<source-field name="String"/>
+
<target-field name="String"/>
+
</field-translation>
+
</field-translations>
+
<source-to-target-key-field-association>
+
<field-reference>
+
<source-field name="String"/>
+
<target-field name="String"/>
+
</field-reference>
+
<field-reference>
+
<source-field name="String"/>
+
<target-field name="String"/>
+
</field-reference>
+
</source-to-target-key-field-association>
+
<source-to-target-key-fields>
+
<field name="String"/>
+
<field name="String"/>
+
</source-to-target-key-fields>
+
</xml-object-reference-mapping>
+
</source>
+
 
+
==== XML Collection Reference Mapping ====
+
 
+
<source lang="xml">
+
<xml-collection-reference-mapping
+
xmlns="http://www.eclipse.org/eclipselink/xsds/persistence">
+
<attribute-name>String</attribute-name>
+
<read-only>false</read-only>
+
<get-method>String</get-method>
+
<set-method>String</set-method>
+
<properties>
+
<property name="String">
+
<value>Text</value>
+
</property>
+
<property name="String">
+
<value>Text</value>
+
</property>
+
</properties>
+
<reference-class>String</reference-class>
+
<allow-null>true</allow-null>
+
<field-translations>
+
<field-translation>
+
<source-field name="String"/>
+
<target-field name="String"/>
+
</field-translation>
+
<field-translation>
+
<source-field name="String"/>
+
<target-field name="String"/>
+
</field-translation>
+
</field-translations>
+
<source-to-target-key-field-association>
+
<field-reference>
+
<source-field name="String"/>
+
<target-field name="String"/>
+
</field-reference>
+
<field-reference>
+
<source-field name="String"/>
+
<target-field name="String"/>
+
</field-reference>
+
</source-to-target-key-field-association>
+
<source-to-target-key-fields>
+
<field name="String"/>
+
<field name="String"/>
+
</source-to-target-key-fields>
+
<containerpolicy>
+
<collection-type>String</collection-type>
+
</containerpolicy>
+
<uses-single-node>1</uses-single-node>
+
</xml-collection-reference-mapping>
+
</source>
+
 
+
==== XML Binary Data Mapping ====
+
 
+
<source lang="xml">
+
<xml-binary-data-mapping
+
xmlns="http://www.eclipse.org/eclipselink/xsds/persistence">
+
<attribute-name>String</attribute-name>
+
<read-only>false</read-only>
+
<get-method>String</get-method>
+
<set-method>String</set-method>
+
<properties>
+
<property name="String">
+
<value>Text</value>
+
</property>
+
<property name="String">
+
<value>Text</value>
+
</property>
+
</properties>
+
<field name="String"/>
+
<null-value>String</null-value>
+
<converter/>
+
<attribute-classification>String</attribute-classification>
+
<is-cdata>1</is-cdata>
+
<null-policy>
+
<xsi-nil-represents-null>false</xsi-nil-represents-null>
+
<empty-node-represents-null>false</empty-node-represents-null>
+
<null-representation-for-xml>XSI_NIL</null-representation-for-xml>
+
</null-policy>
+
<is-swa-ref>1</is-swa-ref>
+
<mime-type>String</mime-type>
+
<should-inline-data>1</should-inline-data>
+
</xml-binary-data-mapping>
+
</source>
+
 
+
==== XML Binary Data Collection Mapping ====
+
 
+
==== XML Any Object Mapping ====
+
 
+
<source lang="xml">
+
<xml-any-object-mapping
+
xmlns="http://www.eclipse.org/eclipselink/xsds/persistence">
+
<attribute-name>String</attribute-name>
+
<read-only>false</read-only>
+
<get-method>String</get-method>
+
<set-method>String</set-method>
+
<properties>
+
<property name="String">
+
<value>Text</value>
+
</property>
+
<property name="String">
+
<value>Text</value>
+
</property>
+
</properties>
+
<field name="String"/>
+
<use-xml-root>false</use-xml-root>
+
<keep-as-element-policy>String</keep-as-element-policy>
+
</xml-any-object-mapping>
+
</source>
+
 
+
==== XML Any Collection Mapping ====
+
 
+
<source lang="xml">
+
<xml-any-collection-mapping
+
xmlns="http://www.eclipse.org/eclipselink/xsds/persistence">
+
<attribute-name>String</attribute-name>
+
<read-only>false</read-only>
+
<get-method>String</get-method>
+
<set-method>String</set-method>
+
<properties>
+
<property name="String">
+
<value>Text</value>
+
</property>
+
<property name="String">
+
<value>Text</value>
+
</property>
+
</properties>
+
<field name="String"/>
+
<container>
+
<collection-type>String</collection-type>
+
</container>
+
<use-xml-root>false</use-xml-root>
+
<keep-as-element-policy>String</keep-as-element-policy>
+
</xml-any-collection-mapping>
+
</source>
+
 
+
==== XML Fragment Mapping ====
+
 
+
<source lang="xml">
+
<xml-fragment-mapping
+
xmlns="http://www.eclipse.org/eclipselink/xsds/persistence">
+
<attribute-name>String</attribute-name>
+
<read-only>false</read-only>
+
<get-method>String</get-method>
+
<set-method>String</set-method>
+
<properties>
+
<property name="String">
+
<value>Text</value>
+
</property>
+
<property name="String">
+
<value>Text</value>
+
</property>
+
</properties>
+
<field name="String"/>
+
<null-value>String</null-value>
+
<converter/>
+
<attribute-classification>String</attribute-classification>
+
<is-cdata>1</is-cdata>
+
<null-policy>
+
<xsi-nil-represents-null>false</xsi-nil-represents-null>
+
<empty-node-represents-null>false</empty-node-represents-null>
+
<null-representation-for-xml>XSI_NIL</null-representation-for-xml>
+
</null-policy>
+
</xml-fragment-mapping>
+
</source>
+
 
+
==== XML Fragment Collection ====
+
 
+
<source lang="xml">
+
<xml-fragment-collection-mapping
+
xmlns="http://www.eclipse.org/eclipselink/xsds/persistence">
+
<attribute-name>String</attribute-name>
+
<read-only>false</read-only>
+
<get-method>String</get-method>
+
<set-method>String</set-method>
+
<properties>
+
<property name="String">
+
<value>Text</value>
+
</property>
+
<property name="String">
+
<value>Text</value>
+
</property>
+
</properties>
+
<reference-class>String</reference-class>
+
<field name="String"/>
+
<container>
+
<collection-type>String</collection-type>
+
</container>
+
</xml-fragment-collection-mapping>
+
</source>
+
 
+
==== XML Choice Object Mapping ====
+
 
+
<source lang="xml">
+
<xml-choice-object-mapping
+
xmlns="http://www.eclipse.org/eclipselink/xsds/persistence">
+
<attribute-name>String</attribute-name>
+
<read-only>false</read-only>
+
<get-method>String</get-method>
+
<set-method>String</set-method>
+
<properties>
+
<property name="String">
+
<value>Text</value>
+
</property>
+
<property name="String">
+
<value>Text</value>
+
</property>
+
</properties>
+
<field-to-class-association>
+
<xml-field name="String">
+
<position>0</position>
+
<typed-text-field>1</typed-text-field>
+
<single-node>1</single-node>
+
<schema-type>String</schema-type>
+
<schema-type>String</schema-type>
+
<xml-to-java-conversion-pair>
+
<qname>String</qname>
+
<class-name>String</class-name>
+
</xml-to-java-conversion-pair>
+
<xml-to-java-conversion-pair>
+
<qname>String</qname>
+
<class-name>String</class-name>
+
</xml-to-java-conversion-pair>
+
<java-to-xml-conversion-pair>
+
<qname>String</qname>
+
<class-name>String</class-name>
+
</java-to-xml-conversion-pair>
+
<java-to-xml-conversion-pair>
+
<qname>String</qname>
+
<class-name>String</class-name>
+
</java-to-xml-conversion-pair>
+
<leaf-element-type>String</leaf-element-type>
+
</xml-field>
+
<class-name>String</class-name>
+
</field-to-class-association>
+
<field-to-class-association>
+
<xml-field name="String">
+
<position>0</position>
+
<typed-text-field>1</typed-text-field>
+
<single-node>1</single-node>
+
<schema-type>String</schema-type>
+
<schema-type>String</schema-type>
+
<xml-to-java-conversion-pair>
+
<qname>String</qname>
+
<class-name>String</class-name>
+
</xml-to-java-conversion-pair>
+
<xml-to-java-conversion-pair>
+
<qname>String</qname>
+
<class-name>String</class-name>
+
</xml-to-java-conversion-pair>
+
<java-to-xml-conversion-pair>
+
<qname>String</qname>
+
<class-name>String</class-name>
+
</java-to-xml-conversion-pair>
+
<java-to-xml-conversion-pair>
+
<qname>String</qname>
+
<class-name>String</class-name>
+
</java-to-xml-conversion-pair>
+
<leaf-element-type>String</leaf-element-type>
+
</xml-field>
+
<class-name>String</class-name>
+
</field-to-class-association>
+
</xml-choice-object-mapping>
+
</source>
+
 
+
==== XML Choice Collection Mapping ====
+
 
+
<source lang="xml">
+
<xml-choice-collection-mapping
+
xmlns="http://www.eclipse.org/eclipselink/xsds/persistence">
+
<attribute-name>String</attribute-name>
+
<read-only>false</read-only>
+
<get-method>String</get-method>
+
<set-method>String</set-method>
+
<properties>
+
<property name="String">
+
<value>Text</value>
+
</property>
+
<property name="String">
+
<value>Text</value>
+
</property>
+
</properties>
+
<container-policy>
+
<collection-type>String</collection-type>
+
</container-policy>
+
<field-to-class-association>
+
<xml-field name="String">
+
<position>0</position>
+
<typed-text-field>1</typed-text-field>
+
<single-node>1</single-node>
+
<schema-type>String</schema-type>
+
<schema-type>String</schema-type>
+
<xml-to-java-conversion-pair>
+
<qname>String</qname>
+
<class-name>String</class-name>
+
</xml-to-java-conversion-pair>
+
<xml-to-java-conversion-pair>
+
<qname>String</qname>
+
<class-name>String</class-name>
+
</xml-to-java-conversion-pair>
+
<java-to-xml-conversion-pair>
+
<qname>String</qname>
+
<class-name>String</class-name>
+
</java-to-xml-conversion-pair>
+
<java-to-xml-conversion-pair>
+
<qname>String</qname>
+
<class-name>String</class-name>
+
</java-to-xml-conversion-pair>
+
<leaf-element-type>String</leaf-element-type>
+
</xml-field>
+
<class-name>String</class-name>
+
</field-to-class-association>
+
<field-to-class-association>
+
<xml-field name="String">
+
<position>0</position>
+
<typed-text-field>1</typed-text-field>
+
<single-node>1</single-node>
+
<schema-type>String</schema-type>
+
<schema-type>String</schema-type>
+
<xml-to-java-conversion-pair>
+
<qname>String</qname>
+
<class-name>String</class-name>
+
</xml-to-java-conversion-pair>
+
<xml-to-java-conversion-pair>
+
<qname>String</qname>
+
<class-name>String</class-name>
+
</xml-to-java-conversion-pair>
+
<java-to-xml-conversion-pair>
+
<qname>String</qname>
+
<class-name>String</class-name>
+
</java-to-xml-conversion-pair>
+
<java-to-xml-conversion-pair>
+
<qname>String</qname>
+
<class-name>String</class-name>
+
</java-to-xml-conversion-pair>
+
<leaf-element-type>String</leaf-element-type>
+
</xml-field>
+
<class-name>String</class-name>
+
</field-to-class-association>
+
</xml-choice-collection-mapping>
+
</source>
+
 
+
==== XML Transformation Mapping ====
+
 
+
<source lang="xml">
+
<xml-transformation-mapping xmlns="http://www.eclipse.org/eclipselink/xsds/persistence">
+
<attribute-name>String</attribute-name>
+
<read-only>false</read-only>
+
<get-method>String</get-method>
+
<set-method>String</set-method>
+
<properties>
+
<property name="String">
+
<value>Text</value>
+
</property>
+
<property name="String">
+
<value>Text</value>
+
</property>
+
</properties>
+
<attribute-method>String</attribute-method>
+
<attribute-transformer>String</attribute-transformer>
+
<mutable>true</mutable>
+
<indirection/>
+
<field-transformations>
+
<field-transformation>
+
<field name="String"/>
+
</field-transformation>
+
<field-transformation>
+
<field name="String"/>
+
</field-transformation>
+
</field-transformations>
+
</xml-transformation-mapping>
+
</source>
+
 
+
==== XML Any Attribute Mapping ====
+
 
+
<source lang="xml">
+
<xml-any-attribute-mapping xmlns="http://www.eclipse.org/eclipselink/xsds/persistence">
+
<attribute-name>String</attribute-name>
+
<read-only>false</read-only>
+
<get-method>String</get-method>
+
<set-method>String</set-method>
+
<properties>
+
<property name="String">
+
<value>Text</value>
+
</property>
+
<property name="String">
+
<value>Text</value>
+
</property>
+
</properties>
+
<field name="String"/>
+
<container>
+
<collection-type>String</collection-type>
+
</container>
+
<include-namespace-declaration>1</include-namespace-declaration>
+
<include-schema-instance>1</include-schema-instance>
+
</xml-any-attribute-mapping>
+
</source>
+
  
 
== Design / Functionality ==
 
== Design / Functionality ==
Line 756: Line 181:
 
| align="center" |  
 
| align="center" |  
 
| align="center" |  
 
| align="center" |  
 +
| align="center" |
 +
| align="center" |
 +
|-
 +
| XmlElementDecl
 +
| xml-element-decl
 +
| align="center" | 
 +
| align="center" |
 +
| align="center" | X
 
| align="center" |  
 
| align="center" |  
 
| align="center" |  
 
| align="center" |  
Line 817: Line 250:
 
| XmlIDREF  
 
| XmlIDREF  
 
| xml-idref  
 
| xml-idref  
 +
| align="center" |
 +
| align="center" |
 +
| align="center" |
 +
| align="center" | X
 +
| align="center" |
 +
|-
 +
| XmlInlineBinaryData
 +
| xml-inline-binary-data
 
| align="center" |  
 
| align="center" |  
 
| align="center" |  
 
| align="center" |  
Line 886: Line 327:
 
| align="center" |  
 
| align="center" |  
 
| align="center" | X
 
| align="center" | X
 +
|-
 +
| XmlRegistry
 +
| xml-registry
 +
| align="center" | X
 +
| align="center" |
 +
| align="center" |
 +
| align="center" |
 +
| align="center" |
 
|-
 
|-
 
| XmlRootElement  
 
| XmlRootElement  
Line 954: Line 403:
 
==== Schema file  ====
 
==== Schema file  ====
  
The schema file for EclipseLink 2.1 can be found in <code>eclipselink.jar</code> here: <code>xsd\eclipselink_oxm_2_1.xsd</code>.  The XML schema that will be supported in EclipseLink 2.1 follows:
+
The schema file for EclipseLink 2.1 can be found in the <code>eclipselink.jar</code> here: <code>xsd\eclipselink_oxm_2_1.xsd</code>.  The JAR can be downloaded on the [http://www.eclipse.org/eclipselink/downloads/nightly.php EclipseLink nightly build page].
 
+
<source lang="xml">
+
<?xml version="1.0" encoding="UTF-8"?>
+
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+
    xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/oxm"
+
    targetNamespace="http://www.eclipse.org/eclipselink/xsds/persistence/oxm"
+
    elementFormDefault="qualified"
+
    attributeFormDefault="unqualified"
+
    version="2.1">
+
 
+
    <xs:element name="xml-bindings">
+
        <xs:complexType>
+
            <xs:all>
+
                <xs:element ref="xml-java-type-adapters" />
+
                <xs:element ref="xml-schema" />
+
                <xs:element ref="xml-schema-type" />
+
                <xs:element name="java-types">
+
                    <xs:complexType>
+
                        <xs:sequence>
+
                            <xs:element ref="java-type" maxOccurs="unbounded" />
+
                        </xs:sequence>
+
                    </xs:complexType>
+
                </xs:element>
+
            </xs:all>
+
            <xs:attribute name="xml-accessor-type" type="xml-access-type" default="PUBLIC_MEMBER" />
+
            <xs:attribute name="xml-accessor-order" type="xml-access-order" default="UNDEFINED" />
+
        </xs:complexType>
+
    </xs:element>
+
    <xs:element name="java-type">
+
        <xs:complexType>
+
            <xs:all>
+
                <xs:element ref="xml-type" />
+
                <xs:element ref="xml-root-element" />
+
                <xs:element ref="xml-see-also" />
+
                <xs:element ref="xml-java-type-adapter" />
+
                <xs:element name="java-attributes">
+
                    <xs:complexType>
+
                        <xs:sequence>
+
                            <xs:element ref="java-attribute" maxOccurs="unbounded" />
+
                        </xs:sequence>
+
                    </xs:complexType>
+
                </xs:element>
+
            </xs:all>
+
            <xs:attribute name="name" type="xs:string" />
+
            <xs:attribute name="xml-transient" type="xs:boolean" default="false" />
+
            <xs:attribute name="xml-customizer" type="xs:string" />
+
            <xs:attribute name="xml-accessor-type" type="xml-access-type" default="PUBLIC_MEMBER" />
+
            <xs:attribute name="xml-accessor-order" type="xml-access-order" default="UNDEFINED" />
+
        </xs:complexType>
+
    </xs:element>
+
    <xs:element name="java-attribute" type="java-attribute" />
+
    <xs:complexType name="java-attribute" abstract="true">
+
        <xs:attribute name="java-attribute" type="xs:string" />
+
    </xs:complexType>
+
 
+
    <!-- Enums -->
+
    <xs:simpleType name="xml-access-order">
+
        <xs:restriction base="xs:string">
+
            <xs:enumeration value="ALPHABETICAL" />
+
            <xs:enumeration value="UNDEFINED" />
+
        </xs:restriction>
+
    </xs:simpleType>
+
    <xs:simpleType name="xml-access-type">
+
        <xs:restriction base="xs:string">
+
            <xs:enumeration value="FIELD" />
+
            <xs:enumeration value="NONE" />
+
            <xs:enumeration value="PROPERTY" />
+
            <xs:enumeration value="PUBLIC_MEMBER" />
+
        </xs:restriction>
+
    </xs:simpleType>
+
    <xs:simpleType name="xml-ns-form">
+
        <xs:restriction base="xs:string">
+
            <xs:enumeration value="UNQUALIFIED" />
+
            <xs:enumeration value="QUALIFIED" />
+
            <xs:enumeration value="UNSET" />
+
        </xs:restriction>
+
    </xs:simpleType>
+
 
+
    <!-- @Target(value=PACKAGE) -->
+
    <xs:element name="xml-schema">
+
        <xs:complexType>
+
            <xs:sequence>
+
                <xs:element name="xml-ns" minOccurs="0" maxOccurs="unbounded">
+
                    <xs:complexType>
+
                        <xs:attribute name="namespace-uri" type="xs:string" />
+
                        <xs:attribute name="prefix" type="xs:string" />
+
                    </xs:complexType>
+
                </xs:element>
+
            </xs:sequence>
+
            <xs:attribute name="attribute-form-default" type="xml-ns-form" default="UNSET" />
+
            <xs:attribute name="element-form-default" type="xml-ns-form" default="UNSET" />
+
            <xs:attribute name="location" type="xs:string" />
+
            <xs:attribute name="namespace" type="xs:string" />
+
        </xs:complexType>
+
    </xs:element>
+
    <xs:element name="xml-java-type-adapters">
+
        <xs:complexType>
+
            <xs:sequence>
+
                <xs:element ref="xml-java-type-adapter" maxOccurs="unbounded" />
+
            </xs:sequence>
+
        </xs:complexType>
+
    </xs:element>
+
 
+
    <!-- @Target(value={FIELD,METHOD,PACKAGE}) -->
+
    <xs:element name="xml-schema-type">
+
        <xs:complexType>
+
            <xs:attribute name="name" type="xs:string" use="required" />
+
            <xs:attribute name="namespace" type="xs:string" default="http://www.w3.org/2001/XMLSchema" />
+
            <xs:attribute name="type" type="xs:string" default="javax.xml.bind.annotation.XmlSchemaType.DEFAULT" />
+
        </xs:complexType>
+
    </xs:element>
+
 
+
    <!-- @Target(value={PACKAGE,FIELD,METHOD,TYPE,PARAMETER}) -->
+
    <xs:element name="xml-java-type-adapter" substitutionGroup="java-attribute">
+
        <xs:complexType>
+
            <xs:complexContent>
+
                <xs:extension base="java-attribute">
+
                    <xs:attribute name="value" type="xs:string" />
+
                    <xs:attribute name="type" type="xs:string" default="javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter.DEFAULT" />
+
                </xs:extension>
+
            </xs:complexContent>
+
        </xs:complexType>
+
    </xs:element>
+
 
+
    <!-- @Target(value={FIELD,METHOD,TYPE}) -->
+
    <xs:element name="xml-transient" substitutionGroup="java-attribute">
+
        <xs:complexType>
+
            <xs:complexContent>
+
                <xs:extension base="java-attribute" />
+
            </xs:complexContent>
+
        </xs:complexType>
+
    </xs:element>
+
 
+
    <!-- @Target(value=TYPE) -->
+
    <xs:element name="xml-type">
+
        <xs:complexType>
+
            <xs:attribute name="name" type="xs:string" default="##default" />
+
            <xs:attribute name="namespace" type="xs:string" default="##default" />
+
            <xs:attribute name="prop-order">
+
                <xs:simpleType>
+
                    <xs:list itemType="xs:string" />
+
                </xs:simpleType>
+
            </xs:attribute>
+
        </xs:complexType>
+
    </xs:element>
+
    <xs:element name="xml-root-element">
+
        <xs:complexType>
+
            <xs:attribute name="name" type="xs:string" default="##default" />
+
            <xs:attribute name="namespace" type="xs:string" default="##default" />
+
        </xs:complexType>
+
    </xs:element>
+
    <xs:element name="xml-see-also">
+
        <xs:simpleType>
+
            <xs:list itemType="xs:string" />
+
        </xs:simpleType>
+
    </xs:element>
+
 
+
    <!-- @Target(value={FIELD})  -->
+
 
+
    <!-- @Target(value={FIELD,METHOD}) -->
+
    <xs:element name="xml-any-attribute" substitutionGroup="java-attribute">
+
        <xs:complexType>
+
            <xs:complexContent>
+
                <xs:extension base="java-attribute" />
+
            </xs:complexContent>
+
        </xs:complexType>
+
    </xs:element>
+
    <xs:element name="xml-attribute" substitutionGroup="java-attribute">
+
        <xs:complexType>
+
            <xs:complexContent>
+
                <xs:extension base="java-attribute">
+
                    <xs:all>
+
                        <xs:element ref="xml-java-type-adapter" />
+
                        <xs:element ref="xml-schema-type" />
+
                    </xs:all>
+
                    <xs:attribute name="name" type="xs:string" default="##default" />
+
                    <xs:attribute name="namespace" type="xs:string" default="##default" />
+
                    <xs:attribute name="required" type="xs:boolean" default="false" />
+
                    <xs:attribute name="xml-id" type="xs:boolean" default="false" />
+
                    <xs:attribute name="xml-idref" type="xs:boolean" default="false" />
+
                    <xs:attribute name="xml-list" type="xs:boolean" default="false" />
+
                    <xs:attribute name="xml-attachment-ref" type="xs:boolean" default="false" />
+
                    <xs:attribute name="xml-mime-type" type="xs:string" />
+
                </xs:extension>
+
            </xs:complexContent>
+
        </xs:complexType>
+
    </xs:element>
+
    <xs:element name="xml-any-element" substitutionGroup="java-attribute">
+
        <xs:complexType>
+
            <xs:complexContent>
+
                <xs:extension base="java-attribute">
+
                    <xs:all>
+
                        <xs:element ref="xml-java-type-adapter" />
+
                    </xs:all>
+
                    <xs:attribute name="xml-mixed" type="xs:boolean" default="false" />
+
                    <xs:attribute name="lax" type="xs:boolean" default="false" />
+
                    <xs:attribute name="dom-handler" type="xs:string" default="javax.xml.bind.annotation.W3CDomHandler" />
+
                </xs:extension>
+
            </xs:complexContent>
+
        </xs:complexType>
+
    </xs:element>
+
    <xs:element name="xml-element" substitutionGroup="java-attribute">
+
        <xs:complexType>
+
            <xs:complexContent>
+
                <xs:extension base="java-attribute">
+
                    <xs:all>
+
                        <xs:element ref="xml-element-wrapper" />
+
                        <xs:element ref="xml-java-type-adapter" />
+
<xs:element ref="xml-map" />
+
                        <xs:element ref="xml-schema-type" />
+
                    </xs:all>
+
                    <xs:attribute name="name" type="xs:string" default="##default" />
+
                    <xs:attribute name="namespace" type="xs:string" default="##default" />
+
                    <xs:attribute name="default-value" type="xs:string" />
+
                    <xs:attribute name="nillable" type="xs:boolean" default="false" />
+
                    <xs:attribute name="required" type="xs:boolean" default="false" />
+
                    <xs:attribute name="type" type="xs:string" default="javax.xml.bind.annotation.XmlElement.DEFAULT" />
+
                    <xs:attribute name="xml-id" type="xs:boolean" default="false" />
+
                    <xs:attribute name="xml-idref" type="xs:boolean" default="false" />
+
                    <xs:attribute name="xml-list" type="xs:boolean" default="false" />
+
                    <xs:attribute name="xml-attachment-ref" type="xs:boolean" default="false" />
+
                    <xs:attribute name="xml-mime-type" type="xs:string" />
+
                </xs:extension>
+
            </xs:complexContent>
+
        </xs:complexType>
+
    </xs:element>
+
    <xs:element name="xml-elements" substitutionGroup="java-attribute">
+
        <xs:complexType>
+
            <xs:complexContent>
+
                <xs:extension base="java-attribute">
+
                    <xs:sequence>
+
                        <xs:element ref="xml-element" maxOccurs="unbounded" />
+
                        <xs:element ref="xml-element-wrapper" minOccurs="0" />
+
                    </xs:sequence>
+
                    <xs:attribute name="xml-idref" type="xs:boolean" default="false" />
+
                    <xs:attribute name="xml-list" type="xs:boolean" default="false" />
+
                </xs:extension>
+
            </xs:complexContent>
+
        </xs:complexType>
+
    </xs:element>
+
    <xs:element name="xml-element-ref" substitutionGroup="java-attribute">
+
        <xs:complexType>
+
            <xs:complexContent>
+
                <xs:extension base="java-attribute">
+
                    <xs:all>
+
                        <xs:element ref="xml-element-wrapper" />
+
                    </xs:all>
+
                    <xs:attribute name="name" type="xs:string" default="##default" />
+
                    <xs:attribute name="namespace" type="xs:string" />
+
                    <xs:attribute name="type" type="xs:string" default="javax.xml.bind.annotation.XmlElementRef.DEFAULT" />
+
                </xs:extension>
+
            </xs:complexContent>
+
        </xs:complexType>
+
    </xs:element>
+
    <xs:element name="xml-element-refs" substitutionGroup="java-attribute">
+
        <xs:complexType>
+
            <xs:complexContent>
+
                <xs:extension base="java-attribute">
+
                    <xs:sequence>
+
                        <xs:element ref="xml-element-ref" maxOccurs="unbounded" />
+
                        <xs:element ref="xml-element-wrapper" minOccurs="0" />
+
                    </xs:sequence>
+
                </xs:extension>
+
            </xs:complexContent>
+
        </xs:complexType>
+
    </xs:element>
+
    <xs:element name="xml-element-wrapper">
+
        <xs:complexType>
+
            <xs:attribute name="name" type="xs:string" default="##default" />
+
            <xs:attribute name="namespace" type="xs:string" default="##default" />
+
            <xs:attribute name="nillable" type="xs:boolean" default="false" />
+
            <xs:attribute name="required" type="xs:boolean" default="false" />
+
        </xs:complexType>
+
    </xs:element>
+
    <xs:element name="xml-value" substitutionGroup="java-attribute">
+
        <xs:complexType>
+
            <xs:complexContent>
+
                <xs:extension base="java-attribute" />
+
            </xs:complexContent>
+
        </xs:complexType>
+
    </xs:element>
+
    <xs:element name="xml-map">
+
        <xs:complexType>
+
            <xs:attribute name="key-type" type="xs:string"/>
+
            <xs:attribute name="value-type" type="xs:string"/>                                                   
+
        </xs:complexType>
+
    </xs:element>
+
</xs:schema>
+
</source>
+
  
 
==== XML Bindings  ====
 
==== XML Bindings  ====
Line 1,252: Line 412:
  
 
==== [http://wiki.eclipse.org/EclipseLink/DesignDocs/277920#Boot_Strapping Specifying the Externalized Metadata File] ====
 
==== [http://wiki.eclipse.org/EclipseLink/DesignDocs/277920#Boot_Strapping Specifying the Externalized Metadata File] ====
 
=== Common Mapping Metadata ===
 
 
==== XML Schema ====
 
 
<source lang="xml">
 
<xs:complexType name="java-attribute">
 
<xs:all>
 
<xs:element ref="properties"/>
 
</xs:all>
 
<xs:attribute name="attribute-name" type="xs:string"/>
 
<xs:attribute name="get-method" type="xs:string"/>
 
<xs:attribute name="set-method" type="xs:string"/>
 
<xs:attribute name="read-only" type="xs:boolean" default="false"/>
 
</xs:complexType>
 
 
<xs:element name="properties">
 
<xs:complexType>
 
<xs:sequence>
 
<xs:element name="property" minOccurs="0" maxOccurs="unbounded">
 
<xs:complexType>
 
<xs:attribute name="name" type="xs:string"/>
 
<xs:attribute name="value" type="xs:string"/>
 
</xs:complexType>
 
</xs:element>
 
</xs:sequence>
 
</xs:complexType>
 
</xs:element>
 
</source>
 
 
==== XML ====
 
 
<source lang="xml">
 
<xml-mapping
 
attribute-name="String"
 
read-only="false"
 
get-method="String"
 
set-method="String">
 
<properties>
 
<property name="String" value="String"/>
 
<property name="String" value="String"/>
 
</properties>
 
</xml-mapping>
 
</source>
 
 
 
=== Null Policy ===
 
 
==== XML Schema ====
 
 
<source lang="xml">
 
<xs:element name="null-policy">
 
    <xs:complexType>
 
        <xs:attribute name="set-performed-for-absent-node" type="xs:boolean" default="true"/>
 
        <xs:attribute name="null-represented-by-empty-node" type="xs:boolean" default="false"/>
 
        <xs:attribute name="null-represented-by-xsi-nil" type="xs:boolean" default="false"/>
 
        <xs:attribute name="marshal-null-representation">
 
            <xs:simpleType>
 
                <xs:restriction base="xs:string">
 
                    <xs:enumeration value="XSI_NIL"/>
 
                    <xs:enumeration value="ABSENT_NODE"/>
 
                    <xs:enumeration value="EMPTY_NODE"/>
 
                </xs:restriction>
 
            </xs:simpleType>
 
        </xs:attribute>
 
    </xs:complexType>
 
</xs:element>
 
</source>
 
 
==== XML ====
 
 
<source lang="java">
 
<null-policy>
 
    <xsi-nil-represents-null>false</xsi-nil-represents-null>
 
    <empty-node-represents-null>false</empty-node-represents-null>
 
    <null-representation-for-xml>XSI_NIL</null-representation-for-xml>
 
</null-policy>
 
</source>
 
 
=== XML Any Attribute Mapping ===
 
 
==== XML Schema ====
 
 
<source lang="xml">
 
<xs:element name="xml-any-attribute-mapping">
 
<xs:complexType>
 
<xs:complexContent>
 
<xs:extension base="xml-mapping">
 
<xs:attribute name="include-namespace-declaration" type="xs:boolean"/>
 
<xs:attribute name="include-schema-instance" type="xs:boolean"/>
 
</xs:extension>
 
</xs:complexContent>
 
</xs:complexType>
 
</xs:element>
 
</source>
 
 
==== XML ====
 
 
<source lang="xml">
 
<xml-any-attribute-mapping
 
attribute-name="String"
 
read-only="false"
 
get-method="String"
 
set-method="String"
 
include-namespace-declaration="true"
 
include-schema-instance="true">
 
<properties>
 
<property name="String" value="String"/>
 
</properties>
 
</xml-any-attribute-mapping>
 
</source>
 
 
=== XML Attribute ===
 
 
<source lang="xml">
 
<xs:element name="xml-attribute" substitutionGroup="java-attribute">
 
<xs:complexType>
 
<xs:complexContent>
 
<xs:extension base="java-attribute">
 
<xs:all>
 
<xs:element ref="xml-schema-type"/>
 
<xs:element ref="xml-java-type-adapter"/>
 
<xs:element ref="null-policy"/>
 
</xs:all>
 
<xs:attribute ref="xml-inline-binary-data"/>
 
<xs:attribute ref="xml-id"/>
 
<xs:attribute ref="xml-idref"/>
 
<xs:attribute ref="xml-attachment-ref"/>
 
<xs:attribute ref="xml-list"/>
 
<xs:attribute ref="xml-mime-type"/>
 
<xs:attribute name="name" type="xs:string" default="##default"/>
 
<xs:attribute name="namespace" type="xs:string" default="##default"/>
 
<xs:attribute name="required" type="xs:boolean" default="false"/>
 
</xs:extension>
 
</xs:complexContent>
 
</xs:complexType>
 
</xs:element>
 
</source>
 
 
=== XML Element ===
 
<source lang="xml">
 
<xs:element name="xml-element" substitutionGroup="java-attribute">
 
<xs:complexType>
 
<xs:complexContent>
 
<xs:extension base="java-attribute">
 
<xs:all>
 
<xs:element ref="xml-schema-type"/>
 
<xs:element ref="xml-element-wrapper"/>
 
<xs:element ref="xml-java-type-adapter"/>
 
<xs:element ref="null-policy"/>
 
</xs:all>
 
<xs:attribute ref="xml-inline-binary-data"/>
 
<xs:attribute ref="xml-id"/>
 
<xs:attribute ref="xml-idref"/>
 
<xs:attribute ref="xml-attachment-ref"/>
 
<xs:attribute ref="xml-list"/>
 
<xs:attribute ref="xml-mime-type"/>
 
<xs:attribute name="name" type="xs:string" default="##default"/>
 
<xs:attribute name="namespace" type="xs:string" default="##default"/>
 
<xs:attribute name="default-value" type="xs:string"/>
 
<xs:attribute name="nillable" type="xs:boolean" default="false"/>
 
<xs:attribute name="required" type="xs:boolean" default="false"/>
 
<xs:attribute name="type" type="xs:string" default="javax.xml.bind.annotation.XmlElement.DEFAULT"/>
 
</xs:extension>
 
</xs:complexContent>
 
</xs:complexType>
 
</xs:element>
 
</source>
 
  
 
== Testing ==
 
== Testing ==
 +
The basic testing strategy will be to have a test suite for each annotation (JAXB) and mapping (MOXy).  Each suite will, at a minimum, test schema generation, unmarshal and marshal operations.
  
 
== API ==
 
== API ==

Latest revision as of 11:09, 26 February 2010

Design Specification: MOXy - OXM XSD

ER 293925

Document History

Date Author Version Description & Notes
2009/11/09 David McCann Initial Contribution. The work outlined in this design document is a continuation of the work done for ER 277920
2009/12/08 David McCann Bringing page up to date: xml schema, goals, etc. needed attention.

Project overview

Goals:

  • Support JAXB 2.1 annotations via XML external metadata.
  • Support MOXy metadata (used to extend JAXB) via external metadata.
  • Support the use of the XML metadata as a means to override metadata specified by annotations.

Note:

  • This work is a continuation of support added for ER 277920

Concepts

  • Although JAXB annotations can be applied independently they are logically linked. For example @XmlList can only be used with XmlElement, XmlAttribute, XmlValue, XmlIDREF. These rules will be enforced through the XML metadata.
  • Overriding will be handled at the property level.

Requirements

The following sections will expand the goals of this project into more concrete requirements.

Design Constraints

JAXB Annotations

The XML should have the same feel as the JAXB annotations.

javax.xml.bind.annotation Javadoc

EclipseLink JPA Metadata

The XML should have the same feel as the equivalent XML for EclipseLink JPA

EclipseLink JPA XSD

EclipseLink MOXy Metadata

At a minimum the metadata available in EclipseLink 2.1 must be available in the new format (see below).

High Level Design

JAXB 2.1 annotation support via XML external metadata

This support will be added as outlined in the following phases:

XML external metadata support for WebServices

TBD.

OXM mapping support via XML external metadata

Design for this portion of the project can be found here.

Design / Functionality

XML Schema

Design Notes

Design notes from 2.0 release

Annotations to XML

The following table outlines how annotations relate to schema components:

Annotation XML Global Element Global Attribute Local Element Local Attribute Enum
XmlAccessOrder xml-access-order X
XmlAccessorOrder xml-accessor-order X
XmlAccessorType xml-accessor-type X
XmlAccessType xml-access-type X
XmlAnyAttribute xml-any-attribute X
XmlAnyElement xml-any-element X
XmlAttribute xml-attribute X
XmlAttributeRef xml-attribute-ref X
XmlCustomizer (MOXy) xml-customizer X
XmlElement xml-element X
XmlElementDecl xml-element-decl X
XmlElements xml-elements X
XmlElementRef xml-element-ref X
XmlElementRefs xml-element-refs X
XmlElementWrapper xml-element-wrapper X
XmlEnum xml-enum X
XmlEnumValue xml-enum-value X
XmlID xml-id X
XmlIDREF xml-idref X
XmlInlineBinaryData xml-inline-binary-data X
XmlJavaTypeAdapter xml-java-type-adapter X
XmlJavaTypeAdapters xml-java-type-adapters X
XmlList xml-List X
N/A xml-map X
XmlMimeType xml-mime-type X
XmlMixed xml-mixed X
XmlNs xml-ns X
XmlNsForm xml-ns-form X
XmlRegistry xml-registry X
XmlRootElement xml-root-element X
XmlSchema xml-schema X
XmlSchemaType xml-schema-type X
XmlSchemaTypes xml-schema-types X
XmlSeeAlso xml-see-also X
XmlTransient xml-transient X
XmlType xml-type X
XmlValue xml-value X

Schema file

The schema file for EclipseLink 2.1 can be found in the eclipselink.jar here: xsd\eclipselink_oxm_2_1.xsd. The JAR can be downloaded on the EclipseLink nightly build page.

XML Bindings

Bindings info/example from 2.0

Boot Strapping

Specifying the Externalized Metadata File

Testing

The basic testing strategy will be to have a test suite for each annotation (JAXB) and mapping (MOXy). Each suite will, at a minimum, test schema generation, unmarshal and marshal operations.

API

GUI

Config files

Documentation

Open Issues

This section lists the open issues that are still pending that must be decided prior to fully implementing this project's requirements.

Issue # Owner Description / Notes

Decisions

This section lists decisions made. These are intended to document the resolution of open issues or constraints added to the project that are important.

Issue # Description / Notes Decision

Future Considerations

During the research for this project the following items were identified as out of scope but are captured here as potential future enhancements. If agreed upon during the review process these should be logged in the bug system.

Back to the top