Thanks for fixing the issue. I have added a test case for this. Attached is the patch.
-----Original Message----- From: Frank Budinsky (JIRA) [mailto:[EMAIL PROTECTED] Sent: Thursday, August 16, 2007 6:30 PM To: Murtaza Goga Subject: [jira] Resolved: (TUSCANY-1540) Abstract Static Base Types mixed with Dynamic Extended Types [ https://issues.apache.org/jira/browse/TUSCANY-1540?page=com.atlassian.ji ra.plugin.system.issuetabpanels:all-tabpanel ] Frank Budinsky resolved TUSCANY-1540. ------------------------------------- Resolution: Fixed Fixed in revision 566876. I changed the generator to generate a concrete inner subclass for abstract Impl classes: public abstract class AbstractTestImpl extends DataObjectBase implements AbstractTest { public static class ConcreteBase extends AbstractTestImpl { public ConcreteBase() { super(); } } ... } and then added code in FactoryBase$SDOEFactoryImpl.create() to use it if the type is abstract. I've tested it with the following simple program: public static void main(String[] args) throws IOException { HelperContext context = SDOUtil.createHelperContext(); Junk3Factory.INSTANCE.register(context); TypeHelper typeHelper = context.getTypeHelper(); DataFactory factory = context.getDataFactory(); Type abstractType = typeHelper.getType("http://www.example.org/junk/", "AbstractTest"); //DataObject testObject = factory.create(abstractType); // should fail // Create an subtype DataObject exampleType = DataFactory.INSTANCE.create("commonj.sdo", "Type"); exampleType.set("uri", NSURI); exampleType.set("name", "Example"); exampleType.getList("baseType").add(abstractType); Type type = TypeHelper.INSTANCE.define(exampleType); DataObject testObject2 = factory.create(type); if (testObject2.getClass() == AbstractTestImpl.ConcreteBase.class) System.out.println("SUCCESS"); else System.out.println("FAIL"); } It would be good to get a proper JUnit for it. Any volunteers? > Abstract Static Base Types mixed with Dynamic Extended Types > ------------------------------------------------------------ > > Key: TUSCANY-1540 > URL: https://issues.apache.org/jira/browse/TUSCANY-1540 > Project: Tuscany > Issue Type: Bug > Components: Java SDO Implementation > Affects Versions: Java-SDO-1.0 > Reporter: Murtaza Goga > Fix For: Java-SDO-Next > > > Setting a property on a static data object with an object of a type extended in a dynamic model results in a ClassCastException. > Scenario: > Static schema- > <xsd:complexType name="CustomerType"> > <xsd:all> > <xsd:element name="number" type="xsd:integer" /> > <xsd:element form="unqualified" name="info" type="InfoType" /> > </xsd:all> > </xsd:complexType> > > <xsd:complexType name="InfoType" abstract="true"/> > Dynamic Schema > <xsd:complexType name="InfoType"> > <xsd:complexContent> > <xsd:extension base="staticNS:InfoType"> > <xsd:sequence> > <xsd:element name="zipcode" type="xsd:string" /> > </xsd:sequence> > </xsd:extension> > </xsd:complexContent> > </xsd:complexType> > The following will fail: > DataFactory factory = scope.getDataFactory(); > factory.create(CustomerType.class).setDataObject("info", factory.create("dynamicNS", "InfoType")); > It should be legal to assign a property to an object if they are in the same hierachy. > Steps to reproduce within Tuscany: > Testcase org.apache.tuscany.sdo.test.ExtensibleTestCase will break if 'InfoType' defined in extensible/customer.xsd is marked as abstract. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]