Hi,
I'am trying to make a plugin that contains an ATL transformation. By now
I am able to get the resulting file but it does not contains intermodel
references. Obviously I tried the option allowInterModelReferences but
I cannot get it working...
First, is the name of the option contained somewhere in a static field?
org.eclipse.m2m.atl.adt.launching.AtlLauncherTools is not in Galileo,
does it?
Second, is it the same option name if I am calling method
(EMF)Resource.save?
Do you need to pass it to the ATL Launcher (also it's not working)?
Do you need to put a Boolean or a string value (neither work)?
Here is what I think is the interesting code. Note that normally I use
the EMF ATL VM hence I always get an EMFModel as a result.
public static Resource toXxResource(final IResource yyModelResource)
throws ATLCoreException, IOException {
// This is the basic call
IModel outputModel = toXxModel(yyModelResource);
// Now try to serialize the result
URI outputURI = URI.createURI(yyModelResource.getLocationURI()
.toString().concat(".xmi"));
final Map<String, Object> options = new HashMap<String, Object>();
options.put("allowInterModelReferences", Boolean.TRUE);
options.put("AllowInterModelReferences", Boolean.TRUE);
if (outputModel instanceof EMFModel) {
EMFModel emfModel = (EMFModel) outputModel;
Resource res = emfModel.getResource();
assert res != null;
ResourceSet set = res.getResourceSet();
assert set != null
OutputStream outputStream = set.getURIConverter()
.createOutputStream(outputURI);
res.save(outputStream, options);
res.setURI(outputURI);
assert res.getURI().equals(outputURI);
return res;
} else {
IExtractor extractor = CoreService.getExtractor("EMF");
extractor.extract(outputModel, outputURI.toString(), options);
return null;
}
}