Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Doubt about EGL in ANT
icon5.gif  Doubt about EGL in ANT [message #524701] Thu, 01 April 2010 21:04 Go to next message
paolatco  is currently offline paolatco Friend
Messages: 10
Registered: March 2010
Junior Member
Hi!

I get a doubt about egl ant. I did this:
File: launch.xml
<?xml version="1.0"?>
<project default="main">
	
	<target name="main">
			<epsilon.emf.register file="../metamodels/MM.ecore"/>
			<epsilon.loadModel name="test" type="EMF">
				<parameter name="modelFile" file="../models/test.model"/>
				<parameter name="metamodelUri" value="/metamodel/MM.ecore"/>
				<parameter name="isMetamodelFileBased" value="false"/> 
				<parameter name="readOnLoad" value="false"/>
				<parameter name="storeOnDisposal" value="false"/>
			</epsilon.loadModel>

		<epsilon.egl src="MM2txt.egl">
			<model ref="test"/>
		</epsilon.egl>
	</target>
	
</project>


And executes successfully but no generates the files. I get:
File: MM2txt.egl
[% -- Generate Entities
	TemplateFactory.setOutputRoot('out'); -- outputDir
	var template : Template;
	for(entity in DataModel.allInstances()){
			template := TemplateFactory.load('other.egl');
			template.populate('entity',entity);
			--template.process();
			template.generate(entity+'.txt');
		
	}
%]


File: other.egl
Hello World! File: [%=entity%]


Am i missing somethig?

Thanks.
Re: Doubt about EGL in ANT [message #524707 is a reply to message #524701] Thu, 01 April 2010 17:16 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi,

As readonload is set to false, the contents of your model file are not
read, and thus, DataModel.allInstances() returns an empty collection, so
the body of the for loop is never executed. To fix this please set the
value of readonload to true.

Cheers,
Dimitris

paolatco <paolatco@gmail.com> wrote:
> Hi!
>
> I get a doubt about egl ant. I did this:
> File: launch.xml
>
> <?xml version="1.0"?>
> <project default="main">
>
> <target name="main">
> <epsilon.emf.register file="../metamodels/MM.ecore"/>
> <epsilon.loadModel name="test" type="EMF">
> <parameter name="modelFile" file="../models/test.model"/>
> <parameter name="metamodelUri" value="/metamodel/MM.ecore"/>
> <parameter name="isMetamodelFileBased" value="false"/> <parameter
> name="readOnLoad" value="false"/>
> <parameter name="storeOnDisposal" value="false"/>
> </epsilon.loadModel>
>
> <epsilon.egl src="MM2txt.egl">
> <model ref="test"/>
> </epsilon.egl>
> </target>
>
> </project>
>
>
> And executes successfully but no generates the files. I get:
> File: MM2txt.egl
>
> [% -- Generate Entities
> TemplateFactory.setOutputRoot('out'); -- outputDir
> var template : Template;
> for(entity in DataModel.allInstances()){
> template := TemplateFactory.load('other.egl');
> template.populate('entity',entity);
> --template.process();
> template.generate(entity+'.txt');
>
> }
> %]
>
>
> File: other.egl
>
> Hello World! File: [%=entity%]
>
>
> Am i missing somethig?
>
> Thanks.
>
Re: Doubt about EGL in ANT [message #524709 is a reply to message #524707] Thu, 01 April 2010 22:21 Go to previous messageGo to next message
paolatco  is currently offline paolatco Friend
Messages: 10
Registered: March 2010
Junior Member
Yes, that was the problem... Embarrassed
Very Happy Thanks!
Re: Doubt about EGL in ANT [message #524711 is a reply to message #524709] Thu, 01 April 2010 23:04 Go to previous messageGo to next message
paolatco  is currently offline paolatco Friend
Messages: 10
Registered: March 2010
Junior Member
Hi again.
I get a problem with EGL.
When i call package.name.replace('.','_') it replace the whole string with the new character Confused ...
But if for instance i write package.name.replace('T','_') it works fine.

Dot character get to be treated different?
Re: Doubt about EGL in ANT [message #524726 is a reply to message #524711] Fri, 02 April 2010 05:13 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi,

The first argument of replace is a regular expression and in reg exps .
means any character. Please use \\. instead of .

Cheers,
Dimitris

paolatco <paolatco@gmail.com> wrote:
> Hi again.
> I get a problem with EGL.
> When i call package.name.replace('.','_') it replace the whole string
> with the new character :? ...
> But if for instance i write package.name.replace('T','_') it works
> fine.
>
> Dot character get to be treated different?
>
>
Previous Topic:How to load two dependent models, change names in referenced types, and keep models consistent?
Next Topic:Doubt about EGL in ANT
Goto Forum:
  


Current Time: Thu Apr 25 00:28:45 GMT 2024

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

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

Back to the top