Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] Resource instance in the MEMStore
[CDO] Resource instance in the MEMStore [message #633921] Tue, 19 October 2010 21:27 Go to next message
saurav sarkar is currently offline saurav sarkarFriend
Messages: 428
Registered: July 2009
Senior Member
Hi All,

I am new to the internal workings of the CDO and its APIs.

I have created a resource in MEMStore and committed the transaction in the client.

Now in the server i want to retrieve the same resource and load it in a resource set for further processing in the server.

How can i create a EMF Resource instance in the server if my store is MEMStore?.

Things i tried.
I was using the communication in my QueryHandler implementation.
In the client i have a CDOResource instance which i pass in the QueryInfo parameter which i retrieve in the server and it comes as a CDOID. instance.
Now from the CDOID i want to get the instance of EMF Resource.

I was trying to look up in the MEMStore from the repository instance, then get the CDORevision i am not sure if that is the correct way.

Thanks and Regards,
Saurav


[Updated on: Tue, 19 October 2010 21:28]

Report message to a moderator

Re: [CDO] MemStore [message #633957 is a reply to message #633921] Wed, 20 October 2010 03:45 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6446
Registered: July 2009
Senior Member
Am 19.10.2010 23:27, schrieb saurav:
> Hi All,
>
> I am new to the internal workings of the CDO and its APIs.
>
> I have created a resource in MEMStore and committed the transaction in the client.
>
> Now in the server i want to retrieve the same resource and load it in a resource set for further processing in the server.
>
> How can i create a EMF Resource instance in the server if my store is MEMStore?.
If you want to modify data (EObjects) it's always the same recipe. All EObject modifications happen in the context of a CDOTransaction. You just need to open a JVMConnector on the server and use it to open a normal CDOSession on the repo. Then open the transaction, load objects, modify them and commit the transaction.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper



>
> Things i tried.
> I was using the communication in my QueryHandler implementation.
> In the client i have a CDOResource instance which i pass in the QueryInfo parameter which i retrieve in the server and it comes as a CDOID. instance.
> Now from the CDOID i want to get the instance of EMF Resource.
>
> I was trying to look up in the MEMStore from the repository instance, then get the CDORevision i am not sure if that is the correct way.
>
> Thanks and Regards,
> Saurav


Re: [CDO] Resource instance in the MEMStore [message #634046 is a reply to message #633921] Wed, 20 October 2010 11:31 Go to previous messageGo to next message
saurav sarkar is currently offline saurav sarkarFriend
Messages: 428
Registered: July 2009
Senior Member
Hi Eike,

Thanks for the reply.

In that case could i get the reference of the same resource instance created in the client ?.
Then i have to create/load a new resource instance and add the contents to it in the server.

How are the resources loaded in the OCLQueryHandler if it is using the MEMStore in case of any query is executed from the client ?.


Thanks and Regards,
Saurav




[Updated on: Wed, 20 October 2010 13:37]

Report message to a moderator

Re: [CDO] Resource instance in the MEMStore [message #634100 is a reply to message #634046] Wed, 20 October 2010 13:56 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6446
Registered: July 2009
Senior Member
Am 20.10.2010 13:31, schrieb saurav:
> Hi Eike,
>
> Thanks for the reply.
>
> In that case i have to create the resource and add the contents to it in the server.
>
> How are the resources loaded in the OCLQueryHandler if it is using the MEMStore in case of any query is executed from the client?.
The OCLQueryHandler uses the new ServerCDOView on the repository level, independent of the used store.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Re: [CDO] Resource instance in the MEMStore [message #636338 is a reply to message #633921] Sun, 31 October 2010 05:35 Go to previous messageGo to next message
saurav sarkar is currently offline saurav sarkarFriend
Messages: 428
Registered: July 2009
Senior Member
Hi Eike,

Sorry for the delayed reply on this topic.

This is my understanding as below.

In the client i create my objects in the CDO transaction and commit them.Now In the server i want to retrieve the same objects.

I saw the CDORevisions of the objects are available in the server, but how do i get the EObjects and their relationship between them built?.

Do i have to create a new resource instance and then construct the whole object hierarchy in the server. ?

As i understand the Net4j jVM should have the resource object already created in the client if it is not already garbage collected.
If it is yes how do i get the reference of that same object in the server ?Again on the same context will i get the same resource set instance?

Please correct me if i am wrong.

Thanks and Best Regards,
Saurav


[Updated on: Sun, 31 October 2010 06:02]

Report message to a moderator

Re: [CDO] Resource instance in the MEMStore [message #636340 is a reply to message #636338] Sun, 31 October 2010 06:39 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6446
Registered: July 2009
Senior Member
Am 31.10.2010 06:35, schrieb saurav:
> Hi Eike,
>
> Sorry for the delayed reply on this topic.
>
> This is my understanding as below.
>
> In the client i create my objects in the CDO transaction and commit them.Now In the server i want to retrieve the same objects.
What exactly do you mean by "now"?

[1] At an arbitrary point in time after the commit has happened?
[2] Or as part of the commit processing in the server?


>
> I saw the CDORevisions of the objects are available in the server, but how do i get the EObjects and their relationship between them built?.
You need a CDOView because only this facility can provide you with EObjects. Depending on

[1] You just open a new CDOSession on the repository (preferrably based on a JVMConnector), open a new CDOView and do your processing.
[2] You register your custom IRepository.WriteAccessHandler or the brand new base implementation ObjectWriteAccessHandler:

IRepository repository = startRepository();
repository.addHandler(new ObjectWriteAccessHandler()
{
@Override
protected void handleTransactionAfterCommitted(OMMonitor monitor)
{
CDOView view = getView();
CDOResource resource = view.getResource("/my/resource");
// ...
}
});

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper



>
> Do i have to create a new resource instance and then construct the whole object hierarchy in the server. ?
>
> As i understand the Net4j jVM should have the resource object already created in the client if it is not already garbage collected.
> If it is yes how do i get the reference of that same object in the server ?
>
> Please correct me if i am wrong.
>
> Thanks and Best Regards,
> Saurav
>


Re: [CDO] Resource instance in the MEMStore [message #636416 is a reply to message #633921] Mon, 01 November 2010 07:16 Go to previous messageGo to next message
saurav sarkar is currently offline saurav sarkarFriend
Messages: 428
Registered: July 2009
Senior Member
Hi Eike,

Many thanks for the help.
I am able to complete my test case Smile

I have written a test case for using EMFQuery2 in the server side with memory as a backend.

One more question i have on the same regard
Do you have anything like File system based store implementation ?

cheers,
Saurav


Re: [CDO] Resource instance in the MEMStore [message #636659 is a reply to message #636416] Tue, 02 November 2010 11:29 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6446
Registered: July 2009
Senior Member
Am 01.11.2010 08:16, schrieb saurav:
> Hi Eike,
>
> Many thanks for the help.
> I am able to complete my test case :)
> I have written a test case for using EMFQuery2 in the server side with memory as a backend.
>
> One more question i have on the same regard
> Do you have anything like File system based store implementation ?
No. Some years back Bernd Kolb and I started work on such a thing but we didn't finish it. You could have a look at org.eclipse.emf.cdo.server.file in the incubator CVS module but expect it to be full of compiler errors because the core SPIs evolved a lot since...

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


>
> cheers,
> Saurav
>


Re: [CDO] Resource instance in the MEMStore [message #636753 is a reply to message #633921] Tue, 02 November 2010 16:36 Go to previous messageGo to next message
saurav sarkar is currently offline saurav sarkarFriend
Messages: 428
Registered: July 2009
Senior Member
Hi Eike,

Thanks for the link.I will have a look at the code and will try to make it workable for our needs.

We from EMF Query2 are evaluating the integration of CDO with EMF Query2.

I have seen this bugzilla enhancement request.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=256931

Would you like to have a look at the JUnit test case i have created ? ..i can attach the code as a patch in a separate bugzilla entry or how would you like to go about it ?

cheers,
Saurav


[Updated on: Tue, 02 November 2010 16:45]

Report message to a moderator

Re: [CDO] Resource instance in the MEMStore [message #636919 is a reply to message #636753] Wed, 03 November 2010 11:10 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6446
Registered: July 2009
Senior Member
Am 02.11.2010 17:36, schrieb saurav:
> Hi Eike,
>
> Thanks for the link.I will have a look at the code and will try to make it workable for our needs.
>
> We from EMF Query2 are evaluating the integration of CDO with EMF Query2.
Yeah, that could be interesting!

>
> I have seen this bug.
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=256931
>
> Would you like to have a look at the JUnit test case i have created ?
Definitely ;-)

> ..i can attach the code as a patch in a separate bugzilla entry or how would you like to go about it ?
I suggest that you file a bugzilla against CDO and attach your code there. Is that okay?

Note that I have a huge office backlog and it might take a while until I get back to you...

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


>
> cheers,
> Saurav


Re: [CDO] Resource instance in the MEMStore [message #637163 is a reply to message #633921] Thu, 04 November 2010 12:33 Go to previous message
saurav sarkar is currently offline saurav sarkarFriend
Messages: 428
Registered: July 2009
Senior Member
Thanks Eike.

Seems to be fine with me. I will open a new bugzilla enhancement request.Lets take our discussions there.

cheers,
Saurav


Previous Topic:How to access object of bpmn model from emf
Next Topic:IMF integration/bridge to EMF
Goto Forum:
  


Current Time: Tue Oct 22 11:41:01 GMT 2019

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

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

Back to the top