org.apache.tuscany.samples.sdo.specExampleSection
Class SerializingDesearializingADataObject
java.lang.Object
org.apache.tuscany.samples.sdo.specExampleSection.SerializingDesearializingADataObject
public class SerializingDesearializingADataObject
- extends java.lang.Object
Demonstrates serializing and deserializing a DataObject to disk.
The following sample is from the Apache Tuscany project. It was written to help users
understand and experiement with SDO. It is based upon example code contained
within, and is meant for use with, and reference to the SDO Specification. In general this sample attempts to use the
code and comments contained within the specification, exceptions to this are noted
in comments.
The following sample is based upon the 'Serializing/Deserializing a DataGraph or DataObject' example from the Examples section of the SDO
specification.
The DataObject and DataGraph interfaces extend java.io.Serializable, so any DataObject
or DataGraph be serialized. The following code serializes the company dataObject to a file
of the user's choosing. The file is not deleted after execution.
Usage:
This sample can easily be run from within Eclipse as a Java Application if tuscany or
the sample-sdo project is imported into Eclipse as an existing project.
If executing as a standalone application please do the following:
- Include the following jar files on your classpath :
- SDO API and Tuscany Implementation
- sdo-api-{version}.jar - SDO API
- tuscany-sdo-impl-{version}.jar - Tuscany SDO implementation
- EMF dependencies.
- emf-common-{version}.jar - some common framework utility and base classes
- emf-ecore-{version}.jar - the EMF core runtime implementation classes (the Ecore metamodel)
- emf-ecore-change-{version}.jar - the EMF change recorder and framework
- emf-ecore-xmi-{version}.jar - EMF's default XML (and XMI) serializer and loader
- xsd-{version}.jar - the XML Schema model
These jar files can be obtained by downloading and unpacking a Tuscany binary distribution
- Execute:
java org.apache.tuscany.samples.sdo.specExampleSection.SerializingDesearializingADataObject
- Author:
- Robbie Minshall
Field Summary |
static java.lang.String |
DEFAULT_FILE_NAME
Default fileName to serialize DataObject to |
Method Summary |
static void |
main(java.lang.String[] args)
Execute this method in order to run the sample. |
static void |
serializeDO(commonj.sdo.DataObject DataObject,
java.lang.String fileName)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_FILE_NAME
public static final java.lang.String DEFAULT_FILE_NAME
- Default fileName to serialize DataObject to
- See Also:
- Constant Field Values
SerializingDesearializingADataObject
public SerializingDesearializingADataObject()
serializeDO
public static void serializeDO(commonj.sdo.DataObject DataObject,
java.lang.String fileName)
throws java.io.IOException
- Throws:
java.io.IOException
main
public static void main(java.lang.String[] args)
- Execute this method in order to run the sample.
- Parameters:
args
-
Copyright © 2007 Apache Software Foundation. All Rights Reserved.