You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by ke...@apache.org on 2007/06/20 17:52:15 UTC
svn commit: r549141 - in
/incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo:
./ otherSources/ specCodeSnippets/ specExampleSection/ tuscanyapi/
Author: kelvingoodson
Date: Wed Jun 20 08:52:13 2007
New Revision: 549141
URL: http://svn.apache.org/viewvc?view=rev&rev=549141
Log:
more sample updates -- 2 more added to the uber-sample, and added a way of selecting the level of sample you want to run from the uber-sample
Modified:
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/otherSources/CreateCompany.java
incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/otherSources/CreatePurchaseOrder.java
incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/otherSources/PurchaseOrderControl.java
incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/otherSources/ReadPurchaseOrder.java
incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specCodeSnippets/AccessDataObjectPropertiesByName.java
incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specCodeSnippets/AccessDataObjectUsingValidXPath.java
incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specCodeSnippets/CreateDataObjectFromXmlString.java
incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specCodeSnippets/CreateDataObjectFromXsdAndXmlFiles.java
incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specCodeSnippets/DynamicCustomerTypeSample.java
incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specCodeSnippets/ObtainingDataGraphFromXml.java
incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specCodeSnippets/PrintPropertiesOfDataObject.java
incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specCodeSnippets/UsingXPath.java
incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specExampleSection/AccessDataObjectsUsingXPath.java
incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specExampleSection/AccessingDataObjectsViaPropertyIndex.java
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/specExampleSection/CreatingDataObjectTreesFromXMLDocuments.java
incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specExampleSection/CreatingXmlFromDataObjects.java
incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specExampleSection/SerializingDesearializingADataObject.java
incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specExampleSection/UsingTypeAndPropertyWithDataObjects.java
incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/tuscanyapi/CreateCompany.java
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=549141&r1=549140&r2=549141
==============================================================================
--- 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 Wed Jun 20 08:52:13 2007
@@ -23,36 +23,47 @@
import java.lang.reflect.InvocationTargetException;
import org.apache.tuscany.samples.sdo.specCodeSnippets.AccessDataObjectPropertiesByName;
+import org.apache.tuscany.samples.sdo.specCodeSnippets.DynamicCustomerTypeSample;
+import org.apache.tuscany.samples.sdo.specCodeSnippets.ObtainingDataGraphFromXml;
public class ExecuteSamples2 {
- public static Class[] sampleClasses = {
- org.apache.tuscany.samples.sdo.otherSources.CreateCompany.class, // NOVICE level samples
- AccessDataObjectPropertiesByName.class,
+ public static void main(String [] args) throws SecurityException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException {
+
+ Class[] sampleClasses = {
+ org.apache.tuscany.samples.sdo.otherSources.CreateCompany.class,
+ AccessDataObjectPropertiesByName.class,
+
+ DynamicCustomerTypeSample.class,
+ ObtainingDataGraphFromXml.class,
+ org.apache.tuscany.samples.sdo.tuscanyapi.CreateCompany.class
+
+
+ };
- org.apache.tuscany.samples.sdo.tuscanyapi.CreateCompany.class // INTERMEDIATE level samples
- // ADVANCED level samples
-
- };
-
- public static Class[] constructorArgTypes = { Integer.class };
+ Class[] constructorArgTypes = { Integer.class };
- /*
- * Edit the value of this argument to one of NOVICE, INTERMEDIATE or ADVANCED to see
- * more or less commentary. Note, this value only controls the level of commentary,
- * not which samples are executed. Use it to filter out the noise if you have already
- * understood the more basic commentary.
- */
- public static Object[] constructorArgs = { SampleInfrastructure.NOVICE };
-
- public static void main(String [] args) throws SecurityException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException {
+ /*
+ * Edit the value of this argument to one of COMMENTARY_FOR_NOVICE, COMMENTARY_FOR_INTERMEDIATE or COMMENTARY_FOR_ADVANCED to see
+ * more or less commentary. Note, this value only controls the level of commentary,
+ * not which samples are executed. Use it to filter out the noise if you have already
+ * understood the more basic commentary.
+ */
+ Object[] constructorArgs = { SampleInfrastructure.COMMENTARY_FOR_NOVICE };
+
-//
+ /*
+ * By default run all samples from novice level right up to advanced level.
+ * Edit this to run fewer samples.
+ */
+ int sampleLevel = SampleInfrastructure.SAMPLE_LEVEL_ADVANCED.intValue();
+
for (int i=0; i < sampleClasses.length; i++) {
Constructor c = sampleClasses[i].getConstructor(constructorArgTypes);
SampleBase sample = (SampleBase)c.newInstance(constructorArgs);
- sample.run();
+ if(sample.getSampleComplexityLevel() <= sampleLevel) {
+ sample.run();
+ }
}
-
}
}
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=549141&r1=549140&r2=549141
==============================================================================
--- 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 Wed Jun 20 08:52:13 2007
@@ -40,18 +40,25 @@
public SampleBase()
{
- super(NOVICE);
+ super(COMMENTARY_FOR_NOVICE);
}
+ /**
+ * @deprecated use 2 Integer arg constructor
+ */
public SampleBase(Integer userLevel) {
super(userLevel);
}
+ public SampleBase(Integer commentaryLevel, Integer sampLevel) {
+ super(commentaryLevel, sampLevel);
+ }
+
protected HelperContext createScopeForTypes() {
commentary(
- NOVICE,
+ COMMENTARY_FOR_NOVICE,
"All MetaData for SDO types can be viewed as being held in 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" +
@@ -60,7 +67,7 @@
"So we use a Tuscany specific API to do this ...\n\n" +
"HelperContext scope = SDOUtil.createHelperContext();",
- "Creating a new HelperContext scope for types for the next sample run"
+ "Creating a new HelperContext scope for types for the next sample run as we did in previous samples"
);
HelperContext scope = SDOUtil.createHelperContext();
@@ -69,7 +76,7 @@
protected HelperContext useDefaultScopeForTypes() {
commentary(
- NOVICE,
+ COMMENTARY_FOR_NOVICE,
"All MetaData for SDO types can be viewed as being held in 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" +
@@ -80,7 +87,7 @@
"A case in point where the default scope must be used is when using some of the DataGraph APIs\n" +
"which don't all support the type scoping extensions which were introduced in the SDO 2.1 specification",
- "Retrieving the default HelperContext scope for types for the next sample run"
+ "Retrieving the default HelperContext scope for types for the next sample run as we saw in a previous sample"
);
HelperContext scope = HelperProvider.getDefaultContext();
@@ -89,7 +96,7 @@
protected void loadXMLSchemaFromFile(HelperContext scope, String fileName) {
- commentary(NOVICE,
+ commentary(COMMENTARY_FOR_NOVICE,
"If you want to create types dynamically by loading an XML schema you\n" +
"use an instance of XSDHelper. You get that helper from a HelperContext.\n" +
"After successful loading of a schema, the new types are available to every\n" +
@@ -97,7 +104,7 @@
"XSDHelper xsdHelper = scope.getXSDHelper();\n"+
"xsdHelper.define(inputStream, null);",
- "Using an XSDHelper again to create types from an XML schema file"
+ "Using an XSDHelper again to create types from an XML schema file as we saw in a previous sample"
);
XSDHelper xsdHelper = scope.getXSDHelper();
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=549141&r1=549140&r2=549141
==============================================================================
--- 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 Wed Jun 20 08:52:13 2007
@@ -25,30 +25,43 @@
import java.util.HashSet;
import java.util.Set;
-import org.apache.tuscany.sdo.api.SDOUtil;
-
-import commonj.sdo.helper.HelperContext;
-
+/**
+ * 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 at.
+ */
public abstract class SampleInfrastructure {
+
+ protected int sampleComplexityLevel = SAMPLE_LEVEL_NOVICE.intValue();
+ protected int commentaryLevel = COMMENTARY_FOR_NOVICE.intValue();
/*
- * sample program infrastructure
+ * keep a record of what's been said, so that if alternative terse text is
+ * offered, the verbose text need not be repeated for repeat actions.
*/
- protected int userLevel = NOVICE.intValue();
private static Set commentaryHistory = new HashSet();
- public SampleInfrastructure (Integer novice2) {
- this.userLevel = novice2.intValue();
+ public SampleInfrastructure (Integer commentaryLevel) {
+ this.commentaryLevel = commentaryLevel.intValue();
}
+ public SampleInfrastructure(Integer commentaryLevel, Integer sampLevel) {
+ this.commentaryLevel = commentaryLevel.intValue();
+ this.sampleComplexityLevel = sampLevel.intValue();
+ }
+
private static String hrule = "********************************************";
- protected static final Integer NOVICE = new Integer(0);
- protected static final Integer INTERMEDIATE = new Integer(1);
- protected static final Integer ADVANCED = new Integer(2);
- protected static final Integer ALWAYS = new Integer(3);
+ protected static final Integer SAMPLE_LEVEL_NOVICE = new Integer(0);
+ protected static final Integer SAMPLE_LEVEL_INTERMEDIATE = new Integer(1);
+ protected static final Integer SAMPLE_LEVEL_ADVANCED = new Integer(2);
+
- protected static final String[] userLevels = {"NOVICE","INTERMEDIATE","ADVANCED","ALWAYS"};
+ protected static final Integer COMMENTARY_FOR_NOVICE = new Integer(0);
+ protected static final Integer COMMENTARY_FOR_INTERMEDIATE = new Integer(1);
+ protected static final Integer COMMENTARY_FOR_ADVANCED = new Integer(2);
+ protected static final Integer COMMENTARY_ALWAYS = new Integer(3);
+
+ protected static final String[] userLevels = {"COMMENTARY_FOR_NOVICE","COMMENTARY_FOR_INTERMEDIATE","COMMENTARY_FOR_ADVANCED","COMMENTARY_ALWAYS"};
public void banner(char borderChar, String text) {
if(text == null || text.length() == 0) {
@@ -86,7 +99,7 @@
protected void commentary(Integer commentLevel, String text, String repeatText) {
- if(commentLevel.intValue() < userLevel) return;
+ if(commentLevel.intValue() < commentaryLevel) return;
if(repeatText != null) {
boolean alreadySeen = commentaryHistory.contains(text);
@@ -103,11 +116,19 @@
}
protected void commentary(Integer commentLevel, String text) {
- if(commentLevel.intValue() >= userLevel) {
+ if(commentLevel.intValue() >= commentaryLevel) {
banner(text);
}
}
+ /*
+ * convenience method to allow commentary level to default to that of
+ * the sample's compexity
+ */
+ protected void commentary(String text) {
+ commentary(new Integer(getSampleComplexityLevel()), text);
+ }
+
public void somethingUnexpectedHasHappened(Exception e) {
banner('!',
"Something unexpected has gone wrong with the execution of this sample program\n" +
@@ -147,9 +168,9 @@
public void run() {
- commentary(ALWAYS," Tuscany SDO Java Sample " + this.getClass().getName() + " ");
- commentary(INTERMEDIATE, "Running with commentary level for a " + userLevels[userLevel] + " user\n"+
- "Edit the sample program's constructor argument to one from NOVICE, INTERMEDIATE or ADVANCED\n"+
+ commentary(COMMENTARY_ALWAYS," Tuscany SDO Java Sample " + this.getClass().getName() + " ");
+ commentary(COMMENTARY_FOR_INTERMEDIATE, "Running with commentary level for a " + userLevels[commentaryLevel] + " user\n"+
+ "Edit the sample program's constructor argument to one from COMMENTARY_FOR_NOVICE, COMMENTARY_FOR_INTERMEDIATE or COMMENTARY_FOR_ADVANCED\n"+
"in order to alter the level of commentary you are seeing",
"");
@@ -159,11 +180,19 @@
somethingUnexpectedHasHappened(e);
}
finally {
- commentary(ALWAYS, " End of sample " + this.getClass().getName() + " ");
+ commentary(COMMENTARY_ALWAYS, " End of sample " + this.getClass().getName() + " ");
}
}
public abstract void runSample() throws Exception ;
+
+ public int getSampleComplexityLevel() {
+ return sampleComplexityLevel;
+ }
+
+ public void setSampleComplexityLevel(Integer sampleComplexityLevel) {
+ this.sampleComplexityLevel = sampleComplexityLevel.intValue();
+ }
}
Modified: incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/otherSources/CreateCompany.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/otherSources/CreateCompany.java?view=diff&rev=549141&r1=549140&r2=549141
==============================================================================
--- incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/otherSources/CreateCompany.java (original)
+++ incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/otherSources/CreateCompany.java Wed Jun 20 08:52:13 2007
@@ -62,10 +62,13 @@
*/
public class CreateCompany extends SampleBase {
- public CreateCompany(Integer novice) {
- super(novice);
+ public CreateCompany(Integer commentaryLevel) {
+ this(commentaryLevel, SAMPLE_LEVEL_NOVICE);
}
+ public CreateCompany(Integer commentaryLevel, Integer sampleLevel) {
+ super(commentaryLevel, sampleLevel);
+ }
/**
* XML file generated for the company DataObject
*/
@@ -80,11 +83,10 @@
/*
* this sample is suitable for a novice to SDO.
* Change the experience level constructor argument to one of
- * NOVICE, INTERMEDIATE, ADVANCED, change
+ * COMMENTARY_FOR_NOVICE, COMMENTARY_FOR_INTERMEDIATE, COMMENTARY_FOR_ADVANCED, change
* the level of commentary output.
*/
- CreateCompany sample = new CreateCompany(NOVICE);
-
+ CreateCompany sample = new CreateCompany(COMMENTARY_FOR_NOVICE);
sample.run();
@@ -99,7 +101,7 @@
HelperContext scope = createScopeForTypes();
loadXMLSchemaFromFile(scope, SdoSampleConstants.COMPANY_XSD);
- commentary(NOVICE,
+ commentary(
"Now that our type system has been loaded and made available through the scope\n"+
"DataObjects can be created by a DataFactory that has access to the required types.\n\n"+
"DataObject company = scope.getDataFactory().create(SdoSampleConstants.COMPANY_NAMESPACE, \"CompanyType\");");
@@ -110,13 +112,13 @@
FileOutputStream fos = new FileOutputStream(COMPANY_GENERATED_XML);
- commentary(NOVICE,
+ commentary(
"The XMLHelper can be used to write an XML serialized version of the data graph\n\n"+
"scope.getXMLHelper().save(company, SdoSampleConstants.COMPANY_NAMESPACE, \"company\", fos);");
scope.getXMLHelper().save(company, SdoSampleConstants.COMPANY_NAMESPACE, "company", fos);
- commentary(NOVICE,
+ commentary(
"Similarly we can serialize the graph to an XML String using the XMLHelper\n\n"+
"String xml = scope.getXMLHelper().save(company, SdoSampleConstants.COMPANY_NAMESPACE, \"company\");\n");
Modified: incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/otherSources/CreatePurchaseOrder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/otherSources/CreatePurchaseOrder.java?view=diff&rev=549141&r1=549140&r2=549141
==============================================================================
--- incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/otherSources/CreatePurchaseOrder.java (original)
+++ incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/otherSources/CreatePurchaseOrder.java Wed Jun 20 08:52:13 2007
@@ -21,19 +21,15 @@
package org.apache.tuscany.samples.sdo.otherSources;
import java.io.FileOutputStream;
-import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-import commonj.sdo.DataObject;
-import commonj.sdo.helper.DataFactory;
-import commonj.sdo.helper.HelperContext;
-import commonj.sdo.helper.XMLHelper;
-import commonj.sdo.helper.XSDHelper;
-
import org.apache.tuscany.samples.sdo.SampleBase;
import org.apache.tuscany.samples.sdo.SdoSampleConstants;
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.HelperContext;
+
/**
* Demonstrates creating a purchaseOrder DataObject from an existing XSD and then
* persisting to disk. Uses previously defined model
@@ -111,9 +107,9 @@
*/
public static void main(String[] args) {
- // TODO make the default level NOVICE, once the rest of the sample has been
+ // TODO make the default level COMMENTARY_FOR_NOVICE, once the rest of the sample has been
// converted to using commentary()
- CreatePurchaseOrder sample = new CreatePurchaseOrder(INTERMEDIATE);
+ CreatePurchaseOrder sample = new CreatePurchaseOrder(COMMENTARY_FOR_INTERMEDIATE);
sample.run();
Modified: incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/otherSources/PurchaseOrderControl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/otherSources/PurchaseOrderControl.java?view=diff&rev=549141&r1=549140&r2=549141
==============================================================================
--- incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/otherSources/PurchaseOrderControl.java (original)
+++ incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/otherSources/PurchaseOrderControl.java Wed Jun 20 08:52:13 2007
@@ -93,6 +93,7 @@
* @throws Exception
*/
public PurchaseOrderControl(String xsdFileName, String xmlFileName) throws Exception {
+ // FIXME add in the sample commentary and complexity levels
this.xsdFileName = xsdFileName;
this.xmlFileName = xmlFileName;
Modified: incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/otherSources/ReadPurchaseOrder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/otherSources/ReadPurchaseOrder.java?view=diff&rev=549141&r1=549140&r2=549141
==============================================================================
--- incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/otherSources/ReadPurchaseOrder.java (original)
+++ incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/otherSources/ReadPurchaseOrder.java Wed Jun 20 08:52:13 2007
@@ -95,9 +95,9 @@
}
public static void main(String[] args) {
- // TODO make the default level NOVICE, once the rest of the sample has been
+ // TODO make the default level COMMENTARY_FOR_NOVICE, once the rest of the sample has been
// converted to using commentary()
- ReadPurchaseOrder sample = new ReadPurchaseOrder(INTERMEDIATE);
+ ReadPurchaseOrder sample = new ReadPurchaseOrder(COMMENTARY_FOR_INTERMEDIATE);
try {
sample.run();
Modified: incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specCodeSnippets/AccessDataObjectPropertiesByName.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specCodeSnippets/AccessDataObjectPropertiesByName.java?view=diff&rev=549141&r1=549140&r2=549141
==============================================================================
--- incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specCodeSnippets/AccessDataObjectPropertiesByName.java (original)
+++ incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specCodeSnippets/AccessDataObjectPropertiesByName.java Wed Jun 20 08:52:13 2007
@@ -73,8 +73,8 @@
*/
public class AccessDataObjectPropertiesByName extends SampleBase {
- public AccessDataObjectPropertiesByName(Integer userLevel) {
- super(userLevel);
+ public AccessDataObjectPropertiesByName(Integer commentaryLevel) {
+ super(commentaryLevel, SAMPLE_LEVEL_NOVICE);
}
@@ -82,7 +82,7 @@
/*
* This sample is well suited to exploration by a novice user
*/
- AccessDataObjectPropertiesByName sample = new AccessDataObjectPropertiesByName(NOVICE);
+ AccessDataObjectPropertiesByName sample = new AccessDataObjectPropertiesByName(COMMENTARY_FOR_NOVICE);
sample.run();
}
Modified: incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specCodeSnippets/AccessDataObjectUsingValidXPath.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specCodeSnippets/AccessDataObjectUsingValidXPath.java?view=diff&rev=549141&r1=549140&r2=549141
==============================================================================
--- incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specCodeSnippets/AccessDataObjectUsingValidXPath.java (original)
+++ incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specCodeSnippets/AccessDataObjectUsingValidXPath.java Wed Jun 20 08:52:13 2007
@@ -108,9 +108,9 @@
* No parameters required.
*/
public static void main(String[] args) {
- // TODO make the default level NOVICE, once the rest of the sample has been
+ // TODO make the default level COMMENTARY_FOR_NOVICE, once the rest of the sample has been
// converted to using commentary()
- AccessDataObjectPropertiesByName sample = new AccessDataObjectPropertiesByName(INTERMEDIATE);
+ AccessDataObjectPropertiesByName sample = new AccessDataObjectPropertiesByName(COMMENTARY_FOR_INTERMEDIATE);
try {
sample.run();
Modified: incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specCodeSnippets/CreateDataObjectFromXmlString.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specCodeSnippets/CreateDataObjectFromXmlString.java?view=diff&rev=549141&r1=549140&r2=549141
==============================================================================
--- incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specCodeSnippets/CreateDataObjectFromXmlString.java (original)
+++ incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specCodeSnippets/CreateDataObjectFromXmlString.java Wed Jun 20 08:52:13 2007
@@ -103,9 +103,9 @@
* None required
*/
public static void main(String[] args) {
- // TODO make the default level NOVICE, once the rest of the sample has been
+ // TODO make the default level COMMENTARY_FOR_NOVICE, once the rest of the sample has been
// converted to using commentary()
- AccessDataObjectPropertiesByName sample = new AccessDataObjectPropertiesByName(INTERMEDIATE);
+ AccessDataObjectPropertiesByName sample = new AccessDataObjectPropertiesByName(COMMENTARY_FOR_INTERMEDIATE);
try {
sample.run();
Modified: incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specCodeSnippets/CreateDataObjectFromXsdAndXmlFiles.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specCodeSnippets/CreateDataObjectFromXsdAndXmlFiles.java?view=diff&rev=549141&r1=549140&r2=549141
==============================================================================
--- incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specCodeSnippets/CreateDataObjectFromXsdAndXmlFiles.java (original)
+++ incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specCodeSnippets/CreateDataObjectFromXsdAndXmlFiles.java Wed Jun 20 08:52:13 2007
@@ -176,9 +176,9 @@
* @param args. No arguments required
*/
public static void main(String[] args) {
- // TODO make the default level NOVICE, once the rest of the sample has been
+ // TODO make the default level COMMENTARY_FOR_NOVICE, once the rest of the sample has been
// converted to using commentary()
- AccessDataObjectPropertiesByName sample = new AccessDataObjectPropertiesByName(INTERMEDIATE);
+ AccessDataObjectPropertiesByName sample = new AccessDataObjectPropertiesByName(COMMENTARY_FOR_INTERMEDIATE);
try {
sample.run();
Modified: incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specCodeSnippets/DynamicCustomerTypeSample.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specCodeSnippets/DynamicCustomerTypeSample.java?view=diff&rev=549141&r1=549140&r2=549141
==============================================================================
--- incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specCodeSnippets/DynamicCustomerTypeSample.java (original)
+++ incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specCodeSnippets/DynamicCustomerTypeSample.java Wed Jun 20 08:52:13 2007
@@ -74,7 +74,7 @@
HelperContext scope;
public DynamicCustomerTypeSample(Integer userLevel) {
- super(userLevel);
+ super(userLevel, SAMPLE_LEVEL_INTERMEDIATE);
}
@@ -108,106 +108,104 @@
public static final String CUSTOMER_XML_GENERATED = "generatedCustomer.xml";
/**
- * Method dynamically defines customer types
- */
- public void defineCustomerTypes() {
- // get an instance of the type helper
- TypeHelper types = scope.getTypeHelper();
- Type intType = types.getType("commonj.sdo", "Int");
- Type stringType = types.getType("commonj.sdo", "String");
-
- // create a new Type for Customers
- DataObject customerType = scope.getDataFactory().create("commonj.sdo", "Type");
- customerType.set("uri", "http://example.com/customer");
- customerType.set("name", "Customer");
-
- // create a customer number property
- DataObject custNumProperty = customerType.createDataObject("property");
- custNumProperty.set("name", "custNum");
- custNumProperty.set("type", intType);
-
- // create a last name property
- DataObject lastNameProperty = customerType.createDataObject("property");
- lastNameProperty.set("name", "lastName");
- lastNameProperty.set("type", stringType);
-
- // create a first name property
- DataObject firstNameProperty = customerType.createDataObject("property");
- firstNameProperty.set("name", "firstName");
- firstNameProperty.set("type", stringType);
-
- // now define the Customer type so that customers can be made
- types.define(customerType);
-
- Type testType = scope.getTypeHelper().getType("http://example.com/customer", "Customer");
- List props = testType.getProperties();
- for (int i = 0; i < props.size(); i++) {
- System.out.println(props.get(i));
- }
- }
-
- /**
- * Creates a new Customer using dynamically defined Customer Type
- *
- * @param custNum
- * @param firstName
- * @param lastName
- * @return
- */
- private DataObject createCustomer(int custNum, String firstName, String lastName) {
- DataFactory factory = scope.getDataFactory();
- DataObject customer1 = factory.create("http://example.com/customer", "Customer");
- customer1.setInt("custNum", custNum);
- customer1.set("firstName", firstName);
- customer1.set("lastName", lastName);
- return customer1;
- }
-
- /**
* Drives sample methods
*
* @param args
* no arguments required
*/
public static void main(String[] args) {
- // TODO make the default level NOVICE, once the rest of the sample has been
- // converted to using commentary()
- AccessDataObjectPropertiesByName sample = new AccessDataObjectPropertiesByName(INTERMEDIATE);
- try {
- sample.run();
- }
- catch (Exception e) {
- sample.somethingUnexpectedHasHappened(e);
- }
+ DynamicCustomerTypeSample sample =
+ new DynamicCustomerTypeSample(COMMENTARY_FOR_INTERMEDIATE);
+ sample.run();
+
}
public void runSample () throws Exception {
- System.out.println("***************************************");
- System.out.println("SDO Sample DynamicCustomerTypeSample");
- System.out.println("***************************************");
- System.out.println("Demonstrats creating and using Types dynamically");
- System.out.println("***************************************");
- try {
- scope = createScopeForTypes();
+ commentary(COMMENTARY_ALWAYS,
+ "Demonstrates the use of the SDO API to build types dynamically\n"+
+ "by building a data graph representing the type system and\n"+
+ "submitting that graph to TypeHelper.define()");
+
+
+ scope = createScopeForTypes();
+
+
+ commentary("A TypeHelper is used for both looking up types, and later creating them\n\n"+
+ "TypeHelper typeHelper = scope.getTypeHelper();");
+
+ TypeHelper typeHelper = scope.getTypeHelper();
+
+ commentary("We can look up existing types to use in the creation of Properties\n\n"+
+ "Type intType = types.getType(\"commonj.sdo\", \"Int\");\n"+
+ "Type stringType = types.getType(\"commonj.sdo\", \"String\");");
+
+ Type intType = typeHelper.getType("commonj.sdo", "Int");
+ Type stringType = typeHelper.getType("commonj.sdo", "String");
+
+ commentary("To begin modelling the type system we create a DataObject with\n"+
+ "Type \"commonj.sdo#Type\" and set the URI and name for that type\n\n"+
- System.out.println("Dynamically defining Customer Type");
- defineCustomerTypes();
+ "DataObject customerType = scope.getDataFactory().create(\"commonj.sdo\", \"Type\");"+
+ "customerType.set(\"uri\", \"http://example.com/customer\");\n"+
+ "customerType.set(\"name\", \"Customer\");");
+
+ DataObject customerType = scope.getDataFactory().create("commonj.sdo", "Type");
+ customerType.set("uri", "http://example.com/customer");
+ customerType.set("name", "Customer");
+
+ commentary("Now we can create a model for the Properties for the Type\n"+
+ "and set the name and Types of those Properties\n\n"+
+ "DataObject custNumProperty = customerType.createDataObject(\"property\");"+
+ "custNumProperty.set(\"name\", \"custNum\");"+
+ "custNumProperty.set(\"type\", intType);"
+ );
+
+ DataObject custNumProperty = customerType.createDataObject("property");
+ custNumProperty.set("name", "custNum");
+ custNumProperty.set("type", intType);
+
+ commentary("We continue in this manner until all the Types and their Properties are modelled");
+ DataObject lastNameProperty = customerType.createDataObject("property");
+ lastNameProperty.set("name", "lastName");
+ lastNameProperty.set("type", stringType);
+
+ DataObject firstNameProperty = customerType.createDataObject("property");
+ firstNameProperty.set("name", "firstName");
+ firstNameProperty.set("type", stringType);
+
+ commentary("Now that our type is fully modelled we submit the model to the TypeHelper\n"+
+ "The new Type instance is retuend to us, but is also available for lookup within\n"+
+ "the scope associated with the TypeHelper\n\n"+
+ "Type t = typeHelper.define(customerType);");
+ Type t = typeHelper.define(customerType);
+
+ commentary("Here we see the newly created Type being accessed via the TypeHelper\n"+
+ "along with a printout of the Type's Properties\n\n"+
+ "Type testType = scope.getTypeHelper().getType(\"http://example.com/customer\", \"Customer\");");
+
+ Type testType = scope.getTypeHelper().getType("http://example.com/customer", "Customer");
+ List props = testType.getProperties();
+ for (int i = 0; i < props.size(); i++) {
+ System.out.println(props.get(i));
+ }
+
+ commentary("Now we can create an instance of the type using the DataFactory associated with the type scope\n\n"+
+ "DataFactory factory = scope.getDataFactory();"+
+ "DataObject customer1 = factory.create(\"http://example.com/customer\", \"Customer\");");
+
+ DataFactory factory = scope.getDataFactory();
+ DataObject customer1 = factory.create("http://example.com/customer", "Customer");
+ customer1.setInt("custNum", 1);
+ customer1.set("firstName", "John");
+ customer1.set("lastName", "Adams");
+
+ commentary("Here's an XML String representing a DataObject we have created with the new type");
+ String xmlDocString = scope.getXMLHelper().save(customer1, CUSTOMER_NAMESPACE, "customer");
+ System.out.println(xmlDocString);
+
- System.out.println("Creating new customer DataObject");
- DataObject customer1 = createCustomer(1, "John", "Adams");
- System.out.println("Customer Created");
-
- System.out.println("converting to xml");
- String xmlDocString = scope.getXMLHelper().save(customer1, CUSTOMER_NAMESPACE, "customer");
- System.out.println(xmlDocString);
-
- } catch (Exception e) {
- System.out.println("Sorry unexpected exception caught during sample execution : " + e.toString());
- e.printStackTrace();
- }
- System.out.println("GoodBye");
}
}
Modified: incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specCodeSnippets/ObtainingDataGraphFromXml.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specCodeSnippets/ObtainingDataGraphFromXml.java?view=diff&rev=549141&r1=549140&r2=549141
==============================================================================
--- incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specCodeSnippets/ObtainingDataGraphFromXml.java (original)
+++ incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specCodeSnippets/ObtainingDataGraphFromXml.java Wed Jun 20 08:52:13 2007
@@ -101,16 +101,16 @@
public ObtainingDataGraphFromXml(Integer userLevel) {
- super(userLevel);
+ super(userLevel, SAMPLE_LEVEL_INTERMEDIATE);
}
public static void main(String[] args) {
/*
- * Create an instance of the sample program. Edit the "userLevel" argument to suit
- * your experience, NOVICE, INTERMEDIATE or ADVANCED
+ * Create an instance of the sample program. Edit the "commentaryLevel" argument to suit
+ * your experience, COMMENTARY_FOR_NOVICE, COMMENTARY_FOR_INTERMEDIATE or COMMENTARY_FOR_ADVANCED
*/
- ObtainingDataGraphFromXml sample = new ObtainingDataGraphFromXml(NOVICE);
+ ObtainingDataGraphFromXml sample = new ObtainingDataGraphFromXml(COMMENTARY_FOR_NOVICE);
sample.run();
}
@@ -148,12 +148,12 @@
DataObject company = null;
- commentary(INTERMEDIATE,
+ commentary(
"Here we see the specification's example for obtaining dealing with\n"+
"loading a data graph which uses a method, XMLHelper.load(). This loads an XML instance document\n"+
"into an instance of XMLDocument ...\n\n"+
"XMLDocument doc = scope.getXMLHelper().load(\n"+
- " ClassLoader.getSystemResourceAsStream(SdoSampleConstants.COMPANY_DATAGRAPH_XML));"
+ "ClassLoader.getSystemResourceAsStream(SdoSampleConstants.COMPANY_DATAGRAPH_XML));"
);
InputStream is = ClassLoader.getSystemResourceAsStream(SdoSampleConstants.COMPANY_DATAGRAPH_XML);
@@ -167,7 +167,7 @@
XMLDocument doc = scope.getXMLHelper().load(
ClassLoader.getSystemResourceAsStream(SdoSampleConstants.COMPANY_DATAGRAPH_XML));
- commentary(INTERMEDIATE,
+ commentary(
"Now we can get the wrapper for the data graph, which in this case is the DataObject\n"+
"of type commonj.sdo#DataGraph. Note how there's no magic here; no special class for\n"+
"DataGraph, no special handling, this is just a standard pattern of using a built in SDO Type.\n"+
@@ -179,21 +179,21 @@
System.out.println(dataObjectRepresentingDataGraph);
- commentary(INTERMEDIATE,
+ commentary(
"If you are confused by the fact that whatt we really get is an instance of DataGraphTypeImpl\n"+
"This really is a DataObject, but it is a generated class extending DataObjectImpl\n+"+
"representing the DataGraph model.");
company = dataObjectRepresentingDataGraph.getDataObject("company");
- commentary(INTERMEDIATE,
+ commentary(
"We've obtained a DataObject representing the data graph, and from that we have obtained\n"+
"the true root object of the business data");
System.out.println(company);
System.out.println();
- commentary(INTERMEDIATE,
+ commentary(
"Using an instance of DataGraph can perhaps be seen as an older style pattern of wrapping a data graph\n"+
"and the first approach is likely to get more emphaissi and attention in future revisions of the spec.\n"+
"The SDO API has some limitations in the area of saving and loading instances of the\n"+
@@ -207,7 +207,7 @@
System.out.println(datagraph);
- commentary(INTERMEDIATE,
+ commentary(
"In this case we directly receive an instance of DataGraph and can retrieve the root\n"+
"business object from the DataGraph\n\n"+
"DataObject company = datagraph.getRootObject();");
Modified: incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specCodeSnippets/PrintPropertiesOfDataObject.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specCodeSnippets/PrintPropertiesOfDataObject.java?view=diff&rev=549141&r1=549140&r2=549141
==============================================================================
--- incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specCodeSnippets/PrintPropertiesOfDataObject.java (original)
+++ incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specCodeSnippets/PrintPropertiesOfDataObject.java Wed Jun 20 08:52:13 2007
@@ -148,9 +148,9 @@
* none required.
*/
public static void main(String[] args) {
- // TODO make the default level NOVICE, once the rest of the sample has been
+ // TODO make the default level COMMENTARY_FOR_NOVICE, once the rest of the sample has been
// converted to using commentary()
- AccessDataObjectPropertiesByName sample = new AccessDataObjectPropertiesByName(INTERMEDIATE);
+ AccessDataObjectPropertiesByName sample = new AccessDataObjectPropertiesByName(COMMENTARY_FOR_INTERMEDIATE);
try {
sample.run();
Modified: incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specCodeSnippets/UsingXPath.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specCodeSnippets/UsingXPath.java?view=diff&rev=549141&r1=549140&r2=549141
==============================================================================
--- incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specCodeSnippets/UsingXPath.java (original)
+++ incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specCodeSnippets/UsingXPath.java Wed Jun 20 08:52:13 2007
@@ -115,9 +115,9 @@
* No parameters required.
*/
public static void main(String[] args) {
- // TODO make the default level NOVICE, once the rest of the sample has been
+ // TODO make the default level COMMENTARY_FOR_NOVICE, once the rest of the sample has been
// converted to using commentary()
- AccessDataObjectPropertiesByName sample = new AccessDataObjectPropertiesByName(INTERMEDIATE);
+ AccessDataObjectPropertiesByName sample = new AccessDataObjectPropertiesByName(COMMENTARY_FOR_INTERMEDIATE);
try {
sample.run();
Modified: incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specExampleSection/AccessDataObjectsUsingXPath.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specExampleSection/AccessDataObjectsUsingXPath.java?view=diff&rev=549141&r1=549140&r2=549141
==============================================================================
--- incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specExampleSection/AccessDataObjectsUsingXPath.java (original)
+++ incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specExampleSection/AccessDataObjectsUsingXPath.java Wed Jun 20 08:52:13 2007
@@ -120,9 +120,9 @@
* @param args
*/
public static void main(String[] args) {
- // TODO make the default level NOVICE, once the rest of the sample has been
+ // TODO make the default level COMMENTARY_FOR_NOVICE, once the rest of the sample has been
// converted to using commentary()
- AccessDataObjectPropertiesByName sample = new AccessDataObjectPropertiesByName(INTERMEDIATE);
+ AccessDataObjectPropertiesByName sample = new AccessDataObjectPropertiesByName(COMMENTARY_FOR_INTERMEDIATE);
try {
sample.run();
Modified: incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specExampleSection/AccessingDataObjectsViaPropertyIndex.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specExampleSection/AccessingDataObjectsViaPropertyIndex.java?view=diff&rev=549141&r1=549140&r2=549141
==============================================================================
--- incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specExampleSection/AccessingDataObjectsViaPropertyIndex.java (original)
+++ incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specExampleSection/AccessingDataObjectsViaPropertyIndex.java Wed Jun 20 08:52:13 2007
@@ -149,9 +149,9 @@
* @param args
*/
public static void main(String[] args) {
- // TODO make the default level NOVICE, once the rest of the sample has been
+ // TODO make the default level COMMENTARY_FOR_NOVICE, once the rest of the sample has been
// converted to using commentary()
- AccessDataObjectPropertiesByName sample = new AccessDataObjectPropertiesByName(INTERMEDIATE);
+ AccessDataObjectPropertiesByName sample = new AccessDataObjectPropertiesByName(COMMENTARY_FOR_INTERMEDIATE);
try {
sample.run();
Modified: 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/specExampleSection/AccessingTheContentsOfASequence.java?view=diff&rev=549141&r1=549140&r2=549141
==============================================================================
--- 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/specExampleSection/AccessingTheContentsOfASequence.java Wed Jun 20 08:52:13 2007
@@ -115,16 +115,12 @@
* @param args
*/
public static void main(String[] args) {
- // TODO make the default level NOVICE, once the rest of the sample has been
+ // TODO make the default level COMMENTARY_FOR_NOVICE, once the rest of the sample has been
// converted to using commentary()
- AccessDataObjectPropertiesByName sample = new AccessDataObjectPropertiesByName(INTERMEDIATE);
+ AccessDataObjectPropertiesByName sample = new AccessDataObjectPropertiesByName(COMMENTARY_FOR_INTERMEDIATE);
+
+ sample.run();
- try {
- sample.run();
- }
- catch (Exception e) {
- sample.somethingUnexpectedHasHappened(e);
- }
}
public void runSample () throws Exception {
Modified: incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specExampleSection/CreatingDataObjectTreesFromXMLDocuments.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specExampleSection/CreatingDataObjectTreesFromXMLDocuments.java?view=diff&rev=549141&r1=549140&r2=549141
==============================================================================
--- incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specExampleSection/CreatingDataObjectTreesFromXMLDocuments.java (original)
+++ incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specExampleSection/CreatingDataObjectTreesFromXMLDocuments.java Wed Jun 20 08:52:13 2007
@@ -103,9 +103,9 @@
* none required.
*/
public static void main(String[] args) {
- // TODO make the default level NOVICE, once the rest of the sample has been
+ // TODO make the default level COMMENTARY_FOR_NOVICE, once the rest of the sample has been
// converted to using commentary()
- AccessDataObjectPropertiesByName sample = new AccessDataObjectPropertiesByName(INTERMEDIATE);
+ AccessDataObjectPropertiesByName sample = new AccessDataObjectPropertiesByName(COMMENTARY_FOR_INTERMEDIATE);
try {
sample.run();
Modified: incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specExampleSection/CreatingXmlFromDataObjects.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specExampleSection/CreatingXmlFromDataObjects.java?view=diff&rev=549141&r1=549140&r2=549141
==============================================================================
--- incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specExampleSection/CreatingXmlFromDataObjects.java (original)
+++ incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specExampleSection/CreatingXmlFromDataObjects.java Wed Jun 20 08:52:13 2007
@@ -98,9 +98,9 @@
public static void main(String[] args) {
- // TODO make the default level NOVICE, once the rest of the sample has been
+ // TODO make the default level COMMENTARY_FOR_NOVICE, once the rest of the sample has been
// converted to using commentary()
- AccessDataObjectPropertiesByName sample = new AccessDataObjectPropertiesByName(INTERMEDIATE);
+ AccessDataObjectPropertiesByName sample = new AccessDataObjectPropertiesByName(COMMENTARY_FOR_INTERMEDIATE);
try {
sample.run();
Modified: incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specExampleSection/SerializingDesearializingADataObject.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specExampleSection/SerializingDesearializingADataObject.java?view=diff&rev=549141&r1=549140&r2=549141
==============================================================================
--- incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specExampleSection/SerializingDesearializingADataObject.java (original)
+++ incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/specExampleSection/SerializingDesearializingADataObject.java Wed Jun 20 08:52:13 2007
@@ -121,9 +121,9 @@
* @param args
*/
public static void main(String[] args) {
- // TODO make the default level NOVICE, once the rest of the sample has been
+ // TODO make the default level COMMENTARY_FOR_NOVICE, once the rest of the sample has been
// converted to using commentary()
- AccessDataObjectPropertiesByName sample = new AccessDataObjectPropertiesByName(INTERMEDIATE);
+ AccessDataObjectPropertiesByName sample = new AccessDataObjectPropertiesByName(COMMENTARY_FOR_INTERMEDIATE);
try {
sample.run();
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=549141&r1=549140&r2=549141
==============================================================================
--- 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 Wed Jun 20 08:52:13 2007
@@ -103,9 +103,9 @@
* @param args
*/
public static void main(String[] args) {
- // TODO make the default level NOVICE, once the rest of the sample has been
+ // TODO make the default level COMMENTARY_FOR_NOVICE, once the rest of the sample has been
// converted to using commentary()
- AccessDataObjectPropertiesByName sample = new AccessDataObjectPropertiesByName(INTERMEDIATE);
+ AccessDataObjectPropertiesByName sample = new AccessDataObjectPropertiesByName(COMMENTARY_FOR_INTERMEDIATE);
try {
sample.run();
Modified: incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/tuscanyapi/CreateCompany.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/tuscanyapi/CreateCompany.java?view=diff&rev=549141&r1=549140&r2=549141
==============================================================================
--- incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/tuscanyapi/CreateCompany.java (original)
+++ incubator/tuscany/java/sdo/sample/src/main/java/org/apache/tuscany/samples/sdo/tuscanyapi/CreateCompany.java Wed Jun 20 08:52:13 2007
@@ -64,8 +64,8 @@
*/
public class CreateCompany extends org.apache.tuscany.samples.sdo.otherSources.CreateCompany {
- public CreateCompany(Integer userLevel) {
- super(userLevel);
+ public CreateCompany(Integer commentaryLevel) {
+ super(commentaryLevel, SAMPLE_LEVEL_INTERMEDIATE);
}
/**
@@ -85,7 +85,7 @@
* of understanding of SDO. Change the experience level argument to get more
* or less commentary.
*/
- CreateCompany sample = new CreateCompany(INTERMEDIATE);
+ CreateCompany sample = new CreateCompany(COMMENTARY_FOR_INTERMEDIATE);
sample.run();
}
@@ -102,7 +102,7 @@
"If you don't have a need to use a DataGraph instance then you may want to skip this\n"+
"sample, or leave it until you have explored the DataObject interface fully\n");
- commentary(INTERMEDIATE,
+ commentary(COMMENTARY_FOR_INTERMEDIATE,
"As we are dealing with a DataGraph, the SDO API has some gray areas at the moment\n"+
"in that the DataGraph API hasn't yet been developed to deal with scopes\n"+
"other than the default scope. So here is an occasion where we must use"+
@@ -110,13 +110,13 @@
HelperContext scope = useDefaultScopeForTypes();
loadXMLSchemaFromFile(scope, SdoSampleConstants.COMPANY_XSD);
- commentary (INTERMEDIATE,
+ commentary (COMMENTARY_FOR_INTERMEDIATE,
"Here is the use of the Tuscany API for creating a DataGraph instance\n\n"+
"DataGraph dataGraph = SDOUtil.createDataGraph();");
DataGraph dataGraph = SDOUtil.createDataGraph();
- commentary(INTERMEDIATE,
+ commentary(COMMENTARY_FOR_INTERMEDIATE,
"Now we create a root object of a selected type for the DataGraph wrapper to contain.\n"+
"This is an example of a DataGraph interface that currently forces us to use the default scope.\n\n"+
"company = dataGraph.createRootObject(SdoSampleConstants.COMPANY_NAMESPACE, \"CompanyType\");");
@@ -125,7 +125,7 @@
populateGraph(scope, company);
- commentary(INTERMEDIATE,
+ commentary(COMMENTARY_FOR_INTERMEDIATE,
"Since the SDO API doesn't currently have a method for serializing the DataGraph instance\n"+
"we again use a Tuscany specific API\n\n"+
"SDOUtil.saveDataGraph(dataGraph, fos, null);");
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org