Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Can not instantiate EmfModel
Can not instantiate EmfModel [message #1754519] Sun, 19 February 2017 12:13 Go to next message
Vale Roemer is currently offline Vale RoemerFriend
Messages: 2
Registered: February 2017
Junior Member
Hello,
i want to start an egl file from Java with an emf model.
But I have an exception at EmfModel():

Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/emf/ecore/EClassifier
at StartEGL.main(StartEGL.java:35)
Caused by: java.lang.ClassNotFoundException: org.eclipse.emf.ecore.EClassifier

	
EglFileGeneratingTemplateFactory eglTemplateFactory = new EglFileGeneratingTemplateFactory();
IEolExecutableModule module = new EglTemplateFactoryModuleAdapter(eglTemplateFactory);
eglTemplateFactory.setOutputRoot("model/calender.html");
module.parse(new File("model/Calender2HTML.egl").getAbsoluteFile());
		
EmfModel model = new EmfModel();


How can i do this at the right way?
Thanks.
Re: Can not instantiate EmfModel [message #1754681 is a reply to message #1754519] Tue, 21 February 2017 14:26 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 1498
Registered: July 2009
Location: York, UK
Senior Member

Hi,

You need to add EMF to your classpath. The easiest way to add both Epsilon and EMF is through the kitchensink jar [1, 2].

Cheers,
Dimitris

[1] http://www.eclipse.org/epsilon/download/ (JARs tab)
[2] http://www.eclipse.org/downloads/download.php?file=/epsilon/jars/epsilon-1.4-kitchensink.jar
Re: Can not instantiate EmfModel [message #1754712 is a reply to message #1754519] Tue, 21 February 2017 17:34 Go to previous messageGo to next message
Vale Roemer is currently offline Vale RoemerFriend
Messages: 2
Registered: February 2017
Junior Member
Okay, now I can instantiate my EmfModel Smile

But no output is generated. Here is my Code:

EglFileGeneratingTemplateFactory eglTemplateFactory = new EglFileGeneratingTemplateFactory();
		    IEolExecutableModule module = new EglTemplateFactoryModuleAdapter(eglTemplateFactory);
		    eglTemplateFactory.setOutputRoot("model/calender.html");
		    	module.parse(new File("model/Calender2HTML.egl").getAbsoluteFile());
		    	
		    	EmfModel model = new EmfModel();
		    	StringProperties properties = new StringProperties();
		    properties.put(EmfModel.PROPERTY_NAME, "Mein Kalender");
		    properties.put(EmfModel.PROPERTY_FILE_BASED_METAMODEL_URI, "model/Calender.ecore");//"file:/" + new File(metamodel).getAbsolutePath());
		    	properties.put(EmfModel.PROPERTY_MODEL_URI, "file:/" + new File("model/My.Calender").getAbsolutePath());
		    properties.put(EmfModel.PROPERTY_IS_METAMODEL_FILE_BASED, "true");
		    properties.put(EmfModel.PROPERTY_READONLOAD, true + "");
		    	properties.put(EmfModel.PROPERTY_STOREONDISPOSAL, true + "");
		    model.load(properties, (IRelativePathResolver) null);
		    eglTemplateFactory.getContext().getModelRepository().addModel(model) ;
		    	
		    	module.execute();
		    	module.getContext().getModelRepository().dispose();




Regards,
Roemer
Re: Can not instantiate EmfModel [message #1754737 is a reply to message #1754712] Tue, 21 February 2017 20:43 Go to previous message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 1498
Registered: July 2009
Location: York, UK
Senior Member

Hi,

module.execute() will return the generated content as a String. You can put this content in the target file using e.g. a FileOutputStream. You may also want to have a look at EGX [1] which provides built-in support for saving content generated using EGL templates (in which case you'll need to instantiate/parse/execute an EgxModule).

Cheers,
Dimitris

[1] http://www.eclipse.org/epsilon/doc/articles/code-generation-tutorial-egl/
Previous Topic:loading ETL model in Sample Reflective Editor
Next Topic:EMF metmodel
Goto Forum:
  


Current Time: Wed Jan 17 01:50:27 GMT 2018

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

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