|
Re: Non-EMF model as source for model-to-model transformation? [message #1705159 is a reply to message #1705154] |
Wed, 12 August 2015 13:43 |
|
You can use ETL (or any Epsilon tool) with non-EMF models. Epsilon uses a compatibility layer (the Epsilon Model Connectivity layer, IIRC) for supporting various modeling technologies, including EMF. Beyond EMF, other EMC drivers include pure XML files, spreadsheets, CSV files, GraphML diagrams, BibTeX files and so on.
For your particular case, I'd say there would be two options:
- If you want to run ETL with a JSON input from the "Run Configurations..." dialog, you'll need to write your own JSON EMC driver. It's not too complicated, though. You can have a look at the source code for our org.eclipse.epsilon.emc.csv or org.eclipse.epsilon.emc.bibtex plugins.
- If you're OK with running ETL from Java code, you can parse your JSON normally and then add the JSON objects and their classes to the model repository of the ETL module with the JavaModel EMC driver included in the org.eclipse.epsilon.eol.engine plugin. JavaModel is designed to work with collections of POJOs, I think.
For the second case, the code would look something like this:
List<Object> jsonObjects;
List<Class<?>> jsonClasses;
// ... populate jsonObjects with your own JSON parser, and list all the different possible classes in jsonClasses ...
EtlModule etlModule = new EtlModule();
etlModule.getContext().getModelRepository().addModel(new JavaModel("ModelName", jsonObjects, jsonClasses)));
// ... populate the rest of the model repository with the target models ...
etlModule.parse("path/to/your/etl");
etlModule.execute();
(Edit for rewording.)
[Updated on: Wed, 12 August 2015 13:52] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.03137 seconds