Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO/Dawn] Cannot retrieve resources created via a ResourceSet(Cannot retrieve resources created via a ResourceSet)
[CDO/Dawn] Cannot retrieve resources created via a ResourceSet [message #968894] Fri, 02 November 2012 21:00 Go to next message
Ray Braithwood is currently offline Ray BraithwoodFriend
Messages: 5
Registered: November 2012
Junior Member
Hello,

I am working to migrate my application's GMF diagrams to Dawn. I am having a fairly major problem right now with resources.

1) I create a resource using a ResourceSet
2) I set the Diagram to the resource and set the element to what is shown in the diagram
3) save the resource

I see everything in our DB so it looks like it worked. An the diagram does show properly. However, if I shut down the application and restart ResourceSet.getResource(uri, false) returns null and loadOnDemand creates a new empty diagram.

What I do not understand is CDOView.hasResource(path) return true in the new session and getResource(path) will return the correct resource. However if I try to use that resource for the editor I get a "Legacy mode not enabled" error.

Some more notes about my model:
1) The model object used for the element of the diagram is not a resource itself.
2) We basically have a single model resource
3) I am using CDO 4.1

Any help here would be greatly appreciated as we are close to dropping the usage of Dawn and just putting the diagram XML into the DB somewhere.

Thank you,
Ray Braithwood
Re: [CDO/Dawn] Cannot retrieve resources created via a ResourceSet [message #972228 is a reply to message #968894] Mon, 05 November 2012 13:03 Go to previous messageGo to next message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<meta name="CocoaVersion" content="1187.34">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 15.0px; font: 12.0px Helvetica}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 15.0px; font: 12.0px Helvetica; min-height: 14.0px}
p.p3 {margin: 0.0px 0.0px 0.0px 12.0px; line-height: 14.0px; font: 12.0px Helvetica; color: #011892}
p.p4 {margin: 0.0px 0.0px 0.0px 12.0px; line-height: 14.0px; font: 12.0px Helvetica; color: #011892; min-height: 14.0px}
p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 14.0px; font: 12.0px Helvetica; min-height: 14.0px}
p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 14.0px; font: 12.0px Helvetica}
p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 14.0px; font: 12.0px Helvetica; color: #011892; min-height: 14.0px}
</style>
</head>
<body>
<p class="p1">Hi, Ray,</p>
<p class="p2"><br></p>
<p class="p1">See some replies in-line, below.</p>
<p class="p2"><br></p>
<p class="p1">HTH,</p>
<p class="p2"><br></p>
<p class="p1">Christian</p>
<p class="p2"><br></p>
<p class="p1">On 2012-11-04 12:04:37 +0000, Ray Braithwood said:</p>
<p class="p2"><br></p>
<p class="p3">Hello,</p>
<p class="p4"><br></p>
<p class="p3">I am working to migrate my application's GMF diagrams to Dawn.<span class="Apple-converted-space">  </span>I am having a fairly major problem right now with resources.</p>
<p class="p4"><br></p>
<p class="p3">1) I create a resource using a ResourceSet</p>
<p class="p3">2) I set the Diagram to the resource and set the element to what is shown in the diagram</p>
<p class="p3">3) save the resource</p>
<p class="p4"><br></p>
<p class="p3">I see everything in our DB so it looks like it worked.<span class="Apple-converted-space">  </span>An the diagram does show properly.<span class="Apple-converted-space">  </span>However, if I shut down the application and restart ResourceSet.getResource(uri, false) returns null and loadOnDemand creates a new empty diagram.</p>
<p class="p5"><br></p>
<p class="p6">You mean, if you try again with getResource(uri, true), you get an empty diagram?<span class="Apple-converted-space">  </span>Do you get a Diagram instance in the root of the resource, and that instance is empty, or do you get a resource that doesn't contain a diagram, so the diagram *editor* is empty?</p>
<p class="p5"><br></p>
<p class="p5"><br></p>
<p class="p7"><br></p>
<p class="p3">What I do not understand is CDOView.hasResource(path) return true in the new session and getResource(path) will return the correct resource.<span class="Apple-converted-space">  </span>However if I try to use that resource for the editor I get a "Legacy mode not enabled" error.</p>
<p class="p5"><br></p>
<p class="p6">Did you invoke CDOUtil::setLegacyModeDefault(true) on the thread in which you try to get your resource, *before* you created the view in which you're loading it?</p>
<p class="p5"><br></p>
<p class="p5"><br></p>
<p class="p3">Some more notes about my model:</p>
<p class="p3">1) The model object used for the element of the diagram is not a resource itself.</p>
<p class="p5"><br></p>
<p class="p6">Usually one doesn't use a resource as the model for diagram views.<span class="Apple-converted-space">  </span>Or I don't understand your meaning.</p>
<p class="p5"><br></p>
<p class="p5"><br></p>
<p class="p3">2) We basically have a single model resource</p>
<p class="p5"><br></p>
<p class="p6">That's the normal Dawn pattern.</p>
<p class="p5"><br></p>
<p class="p5"><br></p>
<p class="p3">3) I am using CDO 4.1</p>
<p class="p5"><br></p>
<p class="p6">There is a 4.1.x service release available, although I'm not sure that it has any fixes that would pertain to your problem.</p>
<p class="p5"><br></p>
<p class="p5"><br></p>
<p class="p3">Any help here would be greatly appreciated as we are close to dropping the usage of Dawn and just putting the diagram XML into the DB somewhere.</p>
<p class="p4"><br></p>
<p class="p3">Thank you,</p>
<p class="p3">Ray Braithwood</p>
<p class="p5"><br></p>
</body>
</html>
Re: [CDO/Dawn] Cannot retrieve resources created via a ResourceSet [message #972354 is a reply to message #972228] Mon, 05 November 2012 15:08 Go to previous messageGo to next message
Ray Braithwood is currently offline Ray BraithwoodFriend
Messages: 5
Registered: November 2012
Junior Member
Christian,

Thank you for your reply. It came through for me with a lot of html formatting so I am trying to parse through all that.

You mean, if you try again with getResource(uri, true), you get an empty diagram?<span class="Apple-converted-space"> </span>Do you get a Diagram instance in the root of the resource, and that instance is empty, or do you get a resource that doesn't contain a diagram, so the diagram *editor* is empty?
Sorry, what I mean is that it will create an empty resource and the editor will not open with an error of "No diagram present"

Did you invoke CDOUtil::setLegacyModeDefault(true) on the thread in which you try to get your resource, *before* you created the view in which you're loading it?
No, I did not try this. However, we are using a shared View for the application and doing this is not ideal

Just to clarify, when I said we have a single model resource what I meant was our model has a root instance that has a resource. Underneath that are objects that are the models for the GMF diagrams. These objects do not have resources.

Can you tell me how the URI is used to find a resource in a resource set? There is no documentation about this. I can confirm that the URI is the same for when I create and retrieve the resource but unless it is already in memory, it will not get retrieved. It almost seems like I need to "preload" the resource set before calling getResource(..).

Also, can you tell me why searching via the path on the view does work while searching via a resource set does not?

Thanks
Ray Braithwood
Re: [CDO/Dawn] Cannot retrieve resources created via a ResourceSet [message #972650 is a reply to message #972354] Mon, 05 November 2012 19:59 Go to previous messageGo to next message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

Hi, Ray,

Sorry, that's the first I hear of my NNTP client producing in-your-face
HTML. I hope this doesn't persist.

Some more replies in-line.

cW


On 2012-11-05 15:08:24 +0000, Ray Braithwood said:

> Christian,
>
> Thank you for your reply. It came through for me with a lot of html
> formatting so I am trying to parse through all that.
>
> You mean, if you try again with getResource(uri, true), you get an
> empty diagram?<span class="Apple-converted-space"> </span>Do you get a
> Diagram instance in the root of the resource, and that instance is
> empty, or do you get a resource that doesn't contain a diagram, so the
> diagram *editor* is empty?
> Sorry, what I mean is that it will create an empty resource and the
> editor will not open with an error of "No diagram present"

Interesting. You confirmed separately (via
CDOView::getResource(String) method) that the resource exists, yet it
comes back empty. I suspect that's because Legacy Mode isn't enabled,
so the legacy objects in the resource aren't available. But, I'm still
rather new to Dawn, myself ...


> Did you invoke CDOUtil::setLegacyModeDefault(true) on the thread in
> which you try to get your resource, *before* you created the view in
> which you're loading it?
> No, I did not try this. However, we are using a shared View for the
> application and doing this is not ideal

Well, the GMF notation model is a "legacy" model, so this step is
required. Note that a view that has legacy mode enabled handles CDO
native models perfectly fine. It's just that it spends a bit more
effort on handling legacy objects, too.


> Just to clarify, when I said we have a single model resource what I
> meant was our model has a root instance that has a resource.
> Underneath that are objects that are the models for the GMF diagrams.
> These objects do not have resources.

Sorry, I'm not quite understanding. The root model element has a
containment reference of type CDOResource and that resource, in turn,
contains the Diagram objects?

Or, do you mean that the root of your model is *in* a resource, and
this root contains the Diagrams (in addition to the rest of your
"semantic" model content). This should be supported in legacy mode.


> Can you tell me how the URI is used to find a resource in a resource
> set? There is no documentation about this. I can confirm that the URI
> is the same for when I create and retrieve the resource but unless it
> is already in memory, it will not get retrieved. It almost seems like
> I need to "preload" the resource set before calling getResource(..).

All URIs in EMF are resolved and loaded through the ResourceSet's
URIConverter. The ResourceSet provided by a CDO view adds a URIHandler
to the URIConverter that handles "cdo" scheme URIs. These basically
carry only the same path string that you use with
CDOView::getResource(...).


> Also, can you tell me why searching via the path on the view does work
> while searching via a resource set does not?

The only reason that comes to mind is that you're not using the
resource set that is encapsulated by the CDOView in the second case.
From whence are you getting your resource set?


>
> Thanks
> Ray Braithwood
Re: [CDO/Dawn] Cannot retrieve resources created via a ResourceSet [message #980099 is a reply to message #972650] Sun, 11 November 2012 10:47 Go to previous message
Martin Fluegge is currently offline Martin FlueggeFriend
Messages: 141
Registered: July 2009
Senior Member
Ray,

as Christian mentioned correctly you need to enable legacy, otherwise
you will not be able to work with the Notational model, as it is not a
CDO native one.

Are you sure the you have really have persisted the graphical
information in the db? From my last memories concerning the legacy mode
this is actually impossible if legacy is not enable in the code.

What happens when you generate the Dawn diagram extension for your GMF
editor and create a model using this editor? Does this work correctly?

Cheers,

Martin
Previous Topic:[CDO] Questions regarding the new offline/failover example
Next Topic:[CDO] Problem running clone example
Goto Forum:
  


Current Time: Thu Apr 25 02:21:42 GMT 2024

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

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

Back to the top