Home » Modeling » Epsilon » [Flock] error while executing migration strategy distributed via plugin
| | |
Re: [Flock] error while executing migration strategy distributed via plugin [message #675100 is a reply to message #674386] |
Mon, 30 May 2011 10:03 |
Hristina Moneva Messages: 31 Registered: October 2009 |
Member |
|
|
Dear Louis,
Thanks for your reply and suggestion to send an example to your mail, but...
As I already mentioned in my previous mail, I cannot reproduce the same error in other simple example. I also made the simple example using two ecores, where one extends the other and it works fine.
Any ideas?
Greetings,
Hristina
PS: I cannot send you my primary metamodels, because they are confidential. And by the way, last week I already send another question with an example to your e-mail and I am still waiting for a reply. The question there was about how to create new element and set its attributes within migration strategy... In my case, the element gets created, but the attributes are empty!
[Updated on: Mon, 30 May 2011 15:07] Report message to a moderator
|
|
| | |
Re: [Flock] error while executing migration strategy distributed via plugin [message #675465 is a reply to message #675100] |
Tue, 31 May 2011 15:50 |
Louis Rose Messages: 440 Registered: July 2009 Location: York, United Kingdom |
Senior Member |
|
|
Xmoneva.gmail.com wrote on Mon, 30 May 2011 06:03And by the way, last week I already send another question with an example to your e-mail and I am still waiting for a reply. The question there was about how to create new element and set its attributes within migration strategy... In my case, the element gets created, but the attributes are empty!
I'm sorry about this. We don't check the epsilon.devs account unless we are expecting to receive a file from someone. We prefer to use the forum to discuss problems, as this provides a public record of any problems, which other users can search in the future.
To answer the question you sent by email, (in general) the values of new properties are set via the migrated variable in the body of a migrate rule. So for a metamodel that evolves from:
class Block {
attr String name;
val Property[*] hasProperty
}
to
class Block {
attr String name;
attr int multiplicity = 1;
val Property[*] hasProperty
}
The following Flock migration strategy can be used to set the value of the multiplicity attribute to the number of properties contained in each original Block:
migrate Block {
migrated.multiplicity = original.hasProperty.size();
}
A chapter on Flock for the Epsilon Book is high on my priority list, and should be completed within the next month. In the body of each migrate rule, any valid EOL statements can be used.
This paper at ICMT 2010 might also be helpful: http://dx.doi.org/10.1007/978-3-642-13688-7_13
I hope that helps!
Cheers,
Louis.
|
|
|
Re: [Flock] error while executing migration strategy distributed via plugin [message #684916 is a reply to message #675465] |
Thu, 16 June 2011 13:22 |
Hristina Moneva Messages: 31 Registered: October 2009 |
Member |
|
|
Dear Louis,
Thanks for the answer! But... I still cannot manage. The example you gave in your reply was exactly the opposite of what I need - just switching the from and to metamodels. It should be:
FROM:
class Block {
attr String name;
attr int multiplicity = 1;
val Property[*] hasProperty
}
TO:
class Block {
attr String name;
val Property[*] hasProperty
}
The goal of the migration is to create new property with name "multiplicity" and value as it was in the original model.
The MIGRATION STRATEGY I use is as follows:
migrate Block {
for (multi in original.multiplicity) {
var par = new Property();
par.key = "multiplicity";
par.value = multi.toString();
par.println();
migrated.hasProperty.add(par);
}
}
The result is that a new Property element is created ("par.print()" supports my statement that the attributes are created correctly), but no attributes are set (based on the resulting migrated model).
What is the correct way of setting the attributes?!
Thanks in advance,
Hristina
[Updated on: Thu, 16 June 2011 14:46] Report message to a moderator
|
|
|
Re: [Flock] error while executing migration strategy distributed via plugin [message #684935 is a reply to message #675463] |
Thu, 16 June 2011 13:49 |
Hristina Moneva Messages: 31 Registered: October 2009 |
Member |
|
|
Dear Louis,
And now about the bundle.getResource(...) problem.
The current situation is as follows: I have two examples - small and big. In the small everything works fine - with "Epsilon Flock Migration Strategy" Run Configuration and via Flock extension point. In the big example - the "Epsilon Flock Migration Strategy" Run Configuration works fine, but the Flock extension point ends with the bundle.getResource(...) error.
The plugin.xml files...
SMALL EXAMPLE:
<plugin>
<extension point="org.eclipse.emf.ecore.generated_package">
<package
uri="http://www.whatever.nl/MyA.ecore"
class="MyA.MyAPackage"/>
</extension>
<extension
point="org.eclipse.epsilon.flock.dt.strategy">
<migrationStrategy
migratedMetamodelFile="model-migration/new/My.ecore"
modelExtensions="my"
originalMetamodelFile="model-migration/old/My.ecore"
strategyFile="model-migration/old2new-abstr.mig">
</migrationStrategy>
</extension>
</plugin>
BIG NOT_WORKING EXAMPLE:
<plugin>
<extension point="org.eclipse.emf.ecore.generated_package">
<package
uri="http://www.esi.nl/2.0.0/design.ecore"
class="nl.esi.design.DesignPackage"/>
</extension>
<extension
point="org.eclipse.epsilon.flock.dt.strategy">
<migrationStrategy
migratedMetamodelFile="model-migration/m110v200/design.ecore"
modelExtensions="design"
originalMetamodelFile="model-migration/m100v100/design.ecore"
strategyFile="model-migration/M100toM110.mig">
</migrationStrategy>
</extension>
</plugin>
The build.properties files...
SMALL EXAMPLE:
bin.includes = .,\
model-migration/,\
META-INF/,\
plugin.xml,\
plugin.properties
jars.compile.order = .
source.. = src/
output.. = bin/
BIG NOT_WORKING EXAMPLE:
bin.includes = nl.esi.design.model.jar,\
META-INF/,\
plugin.xml,\
plugin.properties,\
model-migration/
jars.compile.order = nl.esi.design.model.jar
source.nl.esi.design.model.jar = src/
output.nl.esi.design.model.jar = bin/
The migration strategy files...
SMALL EXAMPLE:
migrate Block {
for (multi in original.multiplicity) {
var par = new Property();
par.key = "multiplicity";
par.value = multi.toString();
migrated.hasProperty.add(par);
}
}
BIG NOT_WORKING EXAMPLE:
migrate SystemBlock {
for (multi in original.multiplicity) {
var par = new Parameter();
par.key = "multiplicity";
par.value = multi.toString();
migrated.hasParameter.add(par);
}
}
I am going to prepare an archive of the small example and send to you and hope to hear on both topics from you!
Greetings,
Hristina
[Updated on: Thu, 16 June 2011 14:44] Report message to a moderator
|
|
|
Re: [Flock] error while executing migration strategy distributed via plugin [message #686101 is a reply to message #684916] |
Tue, 21 June 2011 17:52 |
Louis Rose Messages: 440 Registered: July 2009 Location: York, United Kingdom |
Senior Member |
|
|
Hristina Moneva wrote on Thu, 16 June 2011 09:22Dear Louis,
Thanks for the answer! But... I still cannot manage. The example you gave in your reply was exactly the opposite of what I need - just switching the from and to metamodels. It should be:
FROM:
class Block {
attr String name;
attr int multiplicity = 1;
val Property[*] hasProperty
}
TO:
class Block {
attr String name;
val Property[*] hasProperty
}
The goal of the migration is to create new property with name "multiplicity" and value as it was in the original model.
The MIGRATION STRATEGY I use is as follows:
migrate Block {
for (multi in original.multiplicity) {
var par = new Property();
par.key = "multiplicity";
par.value = multi.toString();
par.println();
migrated.hasProperty.add(par);
}
}
The result is that a new Property element is created ("par.print()" supports my statement that the attributes are created correctly), but no attributes are set (based on the resulting migrated model).
What is the correct way of setting the attributes?!
Hi Hristina,
Thanks for the very clear descriptions of what you'd like to achieve.
The problem is that the type Property is ambiguous: this could refer to the Property in the original model or in the migrated model. We need to be more specific, and indicate that we wish to refer to Property in the metamodel of the migrated model:
Admittedly, EOL and hence Flock should probably issue a warning here, as the ambiguity can cause much confusion (as in this case). I'll open a bug to fix this.
Finally, it's worth noting that the for loop is not necessary here: original.multiplicity is always an integer, and iterating over an integer is the same as executing the loop once. So, the final code looks like this:
migrate Block {
var par = new Migrated!Property();
par.key = "multiplicity";
par.value = original.multiplicity.toString();
par.println();
migrated.hasProperty.add(par);
}
I'll take a look at the extension point problem now too.
Cheers,
Louis.
|
|
| | | |
Re: [Flock] error while executing migration strategy distributed via plugin [message #691453 is a reply to message #686112] |
Fri, 01 July 2011 13:43 |
Hristina Moneva Messages: 31 Registered: October 2009 |
Member |
|
|
Hi Louis,
About the extension strategy...
Quote:If so, are you certain that the path to the Flock migration strategy file in the plugin.xml below is correct?
Yes, I am, because I use the Browse button to select the file (not just manually typing it in the plugin.xml), as you can see in the screenshot (the attached file).
Quote:Maybe it should be "model-migration/M100toM200.mig"?
No, because such file does not exist. The previous argument holds here as well...
In the screenshot you can see the file hierarchy I use (in the Package Explorer), as well as the selection of the only strategy I have...
About the fact that the simple example I sent you works at your computer - it is the same here. The problem is that identical, but more complex case - does not!
I have no idea how to solve it... I will try with a clean Eclipse installation and importing there anew all the projects. I have no other idea for now... If nothing helps, I have still two options: to use other migration technology or sending you my complete project set (which I hesitate). I will inform you if I have some progress. I would appreciate if you have any other ideas...
Greetings,
Hristina
PS: in the screenshot you can also see the error message for the migration strategy itself on "Migrated!Parameter" (in the simple example should be "Migrated!Property")
|
|
| |
Re: [Flock] error while executing migration strategy distributed via plugin [message #697649 is a reply to message #696685] |
Sun, 17 July 2011 15:39 |
Louis Rose Messages: 440 Registered: July 2009 Location: York, United Kingdom |
Senior Member |
|
|
Hristina,
Firstly, I'm sorry for the late reply. I've been travelling, and generally very busy for the past couple of weeks.
So it seems that two problems remain. With respect to the "Type Migrated!Property not found" error, could this be because of the way that the migration strategy is being launched? If it's being launched from an Eclipse launch configuration, the "Migrated" part of the name should match exactly the name of the model that has been selected in the launch configuration. For example, in the attached screenshot, I've selected "B" as the migrated model and hence the type would be "B!Property" (and not "Migrated!Property").
For the second problem (the NullPointerException), I'm afraid that I'm out of ideas. It would really help if you could send me a copy of the project that is causing the problem. I'd be happy to sign a non-disclosure or confidentiality agreement if that would be helpful.
Cheers,
Louis.
|
|
| |
Re: [Flock] error while executing migration strategy distributed via plugin [message #714708 is a reply to message #709742] |
Thu, 11 August 2011 10:25 |
Louis Rose Messages: 440 Registered: July 2009 Location: York, United Kingdom |
Senior Member |
|
|
Hristina,
Sorry for the late reply: I've been on vacation for the past 10 days. However, I think that I've finally got to the bottom of this problem...
It seems that the method (Bundle#getResource()) that I use to locate the Flock migration strategy from a user's extensions does not work when the user's plugin builds a JAR file that has a name other than the Eclipse default (which is "."). I've changed Flock to use a different method (Bundle#getEntry()), which seems more tolerant: it can load resources from a bundle that does not have the default name. I've committed this change, and the fix will be available in the next interim release of Epsilon.
As a workaround for now, you can restore the default JAR file name for the plugin that defines your Flock extension:
1) Open "your.plugin/plugin.xml" and select the Build tab.
a) Under the runtime information group (at the top), right-click "your.plugin.jar".
b) Select Rename.
c) Enter a single full stop character as the name. In other words, the name should be: .
2) Now open the MANIFEST.MF tab of the same file ("your.plugin/plugin.xml").
a) Find the line that reads: Bundle-ClassPath: nl.esi.design.model.jar
b) Replace it with a line that reads: Bundle-ClassPath: .
3) Save the changes to the "your.plugin/plugin.xml" file.
4) Relaunch Eclipse.
The above should prevent the NullPointerException for now. When the next interim version of Epsilon is released, you can go back to the previous settings that cause your plugin to build a JAR named "your.plugin.jar"
Finally, you'll need to use Original and Migrated as the model names when launching a Flock migration strategy via the extension point. Specifically, you'll need to change "xxx!Parameter" to "Migrated!Parameter" on line 2 of the migration strategy that you emailed to us.
I hope this helps to finally solve this very mysterious problem! Thanks a lot for all of your patience. I'm sorry that it's taken so long to get to diagnose. As you can see, the issue seems to occur in very specific circumstances that I was previously unable to recreate.
Cheers,
Louis.
|
|
| | | | |
Goto Forum:
Current Time: Thu Sep 26 12:08:14 GMT 2024
Powered by FUDForum. Page generated in 0.06394 seconds
|