tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kelvingood...@apache.org
Subject svn commit: r553460 - in /incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo: ./ advanced/ basic/ intermediate/ specExampleSection/ util/
Date Thu, 05 Jul 2007 11:37:19 GMT
Author: kelvingoodson
Date: Thu Jul  5 04:37:17 2007
New Revision: 553460

URL: http://svn.apache.org/viewvc?view=rev&rev=553460
Log:
Updated samples to be contain metadata relating to their function.  Added DocumentSamples utility to inspect the metadata in the sample programs. Added the output of the documentation utility and referenced it from the overview.

Added:
    incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/basic/AccessingTheContentsOfASequence.java
      - copied, changed from r553262, incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specExampleSection/AccessingTheContentsOfASequence.java
    incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/sampleProgramContents.html
    incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/util/
    incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/util/DocumentSamples.java
Removed:
    incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specExampleSection/AccessingTheContentsOfASequence.java
Modified:
    incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/ExecuteSamples.java
    incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/ExecuteSamples2.java
    incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/SampleBase.java
    incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/SampleInfrastructure.java
    incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/advanced/MedicalScenario.java
    incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/advanced/ObtainingDataGraphFromXml.java
    incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/advanced/PrintDataGraph.java
    incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/basic/AccessDataObjectPropertiesByName.java
    incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/basic/CreateCompany.java
    incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/basic/CreatePurchaseOrder.java
    incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/basic/ReadPurchaseOrder.java
    incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/intermediate/AccessDataObjectUsingValidXPath.java
    incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/intermediate/AccessingDataObjectsViaPropertyIndex.java
    incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/intermediate/CreateDataObjectFromXmlString.java
    incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/intermediate/DynamicCustomerTypeSample.java
    incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/intermediate/SerializingDeserializingADataObject.java
    incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/overview.html
    incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specExampleSection/UsingTypeAndPropertyWithDataObjects.java

Modified: incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/ExecuteSamples.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/ExecuteSamples.java?view=diff&rev=553460&r1=553459&r2=553460
==============================================================================
--- incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/ExecuteSamples.java (original)
+++ incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/ExecuteSamples.java Thu Jul  5 04:37:17 2007
@@ -25,6 +25,7 @@
 
 import org.apache.tuscany.samples.sdo.advanced.ObtainingDataGraphFromXml;
 import org.apache.tuscany.samples.sdo.basic.AccessDataObjectPropertiesByName;
+import org.apache.tuscany.samples.sdo.basic.AccessingTheContentsOfASequence;
 import org.apache.tuscany.samples.sdo.basic.CreatePurchaseOrder;
 import org.apache.tuscany.samples.sdo.basic.ReadPurchaseOrder;
 import org.apache.tuscany.samples.sdo.intermediate.AccessingDataObjectsViaPropertyIndex;
@@ -32,7 +33,6 @@
 import org.apache.tuscany.samples.sdo.intermediate.DynamicCustomerTypeSample;
 import org.apache.tuscany.samples.sdo.intermediate.SerializingDeserializingADataObject;
 import org.apache.tuscany.samples.sdo.otherSources.PurchaseOrderCmdLine;
-import org.apache.tuscany.samples.sdo.specExampleSection.AccessingTheContentsOfASequence;
 import org.apache.tuscany.samples.sdo.specExampleSection.CreatingDataObjectTreesFromXMLDocuments;
 import org.apache.tuscany.samples.sdo.specExampleSection.UsingTypeAndPropertyWithDataObjects;
 

Modified: incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/ExecuteSamples2.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/ExecuteSamples2.java?view=diff&rev=553460&r1=553459&r2=553460
==============================================================================
--- incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/ExecuteSamples2.java (original)
+++ incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/ExecuteSamples2.java Thu Jul  5 04:37:17 2007
@@ -25,48 +25,15 @@
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
 
-import org.apache.tuscany.samples.sdo.advanced.MedicalScenario;
-import org.apache.tuscany.samples.sdo.advanced.ObtainingDataGraphFromXml;
-import org.apache.tuscany.samples.sdo.advanced.PrintDataGraph;
-import org.apache.tuscany.samples.sdo.basic.AccessDataObjectPropertiesByName;
-import org.apache.tuscany.samples.sdo.basic.CreateCompany;
-import org.apache.tuscany.samples.sdo.basic.CreatePurchaseOrder;
-import org.apache.tuscany.samples.sdo.basic.ReadPurchaseOrder;
-import org.apache.tuscany.samples.sdo.intermediate.AccessDataObjectUsingValidXPath;
-import org.apache.tuscany.samples.sdo.intermediate.AccessingDataObjectsViaPropertyIndex;
-import org.apache.tuscany.samples.sdo.intermediate.CreateCompanyTuscanyAPI;
-import org.apache.tuscany.samples.sdo.intermediate.CreateDataObjectFromXmlString;
-import org.apache.tuscany.samples.sdo.intermediate.DynamicCustomerTypeSample;
-import org.apache.tuscany.samples.sdo.intermediate.SerializingDeserializingADataObject;
 
 /**
  * A Program to execute a sequence of SDO sample programs.
  */
 public class ExecuteSamples2 {
-  
+ 
   public static void main(String [] args) throws SecurityException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException, IOException {
 
-    /**
-     * Here's the list of sample programs that we are going to execute,  in this sequence.
-     */
-    Class[] sampleClasses = {
-      CreateCompany.class,
-      ReadPurchaseOrder.class,
-      CreatePurchaseOrder.class,
-      AccessDataObjectPropertiesByName.class,
-      
-      AccessDataObjectUsingValidXPath.class,
-      DynamicCustomerTypeSample.class,
-      CreateCompanyTuscanyAPI.class,
-      CreateDataObjectFromXmlString.class,
-      SerializingDeserializingADataObject.class,
-      AccessingDataObjectsViaPropertyIndex.class,
 
-      ObtainingDataGraphFromXml.class,
-      PrintDataGraph.class,
-      MedicalScenario.class
-     
-    };
     
     Class[] constructorArgTypes = { Integer.class };
 
@@ -93,8 +60,8 @@
     BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
     
     int sampleCount = 0;
-    for (int i=0; i < sampleClasses.length; i++) {
-      Constructor c = sampleClasses[i].getConstructor(constructorArgTypes);
+    for (int i=0; i < SampleInfrastructure.sampleClasses.length; i++) {
+      Constructor c = SampleInfrastructure.sampleClasses[i].getConstructor(constructorArgTypes);
       SampleBase sample = (SampleBase)c.newInstance(constructorArgs);
       if(sample.getSampleComplexityLevel() <= runSamplesUpToLevel) {
         sample.run();
@@ -107,4 +74,4 @@
     }
     System.out.println("Ran " + sampleCount + " samples");
   }
-}
+}
\ No newline at end of file

Modified: incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/SampleBase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/SampleBase.java?view=diff&rev=553460&r1=553459&r2=553460
==============================================================================
--- incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/SampleBase.java (original)
+++ incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/SampleBase.java Thu Jul  5 04:37:17 2007
@@ -65,7 +65,7 @@
   protected HelperContext createScopeForTypes() {
     commentary(
         COMMENTARY_FOR_NOVICE,
-        "All MetaData for SDO types can be viewed as being held in an instance of HelperContext\n" +
+        "All MetaData for SDO types can be viewed as being scoped within an instance of HelperContext\n" +
         "The Helper Context instance provides access to a collection of other helpers\n" +
         "that you will see exercised in the SDO samples\n" +
         "All the Helpers related to a given helper context instance know about the same set of types\n\n" +

Modified: incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/SampleInfrastructure.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/SampleInfrastructure.java?view=diff&rev=553460&r1=553459&r2=553460
==============================================================================
--- incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/SampleInfrastructure.java (original)
+++ incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/SampleInfrastructure.java Thu Jul  5 04:37:17 2007
@@ -25,6 +25,21 @@
 import java.util.HashSet;
 import java.util.Set;
 
+import org.apache.tuscany.samples.sdo.advanced.MedicalScenario;
+import org.apache.tuscany.samples.sdo.advanced.ObtainingDataGraphFromXml;
+import org.apache.tuscany.samples.sdo.advanced.PrintDataGraph;
+import org.apache.tuscany.samples.sdo.basic.AccessDataObjectPropertiesByName;
+import org.apache.tuscany.samples.sdo.basic.AccessingTheContentsOfASequence;
+import org.apache.tuscany.samples.sdo.basic.CreateCompany;
+import org.apache.tuscany.samples.sdo.basic.CreatePurchaseOrder;
+import org.apache.tuscany.samples.sdo.basic.ReadPurchaseOrder;
+import org.apache.tuscany.samples.sdo.intermediate.AccessDataObjectUsingValidXPath;
+import org.apache.tuscany.samples.sdo.intermediate.AccessingDataObjectsViaPropertyIndex;
+import org.apache.tuscany.samples.sdo.intermediate.CreateCompanyTuscanyAPI;
+import org.apache.tuscany.samples.sdo.intermediate.CreateDataObjectFromXmlString;
+import org.apache.tuscany.samples.sdo.intermediate.DynamicCustomerTypeSample;
+import org.apache.tuscany.samples.sdo.intermediate.SerializingDeserializingADataObject;
+
 /**
  * One of a pair of base classes for samples. This one contains all the
  * infrastructure code that a person wanting to learn SDO would not want to look
@@ -34,6 +49,82 @@
 
   protected int sampleComplexityLevel = SAMPLE_LEVEL_BASIC.intValue();
   protected int commentaryLevel = COMMENTARY_FOR_NOVICE.intValue();
+  
+  /**
+   * Here's the list of sample programs
+   */
+  public static final Class[] sampleClasses = {
+    CreateCompany.class,
+    ReadPurchaseOrder.class,
+    CreatePurchaseOrder.class,
+    AccessDataObjectPropertiesByName.class,
+    AccessingTheContentsOfASequence.class,
+    
+    AccessDataObjectUsingValidXPath.class,
+    DynamicCustomerTypeSample.class,
+    CreateCompanyTuscanyAPI.class,
+    CreateDataObjectFromXmlString.class,
+    SerializingDeserializingADataObject.class,
+    AccessingDataObjectsViaPropertyIndex.class,
+  
+    ObtainingDataGraphFromXml.class,
+    PrintDataGraph.class,
+    MedicalScenario.class
+  
+  };
+
+  public static class SDOFacets {
+    public static final int GET_PROPERTIES_OF_DATAOBJECT_BY_NAME = 1; 
+    public static final int SET_PROPERTIES_OF_DATAOBJECT_BY_NAME = 2; 
+    public static final int CREATE_DATAOBJECTS_BY_NAME = 3; 
+    public static final int GET_SET_PROPERTIES_OF_DATAOBJECT_BY_INDEX = 4; 
+    public static final int GET_SET_PROPERTIES_BY_INSTANCE_PROPERTIES = 5; 
+    public static final int GET_SET_PROPERTIES_OF_DATAOBJECT_BY_XPATH = 6; 
+    public static final int ISMANY_PROPERTIES = 7; 
+    public static final int CONTAINMENT = 8; 
+    public static final int CREATE_TYPES_USING_THE_SDO_API = 9; 
+    public static final int CREATE_TYPES_USING_XML_SCHEMA = 10; 
+    public static final int CREATE_TYPES_USING_THE_TUSCANY_API = 11; 
+    public static final int USING_BUILT_IN_TYPES = 12; 
+    public static final int ACCESSING_VALUES_IN_A_SEQUENCE = 13; 
+    public static final int GENERIC_DATA_GRAPH_TRAVERSAL = 14; 
+    public static final int LOADING_DATA_FROM_XML = 15; 
+    public static final int SAVING_DATA_TO_XML = 16; 
+    public static final int CHANGE_MONITORING_USING_A_DATAGRAPH = 17; 
+    public static final int CHANGE_MONITORING_USING_A_CHANGESUMMARY_PROPERTY_ON_A_DATAOBJECT = 18; 
+    public static final int WRAPPING_DATA_GRAPH_IN_A_DATAGRAPH_INSTANCE = 19; 
+    public static final int OPEN_CONTENT = 20;
+    public static final int NON_CONTAINMENT = 21; 
+    public static final int CREATE_XML_SCHEMA_FROM_TYPES = 22; 
+    public static final int JAVA_SERIALIZATION_OF_DATA_GRAPH = 23; 
+    public static final int TESTING_FOR_GRAPH_EQUALITY = 24;
+    
+    public static final String [] subject_areas =  {
+      "",
+      "Get Properties of DataObject by name",
+      "Set Properties of DataObject by name",
+      "Create DataObjects by name",
+      "Get/Set Properties of DataObject by index",
+      "Get/Set Properties by Instance Properties",
+      "Get/Set Properties of DataObject by Xpath",
+      "isMany Properties","Containment",
+      "Create Types using the SDO API",
+      "Create Types using XML Schema",
+      "Create Types using the Tuscany API",
+      "Using Built-in Types",
+      "Accessing values in a Sequence",
+      "Generic data graph traversal",
+      "Loading data from XML",
+      "Saving data to XML",
+      "Change Monitoring using a DataGraph",
+      "Change Monitoring using a ChangeSummary Property on a DataObject",
+      "Wrapping data graph in a DataGraph instance",
+      "Open Content","Non-Containment",
+      "Create XML Schema from Types",
+      "Java Serialization of data graph",
+      "Testing for Graph Equality"
+    };
+  }
 
 
   /*

Modified: incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/advanced/MedicalScenario.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/advanced/MedicalScenario.java?view=diff&rev=553460&r1=553459&r2=553460
==============================================================================
--- incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/advanced/MedicalScenario.java (original)
+++ incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/advanced/MedicalScenario.java Thu Jul  5 04:37:17 2007
@@ -23,6 +23,7 @@
 import java.util.List;
 
 import org.apache.tuscany.samples.sdo.SampleBase;
+import org.apache.tuscany.samples.sdo.SampleInfrastructure.SDOFacets;
 import org.apache.tuscany.sdo.api.SDOUtil;
 
 import commonj.sdo.DataObject;
@@ -90,6 +91,24 @@
     s.run();
 
   }
+  
+  /*
+   *  metadata for the sample documenting the areas of SDO that are explored
+   */
+  public static int [] CORE_FUNCTION = {
+    SDOFacets.CONTAINMENT,
+    SDOFacets.CREATE_TYPES_USING_THE_SDO_API,
+    SDOFacets.CREATE_TYPES_USING_XML_SCHEMA,
+    SDOFacets.OPEN_CONTENT,
+    SDOFacets.NON_CONTAINMENT
+  };
+  
+  public static int [] SIGNIFICANT_FUNCTION = {
+    SDOFacets.CREATE_DATAOBJECTS_BY_NAME,
+    SDOFacets.ISMANY_PROPERTIES,
+    SDOFacets.GENERIC_DATA_GRAPH_TRAVERSAL,
+    SDOFacets.SAVING_DATA_TO_XML
+  };
 
   public void runSample() throws Exception {
 

Modified: incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/advanced/ObtainingDataGraphFromXml.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/advanced/ObtainingDataGraphFromXml.java?view=diff&rev=553460&r1=553459&r2=553460
==============================================================================
--- incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/advanced/ObtainingDataGraphFromXml.java (original)
+++ incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/advanced/ObtainingDataGraphFromXml.java Thu Jul  5 04:37:17 2007
@@ -25,6 +25,7 @@
 
 import org.apache.tuscany.samples.sdo.SampleBase;
 import org.apache.tuscany.samples.sdo.SampleInfrastructure;
+import org.apache.tuscany.samples.sdo.SampleInfrastructure.SDOFacets;
 import org.apache.tuscany.sdo.api.SDOUtil;
 
 
@@ -114,6 +115,17 @@
       sample.run();
       
     }
+    
+    /*
+     *  metadata for the sample documenting the areas of SDO that are explored
+     */
+    public static int [] CORE_FUNCTION = {
+      SDOFacets.WRAPPING_DATA_GRAPH_IN_A_DATAGRAPH_INSTANCE
+    };
+
+    public static int [] SIGNIFICANT_FUNCTION = {
+      SDOFacets.USING_BUILT_IN_TYPES
+    };
     
     
     public void runSample () {

Modified: incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/advanced/PrintDataGraph.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/advanced/PrintDataGraph.java?view=diff&rev=553460&r1=553459&r2=553460
==============================================================================
--- incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/advanced/PrintDataGraph.java (original)
+++ incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/advanced/PrintDataGraph.java Thu Jul  5 04:37:17 2007
@@ -26,6 +26,7 @@
 
 import org.apache.tuscany.samples.sdo.SampleBase;
 import org.apache.tuscany.samples.sdo.SampleInfrastructure;
+import org.apache.tuscany.samples.sdo.SampleInfrastructure.SDOFacets;
 
 
 import commonj.sdo.DataObject;
@@ -63,6 +64,21 @@
     PrintDataGraph sample = new PrintDataGraph(COMMENTARY_FOR_NOVICE);
     sample.run();
   }
+  
+  /*
+   *  metadata for the sample documenting the areas of SDO that are explored
+   */
+  public static int [] CORE_FUNCTION = {
+    SDOFacets.GENERIC_DATA_GRAPH_TRAVERSAL
+  };
+
+  public static int [] SIGNIFICANT_FUNCTION = {
+    SDOFacets.GET_SET_PROPERTIES_BY_INSTANCE_PROPERTIES,
+    SDOFacets.ISMANY_PROPERTIES,
+    SDOFacets.CREATE_TYPES_USING_THE_SDO_API,
+    SDOFacets.ACCESSING_VALUES_IN_A_SEQUENCE,
+    SDOFacets.NON_CONTAINMENT
+  };
   
   public void runSample() throws Exception {
     commentary("This sample demonstrates a common pattern of traversing a data graph\n"

Modified: incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/basic/AccessDataObjectPropertiesByName.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/basic/AccessDataObjectPropertiesByName.java?view=diff&rev=553460&r1=553459&r2=553460
==============================================================================
--- incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/basic/AccessDataObjectPropertiesByName.java (original)
+++ incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/basic/AccessDataObjectPropertiesByName.java Thu Jul  5 04:37:17 2007
@@ -25,7 +25,6 @@
 import org.apache.tuscany.samples.sdo.SampleBase;
 import org.apache.tuscany.samples.sdo.SampleInfrastructure;
 
-
 import commonj.sdo.DataObject;
 import commonj.sdo.helper.HelperContext;
 
@@ -53,6 +52,13 @@
       sample.run();
 
     }
+    
+    /*
+     *  metadata for the sample documenting the areas of SDO that are explored
+     */
+    public static int [] CORE_FUNCTION = {
+      SDOFacets.GET_PROPERTIES_OF_DATAOBJECT_BY_NAME
+    };
 
     public void runSample () throws Exception {
 

Copied: incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/basic/AccessingTheContentsOfASequence.java (from r553262, incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specExampleSection/AccessingTheContentsOfASequence.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/basic/AccessingTheContentsOfASequence.java?view=diff&rev=553460&p1=incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specExampleSection/AccessingTheContentsOfASequence.java&r1=553262&p2=incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/basic/AccessingTheContentsOfASequence.java&r2=553460
==============================================================================
--- incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specExampleSection/AccessingTheContentsOfASequence.java (original)
+++ incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/basic/AccessingTheContentsOfASequence.java Thu Jul  5 04:37:17 2007
@@ -18,10 +18,11 @@
  *  under the License.
  */
 
-package org.apache.tuscany.samples.sdo.specExampleSection;
+package org.apache.tuscany.samples.sdo.basic;
 
 
 import org.apache.tuscany.samples.sdo.SampleBase;
+import org.apache.tuscany.samples.sdo.SampleInfrastructure.SDOFacets;
 
 import commonj.sdo.DataObject;
 import commonj.sdo.Property;
@@ -30,65 +31,9 @@
 
 /**
  * Demonstrates accessing the sequence from a DataObject containing mixed content.
- * 
- * The following sample is from the <a href="http://incubator.apache.org/tuscany"
- * target="_blank"> Apache Tuscany</a> 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 <a
- * href="http://www.osoa.org/download/attachments/791/SDO_Specification_Java_V2.01.pdf?version=1"
- * target="_bank">SDO Specification</a>. In general this sample attempts to use the
- * code and comments contained within the specification, exceptions to this are noted
- * in comments.<br>
- * 
- * Specifically the following sample is based upon the 'Accessing the contents of a Sequence' example from the Examples section of the SDO specification. <br>
- * <br>
- * The following code uses the Sequence interface to analyze the contents of a DataObject that conforms to teh Letter model defined in
- * {@link #LETTER_XSD}. This code first goes through the Sequence looking for unformatted text entrires and prints them out. Then the code checks to
- * verify that the contents of teh "lastName" property of the DataObject matches the contents of the same property of the Sequence. <br>
- * <br>
- * This sample reads an xml file (@link #LETTER_XML} representing a DataObject of a letter. In order to create a DataObject or DataGraph this sample
- * relies upon XMLHelper class which is an example of a XML DAS. The code shown here would work just as well against an equivalent DataObject that was
- * provided by any DAS. <br>
- * 
- * The XSD for {@link #LETTER_XSD} defines the FormLetter complex type as mixed.   Mixed content and sequences are often used for semi structured business data.
- * <br><br>
- * <b>Usage:</b> <br>
- * 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.
- * <br><br>
- * If executing as a standalone application please do the following: 
- * <br>
- * <UL>
- * <LI>Include the following jar files on your classpath :
- * <UL>
- * <LI>SDO API and Tuscany Implementation
- * <UL>
- * <LI>sdo-api-{version}.jar - SDO API
- * <LI>tuscany-sdo-impl-{version}.jar - Tuscany SDO implementation
- * </UL>
- * </LI>
- * <LI>EMF dependencies. 
- * <UL>
- * <LI>emf-common-{version}.jar - some common framework utility and base classes
- * <LI>emf-ecore-{version}.jar - the EMF core runtime implementation classes (the Ecore metamodel)
- * <LI>emf-ecore-change-{version}.jar - the EMF change recorder and framework
- * <LI>emf-ecore-xmi-{version}.jar - EMF's default XML (and XMI) serializer and loader
- * <LI>xsd-{version}.jar - the XML Schema model
- * </UL>
- * </LI>
- * </UL>
- * 
- * These jar files can be obtained by downloading and unpacking a <a href="http://cwiki.apache.org/TUSCANY/sdo-downloads.html" target="_blank">Tuscany binary distribution </a> </LI>
- * <LI>Execute: <br>
- * java org.apache.tuscany.samples.sdo.specExampleSection.AccessingTheContentsOfASequence</LI>
- * </UL>
- * 
- * @author Robbie Minshall
  */
 
 public class AccessingTheContentsOfASequence  extends SampleBase {
-  // FIXME integrate this sample
-
 
     HelperContext scope;
 
@@ -113,88 +58,56 @@
      * @param args
      */
     public static void main(String[] args) {
-      // TODO make the default level COMMENTARY_FOR_NOVICE, once the rest of the sample has been
-      // converted to using commentary()
-      AccessingTheContentsOfASequence sample = new AccessingTheContentsOfASequence(COMMENTARY_FOR_INTERMEDIATE);
+
+      AccessingTheContentsOfASequence sample =
+        new AccessingTheContentsOfASequence(COMMENTARY_FOR_NOVICE);
 
       sample.run();
 
     }
+    
+    /*
+     *  metadata for the sample documenting the areas of SDO that are explored
+     */
+    public static int [] CORE_FUNCTION = {
+      SDOFacets.ACCESSING_VALUES_IN_A_SEQUENCE
+    };
 
     public void runSample () throws Exception {
-        System.out.println("***************************************");
-        System.out.println("SDO Sample AccessingTheContentsOfASequence");
-        System.out.println("***************************************");
-        System.out.println("Demonstrates accessing the sequence from a DataObject containing mixed content.");
-        System.out.println("***************************************");
-        
-        // FIXME update sample, and see if it deals with xml attribute sequencing
+ 
+        commentary("Demonstrates accessing the sequence from a DataObject containing mixed content.");
 
         scope = createScopeForTypes();
-        
-        try {
-            // define model
-            System.out.println("Defining Types using XSD");
-            scope.getXSDHelper().define(ClassLoader.getSystemResourceAsStream(LETTER_XSD), null);
-
-            // define letter data object
-            System.out.println("Loading Letter DataObject from XML");
-            DataObject letter = scope.getXMLHelper().load(ClassLoader.getSystemResourceAsStream(LETTER_XML)).getRootObject();
-
-            // print letter sequence
-            System.out.println("Printing sequence for " + letter);
-            System.out.println(scope.getXMLHelper().save(letter, "letter.xsd", "letter"));
-            printSequence(letter);
-
-        } catch (Exception e) {
-            System.out.println("Sorry there was an error encountered " + e.toString());
-            e.printStackTrace();
-        }
-        System.out.println("GoodBye");
+        loadTypesFromXMLSchemaFile(scope, LETTER_XSD);
+        DataObject letter = getDataObjectFromFile(scope, LETTER_XML);
 
-    }
-
-    /**
-     * Uses the Sequence interface to analyze the contents of a DataObject that conforms to teh Letter model defined in
-     * {@link #LETTER_XSD}. This code first goes through the Sequence looking for unformatted text entrires and prints them out. Then the code checks
-     * to verify that the contents of the "lastName" property of the DataObject matches the contents of the same property of the Sequence. <br>
-     * 
-     * @param letter.  Letter DataObject conforming to {@link #LETTER_XSD}
-     */
-    public void printSequence(DataObject letter) {
-        // Access the Sequence of the FormLetter
-        System.out.println("The type is for letter dataObject is mixed " + scope.getXSDHelper().isMixed(letter.getType()));
+        // print letter sequence
+        commentary("We've loaded a documet from an XML file that contains mixed content.\n" +
+        		"Here's how the XML looks ...\n");
+        System.out.println(scope.getXMLHelper().save(letter, "letter.xsd", "letter"));
+ 
+        
+        
+        System.out.println("\nThe Type for the letter DataObject is mixed: " + scope.getXSDHelper().isMixed(letter.getType()));
         
         Sequence letterSequence = letter.getSequence();
-        // Print out all the settings that contain unstructured text
+
+// FIXME -- sort out how this should be -- i think it is confusing
+        
         System.out.println("Unstructured text:");
         for (int i = 0; i < letterSequence.size(); i++) {
-
-            /*
-             * Please note that the following line is a correction to the 2.0 specification which incorrectly calls:
-             * 
-             * String propertyName = ((Property) letterSequence.getProperty(i)).getName();
-             * 
-             * According to the SDO API sequence.getProperty will return null if the content is mixed, in this case
-             * we want to print it out as unstructured text         
-             */
             Property prop = letterSequence.getProperty(i);                                 
             if (prop == null) {
                 String text = (String) letterSequence.getValue(i);
                 System.out.println("\t(" + text + ")");
             }
-           
         }
-
-        /*
-         * Please note that the following line is a correction to the 2.0 Specification which incorrectly uses letterDataObject variable rather than
-         * simply letter
-         */
+        
         // Verify that the lastName property of the DataObject has the same
         // value as the lastName property for the Sequence.
         String dataObjectLastName = letter.getString("lastName");
         for (int i = 0; i < letterSequence.size(); i++) {
-
+        
             /*
              * The following line has been corrected from the 2.0 specification
              * According to the SDO API sequence.getProperty will return null if the content is mixed.
@@ -210,6 +123,8 @@
                 break;
             }
         }
+
+
     }
 
 }

Modified: incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/basic/CreateCompany.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/basic/CreateCompany.java?view=diff&rev=553460&r1=553459&r2=553460
==============================================================================
--- incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/basic/CreateCompany.java (original)
+++ incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/basic/CreateCompany.java Thu Jul  5 04:37:17 2007
@@ -44,6 +44,14 @@
     public CreateCompany(Integer commentaryLevel, Integer sampleLevel) {
       super(commentaryLevel, sampleLevel);
     }
+    
+    /*
+     *  metadata for the sample documenting the areas of SDO that are explored
+     */
+    public static int [] CORE_FUNCTION = {
+        SDOFacets.SET_PROPERTIES_OF_DATAOBJECT_BY_NAME
+    };
+    
     /**
      * XML file generated for the company DataObject
      */    

Modified: incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/basic/CreatePurchaseOrder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/basic/CreatePurchaseOrder.java?view=diff&rev=553460&r1=553459&r2=553460
==============================================================================
--- incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/basic/CreatePurchaseOrder.java (original)
+++ incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/basic/CreatePurchaseOrder.java Thu Jul  5 04:37:17 2007
@@ -25,6 +25,7 @@
 
 import org.apache.tuscany.samples.sdo.SampleBase;
 import org.apache.tuscany.samples.sdo.SampleInfrastructure;
+import org.apache.tuscany.samples.sdo.SampleInfrastructure.SDOFacets;
 
 
 import commonj.sdo.DataObject;
@@ -82,6 +83,15 @@
     public CreatePurchaseOrder(Integer commentaryLevel) {
       super(commentaryLevel, SAMPLE_LEVEL_BASIC);
     }
+    
+    /*
+     *  metadata for the sample documenting the areas of SDO that are explored
+     */
+    public static int [] CORE_FUNCTION = {
+      SDOFacets.LOADING_DATA_FROM_XML,
+      SDOFacets.SAVING_DATA_TO_XML
+    };
+
 
 
     public static void main(String[] args) {

Modified: incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/basic/ReadPurchaseOrder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/basic/ReadPurchaseOrder.java?view=diff&rev=553460&r1=553459&r2=553460
==============================================================================
--- incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/basic/ReadPurchaseOrder.java (original)
+++ incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/basic/ReadPurchaseOrder.java Thu Jul  5 04:37:17 2007
@@ -24,6 +24,7 @@
 
 import org.apache.tuscany.samples.sdo.SampleBase;
 import org.apache.tuscany.samples.sdo.SampleInfrastructure;
+import org.apache.tuscany.samples.sdo.SampleInfrastructure.SDOFacets;
 
 
 import commonj.sdo.DataObject;
@@ -117,6 +118,19 @@
       sample.run();
 
     }
+    
+    /*
+     *  metadata for the sample documenting the areas of SDO that are explored
+     */
+    public static int [] CORE_FUNCTION = {
+      SDOFacets.LOADING_DATA_FROM_XML,
+      SDOFacets.SAVING_DATA_TO_XML
+    };
+    public static int [] SIGNIFICANT_FUNCTION = {
+      SDOFacets.GET_PROPERTIES_OF_DATAOBJECT_BY_NAME
+    };
+
+
 
     public void runSample () throws Exception {
         commentary(COMMENTARY_ALWAYS,

Modified: incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/intermediate/AccessDataObjectUsingValidXPath.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/intermediate/AccessDataObjectUsingValidXPath.java?view=diff&rev=553460&r1=553459&r2=553460
==============================================================================
--- incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/intermediate/AccessDataObjectUsingValidXPath.java (original)
+++ incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/intermediate/AccessDataObjectUsingValidXPath.java Thu Jul  5 04:37:17 2007
@@ -24,6 +24,7 @@
 
 import org.apache.tuscany.samples.sdo.SampleBase;
 import org.apache.tuscany.samples.sdo.SampleInfrastructure;
+import org.apache.tuscany.samples.sdo.SampleInfrastructure.SDOFacets;
 
 import commonj.sdo.DataObject;
 import commonj.sdo.helper.HelperContext;
@@ -91,6 +92,14 @@
       sample.run();
 
     }
+    
+    /*
+     *  metadata for the sample documenting the areas of SDO that are explored
+     */
+    public static int [] CORE_FUNCTION = {
+      SDOFacets.GET_SET_PROPERTIES_OF_DATAOBJECT_BY_XPATH
+    };
+
 
     public void runSample () throws Exception {
 

Modified: incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/intermediate/AccessingDataObjectsViaPropertyIndex.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/intermediate/AccessingDataObjectsViaPropertyIndex.java?view=diff&rev=553460&r1=553459&r2=553460
==============================================================================
--- incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/intermediate/AccessingDataObjectsViaPropertyIndex.java (original)
+++ incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/intermediate/AccessingDataObjectsViaPropertyIndex.java Thu Jul  5 04:37:17 2007
@@ -24,6 +24,7 @@
 
 import org.apache.tuscany.samples.sdo.SampleBase;
 import org.apache.tuscany.samples.sdo.SampleInfrastructure;
+import org.apache.tuscany.samples.sdo.SampleInfrastructure.SDOFacets;
 import org.apache.tuscany.samples.sdo.advanced.PrintDataGraph;
 
 import commonj.sdo.DataObject;
@@ -76,6 +77,14 @@
       sample.run();
  
     }
+    
+    /*
+     *  metadata for the sample documenting the areas of SDO that are explored
+     */
+    public static int [] CORE_FUNCTION = {
+      SDOFacets.GET_SET_PROPERTIES_OF_DATAOBJECT_BY_INDEX
+    };
+
 
     public void runSample () throws Exception {
 

Modified: incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/intermediate/CreateDataObjectFromXmlString.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/intermediate/CreateDataObjectFromXmlString.java?view=diff&rev=553460&r1=553459&r2=553460
==============================================================================
--- incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/intermediate/CreateDataObjectFromXmlString.java (original)
+++ incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/intermediate/CreateDataObjectFromXmlString.java Thu Jul  5 04:37:17 2007
@@ -22,6 +22,7 @@
 import java.util.List;
 
 import org.apache.tuscany.samples.sdo.SampleBase;
+import org.apache.tuscany.samples.sdo.SampleInfrastructure.SDOFacets;
 
 import commonj.sdo.DataObject;
 import commonj.sdo.Property;
@@ -93,6 +94,14 @@
       sample.run();
  
     }
+    
+    /*
+     *  metadata for the sample documenting the areas of SDO that are explored
+     */
+    public static int [] CORE_FUNCTION = {
+      SDOFacets.USING_BUILT_IN_TYPES,
+      SDOFacets.LOADING_DATA_FROM_XML
+    };
 
     public void runSample () throws Exception {
 

Modified: incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/intermediate/DynamicCustomerTypeSample.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/intermediate/DynamicCustomerTypeSample.java?view=diff&rev=553460&r1=553459&r2=553460
==============================================================================
--- incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/intermediate/DynamicCustomerTypeSample.java (original)
+++ incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/intermediate/DynamicCustomerTypeSample.java Thu Jul  5 04:37:17 2007
@@ -29,6 +29,7 @@
 import java.util.List;
 
 import org.apache.tuscany.samples.sdo.SampleBase;
+import org.apache.tuscany.samples.sdo.SampleInfrastructure.SDOFacets;
 
 /**
  * Demonstrates creating and using Types dynamically. This sample is from the <a
@@ -120,6 +121,21 @@
       sample.run();
 
     }
+    
+    /*
+     *  metadata for the sample documenting the areas of SDO that are explored
+     */
+    public static int [] CORE_FUNCTION = {
+      SDOFacets.CREATE_TYPES_USING_THE_SDO_API
+    };
+    /*
+     *  metadata for the sample documenting the areas of SDO that are explored
+     */
+    public static int [] SIGNIFICANT_FUNCTION = {
+      SDOFacets.SET_PROPERTIES_OF_DATAOBJECT_BY_NAME,
+      SDOFacets.USING_BUILT_IN_TYPES,
+      SDOFacets.SAVING_DATA_TO_XML
+    };
 
     public void runSample () throws Exception {
 

Modified: incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/intermediate/SerializingDeserializingADataObject.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/intermediate/SerializingDeserializingADataObject.java?view=diff&rev=553460&r1=553459&r2=553460
==============================================================================
--- incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/intermediate/SerializingDeserializingADataObject.java (original)
+++ incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/intermediate/SerializingDeserializingADataObject.java Thu Jul  5 04:37:17 2007
@@ -28,6 +28,7 @@
 
 import org.apache.tuscany.samples.sdo.SampleBase;
 import org.apache.tuscany.samples.sdo.SampleInfrastructure;
+import org.apache.tuscany.samples.sdo.SampleInfrastructure.SDOFacets;
 
 import commonj.sdo.DataObject;
 import commonj.sdo.helper.HelperContext;
@@ -53,6 +54,19 @@
 
     }
 
+    /*
+     *  metadata for the sample documenting the areas of SDO that are explored
+     */
+    public static int [] CORE_FUNCTION = {
+      SDOFacets.JAVA_SERIALIZATION_OF_DATA_GRAPH
+    };
+    /*
+     *  metadata for the sample documenting the areas of SDO that are explored
+     */
+    public static int [] SIGNIFICANT_FUNCTION = {
+      SDOFacets.TESTING_FOR_GRAPH_EQUALITY
+    };
+    
     public void runSample () throws Exception {
 
         commentary(

Modified: incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/overview.html
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/overview.html?view=diff&rev=553460&r1=553459&r2=553460
==============================================================================
--- incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/overview.html (original)
+++ incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/overview.html Thu Jul  5 04:37:17 2007
@@ -26,12 +26,9 @@
 <h2>Overview</h2>
 This sample code is from the <a href="http://incubator.apache.org/tuscany"
  target="_blank"> Apache Tuscany</a> project. The samples were written to help users
-understand and experiment with SDO. They are grouped into three packages according to the source of the example material. Some are based upon example code contained
-within the <a
- href="http://osoa.org/display/Main/Service+Data+Objects+Specifications"
- target="_bank">SDO Specification</a>, and are intended to be read alongside the specification. Others are based upon papers and published material
- (see the documentation for each sample for the reference to the publication),
- or were simply written specifically for these samples.
+understand and experiment with SDO.  You can get a feel for the topics that are
+covered by each sample by looking at the <a href="sampleProgramContents.html">
+documentation</a> that is produced by the DocumentSamples utility.
 <H2>Experimentation</H2>
 The SDO samples are written to be used in conjunction with the specification and other documents.  However, 
 the most important function that these samples provide is a place to begin experimenting with the SDO API

Added: incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/sampleProgramContents.html
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/sampleProgramContents.html?view=auto&rev=553460
==============================================================================
--- incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/sampleProgramContents.html (added)
+++ incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/sampleProgramContents.html Thu Jul  5 04:37:17 2007
@@ -0,0 +1,210 @@
+<html>
+<!--                                                             
+*                                                              
+*  Licensed to the Apache Software Foundation (ASF) under one  
+*  or more contributor license agreements.  See the NOTICE file
+*  distributed with this work for additional information       
+*  regarding copyright ownership.  The ASF licenses this file  
+*  to you under the Apache License, Version 2.0 (the           
+*  "License"); you may not use this file except in compliance  
+*  with the License.  You may obtain a copy of the License at  
+*                                                              
+*    http://www.apache.org/licenses/LICENSE-2.0                
+*                                                              
+*  Unless required by applicable law or agreed to in writing,  
+*  software distributed under the License is distributed on an 
+*  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY      
+*  KIND, either express or implied.  See the License for the   
+*  specific language governing permissions and limitations     
+*  under the License.                                          
+-->                                                             
+<head><title>SDO Samples</title></head><body>
+  <h1>SDO Samples</h1>
+<H2>Index by Sample Program Name</H2>
+<h3>Sample Program CreateCompany</h3>
+<b>Core function:</b><br/>
+<a href="#facet2">Set Properties of DataObject by name</a><br/>
+<br/><h3>Sample Program ReadPurchaseOrder</h3>
+<b>Core function:</b><br/>
+<a href="#facet15">Loading data from XML</a><br/>
+<a href="#facet16">Saving data to XML</a><br/>
+<br/><b>Also demonstrates:</b><br/>
+<a href="#facet1">Get Properties of DataObject by name</a><br/>
+<h3>Sample Program CreatePurchaseOrder</h3>
+<b>Core function:</b><br/>
+<a href="#facet15">Loading data from XML</a><br/>
+<a href="#facet16">Saving data to XML</a><br/>
+<br/><h3>Sample Program AccessDataObjectPropertiesByName</h3>
+<b>Core function:</b><br/>
+<a href="#facet1">Get Properties of DataObject by name</a><br/>
+<br/><h3>Sample Program AccessingTheContentsOfASequence</h3>
+<b>Core function:</b><br/>
+<a href="#facet13">Accessing values in a Sequence</a><br/>
+<br/><h3>Sample Program AccessDataObjectUsingValidXPath</h3>
+<b>Core function:</b><br/>
+<a href="#facet6">Get/Set Properties of DataObject by Xpath</a><br/>
+<br/><h3>Sample Program DynamicCustomerTypeSample</h3>
+<b>Core function:</b><br/>
+<a href="#facet9">Create Types using the SDO API</a><br/>
+<br/><b>Also demonstrates:</b><br/>
+<a href="#facet2">Set Properties of DataObject by name</a><br/>
+<a href="#facet12">Using Built-in Types</a><br/>
+<a href="#facet16">Saving data to XML</a><br/>
+<h3>Sample Program CreateCompanyTuscanyAPI</h3>
+<b>Core function:</b><br/>
+<a href="#facet2">Set Properties of DataObject by name</a><br/>
+<br/><h3>Sample Program CreateDataObjectFromXmlString</h3>
+<b>Core function:</b><br/>
+<a href="#facet12">Using Built-in Types</a><br/>
+<a href="#facet15">Loading data from XML</a><br/>
+<br/><h3>Sample Program SerializingDeserializingADataObject</h3>
+<b>Core function:</b><br/>
+<a href="#facet23">Java Serialization of data graph</a><br/>
+<br/><b>Also demonstrates:</b><br/>
+<a href="#facet24">Testing for Graph Equality</a><br/>
+<h3>Sample Program AccessingDataObjectsViaPropertyIndex</h3>
+<b>Core function:</b><br/>
+<a href="#facet4">Get/Set Properties of DataObject by index</a><br/>
+<br/><h3>Sample Program ObtainingDataGraphFromXml</h3>
+<b>Core function:</b><br/>
+<a href="#facet19">Wrapping data graph in a DataGraph instance</a><br/>
+<br/><b>Also demonstrates:</b><br/>
+<a href="#facet12">Using Built-in Types</a><br/>
+<h3>Sample Program PrintDataGraph</h3>
+<b>Core function:</b><br/>
+<a href="#facet14">Generic data graph traversal</a><br/>
+<br/><b>Also demonstrates:</b><br/>
+<a href="#facet5">Get/Set Properties by Instance Properties</a><br/>
+<a href="#facet7">isMany Properties</a><br/>
+<a href="#facet9">Create Types using the SDO API</a><br/>
+<a href="#facet13">Accessing values in a Sequence</a><br/>
+<a href="#facet21">Non-Containment</a><br/>
+<h3>Sample Program MedicalScenario</h3>
+<b>Core function:</b><br/>
+<a href="#facet8">Containment</a><br/>
+<a href="#facet9">Create Types using the SDO API</a><br/>
+<a href="#facet10">Create Types using XML Schema</a><br/>
+<a href="#facet20">Open Content</a><br/>
+<a href="#facet21">Non-Containment</a><br/>
+<br/><b>Also demonstrates:</b><br/>
+<a href="#facet3">Create DataObjects by name</a><br/>
+<a href="#facet7">isMany Properties</a><br/>
+<a href="#facet14">Generic data graph traversal</a><br/>
+<a href="#facet16">Saving data to XML</a><br/>
+<H2>Index by function</H2>
+<a name="facet0"/>
+<h3></h3>
+<a name="facet1"/>
+<h3>Get Properties of DataObject by name</h3>
+<b>Samples which demonstrate this as their core function</b><br/>
+AccessDataObjectPropertiesByName<br/>
+<b>Samples which demonstrate this in addition to their core function</b><br/>
+ReadPurchaseOrder<br/>
+<a name="facet2"/>
+<h3>Set Properties of DataObject by name</h3>
+<b>Samples which demonstrate this as their core function</b><br/>
+CreateCompany<br/>
+CreateCompanyTuscanyAPI<br/>
+<b>Samples which demonstrate this in addition to their core function</b><br/>
+DynamicCustomerTypeSample<br/>
+<a name="facet3"/>
+<h3>Create DataObjects by name</h3>
+<b>Samples which demonstrate this in addition to their core function</b><br/>
+MedicalScenario<br/>
+<a name="facet4"/>
+<h3>Get/Set Properties of DataObject by index</h3>
+<b>Samples which demonstrate this as their core function</b><br/>
+AccessingDataObjectsViaPropertyIndex<br/>
+<a name="facet5"/>
+<h3>Get/Set Properties by Instance Properties</h3>
+<b>Samples which demonstrate this in addition to their core function</b><br/>
+PrintDataGraph<br/>
+<a name="facet6"/>
+<h3>Get/Set Properties of DataObject by Xpath</h3>
+<b>Samples which demonstrate this as their core function</b><br/>
+AccessDataObjectUsingValidXPath<br/>
+<a name="facet7"/>
+<h3>isMany Properties</h3>
+<b>Samples which demonstrate this in addition to their core function</b><br/>
+MedicalScenario<br/>
+PrintDataGraph<br/>
+<a name="facet8"/>
+<h3>Containment</h3>
+<b>Samples which demonstrate this as their core function</b><br/>
+MedicalScenario<br/>
+<a name="facet9"/>
+<h3>Create Types using the SDO API</h3>
+<b>Samples which demonstrate this as their core function</b><br/>
+MedicalScenario<br/>
+DynamicCustomerTypeSample<br/>
+<b>Samples which demonstrate this in addition to their core function</b><br/>
+PrintDataGraph<br/>
+<a name="facet10"/>
+<h3>Create Types using XML Schema</h3>
+<b>Samples which demonstrate this as their core function</b><br/>
+MedicalScenario<br/>
+<a name="facet11"/>
+<h3>Create Types using the Tuscany API</h3>
+<a name="facet12"/>
+<h3>Using Built-in Types</h3>
+<b>Samples which demonstrate this as their core function</b><br/>
+CreateDataObjectFromXmlString<br/>
+<b>Samples which demonstrate this in addition to their core function</b><br/>
+DynamicCustomerTypeSample<br/>
+ObtainingDataGraphFromXml<br/>
+<a name="facet13"/>
+<h3>Accessing values in a Sequence</h3>
+<b>Samples which demonstrate this as their core function</b><br/>
+AccessingTheContentsOfASequence<br/>
+<b>Samples which demonstrate this in addition to their core function</b><br/>
+PrintDataGraph<br/>
+<a name="facet14"/>
+<h3>Generic data graph traversal</h3>
+<b>Samples which demonstrate this as their core function</b><br/>
+PrintDataGraph<br/>
+<b>Samples which demonstrate this in addition to their core function</b><br/>
+MedicalScenario<br/>
+<a name="facet15"/>
+<h3>Loading data from XML</h3>
+<b>Samples which demonstrate this as their core function</b><br/>
+CreateDataObjectFromXmlString<br/>
+CreatePurchaseOrder<br/>
+ReadPurchaseOrder<br/>
+<a name="facet16"/>
+<h3>Saving data to XML</h3>
+<b>Samples which demonstrate this as their core function</b><br/>
+CreatePurchaseOrder<br/>
+ReadPurchaseOrder<br/>
+<b>Samples which demonstrate this in addition to their core function</b><br/>
+MedicalScenario<br/>
+DynamicCustomerTypeSample<br/>
+<a name="facet17"/>
+<h3>Change Monitoring using a DataGraph</h3>
+<a name="facet18"/>
+<h3>Change Monitoring using a ChangeSummary Property on a DataObject</h3>
+<a name="facet19"/>
+<h3>Wrapping data graph in a DataGraph instance</h3>
+<b>Samples which demonstrate this as their core function</b><br/>
+ObtainingDataGraphFromXml<br/>
+<a name="facet20"/>
+<h3>Open Content</h3>
+<b>Samples which demonstrate this as their core function</b><br/>
+MedicalScenario<br/>
+<a name="facet21"/>
+<h3>Non-Containment</h3>
+<b>Samples which demonstrate this as their core function</b><br/>
+MedicalScenario<br/>
+<b>Samples which demonstrate this in addition to their core function</b><br/>
+PrintDataGraph<br/>
+<a name="facet22"/>
+<h3>Create XML Schema from Types</h3>
+<a name="facet23"/>
+<h3>Java Serialization of data graph</h3>
+<b>Samples which demonstrate this as their core function</b><br/>
+SerializingDeserializingADataObject<br/>
+<a name="facet24"/>
+<h3>Testing for Graph Equality</h3>
+<b>Samples which demonstrate this in addition to their core function</b><br/>
+SerializingDeserializingADataObject<br/>
+</body>
+</html>

Modified: incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specExampleSection/UsingTypeAndPropertyWithDataObjects.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specExampleSection/UsingTypeAndPropertyWithDataObjects.java?view=diff&rev=553460&r1=553459&r2=553460
==============================================================================
--- incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specExampleSection/UsingTypeAndPropertyWithDataObjects.java (original)
+++ incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specExampleSection/UsingTypeAndPropertyWithDataObjects.java Thu Jul  5 04:37:17 2007
@@ -85,6 +85,8 @@
 
 public class UsingTypeAndPropertyWithDataObjects  extends SampleBase {
   
+  // FIXME decide on the fate of this example
+  
 
     HelperContext scope;
 

Added: incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/util/DocumentSamples.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/util/DocumentSamples.java?view=auto&rev=553460
==============================================================================
--- incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/util/DocumentSamples.java (added)
+++ incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/util/DocumentSamples.java Thu Jul  5 04:37:17 2007
@@ -0,0 +1,187 @@
+/**
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.tuscany.samples.sdo.util;
+
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.tuscany.samples.sdo.SampleInfrastructure;
+import org.apache.tuscany.samples.sdo.SampleInfrastructure.SDOFacets;
+
+public class DocumentSamples {
+
+  private Map classToCoreFunction = new HashMap();
+  private Map coreFunctionToClass = new HashMap();
+  private Map classToSignificantFunction = new HashMap();
+  private Map significantFunctionToClass = new HashMap();
+
+  public static void main(String[] args) throws SecurityException,
+      NoSuchMethodException, IllegalArgumentException, InstantiationException,
+      IllegalAccessException, InvocationTargetException, IOException {
+
+    DocumentSamples ds = new DocumentSamples();
+    ds.run();
+    
+  }
+  
+  private static String HTML_HEADER =
+    "<html>\n"+
+    "<!--                                                             \n"+
+    "*                                                              \n"+
+    "*  Licensed to the Apache Software Foundation (ASF) under one  \n"+
+    "*  or more contributor license agreements.  See the NOTICE file\n"+
+    "*  distributed with this work for additional information       \n"+
+    "*  regarding copyright ownership.  The ASF licenses this file  \n"+
+    "*  to you under the Apache License, Version 2.0 (the           \n"+
+    "*  \"License\"); you may not use this file except in compliance  \n"+
+    "*  with the License.  You may obtain a copy of the License at  \n"+
+    "*                                                              \n"+
+    "*    http://www.apache.org/licenses/LICENSE-2.0                \n"+
+    "*                                                              \n"+
+    "*  Unless required by applicable law or agreed to in writing,  \n"+
+    "*  software distributed under the License is distributed on an \n"+
+    "*  \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY      \n"+
+    "*  KIND, either express or implied.  See the License for the   \n"+
+    "*  specific language governing permissions and limitations     \n"+
+    "*  under the License.                                          \n"+
+    "-->                                                             \n"+
+    "<head><title>SDO Samples</title></head><body>\n" +
+    "  <h1>SDO Samples</h1>\n";
+
+  private static String CLASSES_HEADING =
+    "<H2>Index by Sample Program Name</H2>\n";
+  
+  private static String FUNCTION_HEADING =
+    "<H2>Index by function</H2>\n";
+  
+  private static String HTML_FOOTER =
+    "</body>\n</html>";
+  
+
+  private void run() throws IllegalAccessException {
+    /*
+     * gather the data
+     */
+    for (int i = 0; i < SampleInfrastructure.sampleClasses.length; i++) {
+      Class c = SampleInfrastructure.sampleClasses[i];
+      classToCoreFunction.put(c, new HashSet());
+      try {
+        Field coreFunction = c.getField("CORE_FUNCTION");
+        recordFunction(c, coreFunction, coreFunctionToClass, classToCoreFunction);
+      } catch (NoSuchFieldException e) {
+        // no problem
+      }
+      try {
+        Field sigFunction = c.getField("SIGNIFICANT_FUNCTION");
+        recordFunction(c, sigFunction, significantFunctionToClass, classToSignificantFunction);
+      } catch (NoSuchFieldException e) {
+        // no problem
+      }
+    }
+    
+    /*
+     * create the documentation
+     */
+    StringBuffer doc = new StringBuffer();
+    doc.append(HTML_HEADER);
+    
+    doc.append(CLASSES_HEADING);
+    Class [] classes = SampleInfrastructure.sampleClasses;
+    for(int i=0; i < classes.length;i++) {
+      doc.append("<h3>Sample Program " + classes[i].getSimpleName() + "</h3>\n");
+      doc.append("<b>Core function:</b><br/>\n");
+      int [] functions = (int[])classToCoreFunction.get(classes[i]);
+      for(int j=0;j<functions.length;j++) {
+        doc.append("<a href=\"#facet")
+        .append(functions[j])
+        .append("\">")
+        .append(SDOFacets.subject_areas[functions[j]])
+        .append("</a><br/>\n");      }
+      doc.append("<br/>");
+      if(classToSignificantFunction.get(classes[i])!= null) {
+        doc.append("<b>Also demonstrates:</b><br/>\n");
+        functions = (int[])classToSignificantFunction.get(classes[i]);
+        for(int j=0;j<functions.length;j++) {
+          doc.append("<a href=\"#facet")
+            .append(functions[j])
+            .append("\">")
+            .append(SDOFacets.subject_areas[functions[j]])
+            .append("</a><br/>\n");
+        }
+      }
+    }
+    
+    doc.append(FUNCTION_HEADING);
+    
+    String [] facets = SDOFacets.subject_areas;
+    for(int f = 0; f<facets.length; f++) {
+      Integer fobj = new Integer(f);
+      doc.append("<a name=\"facet")  
+        .append(f)
+        .append("\"/>\n<h3>")
+        .append(SDOFacets.subject_areas[f])
+        .append("</h3>\n");
+      if(coreFunctionToClass.keySet().contains(fobj)) {
+        doc.append("<b>Samples which demonstrate this as their core function</b><br/>\n");
+        Set classesWithFunction = (Set)coreFunctionToClass.get(fobj);
+        for(Iterator cwf = classesWithFunction.iterator(); cwf.hasNext();) {
+          Class c = (Class)cwf.next();
+          doc.append(c.getSimpleName()).append("<br/>\n");
+        }
+      }
+      if(significantFunctionToClass.keySet().contains(fobj)) {
+        doc.append("<b>Samples which demonstrate this in addition to their core function</b><br/>\n");
+        Set classesWithFunction = (Set)significantFunctionToClass.get(fobj);
+        for(Iterator cwf = classesWithFunction.iterator(); cwf.hasNext();) {
+          Class c = (Class)cwf.next();
+          doc.append(c.getSimpleName()).append("<br/>\n");
+        }
+      }
+      
+    }
+    
+    doc.append(HTML_FOOTER); 
+    System.out.println(doc);
+  }
+
+  private int[] recordFunction(Class c, Field functionIndices,  Map ftoc, Map ctof)
+      throws IllegalAccessException {
+    int[] functions = (int[]) functionIndices.get(c);
+    for (int j = 0; j < functions.length; j++) {
+      addClassesToFunction(ftoc, functions[j], c);
+    }
+    ctof.put(c, functions);
+    return functions;
+  }
+
+  private void addClassesToFunction(Map functionToClass, int i, Class c) {
+    Integer iobj = new Integer(i);
+    if (!functionToClass.containsKey(iobj)) {
+      functionToClass.put(iobj, new HashSet());
+    }
+    ((Set) (functionToClass.get(iobj))).add(c);
+  }
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org


Mime
View raw message