Hi Kelvin,

Thank you for your quick response. I built Tuscany SDO the morning of
May 9th. I'm using EMF 2.2.3. When I generate the static classes
against the schema below, I see the following method created in
PersonTypeImpl:

 public DogType[] getDog()
 {
   BasicEList list = (BasicEList)getDogList();
   if (list.isEmpty()) return DOG_EEMPTY_ARRAY;
   list.shrink();
   return (DogType[])list.data();
 }

The getDogList() in that method is returning a
FeatureMapUtil$FeatureEList object which can't be cast into a
BasicEList.

I'm using the -arrayAccessors switch when generating my source. That
may be the missing piece here. Sorry I didn't include that earlier.
Here are the commands I use to generate the static SDOs:

set javaExe=C:\ibmsdk1.4.2_sr4-1\bin\java
set output=.

set 
sdo_cp=lib\org.eclipse.emf.codegen_2.2.2.v200705020400.jar;lib\org.eclipse.emf.codegen.ecore_2.2.2.v200705020400.jar;lib\org.eclipse.emf.common_2.2.1.v200705020400.jar;lib\org.eclipse.emf.ecore_2.2.3.v200705020400.jar;lib\org.eclipse.emf.ecore.change_2.2.1.v200705020400.jar;lib\org.eclipse.emf.ecore.xmi_2.2.3.v200705020400.jar;lib\sdo-api-r2.1-1.0-incubating-SNAPSHOT.jar;lib\tuscany-sdo-impl-1.0-incubating-SNAPSHOT.jar;lib\tuscany-sdo-tools-1.0-incubating-SNAPSHOT.jar;lib\org.eclipse.xsd_2.2.3.v200705020400.jar
set options=-cp %sdo_cp%
org.apache.tuscany.sdo.generate.XSD2JavaGenerator -arrayAccessors
-targetDirectory %output%

%javaExe% %options% Person.xsd

Let me know if you still have problems recreating this issue. Thanks,
-Chris

On 5/10/07, kelvin goodson <[EMAIL PROTECTED]> wrote:
Hi  Chris,
  the code snippet you supplied doesn't compile against the code that I
generated. Person's dog Property is isMany=true so to add a dog you need to
do person.getDog().add(aDog)
Regards, kelvin.

On 10/05/07, Chris Mildebrandt <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I'm having a little generation problem with groups. Here's my sample
> schema:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";
> targetNamespace="http://www.example.org/Person";
> xmlns:person="http://www.example.org/Person";
> elementFormDefault="qualified">
>     <xsd:element name="Person" type="person:PersonType"></xsd:element>
>
>     <xsd:complexType name="PersonType">
>         <xsd:sequence>
>                 <xsd:element name="Name" type="xsd:string"></xsd:element>
>                 <xsd:element name="Age" type="xsd:string"></xsd:element>
>                         <xsd:group ref="person:AnimalGroup" minOccurs="0"
> maxOccurs="unbounded"/>
>         </xsd:sequence>
>     </xsd:complexType>
>
>     <xsd:simpleType name="Hair">
>         <xsd:restriction base="xsd:string"></xsd:restriction>
>     </xsd:simpleType>
>
>         <xsd:group name="AnimalGroup">
>                 <xsd:choice>
>                         <xsd:element name="Cat" type="person:CatType"/>
>                         <xsd:element name="Dog" type="person:DogType"/>
>                 </xsd:choice>
>         </xsd:group>
>
>     <xsd:complexType name="DogType">
>         <xsd:sequence>
>                 <xsd:element name="Name" type="xsd:string"></xsd:element>
>                 <xsd:element name="Age" type="xsd:string"></xsd:element>
>                 <xsd:element name="Breed" type="xsd:string"></xsd:element>
>         </xsd:sequence>
>     </xsd:complexType>
>
>     <xsd:complexType name="CatType">
>         <xsd:sequence>
>                 <xsd:element name="Name" type="xsd:string"></xsd:element>
>                 <xsd:element name="Age" type="xsd:string"></xsd:element>
>                 <xsd:element name="Breed" type="xsd:string"></xsd:element>
>         </xsd:sequence>
>     </xsd:complexType>
>
> </xsd:schema>
>
> And my code:
>
>         HelperContext context = SDOUtil.createHelperContext();
>
>         PersonFactory.INSTANCE.register(context);
>         PersonType person = PersonFactory.INSTANCE.createPersonType();
>
>         person.setAge("30");
>         person.setName("Jim");
>
>         DogType dog = PersonFactory.INSTANCE.createDogType();
>         dog.setAge("4");
>         dog.setBreed("pug");
>         dog.setName("chewie");
>
>         DogType[] dogs = new DogType[0];
>
>         person.setDog(dogs);
>         person.getDog();
>
> I get the following exception when running either setDogs() or getDogs():
>
> Exception in thread "main" java.lang.ClassCastException:
> org.eclipse.emf.ecore.util.FeatureMapUtil$FeatureEList
>         at org.example.person.impl.PersonTypeImpl.setDog(
> PersonTypeImpl.java:447)
>         at Test.anyTest_Static_Person(Test.java:144)
>         at Test.main(Test.java:153)
>
>
> Let me know if you need any more information. Thanks,
> -Chris
>
> ---------------------------------------------------------------------
> 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