Home » Modeling » EMF » [CDO] Get last commit info from a CDO Object
[CDO] Get last commit info from a CDO Object [message #1031879] |
Tue, 02 April 2013 10:17 |
Marc Gil Messages: 81 Registered: July 2009 |
Member |
|
|
Hi,
I'm trying to retrieve all the last commit info for a CDO Object, but I'm not able to get it. I try the following:
node.cdoHistory().getLastElement();
But everytime I get the following error:
Caused by: java.lang.IllegalStateException: Can only retrieve current version 4 for OID30 - version requested was BranchVersion[Branch[id=0, name=MAIN], v3]
at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.readRevisionByVersion(DBStoreAccessor.java:317)
at org.eclipse.emf.cdo.internal.server.Repository.loadRevisionByVersion(Repository.java:569)
at org.eclipse.emf.cdo.internal.common.revision.CDORevisionManagerImpl.getRevisionByVersion(CDORevisionManagerImpl.java:252)
at org.eclipse.emf.cdo.server.internal.net4j.protocol.LoadRevisionByVersionIndication.responding(LoadRevisionByVersionIndication.java:72)
at org.eclipse.emf.cdo.server.internal.net4j.protocol.CDOServerIndication.responding(CDOServerIndication.java:134)
at org.eclipse.net4j.signal.IndicationWithResponse.doExtendedOutput(IndicationWithResponse.java:98)
at org.eclipse.net4j.signal.Signal.doOutput(Signal.java:298)
at org.eclipse.net4j.signal.IndicationWithResponse.execute(IndicationWithResponse.java:67)
at org.eclipse.emf.cdo.server.internal.net4j.protocol.CDOServerReadIndication.execute(CDOServerReadIndication.java:36)
... 5 more
Furthermore, the returned object (last element of the history) is always the same while I'm working in the same view. I mean, once I close the working view and open another one, the history is refreshed, but I always get the error.
What am I doing wrong?
Thanks,
Marc
|
|
|
Re: [CDO] Get last commit info from a CDO Object [message #1034348 is a reply to message #1031879] |
Fri, 05 April 2013 10:29 |
|
Am 02.04.2013 12:17, schrieb Marc Gil:
> Hi,
>
> I'm trying to retrieve all the last commit info for a CDO Object, but I'm not able to get it. I try the following:
>
>
> node.cdoHistory().getLastElement();
To me it seems as if the exact call aboce succeeded because the exception below seems unrelated.
> But everytime I get the following error:
>
> Caused by: java.lang.IllegalStateException: Can only retrieve current version 4 for OID30 - version requested was
> BranchVersion[Branch[id=0, name=MAIN], v3]
> at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.readRevisionByVersion(DBStoreAccessor.java:317)
I think this can happen if you access data *in* the CDOCommitInfo for a non-auditing repository. Please check your
repository configuration and make sure you specifiy
<property name="supportingAudits" value="true"/>
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
> at org.eclipse.emf.cdo.internal.server.Repository.loadRevisionByVersion(Repository.java:569)
> at
> org.eclipse.emf.cdo.internal.common.revision.CDORevisionManagerImpl.getRevisionByVersion(CDORevisionManagerImpl.java:252)
> at
> org.eclipse.emf.cdo.server.internal.net4j.protocol.LoadRevisionByVersionIndication.responding(LoadRevisionByVersionIndication.java:72)
> at org.eclipse.emf.cdo.server.internal.net4j.protocol.CDOServerIndication.responding(CDOServerIndication.java:134)
> at org.eclipse.net4j.signal.IndicationWithResponse.doExtendedOutput(IndicationWithResponse.java:98)
> at org.eclipse.net4j.signal.Signal.doOutput(Signal.java:298)
> at org.eclipse.net4j.signal.IndicationWithResponse.execute(IndicationWithResponse.java:67)
> at org.eclipse.emf.cdo.server.internal.net4j.protocol.CDOServerReadIndication.execute(CDOServerReadIndication.java:36)
> ... 5 more
>
>
> Furthermore, the returned object (last element of the history) is always the same while I'm working in the same view.
> I mean, once I close the working view and open another one, the history is refreshed, but I always get the error.
>
> What am I doing wrong?
>
> Thanks,
> Marc
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
Re: [CDO] Get last commit info from a CDO Object [message #1034361 is a reply to message #1034348] |
Fri, 05 April 2013 10:46 |
Marc Gil Messages: 81 Registered: July 2009 |
Member |
|
|
Hi Eike,
Indeed in my configuration I have set this option as false. I change it to true and, after creating a new repository cause the old one is unusable as I change this option, the exception is not raised.
But one question, it seems that the call node.cdoHistory().getLastElement(); is asynchronous, isn't it? Cause if I check the returned value immediately it is null. But if I sleep the Thread some milliseconds, then I get a value. Is it correct?
There exists a way to execute it in a synchronous way?
Thanks Eike!
Marc
[Updated on: Fri, 05 April 2013 10:47] Report message to a moderator
|
|
|
Re: [CDO] Get last commit info from a CDO Object [message #1034384 is a reply to message #1034361] |
Fri, 05 April 2013 11:22 |
|
Am 05.04.2013 12:46, schrieb Marc Gil:
> Hi Eike,
>
> Indeed in my configuration I have set this option as false. I change it to true and, after creating a new repository
> cause the old one is unusable as I change this option, the exception is not raised.
Perfect ;-)
> But one question, it seems that the call node.cdoHistory().getLastElement(); is asynchronous, isn't it? Cause if I
> check the returned value immediately it is null. But if I sleep the Thread some milliseconds, then I get a value. Is
> it correct?
This method's logic is not executed asynchronously but the loading of the entire history happens in a background thread.
That's why there are methods like:
org.eclipse.emf.cdo.common.commit.CDOCommitHistory.isLoading()
org.eclipse.emf.cdo.common.commit.CDOCommitHistory.waitWhileLoading(long)
org.eclipse.emf.cdo.common.commit.CDOCommitHistory.getLoadCount()
org.eclipse.emf.cdo.common.commit.CDOCommitHistory.setLoadCount(int)
org.eclipse.emf.cdo.common.commit.CDOCommitHistory.triggerLoad()
org.eclipse.emf.cdo.common.commit.CDOCommitHistory.triggerLoad(CDOCommitInfoHandler)
You could work with waitWhileLoading().
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
| | | |
Re: [CDO] Get last commit info from a CDO Object [message #1034435 is a reply to message #1034413] |
Fri, 05 April 2013 12:26 |
|
Am 05.04.2013 14:01, schrieb Marc Gil:
> My purpose is that my customized CDO Sessions View shows the last commit information near every CDO Resource:
> resource1 [user 05/04/2013 13:30:45]
> ..
>
> To do that, I modified the content of the getText() method of the CDOItemProvider.
>
> Maybe locally I can update it using the CDOCommitInfo returned by the commit, but I don't know if it's possible to do
> in the other remote clients. For that reason I'm using the history, but it's not valid for me. I need to investigate a
> little bit more about that...
Then you may want to listen for CDOSessionInvalidationEvent, which are defined as:
public interface CDOSessionInvalidationEvent extends CDOSessionEvent, CDOCommitInfo
>
> The list of commits are stored in the DB even if the repository is not auditable, but I don't know why the history
> don't work, it always returns me only one Commit Info... Maybe it's a bug? I checked the DB and there are a lot of
> commits, all of them affects the same resource.
You seem to create the History with "node.cdoHistory()", which returns a CDOObjectHistory, a subtype of CDOCommitHistory
that only contains CDOCommitInfos related to "node". You may want to use "node.cdoView().getHistory()", which returns a
history for the view's branch. "node.cdoView().getSession().getHistory()" returns a history for all branches.
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
Goto Forum:
Current Time: Thu Sep 19 05:59:35 GMT 2024
Powered by FUDForum. Page generated in 0.03960 seconds
|