Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Edapt] A question about custom migration
[Edapt] A question about custom migration [message #1460547] Mon, 03 November 2014 17:32 Go to next message
Olivier Prouvost is currently offline Olivier ProuvostFriend
Messages: 15
Registered: August 2011
Location: TOULOUSE
Junior Member


Hi,

As far as I have understood the method :

public void migrateBefore(Model model, Metamodel metamodel) throws MigrationException {
// Put your code here before migration
}


It should receive the metamodel before modification has been applied. Right ?

What could be the reason why I currently receive the expected metamodel and not the initial ? Is it a problem of URI in historic ? Should the 'Custom Migration' be at the beginning of the release ?

I have also a model which refer to the new meta model too... While no migration has been done... Strange behavior....

Re: [Edapt] A question about custom migration [message #1460552 is a reply to message #1460547] Mon, 03 November 2014 17:36 Go to previous messageGo to next message
Olivier Prouvost is currently offline Olivier ProuvostFriend
Messages: 15
Registered: August 2011
Location: TOULOUSE
Junior Member

I think I found the answer..! Custom Migration must stand at the beginning of a release ! If you put it at the end, the metamodel contains already all the changes !

May be a message should be displayed to inform the developper that it could fail... ? Is it really a good feature ?

[Updated on: Mon, 03 November 2014 17:37]

Report message to a moderator

Re: [Edapt] A question about custom migration [message #1461129 is a reply to message #1460552] Tue, 04 November 2014 08:28 Go to previous messageGo to next message
Olivier Prouvost is currently offline Olivier ProuvostFriend
Messages: 15
Registered: August 2011
Location: TOULOUSE
Junior Member


It seems to be a problem with the CustomMigration. Javadoc says that CustomeMigration::migrateBefore is called before metamodel is changed, and migrateAfter after metamodel is changed.

BUT If we put a CustomMigration at the beginning of a release, the metamodel is not changed in the both Methods ! For the method migrateBefore this is ok, but not for migrateAfter !

If we put it a the end of the release, the metamodel received in both method is the metamodel changed !

Is there a specific usage I missed ? I work with the latest release (1.0.0.201410271332).

Re: [Edapt] A question about custom migration [message #1463426 is a reply to message #1461129] Thu, 06 November 2014 14:51 Go to previous messageGo to next message
Maximilian Koegel is currently offline Maximilian KoegelFriend
Messages: 253
Registered: July 2009
Senior Member
Hi,

before and after in this case refers to before and after the change
operation the custom migration is attached to, NOT the full migration of
the release. This seems to be ambiguous in the JavaDoc, could you please
open a Bugzilla if you think so. Thanks!

Cheers,
Maximilian

Am 04.11.2014 09:28, schrieb Olivier Prouvost:
>
> It seems to be a problem with the CustomMigration. Javadoc says that
> CustomeMigration::migrateBefore is called before metamodel is changed,
> and migrateAfter after metamodel is changed.
> BUT If we put a CustomMigration at the beginning of a release, the
> metamodel is not changed in the both Methods ! For the method
> migrateBefore this is ok, but not for migrateAfter !
> If we put it a the end of the release, the metamodel received in both
> method is the metamodel changed !
> Is there a specific usage I missed ? I work with the latest release
> (1.0.0.201410271332).
>
>


--
Maximilian Kögel

Get Professional Eclipse Support: http://eclipsesource.com/munich
Re: [Edapt] A question about custom migration [message #1463750 is a reply to message #1463426] Thu, 06 November 2014 22:19 Go to previous messageGo to next message
Olivier Prouvost is currently offline Olivier ProuvostFriend
Messages: 15
Registered: August 2011
Location: TOULOUSE
Junior Member

Ok.

So in my attached sample (customeMigration.png), my Custom Migration will always receive the same metamodel in the before and after method, because it stands at the end of my release ?

It would mean that if we want to store the data in the model before migration, we must have a custom migration at the beginning of the release to remember of the values, and another customMigration at the end of the release to transfer the information ?

Right ?
Re: [Edapt] A question about custom migration [message #1467828 is a reply to message #1463750] Mon, 10 November 2014 10:44 Go to previous message
Maximilian Koegel is currently offline Maximilian KoegelFriend
Messages: 253
Registered: July 2009
Senior Member
Hi,

no, you need to attach a custom migration to the operations that destroy
information and read in the data before and write out the data after the
migration in the implementation of these custom migrations. In your case
probably the two deletes.

Best regards,
Maximilian

Am 06.11.2014 23:19, schrieb Olivier Prouvost:
> Ok.
>
> So in my attached sample (customeMigration.png), my Custom Migration will always receive the same metamodel in the before and after method, because it stands at the end of my release ?
>
> It would mean that if we want to store the data in the model before migration, we must have a custom migration at the beginning of the release to remember of the values, and another customMigration at the end of the release to transfer the information ?
>
> Right ?
>


--
Maximilian Kögel

Get Professional Eclipse Support: http://eclipsesource.com/munich
Previous Topic:[EMF Store] EMF Model and discrepancy tolerance
Next Topic:How to increase margins in EMFForms-generated forms?
Goto Forum:
  


Current Time: Mon Mar 30 14:17:54 GMT 2020

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

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

Back to the top