Is there any way to do custom proxy resolution? [message #417075] |
Mon, 25 February 2008 21:21 |
Eclipse User |
|
|
|
Originally posted by: struck.stottlerhenke.com
I have a project with a client-server setup. The server has an EMF model
loaded, spread across multiple resources. On startup, the client requests
all the objects from one resource and the following occurs:
1. The server serializes the data
2. The server sends the serialized data over the wire
3. The client deserializes the data and reconstitutes the model
In this setup, there are two copies of the EMF model, where the client
model contains a subset of objects contained by the server model.
When the client encounters an object that is not in the initially loaded
set of objects, we want to manage the proxy resolution ourselves by
calling to the server and again having it send a serialized version of the
data across the wire, which the client will then reconstitute.
From what I've read, EMF will call eIsProxy() on an object and, if that
returns true, call EcoreUtil.resolve() for the object's document. Is there
any way to override this proxy resolution with our own custom solution?
What I'm imagining is something along the lines of an interface called
"ProxyResolutionHandler" that we can assign to the EMF model that will
cause EcoreUtil.resolve() to defer to that handler class.
Thanks,
David
|
|
|
Re: Is there any way to do custom proxy resolution? [message #417077 is a reply to message #417075] |
Mon, 25 February 2008 21:46 |
Ed Merks Messages: 33141 Registered: July 2009 |
Senior Member |
|
|
David,
The way I would imagine specializing this is to specialize the URI
converter of the resource set in which you've loaded the initial
resource. When the proxy is resolved, the URI converter will be asked
to create an input stream for the corresponding URI and that would be
your queue that you need to go back to the server to ask for the
contents of that other resource.
EMF's URI converter implementation has been completely revamped and made
more flexible for 2.4. There are now URIHandlers you can register with
the URIConverter to make customization much easier and to let you
compose the customizations. The full life cycle is also supported,
i.e., you can delete resource. In there
https://bugs.eclipse.org/bugs/show_bug.cgi?id=191077 there is even a
little sample servlet to show how you can load and save via HTTP.
David Struck wrote:
> I have a project with a client-server setup. The server has an EMF
> model loaded, spread across multiple resources. On startup, the client
> requests all the objects from one resource and the following occurs:
>
> 1. The server serializes the data
> 2. The server sends the serialized data over the wire
> 3. The client deserializes the data and reconstitutes the model
>
> In this setup, there are two copies of the EMF model, where the client
> model contains a subset of objects contained by the server model.
>
> When the client encounters an object that is not in the initially
> loaded set of objects, we want to manage the proxy resolution
> ourselves by calling to the server and again having it send a
> serialized version of the data across the wire, which the client will
> then reconstitute.
>
> From what I've read, EMF will call eIsProxy() on an object and, if
> that returns true, call EcoreUtil.resolve() for the object's document.
> Is there any way to override this proxy resolution with our own custom
> solution? What I'm imagining is something along the lines of an
> interface called "ProxyResolutionHandler" that we can assign to the
> EMF model that will cause EcoreUtil.resolve() to defer to that handler
> class.
>
> Thanks,
>
> David
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.03396 seconds