Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Refreshing EMF resources through a byte[](Refreshing an EMF Resource from a server, returning the resource only as byte[])
Refreshing EMF resources through a byte[] [message #1220709] Fri, 13 December 2013 08:54 Go to next message
Andreas Maier is currently offline Andreas MaierFriend
Messages: 4
Registered: September 2013
Junior Member
Hello everybody,

I'm having a problem refreshing/overwriting an emf resource. I have a graphiti editor for editing an emf model. The emf resources are saved to a server, that doesn't know about emf or anything, so I upload the resource as byte[] and I download the resource as byte[].

The upload case is no problem. Works as expected. The download case not so much. I try so set the new contents via
resource.delete(null);
resourceSet.createResource(URI.createPlatformResourceURI(modelFile.getLocationURI().toString(), true), <id-of-the-content-type>);
Files.write(Paths.get(modelFile.getLocationURI()), serverContent);

That also seems to work (the contents are written to the file), but the graphiti editor then tells me, that I have a file conflict. Is there a better way to overwrite the contents via byte[] or to suppress that file conflict dialog?

Any hints are welcome Smile

Thanks in advance!

Best,
Andreas
Re: Refreshing EMF resources through a byte[] [message #1220730 is a reply to message #1220709] Fri, 13 December 2013 10:14 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

You don't say which Files you use, but I would recommend
IFile.setContent so that Eclipse knows what's happening.

Regards

Ed Willink


On 13/12/2013 08:54, Andreas Maier wrote:
> Hello everybody,
>
> I'm having a problem refreshing/overwriting an emf resource. I have a
> graphiti editor for editing an emf model. The emf resources are saved
> to a server, that doesn't know about emf or anything, so I upload the
> resource as byte[] and I download the resource as byte[].
> The upload case is no problem. Works as expected. The download case
> not so much. I try so set the new contents via
> resource.delete(null);
> resourceSet.createResource(URI.createPlatformResourceURI(modelFile.getLocationURI().toString(),
> true), <id-of-the-content-type>);
> Files.write(Paths.get(modelFile.getLocationURI()), serverContent);
>
> That also seems to work (the contents are written to the file), but
> the graphiti editor then tells me, that I have a file conflict. Is
> there a better way to overwrite the contents via byte[] or to suppress
> that file conflict dialog?
> Any hints are welcome :)
> Thanks in advance!
>
> Best,
> Andreas
Re: Refreshing EMF resources through a byte[] [message #1220737 is a reply to message #1220730] Fri, 13 December 2013 10:42 Go to previous message
Andreas Maier is currently offline Andreas MaierFriend
Messages: 4
Registered: September 2013
Junior Member
Hey,

Sorry, I didn't think of that. It was the java.nio.Files API. Using the Eclipse Resource API seems to work.
Thank you very much!

Best,
Andreas
Previous Topic:Strange EOpposite issue
Next Topic:EMF model with multiple resources
Goto Forum:
  


Current Time: Thu Apr 25 01:21:49 GMT 2024

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

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

Back to the top