You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by kelvin goodson <ke...@gmail.com> on 2007/06/25 14:24:22 UTC
Re: ClassCastException on getChangeSummary().beginLogging();
Hi Tom,
the only generator we have in good shape to generate Tuscany SDO
classes is the XSD to Java generator. I think it would be a
significant new feature to properly support what you are trying to do.
You are correct in your understanding that you must arrange for a
specialised factory to be in place to create your types, so that they
are instances of Type rather than of EClass. Tuscany SDO itself has to
do this in order to ensure that the SDOFactory is used to create SDO
objects.
Regards, Kelvin.
On 25/06/07, Thomas Kuhn <th...@sphere.ae> wrote:
> Hi,
>
> I'm getting a ClassCastException (see below) when I try to do
> myDataObj.getChangeSummary().beginLogging();
>
> I am use EMF to create the objects. I changed the .genmodel file to generate
> SDO objects (I changed the genmodel first to create SDO 1.0 objects.
> Subsequently, I modified the .genmodel file to generate code that uses the
> Tuscany classes). The generated interfaces extend DataObject and their
> implementations correctly extend DataObjectImpl. I think the problem lies in
> the generated Package file, where getMyDataObj() returns an EClass. If it
> would be of any help, I can provide the .genmodel file.
>
> Is it possible at all to generate SDO from an EMF model?
>
> Thanks in advance,
>
> Tom
>
> java.lang.ClassCastException: org.eclipse.emf.ecore.impl.EClassImpl
> at
> org.apache.tuscany.sdo.impl.DataObjectImpl.getType(DataObjectImpl.java:192)
> at
> org.apache.tuscany.sdo.util.DataObjectUtil.getChangeSummary(DataObjectUtil.j
> ava:688)
> at
> org.apache.tuscany.sdo.impl.DataObjectImpl.getChangeSummary(DataObjectImpl.j
> ava:1314)
> ....
>
> Environment: EMF 2.2.0, SDO 2.1.0 incubating beta1
>
>
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org
Re: ClassCastException on getChangeSummary().beginLogging();
Posted by Frank Budinsky <fr...@ca.ibm.com>.
Hi Tom,
Tuscany overrides the templates, and many of the other GenModel settings
for it's code generation. If you look in class
org.apache.tuscany.sdo.generate.JavaGenerator you'll see code like this:
generator.getAdapterFactoryDescriptorRegistry().addDescriptor
(GenModelPackage.eNS_URI, SDOGenModelGeneratorAdapterFactory.
DESCRIPTOR);
and this:
genModel.setRootExtendsInterface("");
genModel.setRootImplementsInterface("commonj.sdo.DataObject");
genModel.setRootExtendsClass(
"org.apache.tuscany.sdo.impl.DataObjectImpl");
genModel.setFeatureMapWrapperInterface("commonj.sdo.Sequence");
genModel.setFeatureMapWrapperInternalInterface(
"org.apache.tuscany.sdo.util.BasicSequence");
genModel.setFeatureMapWrapperClass(
"org.apache.tuscany.sdo.util.BasicSequence");
genModel.setSuppressEMFTypes(true);
genModel.setSuppressEMFMetaData(true);
genModel.setSuppressEMFModelTags(true);
genModel.setCanGenerate(true);
//FIXME workaround java.lang.NoClassDefFoundError:
org/eclipse/jdt/core/jdom/IDOMNode with 02162006 build
genModel.setFacadeHelperClass("Hack");
genModel.setForceOverwrite(true);
... etc ...
I think you should be able set up the EMF generator (GUI) the same way,
but I'd ask on the EMF newsgroup. If you can figure out how to do it and
contribute something back to Tuscany, that would be really great.
Thanks,
Frank
"kelvin goodson" <ke...@gmail.com> wrote on 06/25/2007 08:24:22
AM:
> Hi Tom,
>
> the only generator we have in good shape to generate Tuscany SDO
> classes is the XSD to Java generator. I think it would be a
> significant new feature to properly support what you are trying to do.
> You are correct in your understanding that you must arrange for a
> specialised factory to be in place to create your types, so that they
> are instances of Type rather than of EClass. Tuscany SDO itself has to
> do this in order to ensure that the SDOFactory is used to create SDO
> objects.
>
> Regards, Kelvin.
>
> On 25/06/07, Thomas Kuhn <th...@sphere.ae> wrote:
> > Hi,
> >
> > I'm getting a ClassCastException (see below) when I try to do
> > myDataObj.getChangeSummary().beginLogging();
> >
> > I am use EMF to create the objects. I changed the .genmodel file to
generate
> > SDO objects (I changed the genmodel first to create SDO 1.0 objects.
> > Subsequently, I modified the .genmodel file to generate code that uses
the
> > Tuscany classes). The generated interfaces extend DataObject and their
> > implementations correctly extend DataObjectImpl. I think the problem
lies in
> > the generated Package file, where getMyDataObj() returns an EClass. If
it
> > would be of any help, I can provide the .genmodel file.
> >
> > Is it possible at all to generate SDO from an EMF model?
> >
> > Thanks in advance,
> >
> > Tom
> >
> > java.lang.ClassCastException: org.eclipse.emf.ecore.impl.EClassImpl
> > at
> >
org.apache.tuscany.sdo.impl.DataObjectImpl.getType(DataObjectImpl.java:192)
> > at
> >
org.apache.tuscany.sdo.util.DataObjectUtil.getChangeSummary(DataObjectUtil.j
> > ava:688)
> > at
> >
org.apache.tuscany.sdo.impl.DataObjectImpl.getChangeSummary(DataObjectImpl.j
> > ava:1314)
> > ....
> >
> > Environment: EMF 2.2.0, SDO 2.1.0 incubating beta1
> >
> >
> >
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org