Home » Modeling » Epsilon » Class Cast Exception
|
Re: Class Cast Exception [message #1787348 is a reply to message #1787347] |
Wed, 23 May 2018 23:15 |
|
Hi Omar,
I suspect that this is due to UML2 loading the profile twice (once for the source model and once for the target model) which results in two different in-memory instances of the same EClass. Is your profile located in the same workspace as your models? If so, off the top of my head, you may need to put your profile in a workspace, "register" it through an extension [1], and then put your models and transformation in a nested/runtime workspace. Does this help?
Cheers,
Dimitris
[1] https://www.eclipse.org/forums/index.php/t/604098/
|
|
| | | | | |
Re: Class Cast Exception [message #1787571 is a reply to message #1787493] |
Tue, 29 May 2018 09:24 |
|
Hi Omar,
Yes - you're right about the target model. You'd need to create your target plain-vanilla UML model, apply the profile to it and then populate it using the transformation. I don't remember if/how you can get hold of a plugin-contributed profile from Epsilon off the top of my head but I'll have a look and will get back to you.
Cheers,
Dimitris
|
|
| | |
Re: Class Cast Exception [message #1790010 is a reply to message #1789875] |
Sat, 02 June 2018 23:09 |
omar hassane Messages: 12 Registered: February 2018 |
Junior Member |
|
|
Hi Dimitris, It seems that the only solution for this problem is to launch the transformation as a java standalone application. In this case, the profiles will be loaded once even without registering the profiles through an extension. But still I couldn't get any result from launching the ETL transformation as it is.
Here's the java code if that might be interesting for someone else :
EtlModule module = new EtlModule();
module.parse(new File("path/to/.etl"));
URI inputUri = URI.create(new File("path to input UML Model").toURI().toString());
URI OutputUri= URI.create(new File("Path to the Output Uri").toURI().toString());
createUmlModel(module,"Input",inputUri , true, false);
createUmlModel(module,"Output",OutputUri, false, true);
module.execute();
module.getContext().getModelRepository().dispose();
}
private static UmlModel createUmlModel(EtlModule module,String name, URI model, boolean readOnLoad, boolean storeOnDisposal) throws EolModelLoadingException {
UmlModel umlModel = new UmlModel();
StringProperties properties = new StringProperties();
properties.put(EmfModel.PROPERTY_NAME, name);
properties.put(EmfModel.PROPERTY_FILE_BASED_METAMODEL_URI , new File("Path to the profile").toURI().toString());
if (model != null) properties.put(EmfModel.PROPERTY_MODEL_URI, model.toString());
properties.put(EmfModel.PROPERTY_READONLOAD, readOnLoad + "");
properties.put(EmfModel.PROPERTY_STOREONDISPOSAL, storeOnDisposal + "");
umlModel.load(properties, (IRelativePathResolver) null);
module.getContext().getModelRepository().addModel(umlModel);
return umlModel;
}
Thank you,
Omar
|
|
| |
Goto Forum:
Current Time: Thu Sep 26 08:00:12 GMT 2024
Powered by FUDForum. Page generated in 0.05744 seconds
|