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

Hi again,

I do have the UML2 plugin (version 2.1) installed and loaded.
I really can't figure out why the UML metamodel can't be loaded.


Best regards,

Hugues



"Hugo Bruneliere" <Hugo.Bruneliere@xxxxxxxxxxxxxx> a écrit dans le message 
de news: fv78rp$i5d$1@xxxxxxxxxxxxxxxxxxxx
> Hi Hugues,
>
> Hugues Dubourg a écrit :
>> Thanks for your swift response Hugo,
>>
>>
>> I tried to use the EMF registry indeed, but I specified the URI as a 
>> String parameter:
>>>> umlMM = 
>>>> modelHandler.loadModel("uml2",mofMM,"uri:http://www.eclipse.org/uml2/2.1.0/UML";);
>> I got no error message, but no result either.
>>
>>
>> When using a new URI as you wrote:
>>> umlMM = modelHandler.loadModel("uml2", mofMM, 
>>> URI.createURI("http://www.eclipse.org/uml2/2.1.0/UML";));
>>
>> I now have a null pointer exception whose trace is (sorry it's a bit 
>> long):
>>
>> GRAVE: java.io.FileNotFoundException: 
>> http://www.eclipse.org/uml2/2.1.0/UML
>>
>
> Is the UML2 plugin (version 2.1) installed and loaded onto your Eclipse?
> If another version is installed, you may try with the corresponding URI.
>
> Best regards,
>
> Hugo
>
>> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: 
>> java.io.FileNotFoundException: http://www.eclipse.org/uml2/2.1.0/UML
>>
>> at 
>> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDemandLoadException(ResourceSetImpl.java:315)
>>
>> at 
>> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:274)
>>
>> at 
>> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:397)
>>
>> at 
>> org.eclipse.m2m.atl.drivers.emf4atl.ASMEMFModel.loadASMEMFModel(ASMEMFModel.java:331)
>>
>> at 
>> org.eclipse.m2m.atl.engine.AtlEMFModelHandler.loadModel(AtlEMFModelHandler.java:235)
>>
>> at test.TestKDMtoUML.main(TestKDMtoUML.java:59)
>>
>> Caused by: java.io.FileNotFoundException: 
>> http://www.eclipse.org/uml2/2.1.0/UML
>>
>> at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown 
>> Source)
>>
>> at 
>> org.eclipse.emf.ecore.resource.impl.URIHandlerImpl.createInputStream(URIHandlerImpl.java:178)
>>
>> at 
>> org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl.createInputStream(ExtensibleURIConverterImpl.java:299)
>>
>> at 
>> org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1205)
>>
>> at 
>> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:255)
>>
>> at 
>> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:270)
>>
>> ... 4 more
>>
>> 28 avr. 2008 17:21:39 org.eclipse.m2m.atl.engine.AtlEMFModelHandler 
>> loadModel
>>
>> GRAVE: null
>>
>> java.lang.NullPointerException
>>
>> at 
>> org.eclipse.m2m.atl.drivers.emf4atl.ASMEMFModel.adaptMetamodel(ASMEMFModel.java:368)
>>
>> at 
>> org.eclipse.m2m.atl.drivers.emf4atl.ASMEMFModel.loadASMEMFModel(ASMEMFModel.java:341)
>>
>> at 
>> org.eclipse.m2m.atl.engine.AtlEMFModelHandler.loadModel(AtlEMFModelHandler.java:235)
>>
>> at test.TestKDMtoUML.main(TestKDMtoUML.java:59)
>>
>>
>> I guess there must a problem matching the metamodel with the given URI. 
>> Do you know where this issue could come from?
>>
>> I keep debugging my Java code. If ever I make any further breakthrough, I 
>> will let you know.
>>
>>
>> Hugues
>>
>>
>>
>>
>> "Hugo Bruneliere" <Hugo.Bruneliere@xxxxxxxxxxxxxx> a écrit dans le 
>> message de news: fv4o1a$hs4$1@xxxxxxxxxxxxxxxxxxxx
>>> Hi Hugues,
>>>
>>> Hugues Dubourg a écrit :
>>>> 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());
>>> Have you already tried to do something like this (loading the UML2 
>>> metamodel from the EMF registry)?
>>>
>>>       umlMM = modelHandler.loadModel("uml2", mofMM, 
>>> URI.createURI("http://www.eclipse.org/uml2/2.1.0/UML";));
>>>
>>>
>>> Do you know exactly from which line of your program comes your error?
>>>
>>>
>>> Best regards,
>>>
>>> Hugo
>>>
>>>> }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
>>>>
>>>>
>>>
>>> -- 
>>> --------------------------------------------------------
>>> Hugo Bruneliere - R&D Engineer
>>> ATLAS Group (INRIA & LINA) - University of Nantes
>>> 2, rue de la Houssiniere
>>> 44322 Nantes Cedex 3 - France
>>> office +33 2 51 12 58 10 /\ cell.+33 6 07 42 45 30
>>> EMail: Hugo.Bruneliere@xxxxxxxxxxxxxx
>>> http://www.sciences.univ-nantes.fr/lina/atl/
>>> -------------------------------------------------------- 
>>
>>
>
>
> -- 
> --------------------------------------------------------
> Hugo Bruneliere - R&D Engineer
> ATLAS Group (INRIA & LINA) - University of Nantes
> 2, rue de la Houssiniere
> 44322 Nantes Cedex 3 - France
> office +33 2 51 12 58 10 /\ cell.+33 6 07 42 45 30
> EMail: Hugo.Bruneliere@xxxxxxxxxxxxxx
> http://www.sciences.univ-nantes.fr/lina/atl/
> --------------------------------------------------------