|
|
Re: Recursive loading [message #1043202 is a reply to message #1043174] |
Wed, 17 April 2013 12:19 |
Mathieu MONTIN Messages: 26 Registered: October 2012 |
Junior Member |
|
|
Hello and thanks for your reply.
My code used to look like :
XMIResourceImpl model = new XMIResourceImpl(URI.createURI(pathname));
model.load(new HashMap<Object,Object>());
Now, it looks like :
ResourceSetImpl set = new ResourceSetImpl();
XMIResourceImpl model = (XMIResourceImpl) set.createResource(URI.createURI(pathname));
where pathname = ./example for instance.
In the first case, the model is loaded and works properly (but no recursive calls).
In the second case, the model is null even if the documentation of the method 'createResource' explicitely says that it's not possible.
This is the first time I'm loading a resource into a resourceSet (which should solve my initial problem) so maybe I've been mistaken somewhere.
Edit : concerning the absolute path, until now, my resource was successfully loaded with the path I wrote before, which is relative to the root of my project.
[Updated on: Wed, 17 April 2013 12:26] Report message to a moderator
|
|
|
|
|
Re: Recursive loading [message #1043264 is a reply to message #1043242] |
Wed, 17 April 2013 13:37 |
Ed Merks Messages: 33146 Registered: July 2009 |
Senior Member |
|
|
Mathieu,
Comments below.
On 17/04/2013 3:09 PM, Mathieu MONTIN wrote:
> Sorry, I was not aware that I had to be an experimented user to post
> here.
No, but surely you can't expect that every single new inexperienced user
will get detailed information that's available in the FAQ and in
introductory material...
> Anyway, I did not register any factory because it was mentioned in the
> documentation that eclipse would use the default one if necessary,
> which should have worked considering that my file is a standard .ecore
> file.
Yes, if you run in an Eclipse environment, but you're running stand
alone aren't you?
> After writing my previous message, I kept looking and finally tried to
> register the obvious factory (XMIResourceFactoryImpl). Looks like my
> model is not null anymore (as you already knew) but I keep thinking
> that it does not make any sense according to the documentation. It's
> not like I was trying to load a pdf file as an EMF resource.
No, but it's not like you've looked at how the editor loads a resource
either...
>
> That being said, I'll keep doing my tests to see if it actually worked
> the way I wanted. i just can't figure out why the path has to be
> absolute. But maybe this also is a basic question.
You'll find I've explained that 100 times already in this newsgroup.
It's because relative cross document references can only be resolved
against an absolute URI to yet the absolute URI of the referenced
document...
> Thank you for your help anyway.
> PS : I never said that my initial code was using resourceSets so I
> don't get your first comment.
No, you didn't say much of anything so I had to guess at the common
mistakes, i.e., not using a resource set and not using an absolute URI.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: Recursive loading [message #1043321 is a reply to message #1043264] |
Wed, 17 April 2013 14:58 |
Mathieu MONTIN Messages: 26 Registered: October 2012 |
Junior Member |
|
|
I've made my path absolute.
But still, linked models are not loaded.
For information I'm developping my application under an Eclipse platform.
You say that I did not say much, so feel free to ask for any further information.
I'll keep looking and post again here if I find anything interesting
[Updated on: Wed, 17 April 2013 15:01] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.02891 seconds