Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Texo] Resolve proxies
[Texo] Resolve proxies [message #1023899] Mon, 25 March 2013 08:21 Go to next message
Bastian Wagenfeld is currently offline Bastian Wagenfeld
Messages: 159
Registered: January 2013
Senior Member
Hi Martin,

as I now tried to get the proxy resolving to work some time, I thought it would be the best to ask you for your help.
My problem is I cannot persuade Texo to resolve the proxies. So if my hierarchy is too deep, the objects only contain null values.
Therefore I created a TexoResourceFactory that extends ResourceFactoryImpl that creates JSONTexoResources. In the Resource.Factory.Registry I set this factory as the default factory (registry.getExtensionToFactoryMap().put(Resource.Factory.Registry.DEFAULT_EXTENSION, texoResourceFactory)). That lets me use resourceSet.createResource(URI.createURI("http://localhost:8080/texo/jsonws", null). After that I use jsonTexoResource.query("select u from User u,...) and the resource is loaded as it should. But it doesn't resolve the proxies.
Do you know, what I'm missing, or do you have some example code where this is used?

Best regards
Bastian

[Updated on: Tue, 02 April 2013 02:09]

Report message to a moderator

Re: [Texo] Resolve proxies [message #1025250 is a reply to message #1023899] Tue, 26 March 2013 06:22 Go to previous messageGo to next message
Martin Taal is currently offline Martin Taal
Messages: 5300
Registered: July 2009
Senior Member
Hi Bastian,
I am working on this topic, proxy resolving etc. Will get back to you on this today/tomorrow (probably with a new build
and a testcase which shows the behavior).

gr. Martin

On 03/25/2013 01:21 PM, Bastian Wagenfeld wrote:
> Hi Martin,
>
> as I now tried to get the proxy resolving to work some time, I thought it would be the best to ask you for your help.
> My problem is I cannot persuade Texo to resolve the proxies. So if my hierarchy is too deep, the objects only contain
> null values. Therefore I created a TexoResourceFactory that extends ResourceFactoryImpl that creates JSONTexoResources.
> In the Resource.Factory.Registry I set this factory as the default factory
> (registry.getExtensionToFactoryMap().put(Resource.Factory.Registry.DEFAULT_EXTENSION, texoResourceFactory)). That lets
> me use resourceSet.createResource(URI.createURI("http://localhost:8080/texo/jsonws", null). After that I use
> jsonTexoResource.query("select u from User u,...) and the resource is loaded as it schould. But it doesn't resolve the
> proxies. Do you know, what I'm missing, or do you have some example code where this is used?
>
> Best regards
> Bastian


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: [Texo] Resolve proxies [message #1027611 is a reply to message #1025250] Wed, 27 March 2013 03:19 Go to previous messageGo to next message
Bastian Wagenfeld is currently offline Bastian Wagenfeld
Messages: 159
Registered: January 2013
Senior Member
Hi Martin,

well, that would be great. Thank you a lot for your support!

Best regards
Bastian
Re: [Texo] Resolve proxies [message #1027814 is a reply to message #1027611] Wed, 27 March 2013 08:50 Go to previous messageGo to next message
Bastian Wagenfeld is currently offline Bastian Wagenfeld
Messages: 159
Registered: January 2013
Senior Member
Hi Martin,

I just saw your test case on the refresh case. So I checked my ResourceSet, if it does what yours does. It actually does, but it doesn't resolve proxies as it is supposed to do. Here is what I do:
if (resourceSet == null) {
		resourceSet = new ResourceSetImpl(); 
resourceSet.getResourceFactoryRegistry().getProtocolToFactoryMap()
					.put("http", new TexoResourceFactory());
}
userRes = (JSONTexoResource) resourceSet.createResource(
				URI.createURI(path+"?types=us_User"));
try {
		userRes.load(Collections.emptyMap());
	} catch (IOException e) {
		e.printStackTrace();
	}


With the TexoResourceFactory:
public class TexoResourceFactory implements Resource.Factory {

	@Override
	public Resource createResource(URI uri) {
		JSONTexoResource res = ComponentProvider.getInstance().newInstance(
				JSONTexoResource.class);
		res.setURI(uri);
		return res;
	}
}


Also manual resolving via EcoreUtil.resolveAll(userRes) isn't working. Do you have a clue, what could be the problem?

Best regards
Bastian

P.S.: I'll test the refresh function during the next days.
Re: [Texo] Resolve proxies [message #1027824 is a reply to message #1027814] Wed, 27 March 2013 09:02 Go to previous messageGo to next message
Martin Taal is currently offline Martin Taal
Messages: 5300
Registered: July 2009
Senior Member
Hi Bastian,
I am doing a new build sometime today. It can make sense to wait/try that build with your testcase. I will post here
after the build is published.

gr. Martin

On 03/27/2013 01:50 PM, Bastian Wagenfeld wrote:
> Hi Martin,
>
> I just saw your test case on the refresh case. So I checked my ResourceSet, if it does what yours does. It actually
> does, but it doesn't resolve proxies as it is supposed to do. Here is what I do:
> if (resourceSet == null) {
> resourceSet = new ResourceSetImpl(); resourceSet.getResourceFactoryRegistry().getProtocolToFactoryMap()
> .put("http", new TexoResourceFactory());
> }
> userRes = (JSONTexoResource) resourceSet.createResource(
> URI.createURI(path+"?types=us_User"));
> try {
> userRes.load(Collections.emptyMap());
> } catch (IOException e) {
> e.printStackTrace();
> }
>
>
> With the TexoResourceFactory:
> public class TexoResourceFactory implements Resource.Factory {
>
> @Override
> public Resource createResource(URI uri) {
> JSONTexoResource res = ComponentProvider.getInstance().newInstance(
> JSONTexoResource.class);
> res.setURI(uri);
> return res;
> }
> }
>
> Also manual resolving via EcoreUtil.resolveAll(userRes) isn't working. Do you have a clue, what could be the problem?
>
> Best regards
> Bastian
>
> P.S.: I'll test the refresh function during the next days.


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: [Texo] Resolve proxies [message #1028664 is a reply to message #1027814] Thu, 28 March 2013 11:17 Go to previous messageGo to next message
Martin Taal is currently offline Martin Taal
Messages: 5300
Registered: July 2009
Senior Member
Hi Bastian,
I published a new build.

gr. Martin

On 03/27/2013 01:50 PM, Bastian Wagenfeld wrote:
> Hi Martin,
>
> I just saw your test case on the refresh case. So I checked my ResourceSet, if it does what yours does. It actually
> does, but it doesn't resolve proxies as it is supposed to do. Here is what I do:
> if (resourceSet == null) {
> resourceSet = new ResourceSetImpl(); resourceSet.getResourceFactoryRegistry().getProtocolToFactoryMap()
> .put("http", new TexoResourceFactory());
> }
> userRes = (JSONTexoResource) resourceSet.createResource(
> URI.createURI(path+"?types=us_User"));
> try {
> userRes.load(Collections.emptyMap());
> } catch (IOException e) {
> e.printStackTrace();
> }
>
>
> With the TexoResourceFactory:
> public class TexoResourceFactory implements Resource.Factory {
>
> @Override
> public Resource createResource(URI uri) {
> JSONTexoResource res = ComponentProvider.getInstance().newInstance(
> JSONTexoResource.class);
> res.setURI(uri);
> return res;
> }
> }
>
> Also manual resolving via EcoreUtil.resolveAll(userRes) isn't working. Do you have a clue, what could be the problem?
>
> Best regards
> Bastian
>
> P.S.: I'll test the refresh function during the next days.


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: [Texo] Resolve proxies [message #1031759 is a reply to message #1028664] Tue, 02 April 2013 02:46 Go to previous messageGo to next message
Bastian Wagenfeld is currently offline Bastian Wagenfeld
Messages: 159
Registered: January 2013
Senior Member
Hi Martin,

I just updated to the newest Texo version. Unfortunately resolving proxies does not work as I expected. When an item in a tree is selected an has children that are proxies, they are not resolved automatically, which I thought it would be. But refreshing a single object via jsonTexoResource.refresh(eObject) rexolves the proxies. So I can call them manually in the ContentProviders, which is okay for me.
Is this the right bevaviour or should it be resolved automatically in the ContentProviders?

Thank you for your support!

Bastian
Re: [Texo] Resolve proxies [message #1031831 is a reply to message #1031759] Tue, 02 April 2013 04:54 Go to previous messageGo to next message
Martin Taal is currently offline Martin Taal
Messages: 5300
Registered: July 2009
Senior Member
Hi Bastian,
I have testcase where this works fine, when I do getBooks on a writer all the book proxies are resolved automatically.

To be sure, the ereference of the children has resolve proxies to true?

gr. Martin

On 04/02/2013 08:46 AM, Bastian Wagenfeld wrote:
> Hi Martin,
>
> I just updated to the newest Texo version. Unfortunately resolving proxies does not work as I expected. When an item in
> a tree is selected an has children that are proxies, they are not resolved automatically, which I thought it would be.
> But refreshing a single object via jsonTexoResource.refresh(eObject) rexolves the proxies. So I can call them manually
> in the ContentProviders, which is okay for me.
> Is this the right bevaviour or should it be resolved automatically in the ContentProviders?
>
> Thank you for your support!
>
> Bastian


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: [Texo] Resolve proxies [message #1031950 is a reply to message #1031831] Tue, 02 April 2013 07:58 Go to previous messageGo to next message
Bastian Wagenfeld is currently offline Bastian Wagenfeld
Messages: 159
Registered: January 2013
Senior Member
Hi Martin,

yes, it has. I did a little debugging and found out: The resolving itself via EcoreUtil.resolve(proxy, proxy.eResource()) works. The proxy resolving for EcoreUtil.resolveAll(resourceSet) does not work nor does an implicit call in one of the ContentProviders. This might be more of an EMF thing, because basically the resolving works?! Don't know. I'll do further researches at this.

Best regards
Bastian
Re: [Texo] Resolve proxies [message #1031962 is a reply to message #1031950] Tue, 02 April 2013 08:11 Go to previous message
Martin Taal is currently offline Martin Taal
Messages: 5300
Registered: July 2009
Senior Member
Hi Bastian,
Yes I guess it makes most sense if you debug, you have the best environment to do that, I am interested to hear what you
encounter.

gr. Martin

On 04/02/2013 01:58 PM, Bastian Wagenfeld wrote:
> Hi Martin,
>
> yes, it has. I did a little debugging and found out: The resolving itself via EcoreUtil.resolve(proxy,
> proxy.eResource()) works. The proxy resolving for EcoreUtil.resolveAll(resourceSet) does not work nor does an implicit
> call in one of the ContentProviders. This might be more of an EMF thing, because basically the resolving works?! Don't
> know. I'll do further researches at this.
>
> Best regards
> Bastian


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Previous Topic:EMF diagram editor cardinalities issue
Next Topic:[Texo] Questions regarding the generated Testdata and other stuff
Goto Forum:
  


Current Time: Wed Apr 16 18:52:01 EDT 2014

Powered by FUDForum. Page generated in 0.02371 seconds