Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Accessing Model Repository Data(Persistency of and access to EOL-managed data)
Accessing Model Repository Data [message #1842090] Tue, 08 June 2021 23:28 Go to next message
Jörn Guy Süß is currently offline Jörn Guy SüßFriend
Messages: 320
Registered: July 2009
Location: Anstead, Brisbane, Queens...
Senior Member

We are developing an Ant task that runs inside a build that contains EOL tasks which load, and ultimately save model data.

During the run, we need access to EMF models that have been loaded by EOL.

We find that the models only persist on the shutdown of the build.

This prevents our code from reading the file, as it is not stored at this time.

Hence, we have a first question:

What is the recommended way to force EOL during the run of the build to persist a model to disk? Does one exist?

Further, we have discovered that we can obtain a reference to the EOL model repository that is stored in the references of the Ant project.
However, all the contents are wrapped in EOL wrappers. This leads to our second question:

How can one obtain a reference to the underlying EMF model of a org.eclipse.epsilon.emc.emf.EmfModel?

Technical details of the last item:
We have the model repository as an object from which an IModel can be found by name .getModelByName(name)). This [font=Courier]IModel[/code] is of the type org.eclipse.epsilon.emc.emf.EmfModel.
The meta-model has generated Model code that is accessible to the task.
Re: Accessing Model Repository Data [message #1842096 is a reply to message #1842090] Wed, 09 June 2021 06:45 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2165
Registered: July 2009
Location: York, UK
Senior Member

Hi Jörn,

> What is the recommended way to force EOL during the run of the build to persist a model to disk? Does one exist?

If your model is named M, you can call M.store() to save it.

> How can one obtain a reference to the underlying EMF model of a org.eclipse.epsilon.emc.emf.EmfModel?

M.getTarget() should do the trick.

Best,
Dimitris
Re: Accessing Model Repository Data [message #1842131 is a reply to message #1842096] Wed, 09 June 2021 21:57 Go to previous messageGo to next message
Jörn Guy Süß is currently offline Jörn Guy SüßFriend
Messages: 320
Registered: July 2009
Location: Anstead, Brisbane, Queens...
Senior Member

Thanks! And sorry for asking. There was information on the forum already.
To force a sync in a build for external use:


  1. Call <epsilon.storeModel model="ModelName"/> to sync the file to disk.
  2. For EMFModels this calls EMFModel.store(), which calls
  3. org.eclipse.emf.ecore.resource.Resource.save().


After that, the model can be loaded and manipulated externally.

Note: After the manipulation the file has to be explicitly loaded again for Epsilon using <epsilon.loadModel/>

A direct access to the repository is not possible, AFAIK.
Re: Accessing Model Repository Data [message #1842132 is a reply to message #1842131] Wed, 09 June 2021 22:10 Go to previous messageGo to next message
Jörn Guy Süß is currently offline Jörn Guy SüßFriend
Messages: 320
Registered: July 2009
Location: Anstead, Brisbane, Queens...
Senior Member

In contrast to Dimitris advice org.eclipse.epsilon.emc.emf.EmfModel does not have a getTarget() method in
org.eclipse.epsilon.emc.emf_2.2.0.202009032353.jar, and I have not found a means for direct access.

Re: Accessing Model Repository Data [message #1842136 is a reply to message #1842132] Thu, 10 June 2021 04:25 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2165
Registered: July 2009
Location: York, UK
Senior Member

Apologies - I seem to have misread your message. getResource() returns the underlying EMF resource as shown below.

<project default="main">
	<target name="main">
		
		<epsilon.emf.loadModel name="M" .../>
		
		<epsilon.eol>
			// M is a ReflectiveModelReference
			M.println();
			// M.getTarget() returns the underlying EMF model
			M.getTarget().println();
			// .getResource() returns the EMF model's
			// underlying resource
			M.getTarget().getResource().println();
			<model ref="M"/>
		</epsilon.eol>
	</target>
</project>


Best,
Dimitris

[Updated on: Thu, 10 June 2021 04:26]

Report message to a moderator

Re: Accessing Model Repository Data [message #1842178 is a reply to message #1842136] Fri, 11 June 2021 02:14 Go to previous messageGo to next message
Jörn Guy Süß is currently offline Jörn Guy SüßFriend
Messages: 320
Registered: July 2009
Location: Anstead, Brisbane, Queens...
Senior Member

Thanks! That is very useful and cuts out load/save time for us!
Re: Accessing Model Repository Data [message #1842187 is a reply to message #1842178] Fri, 11 June 2021 06:46 Go to previous message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2165
Registered: July 2009
Location: York, UK
Senior Member

Great - I'm very pleased to hear that!
Previous Topic:Maximum amount of sheets allowable by epsilon
Next Topic:Empty placeholders instead of required values.
Goto Forum:
  


Current Time: Sat Apr 27 12:47:45 GMT 2024

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

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

Back to the top