GenModel Initialize by Loading on standalone [message #658756] |
Wed, 09 March 2011 17:10 |
TobyS 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 |
Ed Merks Messages: 33142 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
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Powered by
FUDForum. Page generated in 0.02583 seconds