Hi Ed
Ed Merks wrote:
Please post EMF questions to the EMF newsgroup, which I've added to
the "to" list of the reply. More comments below.
Oops, sorry.
Roland Brand wrote:
Hi all
I'm trying to read an EMF resource. In case it does not exist, I
create a new one, add some default content to it and call save().
Now I've got the problem, that after the save(), the resource might
still not exist and an IOException is thrown when I try to load the
resource. It seems like a race condition to me, since it never
occurs in the debugger. So I helped myself with the following loop:
while
(!resource.getResourceSet().getURIConverter().exists(resource.getURI(),
Collections.EMPTY_MAP))
{
System.out.println("save it");
resource.save(saveOptions);
}
It is now clear, that save() does not guarantee the existence of the
resource after it has been called. I have seen up to 30 executions
of the while-loop until the resource finally existed.
What's the value of the URI?
The URI is archive:file://home/rbrand/model.zip!/semantic.xmi
As you can probably guess, I have a Zipfile containing GMF resources:
a semantic model and a notation model.
My question is: how can I make sure, that the new resource really
exists? The while-loop does not look like a nice solution to me. Or
am I misunderstanding something?
I wouldn't expect this kind of behavior...
Thanks for your helpful posts ;-)
Roland