Since the properties start at 0, the extra property number should be equal 
to INTERNAL_PROPERTY_COUNT. That looks right.

The StackOverflowException problem looks to me to be caused by the fact 
that the generated methods like isSet(int) are expected to find the 
property and only call super in the dynamic case. In your case, the 
property isn't statically handled, so it eventually calls 
DataObjectBase.eIsSet():

  public boolean eIsSet(int featureID)
  {
    if (isDynamic())
    {
      return super.eIsSet(internalConvertIndex(featureID));
    } else
    {
      return isSet(internalConvertIndex(featureID));
    }
  }

which will recursively call isSet() again because isDynamic() returns 
false. Somehow the code needs to be changed so that the dynamic property 
also causes it to go down the isDynamic() path. 

Actually, this eIsSet() method looks fishy to me regardless. First, the 
call to internalConvertIndex(featureID) for the call to super.eIsSet() 
looks wrong to me. I think it should be just featureID. The super call is 
expecting the internal (EMF) number, not the converted SDO number. Second, 
even in the dynamic sublass case (which this is supposed to be handling, I 
think that a client call to eIsSet() won't work, because it won't ever go 
down the isSet() patch which handles the static properties (in the base 
class(es)).

I think the isDynamic() part of this method should be removed and instead 
there should be an implementation of isSet(int) (in ExtensibleDataObject 
probably?) that handles the case of a property that is either in a dynamic 
sublass or was dynamically added to a static type.

Frank.


Ron Gavlin <[EMAIL PROTECTED]> wrote on 07/26/2007 01:09:27 PM:

> Frank,
> 
> This scenario appears to trigger a property-indexing problem. The 
> newly added property's EMF featureID of 18 equals the value of 
> MyTypeImpl.SDO_PROPERTY_COUNT and MyTypeImpl.
> INTERNAL_PROPERTY_COUNT. This appears to cause an infinite loop. Any
> ideas for working around this problem?
> 
> - Ron
> 
> ----- Original Message ----
> From: Ron Gavlin <[EMAIL PROTECTED]>
> To: [email protected]
> Sent: Thursday, July 26, 2007 12:53:07 PM
> Subject: Re: How to add Property to an XSDHelper-defined Type
> 
> Hi Frank,
> 
> The EMF Diagnostician validate() is generating a 
> StackOverflowException which may be exposing a bug in the Tuscany 
> SDO dynamic subclassing area. Here is the stack trace. Let me know 
> if anything jumps out at you. BTW, I am currently using Tuscany SDO 
> version R548343 and EMF 2.2.2. I plan upgrade to the final 1.0 
> release when it is ready.
> 
> - Ron
> 
> java.lang.StackOverflowError
> at mypackage.impl.MyFactoryImpl.getMyType(MyFactoryImpl.java:1135)
> 
> 
> at mypackage.impl.MyTypeImpl.getStaticType(MyTypeImpl.java:821)
> at org.apache.tuscany.sdo.impl.DataObjectBase.
> eStaticClass(DataObjectBase.java:378)
> at org.apache.tuscany.sdo.impl.ExtensibleDataObjectImpl.
> eClass(ExtensibleDataObjectImpl.java:118)
> at org.apache.tuscany.sdo.impl.ExtensibleDataObjectImpl.
> eDerivedStructuralFeatureID(ExtensibleDataObjectImlp.java:87)
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.
> eIsSet(BasicEObjectimpl.java:815)
> 
> at 
org.apache.tuscany.sdo.impl.DataObjectImpl.isSet(DataObjectImpl.java:152)
> 
> at 
org.apache.tuscany.sdo.impl.DataObjectImpl.isSet(DatObjectImpl.java:112)
> 
> at mypackage.sdo.impl.MyTypeImpl.setSet(MyTypeImpl.java:2005)
> 
> 
> at 
org.apache.tuscany.sdo.impl.DataObjectBase.eIsSet(DataObjectBase.java:437)
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.
> eIsSet(BasicEObjectimpl.java:818)
> at 
org.apache.tuscany.sdo.impl.DataObjectImpl.isSet(DataObjectImpl.java:152)
> at 
org.apache.tuscany.sdo.impl.DataObjectImpl.isSet(DatObjectImpl.java:112)
> ...
> at mypackage.sdo.impl.MyTypeImpl.setSet(MyTypeImpl.java:2005)
> 
> at 
org.apache.tuscany.sdo.impl.DataObjectBase.eIsSet(DataObjectBase.java:437)
> 
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.
> eIsSet(BasicEObjectimpl.java:818)
> 
> at 
org.apache.tuscany.sdo.impl.DataObjectImpl.isSet(DataObjectImpl.java:152)
> 
> at 
org.apache.tuscany.sdo.impl.DataObjectImpl.isSet(DatObjectImpl.java:112)
> 
> ...
> 
> ----- Original Message ----
> From: Ron Gavlin <[EMAIL PROTECTED]>
> To: [email protected]
> Sent: Thursday, July 26, 2007 12:22:49 PM
> Subject: Re: How to add Property to an XSDHelper-defined Type
> 
> Hi Frank,
> 
> The SDOUtil.createProperty() appears to do what I need with one 
> caveat. I am currently using the EMF's Diagnostician to validate my 
> DataObjects since Tuscany SDO does not directly offer such a 
> capability. The Diagnostician throws an Exception when it encounters
> a DataObject whose type modified using SDOUtil.createProperty(). Any
> ideas off the top of your head why the Diagnostician might not like 
> the DataObject with the modified type?
> 
> - Ron
> 
> ----- Original Message ----
> From: Frank Budinsky <[EMAIL PROTECTED]>
> To: [email protected]
> Sent: Thursday, July 26, 2007 9:50:26 AM
> Subject: Re: How to add Property to an XSDHelper-defined Type
> 
> Hi Ron,
> 
> I guess we would need to make TypeHelper.define support a mode where you 

> would only give a patial definition of a Type and it would be used as a 
> delta to modify an exisitng type. 
> 
> A simpler approach, which may be working already, is to use the 
> Tuscany-specific SDOUtil.createProperty() method to modify the existing 
> type. Have you tried that?
> 
> Frank.
> 
> Ron Gavlin <[EMAIL PROTECTED]> wrote on 07/25/2007 05:16:44 PM:
> 
> > Yes, it would be inconvenient for me to use XSDHelper.define() to 
> > modify the existing type. Allowing TypeHelper.define() to "redefine"
> > the type would be much preferred. How would TypeHelperImpl need to 
> > be changed to implement such a feature?
> > 
> > - Ron
> > 
> > ----- Original Message ----
> > From: Frank Budinsky <[EMAIL PROTECTED]>
> > To: [email protected]
> > Sent: Wednesday, July 25, 2007 4:37:46 PM
> > Subject: Re: How to add Property to an XSDHelper-defined Type
> > 
> > If you create your HelperContext using 
> SDOUtil.createHelperContext(true), 
> > XSDHelper.define() will then let you add new types to an existing 
> > namespace and also to replace an existing type with a new version 
(Note: 
> 
> > this is a "use at your own risk" feature).
> > 
> > So, you could add a new property by calling XSDHelper.define() again 
> > passing in a new version of the XSD type that includes the new 
> > element/attribute. 
> > 
> > Maybe we should consider makingTypeHelper.define() also allow you to 
> > modify existing types if the HelperContext has extensibleNamespaces == 

> > true?
> > 
> > Frank.
> > 
> > 
> > 
> > 
> > Ron Gavlin <[EMAIL PROTECTED]> 
> > 07/25/2007 03:55 PM
> > Please respond to
> > [email protected]
> > 
> > 
> > To
> > tuscany-user tuscany-user <[email protected]>
> > cc
> > 
> > Subject
> > How to add Property to an XSDHelper-defined Type
> > 
> > 
> > 
> > 
> > 
> > 
> > Greetings,
> > 
> > I have a Type that was created using XSDHelper.define(). Now I would 
> like 
> > to dynamically add an add'l Property to this Type. This does not 
appear 
> to 
> > be supported. Can you suggest any workarounds?
> > 
> > - Ron
> > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to