[CDO] Resource instance in the MEMStore [message #633921] |
Tue, 19 October 2010 21:27 |
saurav sarkar 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
My Blog http://codifyit.blogspot.com/
Follow me: http://twitter.com/sauravs
[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 |
|
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
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 |
saurav sarkar 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
My Blog http://codifyit.blogspot.com/
Follow me: http://twitter.com/sauravs
[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 |
|
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
>
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05138 seconds