[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.m2m] [ATL] launching a transformation programmatically using the UML2.1 metamodel

Hello,

I'd like to launch an ATL transformation from some Java code. The 
transformation is KDM to UML 2.1. I've already written such a transformation 
for the J2SE to KDM case which works fine.

I did test the transformation using the UML21.ecore file and the EMF 
registry from within the Eclipse plugin. Both case worked fine.

However when calling the transformation from some piece of Java code, 
nothing simply comes out. Here is what the code looks like:

final AtlEMFModelHandler modelHandler = 
(AtlEMFModelHandler)AtlModelHandler.getDefault(AtlModelHandler.AMH_EMF );

ASMModel mofMM = modelHandler.getMof();

//Get MModels

try{

    kdmMM = modelHandler.loadModel( "kdm", mofMM, kdmMMurl.openStream());

    umlMM = modelHandler.loadModel("uml2" , mofMM, umlMMurl.openStream());

}catch (IOException e){

    e.printStackTrace();

}

//Get the kdm Model

kdmModel = modelHandler.loadModel("kdm", kdmMM , kdmModelurl.openStream());

//transform

final AtlLauncher launcher = AtlLauncher.getDefault();

final Map<String, ASMModel> models = new HashMap<String, ASMModel>();

final Map<?, ?> asmParams = Collections.EMPTY_MAP;

final List<?> superimpose = Collections.EMPTY_LIST;

final Map<?, ?> options = Collections.EMPTY_MAP;

final Map<?, ?> libs = Collections.EMPTY_MAP;

ASMModel outputInstance = modelHandler.newModel("OUT", null, umlMM);

models.put( "kdm", kdmMM );

models.put( "uml2", umlMM);

models.put( "IN", kdmModel );

models.put( "OUT", outputInstance);


launcher.launch( transformation, libs, models, asmParams, superimpose, 
options );

//The save code...



When loading the UML metamodel from the ecore file, I got lots of Warning 
like:

28 avr. 2008 15:28:38 org.eclipse.m2m.atl.drivers.emf4atl.ASMEMFModel 
addReferencedExtentsFor

ATTENTION: Resource for org.eclipse.emf.ecore.impl.EClassImpl@cdb06e 
(eProxyURI: 
platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EModelElement) is 
null; cannot be referenced



I tried loading the UML metamodel from the EMF registry using:

umlMM = 
modelHandler.loadModel("uml2",mofMM,"uri:http://www.eclipse.org/uml2/2.1.0/UML";);

I then don't have any warning but still no result.

What am I doing wrong?

Thanks a lot



Hugues Dubourg