Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » GenModel Initialize by Loading on standalone(How to include *.ecore files into standalone projects)
GenModel Initialize by Loading on standalone [message #658756] Wed, 09 March 2011 17:10 Go to next message
TobyS is currently offline TobySFriend
Messages: 4
Registered: July 2009
Junior Member
I've created an ECore moel for handling FpML, but due to the size of the model the "Initialize by Loading" setting has to be set true as per this snippet from the book:

Quote:
Initialize By Loading--This property controls whether the metadata for a package is initialized by generated code in the package implementation class or is loaded dynamically from an .ecore file. This capability is automatically enabled by default for larger models, so as to avoid generating methods in the package
implementation class that exceed Java's 64Kb size limit.


This is all well and good, and works fine in my test project. However, I'm then running a build to put all the generated .class files into a jar, and have a separate project that imports that jar along with the required EMF jars.

Now where I'm stuck, is that this stand-alone project (which runs outside of eclipse) needs to be able to reference the .ecore file to do the dynamic generation. I tried blindly just putting the .ecore file in the same folder as my generated jar file and adding it to my classpath, but this doesn't appear to work. Having searched the web I've seen people talking about putting it in a "bin" folder, but I don't have a bin folder as I'm not running this in eclipse at all, but as a standalone.

Where do I need to put the .ecore file (fpml.ecore in my case), and/or how do I tell the system where to find it?

Ideally I'd like to incorporate it into the jar file if that's possible, so my stand-alone project doesn't have to know about it at all and can just load the one jar file.

Many thanks
Toby
Re: GenModel Initialize by Loading on standalone [message #658759 is a reply to message #658756] Wed, 09 March 2011 17:17 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30551
Registered: July 2009
Senior Member
Toby,

Comments below.

TobyS wrote:
> I've created an ECore moel for handling FpML, but due to the size of
> the model the "Initialize by Loading" setting has to be set true as
> per this snippet from the book:
>
> Quote:
>> Initialize By Loading--This property controls whether the metadata
>> for a package is initialized by generated code in the package
>> implementation class or is loaded dynamically from an .ecore file.
>> This capability is automatically enabled by default for larger
>> models, so as to avoid generating methods in the package
>> implementation class that exceed Java's 64Kb size limit.
>
>
> This is all well and good, and works fine in my test project. However,
> I'm then running a build to put all the generated .class files into a
> jar, and have a separate project that imports that jar along with the
> required EMF jars.
So you'll need to put the .ecore into your jar as well.
>
> Now where I'm stuck, is that this stand-alone project (which runs
> outside of eclipse) needs to be able to reference the .ecore file to
> do the dynamic generation. I tried blindly just putting the .ecore
> file in the same folder as my generated jar file and adding it to my
> classpath, but this doesn't appear to work.
It needs to be in the same folder in the same jar as the generated
XyzPackageImpl. I.e., treat it like a *.properties resource.
> Having searched the web I've seen people talking about putting it in a
> "bin" folder, but I don't have a bin folder as I'm not running this in
> eclipse at all, but as a standalone.
Normally that file is copied to the bin folder and you create your final
jar by copying the contents of the bin to the root of the jar...
>
> Where do I need to put the .ecore file (fpml.ecore in my case), and/or
> how do I tell the system where to find it?
If you put it in the right place (relative of the XyzPackageImpl.class)
it should be found.
> Ideally I'd like to incorporate it into the jar file if that's
> possible, so my stand-alone project doesn't have to know about it at
> all and can just load the one jar file.
Yes, that should work nicely.
>
> Many thanks
> Toby
Re: GenModel Initialize by Loading on standalone [message #658763 is a reply to message #658759] Wed, 09 March 2011 17:33 Go to previous message
TobyS is currently offline TobySFriend
Messages: 4
Registered: July 2009
Junior Member
Great, thanks Ed will give that a go, I just had it in the wrong place then not realising it was folder-senstive. Makes sense though I should have thought of that!

Thanks for the super-quick response!

Cheers,
Toby
Previous Topic:[Mapping] org.eclipse.emf.mapping
Next Topic:Genmodel Changes and XMI Resource
Goto Forum:
  


Current Time: Fri Oct 18 00:58:44 GMT 2019

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

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

Back to the top