Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Model-to-Model Transformation » [ATL] XSD to ECORE ATL transformation
[ATL] XSD to ECORE ATL transformation [message #985913] Fri, 16 November 2012 16:34
Mehdi Missing name is currently offline Mehdi Missing nameFriend
Messages: 22
Registered: December 2010
Junior Member
Hi,

I have an ATL transformation that works just fine under the ATL run configuration with these informations:

As input Metamodel i have a XSD file
As output Metamodel a Ecore Metamodel

The problem is when i try to launch the ATL transformation programmatically within a Java application it does not work.

here is the java code i use:

/****************************
try {
CoreService.registerLauncher("EMF-specific VM", EMFVMLauncher.class);
CoreService.registerFactory("EMF", EMFModelFactory.class);
CoreService.registerExtractor("EMF", EMFExtractor.class);
CoreService.registerInjector("EMF", EMFInjector.class);

injector = CoreService.getInjector("EMF");
extractor = CoreService.getExtractor("EMF");
} catch (ATLCoreException e) {
e.printStackTrace();
}


ModelFactory factory = CoreService.getModelFactory("EMF");


sourceMetamodel = factory.newReferenceModel();
targetMetamodel = factory.newReferenceModel();
injector.inject(sourceMetamodel, sourceFilepath);
injector.inject(targetMetamodel, targetFilepath);


ILauncher launcher = null;
launcher = (EMFVMLauncher)CoreService.getLauncher("EMF-specific VM");
launcher.initialize(Collections.<String, Object> emptyMap());


IModel sourceModel = factory.newModel(sourceMetamodel);
IModel targetModel = factory.newModel(targetMetamodel);


injector.inject(sourceModel, dataSourceFilepath);


launcher.addInModel(sourceModel, LauncherATLIn, LauncherInMMName);
launcher.addOutModel(targetModel, LauncherATLOut, LauncherOutMMName);

URL asmFile = new File(transformationFilepath).toURI().toURL();
Object loadedModule = launcher.loadModule(asmFile.openStream());

launcher.launch(ILauncher.RUN_MODE, new NullProgressMonitor(), Collections.<String, Object> emptyMap(), loadedModule);

extractor.extract(targetModel, dataTargetfilepath);

}

/****************************

It works just fine when i have only Ecores as Metamodels (input and output), but it does not work when i use an XSD as input. I know i should change something to specify that i am using an XSD and not an ECORE but i do not know what to change ? (I suppose that i should change the registerLauncher or/and the model factory parameter from EMF to something but what ?)

Any ideas ?

Thank you in advance.
Previous Topic:creating psm
Next Topic:Behavioral features ( state machine) support
Goto Forum:
  


Current Time: Wed Apr 24 21:03:54 GMT 2024

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

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

Back to the top