Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] What can I do with DynamicCDOObjectImpl ?
[CDO] What can I do with DynamicCDOObjectImpl ? [message #646536] Mon, 27 December 2010 15:32 Go to next message
Stephane Rousseau is currently offline Stephane RousseauFriend
Messages: 34
Registered: September 2010
Member
Hello,

I'm not familiar with CDO and I've problems using it.

I'm using it to load xmi files. At this time, in content of my Resource,
I've an DynamicCDOObjectImpl object. My question is how to retrieve the
corresponding object from my metamodel ?

Suppose that SROProject is a class from my Ecore metamodel, the cast in
following code doesn't work :

Resource target2 = transaction.getResource(getURI().devicePath());
EList<EObject> targetContents2 = target2.getContents();
SROProject rootProject = (SROProject) targetContents2.get(0);


If anyone knows something about my problem, it will be another Christmas
for me !!

Regards

Stephane Rousseau
Re: [CDO] What can I do with DynamicCDOObjectImpl ? [message #646537 is a reply to message #646536] Mon, 27 December 2010 18:41 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33143
Registered: July 2009
Senior Member
Stephane,

If you're seeing DynamicCDOObjectImpl then your generated model isn't
properly registered with CDO and it's just using a dynamic version of
your model instead. I.e., inspect what targetContents2.get(0).eClass()
returns. Likely a dynamic version your XyzPackage.Literals.SRO_PROJECT
EClass.


Stephane Rousseau wrote:
> Hello,
>
> I'm not familiar with CDO and I've problems using it.
>
> I'm using it to load xmi files. At this time, in content of my
> Resource, I've an DynamicCDOObjectImpl object. My question is how to
> retrieve the corresponding object from my metamodel ?
>
> Suppose that SROProject is a class from my Ecore metamodel, the cast
> in following code doesn't work :
>
> Resource target2 = transaction.getResource(getURI().devicePath());
> EList<EObject> targetContents2 = target2.getContents();
> SROProject rootProject = (SROProject) targetContents2.get(0);
>
>
> If anyone knows something about my problem, it will be another
> Christmas for me !!
>
> Regards
>
> Stephane Rousseau


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [CDO] What can I do with DynamicCDOObjectImpl ? [message #646538 is a reply to message #646536] Mon, 27 December 2010 20:53 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 27.12.2010 16:32, schrieb Stephane Rousseau:
> Hello,
>
> I'm not familiar with CDO and I've problems using it.
>
> I'm using it to load xmi files.
Can you give a more complete code snippet of what you're doing?

> At this time, in content of my Resource, I've an DynamicCDOObjectImpl object.
Seems that you've registered a dynamic EPackage with the global EMF package registry or the CDOSession's package registry. Are you sure that your generated version of the model is properly registered? And not removed by subsequent manual registration of a dynamic version?

> My question is how to retrieve the corresponding object from my metamodel ?
>
> Suppose that SROProject is a class from my Ecore metamodel, the cast in following code doesn't work :
>
> Resource target2 = transaction.getResource(getURI().devicePath());
Please try the following and tell us the output of:

System.out.println(transaction.getSession().getPackageRegist ry().getPackageInfo( "http://.../sro").getPackageUnit());

> EList<EObject> targetContents2 = target2.getContents();
> SROProject rootProject = (SROProject) targetContents2.get(0);
>
>
> If anyone knows something about my problem, it will be another Christmas for me !!
I'm sure we'll sort it out ;-)

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Re: [CDO] What can I do with DynamicCDOObjectImpl ? [message #646540 is a reply to message #646537] Tue, 28 December 2010 06:37 Go to previous messageGo to next message
Stephane Rousseau is currently offline Stephane RousseauFriend
Messages: 34
Registered: September 2010
Member
Hello,


Here is the return : org.eclipse.emf.ecore.impl.EClassImpl@c3af8c (name:
SROProject).

So, I will search around registration.

Regards

Stephane

On 27/12/2010 19:41, Ed Merks wrote:
> Stephane,
>
> If you're seeing DynamicCDOObjectImpl then your generated model isn't
> properly registered with CDO and it's just using a dynamic version of
> your model instead. I.e., inspect what targetContents2.get(0).eClass()
> returns. Likely a dynamic version your XyzPackage.Literals.SRO_PROJECT
> EClass.
>
>
> Stephane Rousseau wrote:
>> Hello,
>>
>> I'm not familiar with CDO and I've problems using it.
>>
>> I'm using it to load xmi files. At this time, in content of my
>> Resource, I've an DynamicCDOObjectImpl object. My question is how to
>> retrieve the corresponding object from my metamodel ?
>>
>> Suppose that SROProject is a class from my Ecore metamodel, the cast
>> in following code doesn't work :
>>
>> Resource target2 = transaction.getResource(getURI().devicePath());
>> EList<EObject> targetContents2 = target2.getContents();
>> SROProject rootProject = (SROProject) targetContents2.get(0);
>>
>>
>> If anyone knows something about my problem, it will be another
>> Christmas for me !!
>>
>> Regards
>>
>> Stephane Rousseau
Re: [CDO] What can I do with DynamicCDOObjectImpl ? [message #646542 is a reply to message #646538] Tue, 28 December 2010 07:55 Go to previous messageGo to next message
Stephane Rousseau is currently offline Stephane RousseauFriend
Messages: 34
Registered: September 2010
Member
Hello,

My answers are below.

Regards,

Stephane

On 27/12/2010 21:53, Eike Stepper wrote:
> Am 27.12.2010 16:32, schrieb Stephane Rousseau:
>> Hello,
>>
>> I'm not familiar with CDO and I've problems using it.
>>
>> I'm using it to load xmi files.
> Can you give a more complete code snippet of what you're doing?
>
I have to anonymize the file before.
The goal of my job is to be able to load huge xmi files (many hundreds
of bytes).
To do so, I've tuned (subclassed) the XMIHelperImpl and SAXXMIHandler
classes to read the objects, then, in a second step, make references
between objects.

I've done this with a small file, with the problem described here.

For huge file, I will add commits after reading N objects and M
references. Doing this, I need to retrieve objects from the store.


>> At this time, in content of my Resource, I've an DynamicCDOObjectImpl
>> object.
> Seems that you've registered a dynamic EPackage with the global EMF
> package registry or the CDOSession's package registry. Are you sure that
> your generated version of the model is properly registered? And not
> removed by subsequent manual registration of a dynamic version?
>
>> My question is how to retrieve the corresponding object from my
>> metamodel ?
>>
>> Suppose that SROProject is a class from my Ecore metamodel, the cast
>> in following code doesn't work :
>>
>> Resource target2 = transaction.getResource(getURI().devicePath());
> Please try the following and tell us the output of:
>
> System.out.println(transaction.getSession().getPackageRegist ry().getPackageInfo( "http://.../sro").getPackageUnit());
>
I think the problem here around here because

getEFactory().getSROPackage(); return null

and

transaction.getSession().getPackageRegistry() shows me that packageInfo

is null also.

So i think I've forgotten one step invoking my EFactory and/or my EPackage

>
>> EList<EObject> targetContents2 = target2.getContents();
>> SROProject rootProject = (SROProject) targetContents2.get(0);
>>
>>
>> If anyone knows something about my problem, it will be another
>> Christmas for me !!
> I'm sure we'll sort it out ;-)
>
> Cheers
> /Eike
>
> ----
> http://www.esc-net.de
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>
Re: [CDO] What can I do with DynamicCDOObjectImpl ? [message #646545 is a reply to message #646542] Tue, 28 December 2010 14:34 Go to previous message
Stephane Rousseau is currently offline Stephane RousseauFriend
Messages: 34
Registered: September 2010
Member
Hello,

Some good news for me. The job is not over but this part works !!

The xmi file I was provided was referencing the ecore and not the uri.
So, I changed this part.

I also had a bug in my code passing the source resource contents to the
target resource contents.

Thanks a lot to have helped me to think about my code.

Regards

Stephane

On 28/12/2010 08:55, Stephane Rousseau wrote:
> Hello,
>
> My answers are below.
>
> Regards,
>
> Stephane
>
> On 27/12/2010 21:53, Eike Stepper wrote:
>> Am 27.12.2010 16:32, schrieb Stephane Rousseau:
>>> Hello,
>>>
>>> I'm not familiar with CDO and I've problems using it.
>>>
>>> I'm using it to load xmi files.
>> Can you give a more complete code snippet of what you're doing?
>>
> I have to anonymize the file before.
> The goal of my job is to be able to load huge xmi files (many hundreds
> of bytes).
> To do so, I've tuned (subclassed) the XMIHelperImpl and SAXXMIHandler
> classes to read the objects, then, in a second step, make references
> between objects.
>
> I've done this with a small file, with the problem described here.
>
> For huge file, I will add commits after reading N objects and M
> references. Doing this, I need to retrieve objects from the store.
>
>
>>> At this time, in content of my Resource, I've an DynamicCDOObjectImpl
>>> object.
>> Seems that you've registered a dynamic EPackage with the global EMF
>> package registry or the CDOSession's package registry. Are you sure that
>> your generated version of the model is properly registered? And not
>> removed by subsequent manual registration of a dynamic version?
>>
>>> My question is how to retrieve the corresponding object from my
>>> metamodel ?
>>>
>>> Suppose that SROProject is a class from my Ecore metamodel, the cast
>>> in following code doesn't work :
>>>
>>> Resource target2 = transaction.getResource(getURI().devicePath());
>> Please try the following and tell us the output of:
>>
>> System.out.println(transaction.getSession().getPackageRegist ry().getPackageInfo( "http://.../sro").getPackageUnit());
>>
>>
> I think the problem here around here because
>
> getEFactory().getSROPackage(); return null
>
> and
>
> transaction.getSession().getPackageRegistry() shows me that packageInfo
>
> is null also.
>
> So i think I've forgotten one step invoking my EFactory and/or my EPackage
>
>>
>>> EList<EObject> targetContents2 = target2.getContents();
>>> SROProject rootProject = (SROProject) targetContents2.get(0);
>>>
>>>
>>> If anyone knows something about my problem, it will be another
>>> Christmas for me !!
>> I'm sure we'll sort it out ;-)
>>
>> Cheers
>> /Eike
>>
>> ----
>> http://www.esc-net.de
>> http://thegordian.blogspot.com
>> http://twitter.com/eikestepper
>>
>>
>
Previous Topic:[CDO] Role of a resource
Next Topic:[CDO + Teneo] Use CDO with Teneo 1.1.2 or 1.2.0 ?
Goto Forum:
  


Current Time: Thu May 02 22:01:16 GMT 2024

Powered by FUDForum. Page generated in 0.03956 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top