Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Problem regarding resolving proxy of cross model reference(Problem regarding resolving proxy of cross model reference)
Problem regarding resolving proxy of cross model reference [message #715602] Sun, 14 August 2011 19:03 Go to next message
vaibhav  is currently offline vaibhav Friend
Messages: 22
Registered: September 2010
Junior Member
Hi ,
I have some problem regarding resolving proxies of cross emf references.Suppose class A has a cross references of class B with ecore attrributes "resolve proxies"= "false" .


1. A a = loadPersistedObject.load("C:\\LOCATION\\", "ABC");

2. System.out.println("before----------->"+a.getB().eIsProxy());

3. EObject resolveB = EcoreUtil.resolve(a.getB(), a);


4. System.out.println("after----------->"+a.getB().eIsProxy());



if i executed above code snippet i got following console output.
true.
true.


Well, in my usecase i need to achieve some thing like , after resolving proxies (means calling EcoreUtil.resolve(...)), i should get result of number 4 line within code snippet as "false", it means the proxy are resolved.

And After calling EcoreUtil.resolve(...), i can able to see the resolved object of Class B ,but "eisProxy()" still showing "true" .

Is there any ecore attribute i have to set or something else i have missed ?

Thanks in advance,
Regards,
Vaibhav

Re: Problem regarding resolving proxy of cross model reference [message #715610 is a reply to message #715602] Sun, 14 August 2011 20:07 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Comments below


On 14/08/2011 12:03 PM, vaibhav wrote:
> Hi ,
> I have some problem regarding resolving proxies of cross emf
> references.Suppose class A has a cross references of class B with
> ecore attrributes "resolve proxies"= "false" .
Then the reference better be in the same document.
>
>
> 1. A a = loadPersistedObject.load("C:\\LOCATION\\", "ABC");
>
> 2. System.out.println("before----------->"+a.getB().eIsProxy());
> 3. EObject resolveB = EcoreUtil.resolve(a.getB(), a);
>
>
> 4. System.out.println("after----------->"+a.getB().eIsProxy());
>
>
>
> if i executed above code snippet i got following console output.
> true.
> true.
Is a.eResource().getResourceSet() != null?
>
>
> Well, in my usecase i need to achieve some thing like , after
> resolving proxies (means calling EcoreUtil.resolve(...)), i should
> get result of number 4 line within code snippet as "false", it means
> the proxy are resolved.
>
> And After calling EcoreUtil.resolve(...), i can able to see the
> resolved object of Class B ,but "eisProxy()" still showing "true" .
>
> Is there any ecore attribute i have to set or something else i have
> missed ?
Is it a cross document reference? Are you using absolute URIs to load
the resource?
>
> Thanks in advance,
> Regards,
> Vaibhav
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Problem regarding resolving proxy of cross model reference [message #715642 is a reply to message #715610] Mon, 15 August 2011 02:15 Go to previous messageGo to next message
vaibhav  is currently offline vaibhav Friend
Messages: 22
Registered: September 2010
Junior Member
Thanks Ed Merks for your reply.


Is a.eResource().getResourceSet() != null?

Yes a.eResource().getResourceSet() is not null.


Is it a cross document reference? Are you using absolute URIs to load
the resource?

Yes its a cross document references.Following are the xml ...

A.xml

<?xml version="1.0" encoding="ASCII"?>
<amodel:A xmlns:amodel="http:/a.ecore" name="ABC">
<b href="file:/C:/MySecondWebsite/B.xml#/"/>
</amodel:A>


B.xml

<?xml version="1.0" encoding="ASCII"?>
<bmodel:B xmlns:bmodel="http:/b.ecore" name="B">
<tags>tags</tags>
</bmodel:B>

Both Xmls are persisted in different document in file system.

Best Regards,
Vaibhav
Re: Problem regarding resolving proxy of cross model reference [message #715807 is a reply to message #715642] Mon, 15 August 2011 15:46 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Comments below.

On 14/08/2011 7:15 PM, vaibhav wrote:
> Thanks Ed Merks for your reply.
>
>
> Is a.eResource().getResourceSet() != null?
>
> Yes a.eResource().getResourceSet() is not null.
>
>
> Is it a cross document reference? Are you using absolute URIs to load
> the resource?
>
> Yes its a cross document references.
So you need to enable proxy resolution on the "b" feature.
> Following are the xml ...
>
> A.xml
>
> <?xml version="1.0" encoding="ASCII"?>
> <amodel:A xmlns:amodel="http:/a.ecore" name="ABC">
> <b href="file:/C:/MySecondWebsite/B.xml#/"/>
> </amodel:A>
>
>
> B.xml
>
> <?xml version="1.0" encoding="ASCII"?>
> <bmodel:B xmlns:bmodel="http:/b.ecore" name="B">
> <tags>tags</tags>
> </bmodel:B>
>
> Both Xmls are persisted in different document in file system.
>
> Best Regards,
> Vaibhav


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Problem regarding resolving proxy of cross model reference [message #715830 is a reply to message #715807] Mon, 15 August 2011 17:16 Go to previous messageGo to next message
vaibhav  is currently offline vaibhav Friend
Messages: 22
Registered: September 2010
Junior Member
Thanks Ed Merks i got it, but if i do enabled proxy resolution on the "b" feature, proxy got resolved while accessing the "b" reference from "a"(like a.getB()).Thats why i had put ecore attribute "resolving proxies"="false" on "b" feature.

Because in my use case proxy should resolved on "b" feature, as an when we trying to do it manually means when we trying to resolve using ... EObject resolveB =EcoreUtil.resolve(a.getB(), a), and after resolving
i should able to check whether proxy are resolve or not like this
System.out.println("after----------->"+a.getB().eIsProxy());


So is there are some way so that i can able to achieve this manually ?


Thanks and Best Regards,
Vaibhav


(no subject) [message #715833 is a reply to message #715807] Mon, 15 August 2011 17:16 Go to previous messageGo to next message
vaibhav  is currently offline vaibhav Friend
Messages: 3
Registered: July 2010
Junior Member
Thanks Ed Merks i got it, but if i do enabled proxy resolution on the "b" feature, proxy got resolved while accessing the "b" reference from "a"(like a.getB()).Thats why i had put ecore attribute "resolving proxies"="false" on "b" feature.

Because in my use case proxy should resolved on "b" feature, as an when we trying to do it manually means when we trying to resolve using ... EObject resolveB =EcoreUtil.resolve(a.getB(), a), and after resolving
i should able to check whether proxy are resolve or not like this
System.out.println("after----------->"+a.getB().eIsProxy());


So is there are some way so that i can able to achieve this manually ?


Thanks and Best Regards,
Vaibhav
Re: Problem regarding resolving proxy of cross model reference [message #715835 is a reply to message #715830] Mon, 15 August 2011 17:27 Go to previous messageGo to next message
vaibhav  is currently offline vaibhav Friend
Messages: 22
Registered: September 2010
Junior Member
Thanks Ed Merks i got it, but if i do enabled proxy resolution on the "b" feature, proxy got resolved while accessing the "b" reference from "a"(like a.getB()).Thats why i had put ecore attribute "resolving proxies"="false" on "b" feature.

Because in my use case proxy should resolved on "b" feature, as an when we trying to do it manually means when we trying to resolve using ... EObject resolveB =EcoreUtil.resolve(a.getB(), a), and after resolving
i should able to check whether proxy are resolve or not like this
System.out.println("after----------->"+a.getB().eIsProxy());


So is there are some way so that i can able to achieve this manually ?


Thanks and Best Regards,
Vaibhav
Re: Problem regarding resolving proxy of cross model reference [message #715866 is a reply to message #715830] Mon, 15 August 2011 19:26 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Comments below.


On 15/08/2011 10:16 AM, vaibhav wrote:
> Thanks Ed Merks i got it, but if i do enabled proxy resolution on the
> "b" feature, proxy got resolved while accessing the "b" reference
> from "a"(like a.getB()).
Yes, proxies are automatically resolved.
> Thats why i had put ecore attribute "resolving proxies"="false" on "b"
> feature.
So you don't want proxies to resolve...
>
> Because in my use case proxy should resolved on "b" feature, as an
> when we trying to do it manually means when we trying to resolve
> using ... EObject resolveB
> =EcoreUtil.resolve(a.getB(), a), and after resolving i should able
> to check whether proxy are resolve or not like this
> System.out.println("after----------->"+a.getB().eIsProxy());
The code you showed originally returns you the result of resolving the
proxy. It has no impact on the state of a. If you want a's state to
change, you'd have to call a.setB(resolveB).
>
>
> So is there are some way so that i can able to achieve this manually ?
Of course I have no idea why you don't want proxies to resolve
automatically.
>
>
> Thanks and Best Regards,
> Vaibhav
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Problem regarding resolving proxy of cross model reference [message #717817 is a reply to message #715866] Mon, 22 August 2011 13:02 Go to previous messageGo to next message
vaibhav  is currently offline vaibhav Friend
Messages: 22
Registered: September 2010
Junior Member
Thanks for the reply,

But there is just one more issue with the setB scenario. For me to explicitly call setB() on object a, I will have to open a write transaction on Object a which is also within the scope of an eclipse editor. I do not want to make the model dirty for a read operation until and unless the user has triggered a edit for it.

The use case is that the user has expanded a tree and i need to load some data of the children without the editor being made dirty yet. Basically I don't want to make the model dirty. Is there a way to achieve this?

Regards,
Vaibbhav.
Re: Problem regarding resolving proxy of cross model reference [message #717859 is a reply to message #717817] Mon, 22 August 2011 14:40 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Vaibbhav,

Comments below.


On 22/08/2011 6:02 AM, vaibhav wrote:
> Thanks for the reply,
>
> But there is just one more issue with the setB scenario. For me to
> explicitly call setB() on object a, I will have to open a write
> transaction on Object a which is also within the scope of an eclipse
> editor.
Yes and as I keep saying, I have no idea why you need to do this manually.
> I do not want to make the model dirty for a read operation until and
> unless the user has triggered a edit for it.
So what's wrong with proxies that automatically resolve?
> The use case is that the user has expanded a tree and i need to load
> some data of the children without the editor being made dirty yet.
> Basically I don't want to make the model dirty. Is there a way to
> achieve this?
Again, automatically resolving proxies seem ideal for this. Why not?
>
> Regards,
> Vaibbhav.


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Use attributes in model validation messages
Next Topic:[EMF.core] EcoreUtils.resolve() do not return the actual instance
Goto Forum:
  


Current Time: Wed Apr 24 22:57:22 GMT 2024

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

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

Back to the top