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/02/21 13:49:56 UTC

svn commit: r509986 [1/4] - in /incubator/tuscany/java/sdo: impl/src/main/java/org/apache/tuscany/sdo/helper/ 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/test...

Author: kelvingoodson
Date: Wed Feb 21 04:49:54 2007
New Revision: 509986

URL: http://svn.apache.org/viewvc?view=rev&rev=509986
Log:
TUSCANY-521 -- temporarily reverting this fix pending some  further work

Removed:
    incubator/tuscany/java/sdo/tools/src/test/java/org/apache/tuscany/sdo/test/InheritanceTestCase.java
    incubator/tuscany/java/sdo/tools/src/test/resources/subgroup.xsd
    incubator/tuscany/java/sdo/tools/src/test/resources/subgroup1.xml
Modified:
    incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/TypeHelperImpl.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/DataObjectBase.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/FactoryBase.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
    incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/DefineTypeTestCase.java
    incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/TypeConversionTestCase.java
    incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/XMLStreamHelperTestCase.java
    incubator/tuscany/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/templates/model/SDOClass.java
    incubator/tuscany/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/templates/model/SDOFactoryClass.java
    incubator/tuscany/java/sdo/tools/src/test/java/com/example/sequences/MixedQuote.java
    incubator/tuscany/java/sdo/tools/src/test/java/com/example/sequences/MixedRepeatingChoice.java
    incubator/tuscany/java/sdo/tools/src/test/java/com/example/sequences/RepeatingChoice.java
    incubator/tuscany/java/sdo/tools/src/test/java/com/example/sequences/SequencesFactory.java
    incubator/tuscany/java/sdo/tools/src/test/java/com/example/sequences/TwoRCs.java
    incubator/tuscany/java/sdo/tools/src/test/java/com/example/sequences/TwoRCsMixed.java
    incubator/tuscany/java/sdo/tools/src/test/java/com/example/sequences/impl/MixedQuoteImpl.java
    incubator/tuscany/java/sdo/tools/src/test/java/com/example/sequences/impl/MixedRepeatingChoiceImpl.java
    incubator/tuscany/java/sdo/tools/src/test/java/com/example/sequences/impl/RepeatingChoiceImpl.java
    incubator/tuscany/java/sdo/tools/src/test/java/com/example/sequences/impl/SequencesFactoryImpl.java
    incubator/tuscany/java/sdo/tools/src/test/java/com/example/sequences/impl/TwoRCsImpl.java
    incubator/tuscany/java/sdo/tools/src/test/java/com/example/sequences/impl/TwoRCsMixedImpl.java
    incubator/tuscany/java/sdo/tools/templates/models/SDOClass.javajet
    incubator/tuscany/java/sdo/tools/templates/models/SDOFactoryClass.javajet

Modified: incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/TypeHelperImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/TypeHelperImpl.java?view=diff&rev=509986&r1=509985&r2=509986
==============================================================================
--- incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/TypeHelperImpl.java (original)
+++ incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/TypeHelperImpl.java Wed Feb 21 04:49:54 2007
@@ -289,7 +289,7 @@
     // get/create document root
     EPackage ePackage = extendedMetaData.getPackage(uri);
     Type documentRoot = 
-      ePackage != null ? (Type)extendedMetaData.getType(ePackage, "") : null;
+      ePackage != null ? (Type)extendedMetaData.getType(extendedMetaData.getPackage(uri), "") : null;
     if (documentRoot == null) 
     {
       documentRoot = SDOUtil.createType(this, uri, null, false);

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=509986&r1=509985&r2=509986
==============================================================================
--- 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 Wed Feb 21 04:49:54 2007
@@ -19,28 +19,20 @@
  */
 package org.apache.tuscany.sdo.impl;
 
-import java.util.Collection;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.ArrayList;
-import java.util.Collections;
 
 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.common.util.EList;
-import org.eclipse.emf.common.util.UniqueEList;
 import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
 import org.eclipse.emf.ecore.EStructuralFeature;
 import org.eclipse.emf.ecore.EcorePackage;
 import org.eclipse.emf.ecore.impl.EClassImpl;
-import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
 import org.eclipse.emf.ecore.util.ExtendedMetaData;
-import org.eclipse.emf.ecore.util.FeatureMap;
 
 import commonj.sdo.Property;
 import commonj.sdo.Sequence;
@@ -57,8 +49,6 @@
  */
 public class ClassImpl extends EClassImpl implements Type, org.apache.tuscany.sdo.model.Type/*, DataObject*/
 {
-	private static final long serialVersionUID = 1L;
-	
   private static final Property UNINITIALIZED_CSPC = SDOFactory.eINSTANCE.createAttribute();
   private Property changeSummaryPropertyCache = UNINITIALIZED_CSPC;
   
@@ -109,24 +99,18 @@
    */
   public boolean isOpen()
   {
-    final List properties = getExtendedProperties();
-    if (properties != Collections.EMPTY_LIST)
+    for (int i = 0, count = getFeatureCount(); i < count; ++i)
     {
-      for (int i = 0, count = properties.size(); i < count; ++i)
+      EStructuralFeature eStructuralFeature = getEStructuralFeature(i);
+      switch (ExtendedMetaData.INSTANCE.getFeatureKind(eStructuralFeature))
       {
-        EStructuralFeature eStructuralFeature = (EStructuralFeature)properties.get(i);
-        if (isOpenFeatureMap(eStructuralFeature))
+        case ExtendedMetaData.ELEMENT_WILDCARD_FEATURE:
+          if (eStructuralFeature == ExtendedMetaData.INSTANCE.getMixedFeature(this)) break;
+        case ExtendedMetaData.ATTRIBUTE_WILDCARD_FEATURE:
+        case ExtendedMetaData.GROUP_FEATURE:
           return true;
       }
     }
-
-    for (final Iterator iterator = getBaseTypes().iterator() ; iterator.hasNext(); )
-    {
-      Type baseType = (Type)iterator.next();
-      if (baseType.isOpen())
-        return true;
-    }
-
     return false;
   }
 
@@ -138,7 +122,7 @@
   public boolean isSequenced()
   {
     // isSequenced == isMixed 
-    return ExtendedMetaData.INSTANCE.getMixedFeature(this) != null; //FB is there a more efficient way to check this now that we have extendedProperties list?
+    return ExtendedMetaData.INSTANCE.getMixedFeature(this) != null;
   }
 
   protected List aliasNames = null;
@@ -156,64 +140,16 @@
     }
     return aliasNames;
   }
-  
-  protected List declaredProperties = null;
-  
+
+  /**
+   * <!-- begin-user-doc -->
+   * <!-- end-user-doc -->
+   * @generated NOT
+   */
   public List getDeclaredProperties()
   {
-    if (declaredProperties == null) {
-      initPropertyLists();
-    }
-    return declaredProperties;
-  }
-  
-  protected List extendedProperties = null;
-  
-  public List getExtendedProperties()
-  {
-    if (extendedProperties == null) {
-      initPropertyLists();
-    }
-    return extendedProperties;
-  }
-  
-  protected void initPropertyLists()
-  {
-    declaredProperties = new ArrayList();
-    extendedProperties = Collections.EMPTY_LIST;
-    
-    for (Iterator i = getEStructuralFeatures().iterator(); i.hasNext(); ) {
-      EStructuralFeature eStructuralFeature = (EStructuralFeature)i.next();
-      boolean isExtendedProperty = DataObjectUtil.isInternalProperty(eStructuralFeature);
-      if (isExtendedProperty) {
-        if (extendedProperties == Collections.EMPTY_LIST)
-          extendedProperties = new ArrayList();
-        extendedProperties.add(eStructuralFeature);
-      }
-      else
-        declaredProperties.add(eStructuralFeature);
-    }
+    return getEStructuralFeatures();
   }
-  
-  public EList getEStructuralFeatures()
-  {
-    if (eStructuralFeatures == null)
-    {
-      eStructuralFeatures = 
-        new EObjectContainmentWithInverseEList(EStructuralFeature.class, this, EcorePackage.ECLASS__ESTRUCTURAL_FEATURES, EcorePackage.ESTRUCTURAL_FEATURE__ECONTAINING_CLASS)
-        {
-          protected void didChange()
-          {
-            declaredProperties = extendedProperties = null;
-          }
-        };
-    }
-    return eStructuralFeatures;
-  }
-
-  protected List allProperties = null;
-  protected List allExtendedProperties = null;
-  protected EList allFeaturesCache = null;
 
   /**
    * <!-- begin-user-doc -->
@@ -222,81 +158,7 @@
    */
   public List getProperties()
   {
-    final EList allFeatures = getEAllStructuralFeatures();
-    if (allFeatures != allFeaturesCache) 
-    {
-      allFeaturesCache = allFeatures;
-      allProperties = allExtendedProperties = null;
-    }
-    if (allProperties == null)
-    {
-      allProperties = new UniqueEList();
-      for (final Iterator iterator = getBaseTypes().iterator(); iterator.hasNext(); )
-      {
-        Type baseType = (Type)iterator.next();
-        allProperties.addAll(baseType.getProperties());
-      }
-      allProperties.addAll(getDeclaredProperties());
-    }
-    return allProperties;
-  }
-
-  public List getAllExtendedProperties()
-  {
-    final EList allFeatures = getEAllStructuralFeatures();
-    if (allFeatures != allFeaturesCache) 
-    {
-      allFeaturesCache = allFeatures;
-      allProperties = allExtendedProperties = null;
-    }
-    if (allProperties == null)
-    {
-      allExtendedProperties = new UniqueEList();
-      for (final Iterator iterator = getBaseTypes().iterator(); iterator.hasNext(); )
-      {
-        Type baseType = (Type)iterator.next();
-        allExtendedProperties.addAll(((ClassImpl)baseType).getAllExtendedProperties());
-      }
-      allExtendedProperties.addAll(getExtendedProperties());
-    }
-    return allExtendedProperties;
-  }
-  
-  protected boolean isOpenFeatureMap(EStructuralFeature eStructuralFeature)
-  {
-    switch (ExtendedMetaData.INSTANCE.getFeatureKind(eStructuralFeature))
-    {
-      case ExtendedMetaData.ELEMENT_WILDCARD_FEATURE:
-        return eStructuralFeature != ExtendedMetaData.INSTANCE.getMixedFeature(this);
-      case ExtendedMetaData.ATTRIBUTE_WILDCARD_FEATURE:
-      //FB I think this is wrong ... case ExtendedMetaData.GROUP_FEATURE:
-        return true;
-    }
-    return false;
-  }
-
-  public void addInstanceProperties(EObject dataObject, Collection propertyList)
-  {
-    for (final Iterator iterator = getBaseTypes().iterator(); iterator.hasNext(); )
-    {
-      ClassImpl baseType = (ClassImpl)iterator.next();
-      baseType.addInstanceProperties(dataObject, propertyList);
-    }
-
-    for (final Iterator iter = getExtendedProperties().iterator(); iter.hasNext(); )
-    {
-      EStructuralFeature eStructuralFeature = (EStructuralFeature)iter.next();
-      if (isOpenFeatureMap(eStructuralFeature))
-      {
-        List features = (List)dataObject.eGet(eStructuralFeature);
-        for (int j = 0, size = features.size(); j < size; ++j)
-        {
-          FeatureMap.Entry entry = (FeatureMap.Entry)features.get(j);
-          EStructuralFeature entryFeature = entry.getEStructuralFeature();
-          propertyList.add(entryFeature);
-        }
-      }
-    }
+    return getEAllStructuralFeatures();
   }
 
   /**

Modified: incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DataObjectBase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DataObjectBase.java?view=diff&rev=509986&r1=509985&r2=509986
==============================================================================
--- incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DataObjectBase.java (original)
+++ incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DataObjectBase.java Wed Feb 21 04:49:54 2007
@@ -177,7 +177,6 @@
   }
   
   protected interface ChangeContext {}
-
   
   protected ChangeContext inverseRemove(Object otherEnd, int propertyIndex, ChangeContext changeContext)
   {
@@ -276,14 +275,9 @@
     throw new UnsupportedOperationException();
   }
   
-  protected int internalConvertIndex(int internalIndex)
-  {
-    return internalIndex;
-  }
-  
   public Object eGet(int featureID, boolean resolve, boolean coreType)
   {
-    Object result = get(internalConvertIndex(featureID), resolve);
+    Object result = get(featureID, resolve);
     if (coreType)
     {
       if (result instanceof FeatureMap.Internal.Wrapper) result = ((FeatureMap.Internal.Wrapper)result).featureMap();
@@ -293,17 +287,17 @@
 
   public void eSet(int featureID, Object newValue)
   {
-    set(internalConvertIndex(featureID), newValue);
+    set(featureID, newValue);
   } 
 
   public void eUnset(int featureID)
   {
-    unset(internalConvertIndex(featureID));
+    unset(featureID);
   }
   
   public boolean eIsSet(int featureID)
   {
-    return isSet(internalConvertIndex(featureID));
+    return isSet(featureID);
   }
   
   private class ChangeContextImpl implements ChangeContext
@@ -314,10 +308,9 @@
     }
   }
   
-  //FB TODO ... review this? ... what about eInverseAdd?
-  public NotificationChain eInverseRemove(InternalEObject otherEnd, int propertyNumber, NotificationChain msgs)
+  public NotificationChain eInverseRemove(InternalEObject otherEnd, int propertyIndex, NotificationChain msgs)
   {
-    return ((ChangeContextImpl)inverseRemove(otherEnd, propertyNumber, new ChangeContextImpl(msgs))).notificationChain;
+    return ((ChangeContextImpl)inverseRemove(otherEnd, propertyIndex, new ChangeContextImpl(msgs))).notificationChain;
   }
   
   public String toString()

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=509986&r1=509985&r2=509986
==============================================================================
--- 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 Wed Feb 21 04:49:54 2007
@@ -90,7 +90,7 @@
    */
   public Object get(int propertyIndex)
   {
-    return get(DataObjectUtil.getProperty(this, propertyIndex));  
+    return eGet(propertyIndex, true, false);
   }
 
   /**
@@ -100,7 +100,7 @@
    */
   public void set(int propertyIndex, Object value)
   {
-    set(DataObjectUtil.getProperty(this, propertyIndex), value);  
+    eSet(propertyIndex, value);
   }
 
   /**
@@ -110,7 +110,7 @@
    */
   public boolean isSet(int propertyIndex)
   {
-    return isSet(DataObjectUtil.getProperty(this, propertyIndex));  
+    return eIsSet(propertyIndex);
   }
 
   /**
@@ -120,7 +120,7 @@
    */
   public void unset(int propertyIndex)
   {
-    unset(DataObjectUtil.getProperty(this, propertyIndex));  
+    eUnset(propertyIndex);
   }
 
   /**
@@ -204,7 +204,7 @@
   }
 
   
-  // Remaining DataObject methods are implemented as straight delegation to DataObjectUtil
+  // Remaining DataObject methods are (will be) implemented as straight delegation to DataObjectUtil
 
   /**
    * <!-- begin-user-doc -->

Modified: incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/FactoryBase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/FactoryBase.java?view=diff&rev=509986&r1=509985&r2=509986
==============================================================================
--- incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/FactoryBase.java (original)
+++ incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/FactoryBase.java Wed Feb 21 04:49:54 2007
@@ -110,20 +110,15 @@
       return (Type)createEClass(typeNumber);
   }
   
-  protected void createProperty(boolean isDataType, Type containingType, int internalPropertyNumber)
+  protected void createProperty(boolean isDataType, Type containingType, int propertyNumber)
   {
     if (isDataType)
-      createEAttribute((EClass)containingType, internalPropertyNumber);
+      createEAttribute((EClass)containingType, propertyNumber);
     else
-      createEReference((EClass)containingType, internalPropertyNumber);
+      createEReference((EClass)containingType, propertyNumber);
   }
   
-  protected Property getProperty(Type type, int internalPropertyNumber)
-  {
-    return (Property)((EClass)type).getEAllStructuralFeatures().get(internalPropertyNumber);
-  }
-  
-  protected void initializeType(Type type, Class instanceClass, String name)
+  protected void initializeType(Type type, Class instanceClass, String name) //FB TODO regenerate models and then delete this method
   {
     initEClass((EClass)type, instanceClass, name, !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);   
   }
@@ -147,7 +142,7 @@
   {
     initEReference((EReference)property, (EClassifier)type, (EReference)oppositeProperty, name, defaultValue, lower, upper, containerClass, isDerived, isDerived, !isReadonly, isComposite, !isComposite /*resolve*/, isUnsettable, IS_UNIQUE, isDerived, IS_ORDERED);
   }
-  
+
   protected void initXSD()
   {
     createDocumentRoot();

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=509986&r1=509985&r2=509986
==============================================================================
--- 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 Wed Feb 21 04:49:54 2007
@@ -224,79 +224,85 @@
   }
   
 
+  
+  private static Property getPropertyByIndex(DataObject dataObject, int propertyIndex) {
+    EObject eObject = (EObject) dataObject;
+    Property property = (Property)eObject.eClass().getEStructuralFeature(propertyIndex);
+    return property;
+  }
+
   public static void setString(DataObject dataObject, int propertyIndex, String value) {
-      setString(dataObject,getProperty(dataObject, propertyIndex), value);
+    dataObject.set(propertyIndex, getSetValue(getPropertyByIndex(dataObject, propertyIndex), value));
   }
   
   public static void setShort(DataObject dataObject, int propertyIndex, short value) {
-      setShort(dataObject,getProperty(dataObject, propertyIndex), value);
+    dataObject.set(propertyIndex, getSetValue(getPropertyByIndex(dataObject, propertyIndex), value));
   }
   
   public static void setLong(DataObject dataObject, int propertyIndex, long value) {
-      setLong(dataObject,getProperty(dataObject, propertyIndex), value);
+    dataObject.set(propertyIndex, getSetValue(getPropertyByIndex(dataObject, propertyIndex), value));
   }
   
   public static void setList(DataObject dataObject, int propertyIndex, List value) {
-      setList(dataObject,getProperty(dataObject, propertyIndex), value);
+    dataObject.set(propertyIndex, value);
   }
   
   public static void setInt(DataObject dataObject, int propertyIndex, int value) {
-      setInt(dataObject,getProperty(dataObject, propertyIndex), value);
+    dataObject.set(propertyIndex, getSetValue(getPropertyByIndex(dataObject, propertyIndex), value));
   }
   
   public static void setFloat(DataObject dataObject, int propertyIndex, float value) {
-      setFloat(dataObject,getProperty(dataObject, propertyIndex), value);
+    dataObject.set(propertyIndex, getSetValue(getPropertyByIndex(dataObject, propertyIndex), value));
   }
  
   public static void setDouble(DataObject dataObject, int propertyIndex, double value) {
-      setDouble(dataObject,getProperty(dataObject, propertyIndex), value);
+    dataObject.set(propertyIndex, getSetValue(getPropertyByIndex(dataObject, propertyIndex), value));
   }
   
   public static void setDate(DataObject dataObject, int propertyIndex, Date value) {
-      setDate(dataObject,getProperty(dataObject, propertyIndex), value);
+    dataObject.set(propertyIndex, getSetValue(getPropertyByIndex(dataObject, propertyIndex), value));
   }
   
   public static void setDataObject(DataObject dataObject, int propertyIndex, DataObject value) {
-    dataObject.set(getProperty(dataObject, propertyIndex), value);
+    dataObject.set(propertyIndex, value);
   }
   
   public static void setChar(DataObject dataObject, int propertyIndex, char value) {
-      setChar(dataObject,getProperty(dataObject, propertyIndex), value);
+    dataObject.set(propertyIndex, getSetValue(getPropertyByIndex(dataObject, propertyIndex), value));
   }
   
   public static void setBytes(DataObject dataObject, int propertyIndex, byte[] value) {
-      setBytes(dataObject,getProperty(dataObject, propertyIndex), value);
+    dataObject.set(propertyIndex, getSetValue(getPropertyByIndex(dataObject, propertyIndex), value));
   }
   
   public static void setByte(DataObject dataObject, int propertyIndex, byte value) {
-      setByte(dataObject,getProperty(dataObject, propertyIndex), value);
+    dataObject.set(propertyIndex, getSetValue(getPropertyByIndex(dataObject, propertyIndex), value));
   }
   
   public static void setBoolean(DataObject dataObject, int propertyIndex, boolean value) {
-      setBoolean(dataObject,getProperty(dataObject, propertyIndex), value);
+    dataObject.set(propertyIndex, getSetValue(getPropertyByIndex(dataObject, propertyIndex), value));
   }
   
   public static void setBigInteger(DataObject dataObject, int propertyIndex, BigInteger value)
   {
-      setBigInteger(dataObject,getProperty(dataObject, propertyIndex), value);
+    dataObject.set(propertyIndex, getSetValue(getPropertyByIndex(dataObject, propertyIndex), value));
   }
   
   public static void setBigDecimal(DataObject dataObject, int propertyIndex, BigDecimal value)
   {
-    setBigDecimal(dataObject,getProperty(dataObject, propertyIndex), value);
+    dataObject.set(propertyIndex, getSetValue(getPropertyByIndex(dataObject, propertyIndex), value));
   }
   
   public static String getString(DataObject dataObject, int propertyIndex)
   {
-    return getString(dataObject.get(getProperty(dataObject, propertyIndex)));
+    return getString(dataObject.get(propertyIndex));
   }
   
   public static short getShort(DataObject dataObject, int propertyIndex)
   {
-    return getShort(dataObject.get(getProperty(dataObject, propertyIndex)));
+    return getShort(dataObject.get(propertyIndex));
   }
   
-
   public static Sequence getSequence(DataObject dataObject, int propertyIndex)
   {
     return (Sequence)dataObject.get(propertyIndex);
@@ -304,67 +310,67 @@
   
   public static long getLong(DataObject dataObject, int propertyIndex)
   {
-    return getLong(dataObject.get(getProperty(dataObject, propertyIndex)));
+    return getLong(dataObject.get(propertyIndex));
   }
   
   public static List getList(DataObject dataObject, int propertyIndex)
   {
-    return (List)dataObject.get(getProperty(dataObject, propertyIndex));
+    return (List)dataObject.get(propertyIndex);
   }
   
   public static int getInt(DataObject dataObject, int propertyIndex)
   {
-    return getInt(dataObject.get(getProperty(dataObject, propertyIndex)));
+    return getInt(dataObject.get(propertyIndex));
   }
   
   public static float getFloat(DataObject dataObject, int propertyIndex)
   {
-    return getFloat(dataObject.get(getProperty(dataObject, propertyIndex)));
+    return getFloat(dataObject.get(propertyIndex));
   }
   
   public static double getDouble(DataObject dataObject, int propertyIndex)
   {
-    return getDouble(dataObject.get(getProperty(dataObject, propertyIndex)));
+    return getDouble(dataObject.get(propertyIndex));
   }
   
   public static Date getDate(DataObject dataObject, int propertyIndex)
   {
-    return getDate(dataObject.get(getProperty(dataObject, propertyIndex)));
+    return getDate(dataObject.get(propertyIndex));
   }
   
   public static DataObject getDataObject(DataObject dataObject, int propertyIndex)
   {
-    return (DataObject)dataObject.get(getProperty(dataObject, propertyIndex));
+    return (DataObject)dataObject.get(propertyIndex);
   }
   
   public static char getChar(DataObject dataObject, int propertyIndex)
   {
-    return getChar(dataObject.get(getProperty(dataObject, propertyIndex)));
+    return getChar(dataObject.get(propertyIndex));
   }
   
   public static byte[] getBytes(DataObject dataObject, int propertyIndex)
   {
-    return getBytes(dataObject.get(getProperty(dataObject, propertyIndex)));
+    return getBytes(dataObject.get(propertyIndex));
   }
   
   public static byte getByte(DataObject dataObject, int propertyIndex)
   {
-    return getByte(dataObject.get(getProperty(dataObject, propertyIndex)));
+    return getByte(dataObject.get(propertyIndex));
   }
   
   public static boolean getBoolean(DataObject dataObject, int propertyIndex)
   {
-    return getBoolean(dataObject.get(getProperty(dataObject, propertyIndex)));
+    return getBoolean(dataObject.get(propertyIndex));
   }
   
   public static BigInteger getBigInteger(DataObject dataObject, int propertyIndex)
   {
-    return getBigInteger(dataObject.get(getProperty(dataObject, propertyIndex)));
+    return getBigInteger(dataObject.get(propertyIndex));
   }
   
   public static BigDecimal getBigDecimal(DataObject dataObject, int propertyIndex)
   {
-    return getBigDecimal(dataObject.get(getProperty(dataObject, propertyIndex)));
+    return getBigDecimal(dataObject.get(propertyIndex));
   }
   
   public static void detach(DataObject dataObject) {
@@ -376,16 +382,25 @@
     return (DataObject)EcoreUtil.getRootContainer((EObject)dataObject);
   }
   
-  public static boolean isInternalProperty(EStructuralFeature eStructuralFeature)
-  {
-    return FeatureMapUtil.isFeatureMap(eStructuralFeature);
-  }
-
   public static List getInstanceProperties(DataObject dataObject)
   {
-    Type type = dataObject.getType();
-    List result = new UniqueEList(type.getProperties());
-    ((ClassImpl)type).addInstanceProperties((EObject)dataObject, result);
+    //TODO maybe optimize this to just return type.getProperties if type.isOpen (isOpen would need to be cached)
+    EObject eDataObject = (EObject) dataObject;
+    List result = new UniqueEList(eDataObject.eClass().getEAllStructuralFeatures());
+    for (int i = 0, count = result.size(); i < count; ++i)
+    {
+      EStructuralFeature eStructuralFeature = (EStructuralFeature)result.get(i);
+      if (!eStructuralFeature.isDerived() && FeatureMapUtil.isFeatureMap(eStructuralFeature))
+      {
+        List features = (List)eDataObject.eGet(eStructuralFeature);
+        for (int j = 0, size = features.size(); j < size; ++j)
+        {
+          FeatureMap.Entry entry = (FeatureMap.Entry)features.get(j);
+          EStructuralFeature entryFeature = entry.getEStructuralFeature();
+          result.add(entryFeature);
+        }
+      }
+    }
     return result;
   }
   
@@ -2504,7 +2519,6 @@
   public static EClass createDocumentRoot()
   {
     EClass documentRootEClass = EcoreFactory.eINSTANCE.createEClass();
-    documentRootEClass.setName("DocumentRoot");
     ExtendedMetaData.INSTANCE.setName(documentRootEClass, "");
     ExtendedMetaData.INSTANCE.setContentKind(documentRootEClass, ExtendedMetaData.MIXED_CONTENT);
     

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=509986&r1=509985&r2=509986
==============================================================================
--- 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 Wed Feb 21 04:49:54 2007
@@ -536,7 +536,7 @@
     // currently, we require setSequenced to be called first, before anything else is added to the type.
     if (type.isDataType() || !type.getProperties().isEmpty())
     {
-      if (type.getName() != "DocumentRoot") // document root is a special case
+      if (type.getName() != null) // document root is a special case
         throw new IllegalArgumentException();
     }
     

Modified: incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/DefineTypeTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/DefineTypeTestCase.java?view=diff&rev=509986&r1=509985&r2=509986
==============================================================================
--- incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/DefineTypeTestCase.java (original)
+++ incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/DefineTypeTestCase.java Wed Feb 21 04:49:54 2007
@@ -532,7 +532,7 @@
 
     sequence.addText("\n  ");
 
-    Type definedGlobalType = types.getType("http://www.example.com/open", "DocumentRoot");
+    Type definedGlobalType = types.getType("http://www.example.com/open", null);
     
     Property definedSymbolProperty = definedGlobalType.getProperty("symbol");
     quote.setString(definedSymbolProperty, "fbnt");

Modified: incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/TypeConversionTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/TypeConversionTestCase.java?view=diff&rev=509986&r1=509985&r2=509986
==============================================================================
--- incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/TypeConversionTestCase.java (original)
+++ incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/TypeConversionTestCase.java Wed Feb 21 04:49:54 2007
@@ -51,19 +51,19 @@
 
     // The following constants describe the index for the fields in api_test.xsd.
     
-    private static final int STRING_VAL_INDEX = 0;
-    private static final int BOOLEAN_VAL_INDEX = 1;
-    private static final int BYTE_VAL_INDEX = 3;
-    private static final int DECIMAL_VAL_INDEX = 5;
-    private static final int INT_VAL_INDEX = 7;
-    private static final int FLOAT_VAL_INDEX = 8;
-    private static final int DOUBLE_VAL_INDEX = 9;
-    private static final int DATE_VAL_INDEX = 10;
-    private static final int SHORT_VAL_INDEX = 11;
-    private static final int LONG_VAL_INDEX = 12;
-    private static final int BYTES_VAL_INDEX = 14;
-    private static final int INTEGER_VAL_INDEX = 15;
-    private static final int CHAR_VAL_INDEX = 16;
+    private static final int STRING_VAL_INDEX = 1;
+    private static final int BOOLEAN_VAL_INDEX = 2;
+    private static final int BYTE_VAL_INDEX = 4;
+    private static final int DECIMAL_VAL_INDEX = 6;
+    private static final int INT_VAL_INDEX = 8;
+    private static final int FLOAT_VAL_INDEX = 9;
+    private static final int DOUBLE_VAL_INDEX = 10;
+    private static final int DATE_VAL_INDEX = 11;
+    private static final int SHORT_VAL_INDEX = 12;
+    private static final int LONG_VAL_INDEX = 13;
+    private static final int BYTES_VAL_INDEX = 15;
+    private static final int INTEGER_VAL_INDEX = 16;
+    private static final int CHAR_VAL_INDEX = 17;
     
     // The following variables are Method arrays.  Each array refers to a specific get<Type>, but within
     // the array exist the get<Type>(index), get<Type>(property), and get<Type>(path).  Rather than
@@ -886,4 +886,4 @@
     public void testTuscany_836() {
         assertEquals(DataObjectUtil.getBigDecimal(new Long(Long.MAX_VALUE)).longValue(), Long.MAX_VALUE);
     }
-}
+}
\ No newline at end of file

Modified: incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/XMLStreamHelperTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/XMLStreamHelperTestCase.java?view=diff&rev=509986&r1=509985&r2=509986
==============================================================================
--- incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/XMLStreamHelperTestCase.java (original)
+++ incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/XMLStreamHelperTestCase.java Wed Feb 21 04:49:54 2007
@@ -122,8 +122,7 @@
         List components = moduleObject.getList("component");
         DataObject componentObject = (DataObject) components.get(0);
         // componentObject.getDataObject("implementation.mock");
-        //DataObject implObject = (DataObject) componentObject.getSequence(0).getValue(0);
-        DataObject implObject = componentObject.getDataObject(componentObject.getProperty("implementation.mock")); //FB
+        DataObject implObject = (DataObject) componentObject.getSequence(0).getValue(0);
         Assert.assertTrue(implObject.getString("myAttr").equals("helloworld.HelloWorldImpl"));
     }
 



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