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/UserGuide/SDO/Introduction to EclipseLink SDO (ELUG)"

m (Using Type)
m
Line 1: Line 1:
Information pending
+
 
  
 
This section introduces EclipseLink implementation of Service Data Objects (SDO) specification, as well as provides information on how you can use it in your application development.
 
This section introduces EclipseLink implementation of Service Data Objects (SDO) specification, as well as provides information on how you can use it in your application development.
Line 5: Line 5:
  
 
==Using SDO Metadata==
 
==Using SDO Metadata==
SDO metadata is represented as <code>[[#Using Type|Type]]</code> and <code>[[#Using Property|Property]]</code> objects. You define the metadata at run time either programmatically, or from an XML schema.
+
SDO metadata is represented as <tt>[[#Using Type|Type]]</tt> and <tt>[[#Using Property|Property]]</tt> objects. You define the metadata at run time either programmatically, or from an XML schema.
  
  
 
===Using Type===
 
===Using Type===
SDO <code>Type</code> acts similarly to a Class in Java, and provides much of the same metadata as the Java Reflection API provides for Java classes.
+
SDO <tt>Type</tt> acts similarly to a Class in Java, and provides much of the same metadata as the Java Reflection API provides for Java classes.
  
In EclipseLink, a <code>Type</code> wraps an object-XML mapping (OXM) descriptor (see ...).
+
In EclipseLink, a <tt>Type</tt> wraps an object-XML mapping (OXM) descriptor (see ...).
 
   
 
   
A <code>Type</code> can have supertypes, which corresponds to the EclipseLink concept of an inheritance policy (see ...).
+
A <tt>Type</tt> can have supertypes, which corresponds to the EclipseLink concept of an inheritance policy (see ...).
  
 
For more information, see [http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.emf.ecore.sdo.doc/references/javadoc/commonj/sdo/Type.html Type API].
 
For more information, see [http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.emf.ecore.sdo.doc/references/javadoc/commonj/sdo/Type.html Type API].
Line 25: Line 25:
  
 
===Using Property===
 
===Using Property===
SDO <code>Property</code> acts similarly to a property in Java and provides much of the same metadata as the Java Reflection API provides for Java fields or methods.
+
SDO <tt>Property</tt> acts similarly to a property in Java and provides much of the same metadata as the Java Reflection API provides for Java fields or methods.
  
In EclipseLink, a <code>Property</code> wraps an object-XML mapping (see ...) in the following way:
+
In EclipseLink, a <tt>Property</tt> wraps an object-XML mapping (see ...) in the following way:
  
 
* DataType=true + isMany=false (see OXM Direct Mapping (or an OXM Binary Mapping))  
 
* DataType=true + isMany=false (see OXM Direct Mapping (or an OXM Binary Mapping))  
Line 44: Line 44:
  
 
====How to Define Metadata with EclipseLink XSDHelper====
 
====How to Define Metadata with EclipseLink XSDHelper====
You use the <code>XSDHelper</code> to do the following:
+
You use the <tt>XSDHelper</tt> to do the following:
 
* Define SDO metadata, where SDO metadata is derived from XML schemas.
 
* Define SDO metadata, where SDO metadata is derived from XML schemas.
 
* Generate XML schemas from SDO types.
 
* Generate XML schemas from SDO types.
Line 56: Line 56:
  
 
====How to Define Metadata with EclipseLink TypeHelper====
 
====How to Define Metadata with EclipseLink TypeHelper====
You use the <code>TypeHelper</code> to do the following:
+
You use the <tt>TypeHelper</tt> to do the following:
 
* Look up SDO metadata.
 
* Look up SDO metadata.
* Programmatically define SDO metadata (note that this is not the typical usage for the <code>TypeHelper</code>).  
+
* Programmatically define SDO metadata (note that this is not the typical usage for the <tt>TypeHelper</tt>).  
  
  
Line 65: Line 65:
  
 
===Using DataObject (see 17.2.6 “Mapping converters and transformers” in JITDG/ELUG)===
 
===Using DataObject (see 17.2.6 “Mapping converters and transformers” in JITDG/ELUG)===
<code>DataObject</code> in SDO corresponds to a Java Object (POJO).  
+
<tt>DataObject</tt> in SDO corresponds to a Java Object (POJO).  
To define object-XML mappings, you map the <code>DataObject</code> to XML.
+
To define object-XML mappings, you map the <tt>DataObject</tt> to XML.
You can create your <code>DataObject</code> as either dynamic (see [http://wiki.eclipse.org/EclipseLink/Examples/SDO/DynamicAPI Dynamic DataObject Examples]), or static by applying a type-safe interface to it (see [http://wiki.eclipse.org/EclipseLink/Examples/SDO/StaticAPI Static DataObject Examples]).  
+
You can create your <tt>DataObject</tt> as either dynamic (see [http://wiki.eclipse.org/EclipseLink/Examples/SDO/DynamicAPI Dynamic DataObject Examples]), or static by applying a type-safe interface to it (see [http://wiki.eclipse.org/EclipseLink/Examples/SDO/StaticAPI Static DataObject Examples]).  
The <code>DataObject</code> provides an XPath-like (see ...) means of data access. For example, the following code is valid in SDO:  
+
The <tt>DataObject</tt> provides an XPath-like (see ...) means of data access. For example, the following code is valid in SDO:  
 
  customerDO.getDataObject("contact-info/phone-number[2]");  
 
  customerDO.getDataObject("contact-info/phone-number[2]");  
  
Line 83: Line 83:
  
 
===Using XMLDocument===
 
===Using XMLDocument===
When you marshall (save) to, or unmarshall (load from) XML a <code>DataObject</code>, the <code>[http://www.eclipse.org/eclipselink/api/1.1/commonj/sdo/helper/XMLDocument.html XMLDocument]</code> class contains information about the root of the XML document.
+
When you marshall (save) to, or unmarshall (load from) XML a <tt>DataObject</tt>, the <tt>[http://www.eclipse.org/eclipselink/api/1.1/commonj/sdo/helper/XMLDocument.html XMLDocument]</tt> class contains information about the root of the XML document.
  
 
===What You May Need to Know About Sequence, ChangeSummary, and DataGraph===
 
===What You May Need to Know About Sequence, ChangeSummary, and DataGraph===
 
The following SDO classes... :(information pending)
 
The following SDO classes... :(information pending)
* <code>[http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.emf.ecore.sdo.doc/references/javadoc/commonj/sdo/Sequence.html Sequence]</code>
+
* <tt>[http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.emf.ecore.sdo.doc/references/javadoc/commonj/sdo/Sequence.html Sequence]</tt>
* <code>[http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.emf.ecore.sdo.doc/references/javadoc/commonj/sdo/ChangeSummary.html ChangeSummary]</code>
+
* <tt>[http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.emf.ecore.sdo.doc/references/javadoc/commonj/sdo/ChangeSummary.html ChangeSummary]</tt>
* <code>[http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.emf.ecore.sdo.doc/references/javadoc/commonj/sdo/DataGraph.html DataGraph]</code> -- essentially deprecated.
+
* <tt>[http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.emf.ecore.sdo.doc/references/javadoc/commonj/sdo/DataGraph.html DataGraph]</tt> -- essentially deprecated.
  
  

Revision as of 11:21, 23 April 2009


This section introduces EclipseLink implementation of Service Data Objects (SDO) specification, as well as provides information on how you can use it in your application development.


Using SDO Metadata

SDO metadata is represented as Type and Property objects. You define the metadata at run time either programmatically, or from an XML schema.


Using Type

SDO Type acts similarly to a Class in Java, and provides much of the same metadata as the Java Reflection API provides for Java classes.

In EclipseLink, a Type wraps an object-XML mapping (OXM) descriptor (see ...).

A Type can have supertypes, which corresponds to the EclipseLink concept of an inheritance policy (see ...).

For more information, see Type API.


What You May Need to Know About Open Sequenced Type

...

What You May Need to Know About DataObject Types for Data Types

...

Using Property

SDO Property acts similarly to a property in Java and provides much of the same metadata as the Java Reflection API provides for Java fields or methods.

In EclipseLink, a Property wraps an object-XML mapping (see ...) in the following way:

  • DataType=true + isMany=false (see OXM Direct Mapping (or an OXM Binary Mapping))
  • DataType=true + isMany=true (see OXM Direct Collection Mapping (or an OXM Binary Collection Mapping))
  • DataType=false + isMany=false + containment=true (see OXM Composite Object Mapping)
  • DataType=false + isMany=true + containment=true (see OXM Composite Collection Mapping)
  • DataType=false + isMany=false + containment=false (see OXM Reference Mapping)
  • DataType=false + isMany=true + containment=false (see OXM Collection Reference Mapping)

For more information, see Property API.


Defining Metadata

You can use the following EclipseLink helper classes to define SDO metadata (information pending: document how the underlying EclipseLink metadata can be accessed and modified).


How to Define Metadata with EclipseLink XSDHelper

You use the XSDHelper to do the following:

  • Define SDO metadata, where SDO metadata is derived from XML schemas.
  • Generate XML schemas from SDO types.

You can customize metadata using the following annotations that you apply to the XML schema:

  • Standard annotations (information pending: list them).
  • EclipseLink annotations.

You can also use various APIs to determine the XML representation about the SDO metadata.


How to Define Metadata with EclipseLink TypeHelper

You use the TypeHelper to do the following:

  • Look up SDO metadata.
  • Programmatically define SDO metadata (note that this is not the typical usage for the TypeHelper).


Using Data

...

Using DataObject (see 17.2.6 “Mapping converters and transformers” in JITDG/ELUG)

DataObject in SDO corresponds to a Java Object (POJO). To define object-XML mappings, you map the DataObject to XML. You can create your DataObject as either dynamic (see Dynamic DataObject Examples), or static by applying a type-safe interface to it (see Static DataObject Examples). The DataObject provides an XPath-like (see ...) means of data access. For example, the following code is valid in SDO:

customerDO.getDataObject("contact-info/phone-number[2]"); 

The standard JAXB, however, would require the following:

customer.getContactInfo().getPhoneNumbers().get(1); 


For more information, see DataObject API


What You May Need to Know About Serialization in SDO (see 17.2.6.1 in JITDG/ELUG)

SDO has its own Java serialization format.


Using XMLDocument

When you marshall (save) to, or unmarshall (load from) XML a DataObject, the XMLDocument class contains information about the root of the XML document.

What You May Need to Know About Sequence, ChangeSummary, and DataGraph

The following SDO classes... :(information pending)

Copyright © Eclipse Foundation, Inc. All Rights Reserved.