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 2006/11/27 16:35:18 UTC
svn commit: r479663 [1/2] - in /incubator/tuscany/java/sdo:
impl/src/main/java/org/apache/tuscany/sdo/
impl/src/main/java/org/apache/tuscany/sdo/impl/
impl/src/main/java/org/apache/tuscany/sdo/util/
impl/src/test/java/org/apache/tuscany/sdo/ impl/src/t...
Author: kelvingoodson
Date: Mon Nov 27 07:35:17 2006
New Revision: 479663
URL: http://svn.apache.org/viewvc?view=rev&rev=479663
Log:
partial fix for TUSCANY-153 -- some new code commented out awaiting the update of the new generated model, see the comments "// TODO T-153" for such comments
Added:
incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/AllTests.java (with props)
incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/AllTests.java (with props)
incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/AllTests.java (with props)
incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/ChangeSummaryOnDataObjectTestCase.java (with props)
incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/HelperContextTestCase.java (with props)
incubator/tuscany/java/sdo/impl/src/test/resources/simpleWithChangeSummary.xsd (with props)
incubator/tuscany/java/sdo/tools/src/test/java/org/apache/tuscany/sdo/test/ChangeSummaryGenTestCase.java (with props)
incubator/tuscany/java/sdo/tools/src/test/java/org/apache/tuscany/sdo/test/CreateTestClasses.java (with props)
incubator/tuscany/java/sdo/tools/src/test/java/org/example/
incubator/tuscany/java/sdo/tools/src/test/java/org/example/simple/
incubator/tuscany/java/sdo/tools/src/test/java/org/example/simple/cs/
incubator/tuscany/java/sdo/tools/src/test/java/org/example/simple/cs/CSFactory.java (with props)
incubator/tuscany/java/sdo/tools/src/test/java/org/example/simple/cs/Quote.java (with props)
incubator/tuscany/java/sdo/tools/src/test/java/org/example/simple/cs/QuoteBase.java (with props)
incubator/tuscany/java/sdo/tools/src/test/java/org/example/simple/cs/impl/
incubator/tuscany/java/sdo/tools/src/test/java/org/example/simple/cs/impl/CSFactoryImpl.java (with props)
incubator/tuscany/java/sdo/tools/src/test/java/org/example/simple/cs/impl/QuoteBaseImpl.java (with props)
incubator/tuscany/java/sdo/tools/src/test/java/org/example/simple/cs/impl/QuoteImpl.java (with props)
incubator/tuscany/java/sdo/tools/src/test/resources/simpleWithChangeSummary.xsd (with props)
Modified:
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/SDOPackage.java
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/ChangeSummaryImpl.java
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/ClassImpl.java
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DataObjectImpl.java
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DynamicDataObjectImpl.java
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/SDOPackageImpl.java
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/DataObjectUtil.java
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/SDOUtil.java
Modified: incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/SDOPackage.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/SDOPackage.java?view=diff&rev=479663&r1=479662&r2=479663
==============================================================================
--- incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/SDOPackage.java (original)
+++ incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/SDOPackage.java Mon Nov 27 07:35:17 2006
@@ -140,14 +140,26 @@
*/
int CHANGE_SUMMARY__EDATA_GRAPH = ChangePackage.CHANGE_DESCRIPTION_FEATURE_COUNT + 0;
+//TODO T-153
+// /**
+// * The feature id for the '<em><b>EData Graph</b></em>' reference.
+// * <!-- begin-user-doc -->
+// * <!-- end-user-doc -->
+// * *handcrafted but could be generated
+// * @ordered
+// */
+// int CHANGE_SUMMARY__EDATA_OBJECT = ChangePackage.CHANGE_DESCRIPTION_FEATURE_COUNT + 1;
+
/**
* The number of structural features of the '<em>Change Summary</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @generated
+ * @generated NOT
* @ordered
*/
+//TODO T-153
int CHANGE_SUMMARY_FEATURE_COUNT = ChangePackage.CHANGE_DESCRIPTION_FEATURE_COUNT + 1;
+ //int CHANGE_SUMMARY_FEATURE_COUNT = ChangePackage.CHANGE_DESCRIPTION_FEATURE_COUNT + 2;
/**
* The meta object id for the '{@link org.apache.tuscany.sdo.impl.ChangeSummarySettingImpl <em>Change Summary Setting</em>}' class.
@@ -1350,6 +1362,19 @@
*/
EReference getChangeSummary_EDataGraph();
+// TODO T-153
+// /**
+// * Returns the meta object for the reference '{@link commonj.sdo.ChangeSummary#getEDataGraph <em>EData Graph</em>}'.
+// * <!-- begin-user-doc -->
+// * <!-- end-user-doc -->
+// * @return the meta object for the reference '<em>EData Graph</em>'.
+// * @see commonj.sdo.ChangeSummary#getEDataGraph()
+// * @see #getChangeSummary()
+// * *handcrafted but could be generated
+// */
+// EReference getChangeSummary_EDataObject();
+
+
/**
* Returns the meta object for class '{@link commonj.sdo.ChangeSummary.Setting <em>Change Summary Setting</em>}'.
* <!-- begin-user-doc -->
Modified: incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/ChangeSummaryImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/ChangeSummaryImpl.java?view=diff&rev=479663&r1=479662&r2=479663
==============================================================================
--- incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/ChangeSummaryImpl.java (original)
+++ incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/ChangeSummaryImpl.java Mon Nov 27 07:35:17 2006
@@ -87,6 +87,7 @@
* @ordered
*/
protected DataGraph eDataGraph = null;
+ // TODO T-153 protected DataObject eDataObject = null;
protected ChangeRecorder changeRecorder = null;
protected EList cachedObjectsToDetach = null;
@@ -131,6 +132,16 @@
{
return eDataGraph;
}
+
+// TODO T-153 /**
+// * <!-- begin-user-doc -->
+// * <!-- end-user-doc -->
+// * handcrafted but could be generated
+// */
+// public DataObject getEDataObject()
+// {
+// return eDataObject;
+// }
/**
* <!-- begin-user-doc -->
@@ -148,6 +159,23 @@
}
return msgs;
}
+//TODO T-153
+// /**
+// * <!-- begin-user-doc -->
+// * <!-- end-user-doc -->
+// * handcrafted but could be genereated
+// */
+// public NotificationChain basicSetEDataObject(DataObject newEDataObject, NotificationChain msgs)
+// {
+// DataObject oldEDataObject = eDataObject;
+// eDataObject = newEDataObject;
+// if (eNotificationRequired())
+// {
+// ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SDOPackage.CHANGE_SUMMARY__EDATA_OBJECT, oldEDataObject, newEDataObject);
+// if (msgs == null) msgs = notification; else msgs.add(notification);
+// }
+// return msgs;
+// }
/**
* <!-- begin-user-doc -->
@@ -170,6 +198,31 @@
eNotify(new ENotificationImpl(this, Notification.SET, SDOPackage.CHANGE_SUMMARY__EDATA_GRAPH, newEDataGraph, newEDataGraph));
}
+//TODO T-153
+// /**
+// * <!-- begin-user-doc -->
+// * <!-- end-user-doc -->
+// * handcrafted but could be generated
+// */
+// public void setEDataObject(DataObject newEDataObject)
+// {
+// if (newEDataObject != eDataObject)
+// {
+// NotificationChain msgs = null;
+// // TODO kg - not sure if we need this if the DataObject carries the CS in a setting?
+// // if not then perhaps the inverse remove should still be carried out somehow
+// //if (eDataObject != null)
+// // msgs = ((InternalEObject)eDataObject).eInverseRemove(this, SDOPackage.DATA_OBJECT__ECHANGE_SUMMARY, DataObject.class, msgs);
+// //if (newEDataObject != null)
+// // msgs = ((InternalEObject)newEDataObject).eInverseAdd(this, SDOPackage.DATA_OBJECT__ECHANGE_SUMMARY, DataObject.class, msgs);
+// msgs = basicSetEDataObject(newEDataObject, msgs);
+// if (msgs != null) msgs.dispatch();
+// }
+// else if (eNotificationRequired())
+// eNotify(new ENotificationImpl(this, Notification.SET, SDOPackage.CHANGE_SUMMARY__EDATA_OBJECT, newEDataObject, newEDataObject));
+// }
+
+
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -187,13 +240,28 @@
getResourceChanges().clear();
oldContainmentInformation = null;
- changeRecorder = new SDOChangeRecorder();
- changeRecorder.beginRecording(Collections.singleton(((DataGraphImpl)getEDataGraph()).getRootResource()));
+ beginRecording();
// if (eNotificationRequired())
// eNotify(new ENotificationImpl(this, Notification.SET, SDOPackage.ECHANGE_SUMMARY__LOGGING, false, true));
}
/**
+ *
+ */
+ private void beginRecording() {
+ changeRecorder = new SDOChangeRecorder();
+// TODO T-153
+// if(getEDataGraph() != null) {
+ changeRecorder.beginRecording(Collections.singleton(((DataGraphImpl)getEDataGraph()).getRootResource()));
+// } else if (getEDataObject() != null) {
+// changeRecorder.beginRecording(Collections.singleton(getEDataObject()));
+// } else {
+// // TODO kg - work out if this can ever occur, and if so then handle better
+// throw new IllegalStateException("Change Summary not attached to a DataObject or DataGraph");
+// }
+ }
+
+ /**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
@@ -207,9 +275,8 @@
oldContainmentInformation = null;
- changeRecorder = new SDOChangeRecorder();
- changeRecorder.beginRecording(this, Collections.singleton(((DataGraphImpl)getEDataGraph()).getRootResource()));
-
+ beginRecording();
+
// if (eNotificationRequired())
// eNotify(new ENotificationImpl(this, Notification.SET, SDOPackage.ECHANGE_SUMMARY__LOGGING, false, true));
}
@@ -229,6 +296,12 @@
if (eDataGraph != null)
msgs = ((InternalEObject)eDataGraph).eInverseRemove(this, SDOPackage.DATA_GRAPH__ECHANGE_SUMMARY, DataGraph.class, msgs);
return basicSetEDataGraph((DataGraph)otherEnd, msgs);
+// TODO T-153
+// case SDOPackage.CHANGE_SUMMARY__EDATA_OBJECT:
+// // FIXME how does this inverse remove work? We don't have a SDOPackage.DATA_OBJECT__ECHANGE_SUMMARY
+// //if (eDataObject != null)
+// // msgs = ((InternalEObject)eDataObject).eInverseRemove(this, SDOPackage.DATA_OBJECT__ECHANGE_SUMMARY, DataGraph.class, msgs);
+// return basicSetEDataObject((DataObject)otherEnd, msgs);
default:
return eDynamicInverseAdd(otherEnd, featureID, baseClass, msgs);
}
@@ -257,6 +330,9 @@
return ((InternalEList)getResourceChanges()).basicRemove(otherEnd, msgs);
case SDOPackage.CHANGE_SUMMARY__EDATA_GRAPH:
return basicSetEDataGraph(null, msgs);
+// TODO T-153
+// case SDOPackage.CHANGE_SUMMARY__EDATA_OBJECT:
+// return basicSetEDataObject(null, msgs);
default:
return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs);
}
@@ -284,6 +360,8 @@
return getResourceChanges();
case SDOPackage.CHANGE_SUMMARY__EDATA_GRAPH:
return getEDataGraph();
+// case SDOPackage.CHANGE_SUMMARY__EDATA_OBJECT:
+// return getEDataObject();
}
return eDynamicGet(featureID, resolve, coreType);
}
@@ -315,6 +393,10 @@
case SDOPackage.CHANGE_SUMMARY__EDATA_GRAPH:
setEDataGraph((DataGraph)newValue);
return;
+// TODO T-153
+// case SDOPackage.CHANGE_SUMMARY__EDATA_OBJECT:
+// setEDataObject((DataObject)newValue);
+// return;
}
eDynamicSet(featureID, newValue);
}
@@ -343,6 +425,10 @@
case SDOPackage.CHANGE_SUMMARY__EDATA_GRAPH:
setEDataGraph((DataGraph)null);
return;
+// TODO T-153
+// case SDOPackage.CHANGE_SUMMARY__EDATA_OBJECT:
+// setEDataObject((DataObject)null);
+// return;
}
eDynamicUnset(featureID);
}
@@ -366,6 +452,9 @@
return resourceChanges != null && !resourceChanges.isEmpty();
case SDOPackage.CHANGE_SUMMARY__EDATA_GRAPH:
return eDataGraph != null;
+// TODO T-153
+// case SDOPackage.CHANGE_SUMMARY__EDATA_OBJECT:
+// return eDataObject != null;
}
return eDynamicIsSet(featureID);
}
@@ -624,7 +713,19 @@
{
return getEDataGraph();
}
+
+//TODO T-153
+// /**
+// * <!-- begin-user-doc -->
+// * <!-- end-user-doc -->
+// * handcrafted but could be generated
+// */
+// public DataObject getDataObject()
+// {
+// return getEDataObject();
+// }
+
protected Set deletedObjects;
protected void preApply(boolean reverse)
@@ -675,7 +776,12 @@
{
return dataGraph.getRootObject();
}
- // TODO: handle ChangeSummary-type property
+// TODO T-153
+// // TODO: create a test to exercise this path
+// DataObject dataObject = getDataObject();
+// if(dataObject != null) {
+// return dataObject;
+// }
return null;
}
Modified: incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/ClassImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/ClassImpl.java?view=diff&rev=479663&r1=479662&r2=479663
==============================================================================
--- incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/ClassImpl.java (original)
+++ incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/ClassImpl.java Mon Nov 27 07:35:17 2006
@@ -24,6 +24,9 @@
import java.util.List;
import java.util.Map;
+import org.apache.tuscany.sdo.SDOFactory;
+import org.apache.tuscany.sdo.model.ModelFactory;
+import org.apache.tuscany.sdo.model.impl.ModelFactoryImpl;
import org.apache.tuscany.sdo.util.DataObjectUtil;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EStructuralFeature;
@@ -46,6 +49,10 @@
*/
public class ClassImpl extends EClassImpl implements Type, org.apache.tuscany.sdo.model.Type/*, DataObject*/
{
+ private static final Property cspCacheUnitialized = SDOFactory.eINSTANCE.createAttribute();
+ private Property changeSummaryPropertyCache = cspCacheUnitialized;
+
+
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -283,6 +290,36 @@
public String getUri() {
return getURI();
+ }
+
+//TODO T-153
+ /**
+ *
+ */
+ public Property getChangeSummaryProperty() {
+
+
+ // TODO make sure to take account of dynamic types, where the state might go from
+ // not having a cs to having a cs
+ if(changeSummaryPropertyCache == cspCacheUnitialized) {
+ // check for a property of type ChangeSummaryType and give special treatment
+ changeSummaryPropertyCache = null;
+ Iterator props = getProperties().iterator();
+
+ Type csType = (Type)((ModelFactoryImpl)ModelFactory.INSTANCE).getChangeSummaryType();
+ while(props.hasNext()) {
+ Property p = (Property)props.next();
+ if(csType == p.getType()) {
+ if(changeSummaryPropertyCache == null) {
+ changeSummaryPropertyCache = p;
+ } else {
+ throw new IllegalStateException("Only one Property of type ChangeSummaryType is permitted in a Type");
+ }
+ }
+ }
+ }
+
+ return changeSummaryPropertyCache;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////
Modified: incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DataObjectImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DataObjectImpl.java?view=diff&rev=479663&r1=479662&r2=479663
==============================================================================
--- incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DataObjectImpl.java (original)
+++ incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DataObjectImpl.java Mon Nov 27 07:35:17 2006
@@ -30,6 +30,7 @@
import org.apache.tuscany.sdo.impl.ChangeSummaryImpl.SDOChangeRecorder;
import org.apache.tuscany.sdo.util.DataObjectUtil;
import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EAttribute;
@@ -38,6 +39,7 @@
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.EStructuralFeature.Internal.DynamicValueHolder;
import org.eclipse.emf.ecore.impl.BasicEObjectImpl;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.util.BasicExtendedMetaData;
import org.eclipse.emf.ecore.util.EContentsEList;
@@ -1314,6 +1316,45 @@
{
return DataObjectUtil.getChangeSummary(this);
}
+
+//TODO T-153
+// public ChangeSummary getEChangeSummary() {
+// Property p = DataObjectUtil.getChangeSummaryProperty(this);
+// return (ChangeSummary)eGet((EStructuralFeature)p);
+// }
+//
+// public NotificationChain basicSetEChangeSummary(ChangeSummary newEChangeSummary, NotificationChain msgs)
+// {
+// ChangeSummary oldEChangeSummary = getEChangeSummary();
+// Property p = DataObjectUtil.getChangeSummaryProperty(this);
+// eSet((EStructuralFeature)p, newEChangeSummary);
+// if (eNotificationRequired())
+// {
+// // FBCHECK Do I need any of this notification stuff - I think FB said "no"
+// // FIXME how would I do this when there isnt a SDOPackage.DATA_OBJECT__ECHANGE_SUMMARY
+// // ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SDOPackage.DATA_OBJECT__ECHANGE_SUMMARY, oldEChangeSummary, newEChangeSummary);
+// // if (msgs == null) msgs = notification; else msgs.add(notification);
+// }
+// return msgs;
+// }
+//
+// public void setEChangeSummary(ChangeSummary newEChangeSummary) {
+// ChangeSummary eChangeSummary = getEChangeSummary();
+// if (newEChangeSummary != eChangeSummary)
+// {
+// NotificationChain msgs = null;
+// if (eChangeSummary != null)
+// msgs = ((InternalEObject)eChangeSummary).eInverseRemove(this, SDOPackage.CHANGE_SUMMARY__EDATA_OBJECT, ChangeSummary.class, msgs);
+// if (newEChangeSummary != null)
+// msgs = ((InternalEObject)newEChangeSummary).eInverseAdd(this, SDOPackage.CHANGE_SUMMARY__EDATA_OBJECT, ChangeSummary.class, msgs);
+// msgs = basicSetEChangeSummary(newEChangeSummary, msgs);
+// if (msgs != null) msgs.dispatch();
+// }
+// else if (eNotificationRequired()) {
+// // FIXME - define SDOPackage.DATA_OBJECT__ECHANGE_SUMMARY or fix logic
+// // eNotify(new ENotificationImpl(this, Notification.SET, SDOPackage.DATA_OBJECT__ECHANGE_SUMMARY, newEChangeSummary, newEChangeSummary));
+// }
+// }
/**
* <!-- begin-user-doc -->
Modified: incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DynamicDataObjectImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DynamicDataObjectImpl.java?view=diff&rev=479663&r1=479662&r2=479663
==============================================================================
--- incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DynamicDataObjectImpl.java (original)
+++ incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DynamicDataObjectImpl.java Mon Nov 27 07:35:17 2006
@@ -19,6 +19,7 @@
*/
package org.apache.tuscany.sdo.impl;
+import org.apache.tuscany.sdo.SDOFactory;
import org.apache.tuscany.sdo.SDOPackage;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
@@ -26,6 +27,7 @@
import org.eclipse.emf.ecore.impl.EFactoryImpl;
import commonj.sdo.DataObject;
+import commonj.sdo.Property;
/**
* <!-- begin-user-doc -->
@@ -192,7 +194,17 @@
public EObject basicCreate(EClass eClass)
{
- return new DynamicDataObjectImpl(eClass);
+// TODO T-153
+// TODO TUSCANY-153 decide if i need this eager initialization
+// Property csp = ((ClassImpl)eClass).getChangeSummaryProperty();
+// if(csp == null) {
+ return new DynamicDataObjectImpl(eClass);
+// } else {
+// DynamicDataObjectImpl result = new DynamicDataObjectImpl(eClass);
+// result.set(csp, SDOFactory.eINSTANCE.createChangeSummary());
+// return result;
+// }
+
}
}
Modified: incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/SDOPackageImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/SDOPackageImpl.java?view=diff&rev=479663&r1=479662&r2=479663
==============================================================================
--- incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/SDOPackageImpl.java (original)
+++ incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/SDOPackageImpl.java Mon Nov 27 07:35:17 2006
@@ -283,6 +283,16 @@
return (EReference)changeSummaryEClass.getEStructuralFeatures().get(0);
}
+// /**
+// * <!-- begin-user-doc -->
+// * <!-- end-user-doc -->
+// * <hand coded but could be generated>
+// */
+// public EReference getChangeSummary_EDataObject()
+// {
+// return (EReference)changeSummaryEClass.getEStructuralFeatures().get(1);
+// }
+
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
Modified: incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/DataObjectUtil.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/DataObjectUtil.java?view=diff&rev=479663&r1=479662&r2=479663
==============================================================================
--- incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/DataObjectUtil.java (original)
+++ incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/DataObjectUtil.java Mon Nov 27 07:35:17 2006
@@ -33,8 +33,11 @@
import java.util.TimeZone;
import org.apache.tuscany.sdo.SDOExtendedMetaData;
+import org.apache.tuscany.sdo.SDOFactory;
import org.apache.tuscany.sdo.SDOPackage;
+import org.apache.tuscany.sdo.impl.ClassImpl;
import org.apache.tuscany.sdo.impl.DataGraphImpl;
+import org.apache.tuscany.sdo.impl.DataObjectImpl;
import org.apache.tuscany.sdo.impl.SDOFactoryImpl;
import org.apache.tuscany.sdo.util.resource.SDOXMLResourceFactoryImpl;
import org.eclipse.emf.common.util.BasicEList;
@@ -690,10 +693,43 @@
{
return dataGraph.getChangeSummary();
}
- // TODO: handle ChangeSummary-type property
+// TODO T-153
+// return getDataObjectsChangeSummary(dataObject);
return null;
}
-
+
+//TODO T-153
+// public static Property getChangeSummaryProperty(DataObject dataObject)
+// {
+// return ((ClassImpl)dataObject.getType()).getChangeSummaryProperty();
+// }
+//
+// /**
+// * @param dataObject
+// * @return
+// */
+// private static ChangeSummary getDataObjectsChangeSummary(DataObject dataObject) {
+//
+// if(dataObject == null) {
+// // terminate the recursion up the containment path
+// return null;
+// }
+//
+// Property csp = getChangeSummaryProperty(dataObject);
+//
+// if(csp != null) {
+// ChangeSummary cs = (ChangeSummary)dataObject.get(csp);
+// if(cs == null) {
+// cs = SDOFactory.eINSTANCE.createChangeSummary();
+// ((DataObjectImpl)dataObject).setEChangeSummary(cs);
+// }
+// return cs;
+// }
+//
+// // if it fails to find a CS then continue the search up the containment path
+// return getDataObjectsChangeSummary(dataObject.getContainer());
+// }
+
public static void unset(DataObject dataObject, String path)
{
Property property = dataObject.getType().getProperty(path);
Modified: incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/SDOUtil.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/SDOUtil.java?view=diff&rev=479663&r1=479662&r2=479663
==============================================================================
--- incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/SDOUtil.java (original)
+++ incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/SDOUtil.java Mon Nov 27 07:35:17 2006
@@ -42,6 +42,7 @@
import org.apache.tuscany.sdo.SimpleAnyTypeDataObject;
import org.apache.tuscany.sdo.helper.CrossScopeCopyHelperImpl;
import org.apache.tuscany.sdo.helper.DataFactoryImpl;
+import org.apache.tuscany.sdo.helper.HelperContextImpl;
import org.apache.tuscany.sdo.helper.SDOExtendedMetaDataImpl;
import org.apache.tuscany.sdo.helper.TypeHelperImpl;
import org.apache.tuscany.sdo.helper.XMLHelperImpl;
@@ -80,6 +81,7 @@
import commonj.sdo.Type;
import commonj.sdo.helper.CopyHelper;
import commonj.sdo.helper.DataFactory;
+import commonj.sdo.helper.HelperContext;
import commonj.sdo.helper.TypeHelper;
import commonj.sdo.helper.XMLHelper;
import commonj.sdo.helper.XSDHelper;
@@ -285,12 +287,36 @@
}
}
+ /**
+ * @param scope an instance of TypeHelper which is used to provide scope for types.
+ * Create a HelperContext to provide access to a consistent set of
+ * Helpers which make use of the supplied TypeHelper instance to provide
+ * scope for type definitions.
+ * @return the new HelperContext
+ */
+public static HelperContext createHelperContext(TypeHelper scope)
+ {
+ return new HelperContextImpl(scope);
+ }
+
+ /**
+ * Create a HelperContext to provide access to a consistent set of
+ * Helpers which make use of a new TypeHelper instance to provide
+ * scope for type definitions.
+ * @return the new HelperContext
+ */
+ public static HelperContext createHelperContext()
+ {
+ return new HelperContextImpl(null);
+ }
+
/**
* Create a new TypeHelper instance. The returned type helper will have visibility of types registered
* directly by calling a define method on it or by calling define on an associated XSDHelper. It will
* also have visibility of static types registered by calling SDOUtil.registerStaticTypes in the
* same classLoader scope.
* @return the new TypeHelper.
+ * @deprecated see {@link #createHelperContext(TypeHelper)}
*/
public static TypeHelper createTypeHelper()
{
@@ -313,6 +339,7 @@
* Create a new XMLHelper, with visibility to types in the specified TypeHelper scope.
* @param scope the TypeHelper to use for locating types.
* @return the new XMLHelper.
+ * @deprecated see {@link #createHelperContext(TypeHelper)}
*/
public static XMLHelper createXMLHelper(TypeHelper scope)
{
@@ -323,6 +350,7 @@
* Create a new XSDHelper, with visibility to types in the specified TypeHelper scope.
* @param scope the TypeHelper to use for locating and populating types.
* @return the new XSDHelper.
+ * @deprecated see {@link #createHelperContext(TypeHelper)}
*/
public static XSDHelper createXSDHelper(TypeHelper scope)
{
@@ -333,6 +361,7 @@
* Create a new XMLStreamHelper, with visibility to types in the specified TypeHelper scope.
* @param scope the TypeHelper to use for locating types.
* @return the new XMLStreamHelper.
+ * @deprecated see {@link #createHelperContext(TypeHelper)}
*/
public static XMLStreamHelper createXMLStreamHelper(TypeHelper scope)
{
Added: incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/AllTests.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/AllTests.java?view=auto&rev=479663
==============================================================================
--- incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/AllTests.java (added)
+++ incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/AllTests.java Mon Nov 27 07:35:17 2006
@@ -0,0 +1,22 @@
+package org.apache.tuscany.sdo;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class AllTests {
+
+ public static Test suite() {
+
+ TestSuite suite = new TestSuite();
+
+ suite.addTest(org.apache.tuscany.sdo.codegen.AllTests.suite());
+ suite.addTest(org.apache.tuscany.sdo.test.AllTests.suite());
+
+ return suite;
+ }
+
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(suite());
+ }
+}
+
Propchange: incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/AllTests.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/AllTests.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/AllTests.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/AllTests.java?view=auto&rev=479663
==============================================================================
--- incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/AllTests.java (added)
+++ incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/AllTests.java Mon Nov 27 07:35:17 2006
@@ -0,0 +1,27 @@
+package org.apache.tuscany.sdo.codegen;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class AllTests {
+
+
+ public static TestSuite suite() {
+
+ TestSuite suite = new TestSuite();
+
+ suite.addTestSuite(BytecodeInterfaceGeneratorTestCase.class);
+ suite.addTestSuite(JavaInterfaceGeneratorTestCase.class);
+
+
+ return suite;
+ }
+
+
+ /**
+ * Runs the test suite using the textual runner.
+ */
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(suite());
+ }
+}
+
Propchange: incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/AllTests.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/AllTests.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/AllTests.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/AllTests.java?view=auto&rev=479663
==============================================================================
--- incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/AllTests.java (added)
+++ incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/AllTests.java Mon Nov 27 07:35:17 2006
@@ -0,0 +1,44 @@
+package org.apache.tuscany.sdo.test;
+import junit.framework.TestSuite;
+
+public class AllTests {
+
+
+ public static TestSuite suite() {
+
+ TestSuite suite = new TestSuite();
+
+ // suite.addTestSuite(ChangeSummaryOnDataObjectTestCase.class);
+ suite.addTestSuite(ChangeSummaryTestCase.class);
+ suite.addTestSuite(CrossScopeCopyTestCase.class);
+ suite.addTestSuite(DataTypeBaseTypeTestCase.class);
+ suite.addTestSuite(DateConversionTestCase.class);
+ suite.addTestSuite(DefineOpenContentPropertyTestCase.class);
+ suite.addTestSuite(DefineTypeTestCase.class);
+ suite.addTestSuite(MixedTypeTestCase.class);
+ suite.addTestSuite(OpenTypeTestCase.class);
+ suite.addTestSuite(SerializeTypesTestCase.class);
+ suite.addTestSuite(SimpleCopyTestCase.class);
+ suite.addTestSuite(SimpleDynamicTestCase.class);
+ suite.addTestSuite(SimpleEqualityTestCase.class);
+ suite.addTestSuite(SubstitutionValuesTestCase.class);
+ suite.addTestSuite(TypeConversionTestCase.class);
+ suite.addTestSuite(TypeRoundTripTestCase.class);
+ suite.addTestSuite(XMLDocumentTestCase.class);
+ suite.addTestSuite(XMLStreamHelperTestCase.class);
+ suite.addTestSuite(XPathTestCase.class);
+ suite.addTestSuite(XSDHelperTestCase.class);
+
+ return suite;
+ }
+
+
+
+ /**
+ * Runs the test suite using the textual runner.
+ */
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(suite());
+ }
+}
+
Propchange: incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/AllTests.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/AllTests.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/ChangeSummaryOnDataObjectTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/ChangeSummaryOnDataObjectTestCase.java?view=auto&rev=479663
==============================================================================
--- incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/ChangeSummaryOnDataObjectTestCase.java (added)
+++ incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/ChangeSummaryOnDataObjectTestCase.java Mon Nov 27 07:35:17 2006
@@ -0,0 +1,220 @@
+/**
+ *
+ * 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.sdo.test;
+
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.math.BigDecimal;
+import java.net.URL;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sdo.util.SDOUtil;
+
+import commonj.sdo.ChangeSummary;
+import commonj.sdo.DataGraph;
+import commonj.sdo.DataObject;
+import commonj.sdo.Property;
+import commonj.sdo.Type;
+import commonj.sdo.helper.DataFactory;
+import commonj.sdo.helper.TypeHelper;
+import commonj.sdo.helper.XSDHelper;
+import commonj.sdo.helper.XMLHelper;
+
+
+public class ChangeSummaryOnDataObjectTestCase extends TestCase {
+
+
+ private final String TEST_DATA = "/simplechangesummary.xml";
+ XSDHelper xh;
+ TypeHelper th;
+
+ public void testNothing()
+ {
+ // just to keep junit happy whilst all other tests are commented out
+ }
+
+ public void dont_testBasicsDO() {
+ Type cst = TypeHelper.INSTANCE.getType("commonj.sdo","ChangeSummaryType");
+ Type strt = TypeHelper.INSTANCE.getType("commonj.sdo", "String");
+
+ TypeHelper th = SDOUtil.createTypeHelper();
+ Type newt = SDOUtil.createType(th, "testcases.changesummary", "simpleCS", false);
+ Property strProp = SDOUtil.createProperty(newt, "strElem", strt);
+ SDOUtil.createProperty(newt, "changeSummary", cst);
+
+ DataObject iNewt = DataFactory.INSTANCE.create(newt);
+
+ testBasicsBody(strProp, iNewt);
+}
+
+ public void dont_testBasicsDG() {
+
+ Type strt = TypeHelper.INSTANCE.getType("commonj.sdo", "String");
+
+ TypeHelper th = SDOUtil.createTypeHelper();
+ Type newt = SDOUtil.createType(th, "testcases.changesummary", "simpleNOCS", false);
+ Property strProp = SDOUtil.createProperty(newt, "strElem", strt);
+
+ DataGraph graph = SDOUtil.createDataGraph();
+ DataObject iNewt = graph.createRootObject(newt);
+
+ testBasicsBody(strProp, iNewt);
+}
+
+
+ /**
+ * @param strProp
+ * @param iNewt
+ */
+ private void testBasicsBody(Property strProp, DataObject iNewt) {
+ ChangeSummary cs = iNewt.getChangeSummary();
+ cs.beginLogging();
+
+ List co = cs.getChangedDataObjects();
+ assertEquals(0, co.size());
+ iNewt.set(strProp, "some text");
+ assertEquals(0, co.size());
+ co = cs.getChangedDataObjects();
+ assertEquals(1, co.size());
+
+ List oldValues = cs.getOldValues((DataObject)co.get(0));
+
+ ChangeSummary.Setting ov1 = (ChangeSummary.Setting)oldValues.get(0);
+ Property p = ov1.getProperty();
+ assertEquals("strElem", p.getName());
+ Object v = ov1.getValue();
+ assertEquals(null, v);
+
+ assertTrue(cs.isLogging());
+ cs.endLogging();
+ assertFalse(cs.isLogging());
+
+ }
+
+
+
+ public void dont_testDynamicNestedDataObjectsDG() throws Exception {
+ DataGraph dataGraph = SDOUtil.createDataGraph();
+ DataObject quote = dataGraph.createRootObject(th.getType("http://www.example.com/simple", "Quote"));
+
+ testDynamicNestedDOBody(quote);
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ SDOUtil.saveDataGraph(dataGraph, baos, null);
+ // SDOUtil.saveDataGraph(dataGraph, System.out, null);
+
+ assertTrue(TestUtil.equalXmlFiles(new ByteArrayInputStream(baos.toByteArray()), getClass().getResource(TEST_DATA)));
+
+
+ assertEquals(1, quote.getList("quotes").size());
+ assertEquals("fbnt", quote.getString("symbol"));
+ dataGraph.getChangeSummary().undoChanges();
+ // SDOUtil.saveDataGraph(dataGraph, System.out, null);
+ assertEquals(0, quote.getList("quotes").size());
+ assertNull(quote.getString("symbol"));
+
+
+ }
+
+ public void dont_testDynamicNestedDataObjectsDO() throws Exception {
+ Type quoteType = th.getType("http://www.example.com/simpleCS", "QuoteBase");
+ DataObject quote = DataFactory.INSTANCE.create(quoteType);
+
+ testDynamicNestedDOBody(quote);
+ // XMLHelper.INSTANCE.save(quote, "http://www.example.com/simpleCS", "stockQuote", System.out);
+ assertEquals(1, quote.getList("quotes").size());
+ assertEquals("fbnt", quote.getString("symbol"));
+
+ quote.getChangeSummary().undoChanges();
+
+ assertEquals(0, quote.getList("quotes").size());
+ assertNull(quote.getString("symbol"));
+
+
+ }
+
+ /**
+ * @param quote
+ */
+ private void testDynamicNestedDOBody(DataObject quote) {
+ // Begin logging changes
+ //
+ ChangeSummary changeSummary = quote.getChangeSummary();
+ assertNotNull(changeSummary);
+ assertFalse(changeSummary.isLogging());
+ changeSummary.beginLogging();
+
+
+ // Modify the data graph in various fun and interesting ways
+ //
+ quote.setString("symbol", "fbnt");
+ quote.setString("companyName", "FlyByNightTechnology");
+ quote.setBigDecimal("price", new BigDecimal("1000.0"));
+ quote.setBigDecimal("open1", new BigDecimal("1000.0"));
+ quote.setBigDecimal("high", new BigDecimal("1000.0"));
+ quote.setBigDecimal("low", new BigDecimal("1000.0"));
+ quote.setDouble("volume", 1000);
+ quote.setDouble("change1", 1000);
+
+ DataObject child = quote.createDataObject("quotes");
+ child.setBigDecimal("price", new BigDecimal("2000.0"));
+
+ changeSummary.endLogging();
+ assertEquals(2, changeSummary.getChangedDataObjects().size()); // 2 DataObjects
+ assertTrue(changeSummary.getChangedDataObjects().contains(quote));
+ assertTrue(changeSummary.getChangedDataObjects().contains(child));
+ assertFalse(changeSummary.isCreated(quote));
+ assertTrue(changeSummary.isCreated(child));
+
+ ChangeSummary.Setting ov = changeSummary.getOldValue(quote, quote.getType().getProperty("symbol"));
+ assertNull(ov.getValue());
+
+
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+// uncomment these lines for sending aspect trace to a file
+// tracing.lib.TraceMyClasses tmc = (TraceMyClasses)Aspects.aspectOf(TraceMyClasses.class);
+// tmc.initStream(new PrintStream("c:\\temp\\trace.log"));
+
+ // Populate the meta data for the test (Stock Quote) model
+ URL url = getClass().getResource("/simple.xsd");
+ InputStream inputStream = url.openStream();
+ th = SDOUtil.createTypeHelper();
+ xh = SDOUtil.createXSDHelper(th);
+ xh.define(inputStream, url.toString());
+ inputStream.close();
+
+ URL url2 = getClass().getResource("/simpleWithChangeSummary.xsd");
+ InputStream inputStream2 = url2.openStream();
+ List types = xh.define(inputStream2, url2.toString());
+ inputStream.close();
+
+
+
+}
+
+}
Propchange: incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/ChangeSummaryOnDataObjectTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/ChangeSummaryOnDataObjectTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/HelperContextTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/HelperContextTestCase.java?view=auto&rev=479663
==============================================================================
--- incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/HelperContextTestCase.java (added)
+++ incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/HelperContextTestCase.java Mon Nov 27 07:35:17 2006
@@ -0,0 +1,56 @@
+package org.apache.tuscany.sdo.test;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sdo.util.SDOUtil;
+
+import commonj.sdo.helper.CopyHelper;
+import commonj.sdo.helper.DataFactory;
+import commonj.sdo.helper.DataHelper;
+import commonj.sdo.helper.EqualityHelper;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.TypeHelper;
+import commonj.sdo.helper.XMLHelper;
+import commonj.sdo.helper.XSDHelper;
+import commonj.sdo.impl.HelperProvider;
+
+public class HelperContextTestCase extends TestCase {
+
+ public void testDefaultHelperContext() {
+ HelperContext defaultHelperContext = HelperProvider.getDefaultContext();
+
+ assertNotNull(defaultHelperContext.getCopyHelper());
+ assertEquals(defaultHelperContext.getCopyHelper(), CopyHelper.INSTANCE);
+ assertNotNull(defaultHelperContext.getDataFactory());
+ assertEquals(defaultHelperContext.getDataFactory(), DataFactory.INSTANCE);
+ assertNotNull(defaultHelperContext.getDataHelper());
+ assertEquals(defaultHelperContext.getDataHelper(), DataHelper.INSTANCE);
+ assertNotNull(defaultHelperContext.getEqualityHelper());
+ assertEquals(defaultHelperContext.getEqualityHelper(), EqualityHelper.INSTANCE);
+ assertNotNull(defaultHelperContext.getTypeHelper());
+ assertEquals(defaultHelperContext.getTypeHelper(), TypeHelper.INSTANCE);
+ assertNotNull(defaultHelperContext.getXMLHelper());
+ assertEquals(defaultHelperContext.getXMLHelper(), XMLHelper.INSTANCE);
+ assertNotNull(defaultHelperContext.getXSDHelper());
+ assertEquals(defaultHelperContext.getXSDHelper(), XSDHelper.INSTANCE);
+
+ }
+
+ public void testCreateHelperContext() {
+ HelperContext hc = SDOUtil.createHelperContext();
+ assertNotNull(hc.getCopyHelper());
+ assertNotNull(hc.getDataFactory());
+ assertNotNull(hc.getDataHelper());
+ assertNotNull(hc.getEqualityHelper());
+ assertNotNull(hc.getTypeHelper());
+ assertNotNull(hc.getXMLHelper());
+ assertNotNull(hc.getXSDHelper());
+
+ assertNotSame(hc.getDataFactory(), DataFactory.INSTANCE);
+ assertNotSame(hc.getTypeHelper(), TypeHelper.INSTANCE);
+ assertNotSame(hc.getXMLHelper(), XMLHelper.INSTANCE);
+ assertNotSame(hc.getXSDHelper(), XSDHelper.INSTANCE);
+ // the other "stateless" helpers may be the same as the singletons
+ }
+
+}
Propchange: incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/HelperContextTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/HelperContextTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sdo/impl/src/test/resources/simpleWithChangeSummary.xsd
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/test/resources/simpleWithChangeSummary.xsd?view=auto&rev=479663
==============================================================================
--- incubator/tuscany/java/sdo/impl/src/test/resources/simpleWithChangeSummary.xsd (added)
+++ incubator/tuscany/java/sdo/impl/src/test/resources/simpleWithChangeSummary.xsd Mon Nov 27 07:35:17 2006
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed 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.
+ -->
+<xsd:schema xmlns:sdo="commonj.sdo" xmlns:simpleCS="http://www.example.com/simpleCS" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" targetNamespace="http://www.example.com/simpleCS">
+
+
+ <xsd:import namespace="commonj.sdo" schemaLocation="sdoModel.xsd"/>
+
+ <xsd:complexType name="QuoteBase">
+ <xsd:complexContent>
+ <xsd:extension base="simpleCS:Quote">
+ <xsd:sequence>
+ <xsd:element name="changes" type="sdo:ChangeSummaryType"/>
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+
+ </xsd:complexType>
+
+ <xsd:element name="stockQuote" type="simpleCS:QuoteBase"/>
+
+ <xsd:complexType name="Quote">
+ <xsd:sequence>
+ <xsd:element name="symbol" type="xsd:string"/>
+ <xsd:element name="companyName" type="xsd:string"/>
+ <xsd:element name="price" type="xsd:decimal"/>
+ <xsd:element name="open1" type="xsd:decimal"/>
+ <xsd:element name="high" type="xsd:decimal"/>
+ <xsd:element name="low" type="xsd:decimal"/>
+ <xsd:element name="volume" type="xsd:double"/>
+ <xsd:element name="change1" type="xsd:double"/>
+ <xsd:element maxOccurs="unbounded" minOccurs="0" name="quotes" type="simpleCS:Quote"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+</xsd:schema>
Propchange: incubator/tuscany/java/sdo/impl/src/test/resources/simpleWithChangeSummary.xsd
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sdo/impl/src/test/resources/simpleWithChangeSummary.xsd
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/tuscany/java/sdo/impl/src/test/resources/simpleWithChangeSummary.xsd
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: incubator/tuscany/java/sdo/tools/src/test/java/org/apache/tuscany/sdo/test/ChangeSummaryGenTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/tools/src/test/java/org/apache/tuscany/sdo/test/ChangeSummaryGenTestCase.java?view=auto&rev=479663
==============================================================================
--- incubator/tuscany/java/sdo/tools/src/test/java/org/apache/tuscany/sdo/test/ChangeSummaryGenTestCase.java (added)
+++ incubator/tuscany/java/sdo/tools/src/test/java/org/apache/tuscany/sdo/test/ChangeSummaryGenTestCase.java Mon Nov 27 07:35:17 2006
@@ -0,0 +1,80 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed 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.sdo.test;
+
+
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.example.simple.cs.CSFactory;
+import org.example.simple.cs.Quote;
+import org.example.simple.cs.QuoteBase;
+
+import commonj.sdo.ChangeSummary;
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.XMLHelper;
+
+
+public class ChangeSummaryGenTestCase extends TestCase {
+
+ public void testMixedQuoteType() throws IOException {
+// TODO T-153 reintroduce once generator special cases the change summary type property
+// QuoteBase quote = CSFactory.INSTANCE.createQuoteBase();
+// DataObject dQuote = (DataObject)quote;
+// // FBCHECK should generated method trigger creation of C/S
+// // also gen method returns Impl class -- change to interface?
+// // ChangeSummary csp = quote.getChanges();
+// ChangeSummary cs = dQuote.getChangeSummary();
+// ChangeSummary csp = quote.getChanges();
+// cs.beginLogging();
+//
+// assertSame(cs, csp);
+//
+// quote.setSymbol("fbnt");
+// quote.setCompanyName("FlyByNightTechnology");
+// quote.setPrice(new BigDecimal("1000.0"));
+// quote.setOpen1(new BigDecimal("1000.0"));
+// quote.setHigh(new BigDecimal("1000.0"));
+// quote.setLow(new BigDecimal("1000.0"));
+// quote.setVolume(1000);
+// quote.setChange1(1000);
+//
+// List quotes = quote.getQuotes();
+// Quote innerQuote = CSFactory.INSTANCE.createQuote();
+//
+// quotes.add(innerQuote);
+// innerQuote.setPrice(new BigDecimal("2000.0"));
+//
+// cs.endLogging();
+//
+// XMLHelper.INSTANCE.save(dQuote, "http://www.example.com/simpleCS", "quoteBase", System.out);
+//
+// cs.undoChanges();
+// System.out.println("\nAfter Undo Changes:");
+// XMLHelper.INSTANCE.save(dQuote, "http://www.example.com/simpleCS", "quoteBase", System.out);
+
+
+
+ }
+
+
+
+
+}
Propchange: incubator/tuscany/java/sdo/tools/src/test/java/org/apache/tuscany/sdo/test/ChangeSummaryGenTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sdo/tools/src/test/java/org/apache/tuscany/sdo/test/ChangeSummaryGenTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sdo/tools/src/test/java/org/apache/tuscany/sdo/test/CreateTestClasses.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/tools/src/test/java/org/apache/tuscany/sdo/test/CreateTestClasses.java?view=auto&rev=479663
==============================================================================
--- incubator/tuscany/java/sdo/tools/src/test/java/org/apache/tuscany/sdo/test/CreateTestClasses.java (added)
+++ incubator/tuscany/java/sdo/tools/src/test/java/org/apache/tuscany/sdo/test/CreateTestClasses.java Mon Nov 27 07:35:17 2006
@@ -0,0 +1,27 @@
+package org.apache.tuscany.sdo.test;
+
+import org.apache.tuscany.sdo.generate.XSD2JavaGenerator;
+
+/**
+ * A utility class to regenerate the classes for the test cases
+ */
+public class CreateTestClasses {
+
+ /**
+ * @param args
+ */
+ public static void main(String[] args) {
+
+ CreateTestClasses ctc = new CreateTestClasses();
+ ctc.run();
+
+
+ }
+
+ private void run() {
+
+ XSD2JavaGenerator.generateFromXMLSchema(getClass().getResource("/simpleWithChangeSummary.xsd").getFile(), "http://www.example.com/simpleCS", "src/test/java/", "org.example.simple.cs", "CS", 0);
+
+ }
+
+}
Propchange: incubator/tuscany/java/sdo/tools/src/test/java/org/apache/tuscany/sdo/test/CreateTestClasses.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sdo/tools/src/test/java/org/apache/tuscany/sdo/test/CreateTestClasses.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sdo/tools/src/test/java/org/example/simple/cs/CSFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/tools/src/test/java/org/example/simple/cs/CSFactory.java?view=auto&rev=479663
==============================================================================
--- incubator/tuscany/java/sdo/tools/src/test/java/org/example/simple/cs/CSFactory.java (added)
+++ incubator/tuscany/java/sdo/tools/src/test/java/org/example/simple/cs/CSFactory.java Mon Nov 27 07:35:17 2006
@@ -0,0 +1,46 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.example.simple.cs;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Factory</b> for the model.
+ * It provides a create method for each non-abstract class of the model.
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public interface CSFactory
+{
+
+ /**
+ * The singleton instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ CSFactory INSTANCE = org.example.simple.cs.impl.CSFactoryImpl.init();
+
+ /**
+ * Returns a new object of class '<em>Quote</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Quote</em>'.
+ * @generated
+ */
+ Quote createQuote();
+
+ /**
+ * Returns a new object of class '<em>Quote Base</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Quote Base</em>'.
+ * @generated
+ */
+ QuoteBase createQuoteBase();
+
+} //CSFactory
Propchange: incubator/tuscany/java/sdo/tools/src/test/java/org/example/simple/cs/CSFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sdo/tools/src/test/java/org/example/simple/cs/CSFactory.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sdo/tools/src/test/java/org/example/simple/cs/Quote.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/tools/src/test/java/org/example/simple/cs/Quote.java?view=auto&rev=479663
==============================================================================
--- incubator/tuscany/java/sdo/tools/src/test/java/org/example/simple/cs/Quote.java (added)
+++ incubator/tuscany/java/sdo/tools/src/test/java/org/example/simple/cs/Quote.java Mon Nov 27 07:35:17 2006
@@ -0,0 +1,300 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.example.simple.cs;
+
+import java.io.Serializable;
+
+import java.math.BigDecimal;
+
+import java.util.List;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Quote</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.example.simple.cs.Quote#getSymbol <em>Symbol</em>}</li>
+ * <li>{@link org.example.simple.cs.Quote#getCompanyName <em>Company Name</em>}</li>
+ * <li>{@link org.example.simple.cs.Quote#getPrice <em>Price</em>}</li>
+ * <li>{@link org.example.simple.cs.Quote#getOpen1 <em>Open1</em>}</li>
+ * <li>{@link org.example.simple.cs.Quote#getHigh <em>High</em>}</li>
+ * <li>{@link org.example.simple.cs.Quote#getLow <em>Low</em>}</li>
+ * <li>{@link org.example.simple.cs.Quote#getVolume <em>Volume</em>}</li>
+ * <li>{@link org.example.simple.cs.Quote#getChange1 <em>Change1</em>}</li>
+ * <li>{@link org.example.simple.cs.Quote#getQuotes <em>Quotes</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @extends Serializable
+ * @generated
+ */
+public interface Quote extends Serializable
+{
+ /**
+ * Returns the value of the '<em><b>Symbol</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Symbol</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Symbol</em>' attribute.
+ * @see #setSymbol(String)
+ * @generated
+ */
+ String getSymbol();
+
+ /**
+ * Sets the value of the '{@link org.example.simple.cs.Quote#getSymbol <em>Symbol</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Symbol</em>' attribute.
+ * @see #getSymbol()
+ * @generated
+ */
+ void setSymbol(String value);
+
+ /**
+ * Returns the value of the '<em><b>Company Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Company Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Company Name</em>' attribute.
+ * @see #setCompanyName(String)
+ * @generated
+ */
+ String getCompanyName();
+
+ /**
+ * Sets the value of the '{@link org.example.simple.cs.Quote#getCompanyName <em>Company Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Company Name</em>' attribute.
+ * @see #getCompanyName()
+ * @generated
+ */
+ void setCompanyName(String value);
+
+ /**
+ * Returns the value of the '<em><b>Price</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Price</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Price</em>' attribute.
+ * @see #setPrice(BigDecimal)
+ * @generated
+ */
+ BigDecimal getPrice();
+
+ /**
+ * Sets the value of the '{@link org.example.simple.cs.Quote#getPrice <em>Price</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Price</em>' attribute.
+ * @see #getPrice()
+ * @generated
+ */
+ void setPrice(BigDecimal value);
+
+ /**
+ * Returns the value of the '<em><b>Open1</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Open1</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Open1</em>' attribute.
+ * @see #setOpen1(BigDecimal)
+ * @generated
+ */
+ BigDecimal getOpen1();
+
+ /**
+ * Sets the value of the '{@link org.example.simple.cs.Quote#getOpen1 <em>Open1</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Open1</em>' attribute.
+ * @see #getOpen1()
+ * @generated
+ */
+ void setOpen1(BigDecimal value);
+
+ /**
+ * Returns the value of the '<em><b>High</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>High</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>High</em>' attribute.
+ * @see #setHigh(BigDecimal)
+ * @generated
+ */
+ BigDecimal getHigh();
+
+ /**
+ * Sets the value of the '{@link org.example.simple.cs.Quote#getHigh <em>High</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>High</em>' attribute.
+ * @see #getHigh()
+ * @generated
+ */
+ void setHigh(BigDecimal value);
+
+ /**
+ * Returns the value of the '<em><b>Low</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Low</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Low</em>' attribute.
+ * @see #setLow(BigDecimal)
+ * @generated
+ */
+ BigDecimal getLow();
+
+ /**
+ * Sets the value of the '{@link org.example.simple.cs.Quote#getLow <em>Low</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Low</em>' attribute.
+ * @see #getLow()
+ * @generated
+ */
+ void setLow(BigDecimal value);
+
+ /**
+ * Returns the value of the '<em><b>Volume</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Volume</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Volume</em>' attribute.
+ * @see #isSetVolume()
+ * @see #unsetVolume()
+ * @see #setVolume(double)
+ * @generated
+ */
+ double getVolume();
+
+ /**
+ * Sets the value of the '{@link org.example.simple.cs.Quote#getVolume <em>Volume</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Volume</em>' attribute.
+ * @see #isSetVolume()
+ * @see #unsetVolume()
+ * @see #getVolume()
+ * @generated
+ */
+ void setVolume(double value);
+
+ /**
+ * Unsets the value of the '{@link org.example.simple.cs.Quote#getVolume <em>Volume</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isSetVolume()
+ * @see #getVolume()
+ * @see #setVolume(double)
+ * @generated
+ */
+ void unsetVolume();
+
+ /**
+ * Returns whether the value of the '{@link org.example.simple.cs.Quote#getVolume <em>Volume</em>}' attribute is set.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return whether the value of the '<em>Volume</em>' attribute is set.
+ * @see #unsetVolume()
+ * @see #getVolume()
+ * @see #setVolume(double)
+ * @generated
+ */
+ boolean isSetVolume();
+
+ /**
+ * Returns the value of the '<em><b>Change1</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Change1</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Change1</em>' attribute.
+ * @see #isSetChange1()
+ * @see #unsetChange1()
+ * @see #setChange1(double)
+ * @generated
+ */
+ double getChange1();
+
+ /**
+ * Sets the value of the '{@link org.example.simple.cs.Quote#getChange1 <em>Change1</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Change1</em>' attribute.
+ * @see #isSetChange1()
+ * @see #unsetChange1()
+ * @see #getChange1()
+ * @generated
+ */
+ void setChange1(double value);
+
+ /**
+ * Unsets the value of the '{@link org.example.simple.cs.Quote#getChange1 <em>Change1</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isSetChange1()
+ * @see #getChange1()
+ * @see #setChange1(double)
+ * @generated
+ */
+ void unsetChange1();
+
+ /**
+ * Returns whether the value of the '{@link org.example.simple.cs.Quote#getChange1 <em>Change1</em>}' attribute is set.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return whether the value of the '<em>Change1</em>' attribute is set.
+ * @see #unsetChange1()
+ * @see #getChange1()
+ * @see #setChange1(double)
+ * @generated
+ */
+ boolean isSetChange1();
+
+ /**
+ * Returns the value of the '<em><b>Quotes</b></em>' containment reference list.
+ * The list contents are of type {@link org.example.simple.cs.Quote}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Quotes</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Quotes</em>' containment reference list.
+ * @generated
+ */
+ List getQuotes();
+
+} // Quote
Propchange: incubator/tuscany/java/sdo/tools/src/test/java/org/example/simple/cs/Quote.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sdo/tools/src/test/java/org/example/simple/cs/Quote.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sdo/tools/src/test/java/org/example/simple/cs/QuoteBase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/tools/src/test/java/org/example/simple/cs/QuoteBase.java?view=auto&rev=479663
==============================================================================
--- incubator/tuscany/java/sdo/tools/src/test/java/org/example/simple/cs/QuoteBase.java (added)
+++ incubator/tuscany/java/sdo/tools/src/test/java/org/example/simple/cs/QuoteBase.java Mon Nov 27 07:35:17 2006
@@ -0,0 +1,51 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.example.simple.cs;
+
+import org.apache.tuscany.sdo.model.ChangeSummaryType;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Quote Base</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.example.simple.cs.QuoteBase#getChanges <em>Changes</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public interface QuoteBase extends Quote
+{
+ /**
+ * Returns the value of the '<em><b>Changes</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Changes</em>' reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Changes</em>' reference.
+ * @see #setChanges(ChangeSummaryType)
+ * @generated
+ */
+ ChangeSummaryType getChanges();
+
+ /**
+ * Sets the value of the '{@link org.example.simple.cs.QuoteBase#getChanges <em>Changes</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Changes</em>' reference.
+ * @see #getChanges()
+ * @generated
+ */
+ void setChanges(ChangeSummaryType value);
+
+} // QuoteBase
Propchange: incubator/tuscany/java/sdo/tools/src/test/java/org/example/simple/cs/QuoteBase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sdo/tools/src/test/java/org/example/simple/cs/QuoteBase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sdo/tools/src/test/java/org/example/simple/cs/impl/CSFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/tools/src/test/java/org/example/simple/cs/impl/CSFactoryImpl.java?view=auto&rev=479663
==============================================================================
--- incubator/tuscany/java/sdo/tools/src/test/java/org/example/simple/cs/impl/CSFactoryImpl.java (added)
+++ incubator/tuscany/java/sdo/tools/src/test/java/org/example/simple/cs/impl/CSFactoryImpl.java Mon Nov 27 07:35:17 2006
@@ -0,0 +1,329 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.example.simple.cs.impl;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.Property;
+import commonj.sdo.Type;
+
+import org.apache.tuscany.sdo.SDOFactory;
+
+import org.apache.tuscany.sdo.impl.FactoryBase;
+
+import org.apache.tuscany.sdo.model.ModelFactory;
+
+import org.apache.tuscany.sdo.model.impl.ModelFactoryImpl;
+
+import org.apache.tuscany.sdo.util.SDOUtil;
+
+import org.example.simple.cs.*;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model <b>Factory</b>.
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class CSFactoryImpl extends FactoryBase implements CSFactory
+{
+
+ /**
+ * The package namespace URI.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String NAMESPACE_URI = "http://www.example.com/simpleCS";
+
+ /**
+ * The package namespace name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String NAMESPACE_PREFIX = "cs";
+ public static final int QUOTE = 1;
+ public static final int QUOTE_BASE = 2;
+
+ /**
+ * Creates an instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public CSFactoryImpl()
+ {
+ super(NAMESPACE_URI, NAMESPACE_PREFIX);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public DataObject create(int typeNumber)
+ {
+ switch (typeNumber)
+ {
+ case QUOTE: return (DataObject)createQuote();
+ case QUOTE_BASE: return (DataObject)createQuoteBase();
+ default:
+ return super.create(typeNumber);
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Quote createQuote()
+ {
+ QuoteImpl quote = new QuoteImpl();
+ return quote;
+ }
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public QuoteBase createQuoteBase()
+ {
+ QuoteBaseImpl quoteBase = new QuoteBaseImpl();
+ return quoteBase;
+ }
+
+ // Following creates and initializes SDO metadata for the supported types.
+ protected Type quoteType = null;
+
+ public Type getQuote()
+ {
+ return quoteType;
+ }
+
+ protected Type quoteBaseType = null;
+
+ public Type getQuoteBase()
+ {
+ return quoteBaseType;
+ }
+
+
+ private static boolean isInited = false;
+
+ public static CSFactoryImpl init()
+ {
+ if (isInited) return (CSFactoryImpl)FactoryBase.getStaticFactory(CSFactoryImpl.NAMESPACE_URI);
+ CSFactoryImpl theCSFactoryImpl = new CSFactoryImpl();
+ isInited = true;
+
+ // Initialize simple dependencies
+ SDOUtil.registerStaticTypes(SDOFactory.class);
+ SDOUtil.registerStaticTypes(ModelFactory.class);
+
+ // Create package meta-data objects
+ theCSFactoryImpl.createMetaData();
+
+ // Initialize created meta-data
+ theCSFactoryImpl.initializeMetaData();
+
+ // Mark meta-data to indicate it can't be changed
+ //theCSFactoryImpl.freeze(); //FB do we need to freeze / should we freeze ????
+
+ return theCSFactoryImpl;
+ }
+
+ private boolean isCreated = false;
+
+ public void createMetaData()
+ {
+ if (isCreated) return;
+ isCreated = true;
+
+
+ quoteType = createType(false, QUOTE);
+ createProperty(true, quoteType, QuoteImpl.SYMBOL);
+ createProperty(true, quoteType, QuoteImpl.COMPANY_NAME);
+ createProperty(true, quoteType, QuoteImpl.PRICE);
+ createProperty(true, quoteType, QuoteImpl.OPEN1);
+ createProperty(true, quoteType, QuoteImpl.HIGH);
+ createProperty(true, quoteType, QuoteImpl.LOW);
+ createProperty(true, quoteType, QuoteImpl.VOLUME);
+ createProperty(true, quoteType, QuoteImpl.CHANGE1);
+ createProperty(false, quoteType, QuoteImpl.QUOTES);
+
+ quoteBaseType = createType(false, QUOTE_BASE);
+ createProperty(false, quoteBaseType, QuoteBaseImpl.CHANGES);
+ }
+
+ private boolean isInitialized = false;
+
+ public void initializeMetaData()
+ {
+ if (isInitialized) return;
+ isInitialized = true;
+
+ // Obtain other dependent packages
+ ModelFactoryImpl theModelPackageImpl = (ModelFactoryImpl)FactoryBase.getStaticFactory(ModelFactoryImpl.NAMESPACE_URI);
+ Property property = null;
+
+ // Add supertypes to classes
+ addSuperType(quoteBaseType, quoteType);
+
+ // Initialize classes and features; add operations and parameters
+ initializeType(quoteType, Quote.class, "Quote");
+
+ property = (Property)quoteType.getProperties().get(QuoteImpl.SYMBOL);
+ initializeProperty(property, theModelPackageImpl.getString(), "symbol", null, 1, 1, Quote.class, false, false, false);
+
+ property = (Property)quoteType.getProperties().get(QuoteImpl.COMPANY_NAME);
+ initializeProperty(property, theModelPackageImpl.getString(), "companyName", null, 1, 1, Quote.class, false, false, false);
+
+ property = (Property)quoteType.getProperties().get(QuoteImpl.PRICE);
+ initializeProperty(property, theModelPackageImpl.getDecimal(), "price", null, 1, 1, Quote.class, false, false, false);
+
+ property = (Property)quoteType.getProperties().get(QuoteImpl.OPEN1);
+ initializeProperty(property, theModelPackageImpl.getDecimal(), "open1", null, 1, 1, Quote.class, false, false, false);
+
+ property = (Property)quoteType.getProperties().get(QuoteImpl.HIGH);
+ initializeProperty(property, theModelPackageImpl.getDecimal(), "high", null, 1, 1, Quote.class, false, false, false);
+
+ property = (Property)quoteType.getProperties().get(QuoteImpl.LOW);
+ initializeProperty(property, theModelPackageImpl.getDecimal(), "low", null, 1, 1, Quote.class, false, false, false);
+
+ property = (Property)quoteType.getProperties().get(QuoteImpl.VOLUME);
+ initializeProperty(property, theModelPackageImpl.getDouble(), "volume", null, 1, 1, Quote.class, false, true, false);
+
+ property = (Property)quoteType.getProperties().get(QuoteImpl.CHANGE1);
+ initializeProperty(property, theModelPackageImpl.getDouble(), "change1", null, 1, 1, Quote.class, false, true, false);
+
+ property = (Property)quoteType.getProperties().get(QuoteImpl.QUOTES);
+ initializeProperty(property, this.getQuote(), "quotes", null, 0, -1, Quote.class, false, false, false, true , null);
+
+ initializeType(quoteBaseType, QuoteBase.class, "QuoteBase");
+
+ property = (Property)quoteBaseType.getProperties().get(QuoteBaseImpl.CHANGES);
+ initializeProperty(property, theModelPackageImpl.getChangeSummaryType(), "changes", null, 1, 1, QuoteBase.class, false, false, false, false , null);
+
+ createXSDMetaData(theModelPackageImpl);
+ }
+
+ protected void createXSDMetaData(ModelFactoryImpl theModelPackageImpl)
+ {
+ super.createXSDMetaData();
+
+ Property property = null;
+
+ property = createGlobalProperty
+ ("stockQuote",
+ this.getQuoteBase(),
+ new String[]
+ {
+ "kind", "element",
+ "name", "stockQuote",
+ "namespace", "##targetNamespace"
+ });
+
+ addXSDMapping
+ (quoteType,
+ new String[]
+ {
+ "name", "Quote",
+ "kind", "elementOnly"
+ });
+
+ addXSDMapping
+ ((Property)quoteType.getProperties().get(QuoteImpl.SYMBOL),
+ new String[]
+ {
+ "kind", "element",
+ "name", "symbol"
+ });
+
+ addXSDMapping
+ ((Property)quoteType.getProperties().get(QuoteImpl.COMPANY_NAME),
+ new String[]
+ {
+ "kind", "element",
+ "name", "companyName"
+ });
+
+ addXSDMapping
+ ((Property)quoteType.getProperties().get(QuoteImpl.PRICE),
+ new String[]
+ {
+ "kind", "element",
+ "name", "price"
+ });
+
+ addXSDMapping
+ ((Property)quoteType.getProperties().get(QuoteImpl.OPEN1),
+ new String[]
+ {
+ "kind", "element",
+ "name", "open1"
+ });
+
+ addXSDMapping
+ ((Property)quoteType.getProperties().get(QuoteImpl.HIGH),
+ new String[]
+ {
+ "kind", "element",
+ "name", "high"
+ });
+
+ addXSDMapping
+ ((Property)quoteType.getProperties().get(QuoteImpl.LOW),
+ new String[]
+ {
+ "kind", "element",
+ "name", "low"
+ });
+
+ addXSDMapping
+ ((Property)quoteType.getProperties().get(QuoteImpl.VOLUME),
+ new String[]
+ {
+ "kind", "element",
+ "name", "volume"
+ });
+
+ addXSDMapping
+ ((Property)quoteType.getProperties().get(QuoteImpl.CHANGE1),
+ new String[]
+ {
+ "kind", "element",
+ "name", "change1"
+ });
+
+ addXSDMapping
+ ((Property)quoteType.getProperties().get(QuoteImpl.QUOTES),
+ new String[]
+ {
+ "kind", "element",
+ "name", "quotes"
+ });
+
+ addXSDMapping
+ (quoteBaseType,
+ new String[]
+ {
+ "name", "QuoteBase",
+ "kind", "elementOnly"
+ });
+
+ addXSDMapping
+ ((Property)quoteBaseType.getProperties().get(QuoteBaseImpl.CHANGES),
+ new String[]
+ {
+ "kind", "element",
+ "name", "changes"
+ });
+
+ }
+
+} //CSFactoryImpl
Propchange: incubator/tuscany/java/sdo/tools/src/test/java/org/example/simple/cs/impl/CSFactoryImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sdo/tools/src/test/java/org/example/simple/cs/impl/CSFactoryImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sdo/tools/src/test/java/org/example/simple/cs/impl/QuoteBaseImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/tools/src/test/java/org/example/simple/cs/impl/QuoteBaseImpl.java?view=auto&rev=479663
==============================================================================
--- incubator/tuscany/java/sdo/tools/src/test/java/org/example/simple/cs/impl/QuoteBaseImpl.java (added)
+++ incubator/tuscany/java/sdo/tools/src/test/java/org/example/simple/cs/impl/QuoteBaseImpl.java Mon Nov 27 07:35:17 2006
@@ -0,0 +1,270 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.example.simple.cs.impl;
+
+import commonj.sdo.Type;
+
+import org.apache.tuscany.sdo.model.ChangeSummaryType;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.InternalEObject;
+
+import org.example.simple.cs.CSFactory;
+import org.example.simple.cs.QuoteBase;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Quote Base</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.example.simple.cs.impl.QuoteBaseImpl#getChanges <em>Changes</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class QuoteBaseImpl extends QuoteImpl implements QuoteBase
+{
+ /**
+ * The feature id for the '<em><b>Symbol</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public final static int SYMBOL = QuoteImpl.SYMBOL;
+
+ /**
+ * The feature id for the '<em><b>Company Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public final static int COMPANY_NAME = QuoteImpl.COMPANY_NAME;
+
+ /**
+ * The feature id for the '<em><b>Price</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public final static int PRICE = QuoteImpl.PRICE;
+
+ /**
+ * The feature id for the '<em><b>Open1</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public final static int OPEN1 = QuoteImpl.OPEN1;
+
+ /**
+ * The feature id for the '<em><b>High</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public final static int HIGH = QuoteImpl.HIGH;
+
+ /**
+ * The feature id for the '<em><b>Low</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public final static int LOW = QuoteImpl.LOW;
+
+ /**
+ * The feature id for the '<em><b>Volume</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public final static int VOLUME = QuoteImpl.VOLUME;
+
+ /**
+ * The feature id for the '<em><b>Change1</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public final static int CHANGE1 = QuoteImpl.CHANGE1;
+
+ /**
+ * The feature id for the '<em><b>Quotes</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public final static int QUOTES = QuoteImpl.QUOTES;
+
+ /**
+ * The feature id for the '<em><b>Changes</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public final static int CHANGES = QuoteImpl.SDO_PROPERTY_COUNT + 0;
+
+ /**
+ * This represents the number of properties for this type.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+
+ public final static int SDO_PROPERTY_COUNT = QuoteImpl.SDO_PROPERTY_COUNT + 1;
+
+ /**
+ * The cached value of the '{@link #getChanges() <em>Changes</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getChanges()
+ * @generated
+ * @ordered
+ */
+
+ protected ChangeSummaryType changes = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected QuoteBaseImpl()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Type getType()
+ {
+ return ((CSFactoryImpl)CSFactory.INSTANCE).getQuoteBase();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ChangeSummaryType getChanges()
+ {
+ if (changes != null && ((EObject)changes).isProxy())
+ {
+ InternalEObject oldChanges = (InternalEObject)changes;
+ changes = (ChangeSummaryType)eResolveProxy(oldChanges);
+ if (changes != oldChanges)
+ {
+ if (isNotifying())
+ notify(ChangeKind.RESOLVE, CHANGES, oldChanges, changes);
+ }
+ }
+ return changes;
+ }
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ChangeSummaryType basicGetChanges()
+ {
+ return changes;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setChanges(ChangeSummaryType newChanges)
+ {
+ ChangeSummaryType oldChanges = changes;
+ changes = newChanges;
+ if (isNotifying())
+ notify(ChangeKind.SET, CHANGES, oldChanges, changes);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Object get(int propertyIndex, boolean resolve)
+ {
+ switch (propertyIndex)
+ {
+ case CHANGES:
+ if (resolve) return getChanges();
+ return basicGetChanges();
+ }
+ return super.get(propertyIndex, resolve);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void set(int propertyIndex, Object newValue)
+ {
+ switch (propertyIndex)
+ {
+ case CHANGES:
+ setChanges((ChangeSummaryType)newValue);
+ return;
+ }
+ super.set(propertyIndex, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void unset(int propertyIndex)
+ {
+ switch (propertyIndex)
+ {
+ case CHANGES:
+ setChanges((ChangeSummaryType)null);
+ return;
+ }
+ super.unset(propertyIndex);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public boolean isSet(int propertyIndex)
+ {
+ switch (propertyIndex)
+ {
+ case CHANGES:
+ return changes != null;
+ }
+ return super.isSet(propertyIndex);
+ }
+
+} //QuoteBaseImpl
Propchange: incubator/tuscany/java/sdo/tools/src/test/java/org/example/simple/cs/impl/QuoteBaseImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sdo/tools/src/test/java/org/example/simple/cs/impl/QuoteBaseImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org