Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] loading old resources after modifying the model
[CDO] loading old resources after modifying the model [message #419913] Thu, 12 June 2008 18:29 Go to next message
Andre Dietisheim is currently offline Andre DietisheimFriend
Messages: 131
Registered: July 2009
Senior Member
Hi Eike!

I pushed my investigations a bit further (looks like I'm still in the
age when you love to play in the sandpit ;-)
I ask myself how the following scenario could be solved:

1. you have an ecore model:
generate all necessar model & edit classes, start the CDO client, create
a resource and save it to the server

2. you change your ecore model (ex. add an attribute to a class in your
model):
generate all necessar model & edit classes, start the CDO client and try
to load the old resource.

In the RDBMS world you'd have to migrate your RDBMS to the new schema.
How could that be solved in CDO (My client expects to be able to change
the models continuously)?

Any ideas?

The current implementation of the CDOEditor throws the following error
(which I would have almost expected):

java.lang.IllegalStateException: range.size() != metaIDRange.size()
at
org.eclipse.emf.internal.cdo.CDOSessionImpl.registerEPackage (CDOSessionImpl.java:449)
at
org.eclipse.emf.internal.cdo.util.CDOPackageRegistryImpl$Rem otePackageDescriptor.getEPackage(CDOPackageRegistryImpl.java :186)
at
org.eclipse.emf.ecore.impl.EPackageRegistryImpl.getEPackage( EPackageRegistryImpl.java:133)
at
org.eclipse.emf.internal.cdo.CDOSessionPackageManagerImpl.re solve(CDOSessionPackageManagerImpl.java:111)
at
org.eclipse.emf.cdo.internal.common.model.CDOPackageImpl.res olve(CDOPackageImpl.java:386)
at
org.eclipse.emf.cdo.internal.common.model.CDOPackageImpl.loo kupClass(CDOPackageImpl.java:275)
at
org.eclipse.emf.cdo.internal.common.model.CDOClassRefImpl.re solve(CDOClassRefImpl.java:75)
at
org.eclipse.emf.cdo.internal.common.revision.CDORevisionImpl . <init>(CDORevisionImpl.java:114)

Cheers
André
Re: [CDO] loading old resources after modifying the model [message #419914 is a reply to message #419913] Thu, 12 June 2008 18:52 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Hi André,

What you seem to be looking for is known to me under the term "model
evolution". CDO does not provide for automatic model evolution. Although
this has been asked several times (and thought about by me, too) I
consider this topic as too complex. I won't have the resources to
develop this feature. If you were willing to work on a respective
contribution I'd appreciate to assist you with know-how ;-)

For the time being model evolution must be done manually like with an
RDBMS. The most important precondition (would be the same with automatic
model evolution) is that the new model version has a different namespace
URI. It's best to add a unique version identifier to each URI. This
enables you to have both model versions in the package registry of the
CDOSession and the server to store both models under their unique URI in
the repository. Then you have two possibilities to migrate existing
instances:

1) Use repository API to migrate the stored CDORevisions.
2) Use normal client side API to open a session, register the new
package version, open a transaction (or several ones), load one resource
after another and migrate their objects, finally commit the transaction.

Personally I'd recommend 2).

Cheers
/Eike




André Dietisheim schrieb:
> Hi Eike!
>
> I pushed my investigations a bit further (looks like I'm still in the
> age when you love to play in the sandpit ;-)
> I ask myself how the following scenario could be solved:
>
> 1. you have an ecore model:
> generate all necessar model & edit classes, start the CDO client,
> create a resource and save it to the server
>
> 2. you change your ecore model (ex. add an attribute to a class in
> your model):
> generate all necessar model & edit classes, start the CDO client and
> try to load the old resource.
>
> In the RDBMS world you'd have to migrate your RDBMS to the new schema.
> How could that be solved in CDO (My client expects to be able to
> change the models continuously)?
>
> Any ideas?
>
> The current implementation of the CDOEditor throws the following error
> (which I would have almost expected):
>
> java.lang.IllegalStateException: range.size() != metaIDRange.size()
> at
> org.eclipse.emf.internal.cdo.CDOSessionImpl.registerEPackage (CDOSessionImpl.java:449)
>
> at
> org.eclipse.emf.internal.cdo.util.CDOPackageRegistryImpl$Rem otePackageDescriptor.getEPackage(CDOPackageRegistryImpl.java :186)
>
> at
> org.eclipse.emf.ecore.impl.EPackageRegistryImpl.getEPackage( EPackageRegistryImpl.java:133)
>
> at
> org.eclipse.emf.internal.cdo.CDOSessionPackageManagerImpl.re solve(CDOSessionPackageManagerImpl.java:111)
>
> at
> org.eclipse.emf.cdo.internal.common.model.CDOPackageImpl.res olve(CDOPackageImpl.java:386)
>
> at
> org.eclipse.emf.cdo.internal.common.model.CDOPackageImpl.loo kupClass(CDOPackageImpl.java:275)
>
> at
> org.eclipse.emf.cdo.internal.common.model.CDOClassRefImpl.re solve(CDOClassRefImpl.java:75)
>
> at
> org.eclipse.emf.cdo.internal.common.revision.CDORevisionImpl . <init>(CDORevisionImpl.java:114)
>
>
> Cheers
> André


Previous Topic:ECore to MOF XMI and back
Next Topic:PropertyColumnLabelProvider and list of referenced objects
Goto Forum:
  


Current Time: Fri Apr 26 21:01:41 GMT 2024

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

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

Back to the top