ws-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <>
Subject [Ws Wiki] Update of "Tuscany/SDOJavaOverview" by KelvinGoodson
Date Thu, 11 May 2006 13:12:37 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Ws Wiki" for change notification.

The following page has been changed by KelvinGoodson:

The comment on the change is:
Framework of document complete,  but some updates to be made and images/links to

  === Tuscany Build Environment Setup ===
  SDO 2 is a subproject of the Tuscany project. If you check out and build the whole Tuscany
Java project, you will have also built the SDO 2 subproject. If you want to work with the
SDO 2 project, without the rest of Tuscany, skip to the next section.
  TBD - link to the definitive instructions
@@ -277, +278 @@

+ === Generator Patterns ===
+ The DataObject interface generation pattern is as described in the SDO specification (see
Java Interface Specification section). The SDO specification does not define a factory pattern
for efficient construction of static SDOs, which is however provided by the Tuscany implementation.
The generated SDO Factory interface conforms to the following pattern:
+ {{{
+ public interface <prefix>Factory {
+   <Type1> create<Type1>();
+   <Type2> create<Type2>();
+   ...
+   <prefix>Factory INSTANCE = <default_factory_impl>;
+ }
+ }}}
+ A generated factory corresponds to an SDO Type namespace uri (see commonj.sdo.Type.getURI)
with one create() method for each SDO Type in the namespace. The <prefix> of the factory
name is derived from the uri.  An instance of the factory is available using the INSTANCE
field in the interface. 
+ Using the static factory, a DataObject might be created as follows:
+ {{{
+ Quote aQuote = StockFactory.INSTANCE.createQuote();
+ ... // do something with aQuote
+ }}}
+ The generated implementation of each create() method simply constructs an instance of the
corresponding type like this:
+ {{{
+   public Quote createQuote() {
+     QuoteImpl quote = new QuoteImpl();
+     return quote;
+   }
+ }}}
+ In addition to these generated type-specific create<Type>() methods, the generated
factory implementation class also includes a generated reflective create() method that, given
an SDO Type, efficiently dispatches to the correct type-specific create() method. The reflective
create() method is called by the implementation of the SDO commonj.sdo.helper.DataFactory
+ == Test/Example Programs ==
+ The SDO project does not include any proper sample programs at this time (any volunteers?)
but it does include a number of JUnit test cases, some of which serves as good examples of
how to use SDO APIs to perform various tasks.
+ The following tests are particularly good SDO examples included in the sdo.impl project:
+  * SimpleDynamicTestCase – This program uses the SDO XSDHelper.define() method to register
a simple XML Schema based model (simple.xsd). It then instantiates a DataObject instance (type
Quote), initializes several of its properties, and then serializes the instance to an XML
+  * MixedTypeTestCase – This program shows how to uses the Sequence API to create an XML
instance which mixes arbitrary text within the DataObject’s XML structure. It uses the XML
schema complexType (MixedQuote) in mixed.xsd to define the SDO model.
+  * OpenTypeTestCase – Uses an XML Schema complexType with a wildcard (xsd:any) to illustrate
how to work with and manipulate an SDO open type. The type OpenQuote in open.xsd is used for
this example.
+  * SimpleCopyTestCase – Uses the SDO CopyHelper to create shallow and deep copies of the
simple Quote model from SimpleDyanmicTest.
+  * SimpleEqualityTestCase – Uses the SDO EqualityHelper to perform deep and shallow equality
+  * ChangeSummaryTestCase – Creates a data graph with an instance of type Quote (in simple.xsd)
as the root object. It then turns on change logging and makes a number of changes to the graph.
Finally, it turns off change logging and serializes the data graph.
+  * XSDHelperTestCase – This program shows how the XSDHelper.define() method can be called
multiple times with the same schema. The second (and subsequent) call simply returns the previously
defined list of types.
+ The following is in the project:
+  * SimpleStaticTestCase – This test performs the same function as SimpleDynamicTestCase,
above, only using a generated version of the simple.xsd model. The generated model has been
pre-generated (with default options) in the directory src/test/resources, but it can be regenerated
using the JavaGenerator, possibly with different generator options (e.g., -noInterfaces or
–sparsePattern), if desired.

View raw message