Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] Should Audit validate the timestamp on instantiation?
[CDO] Should Audit validate the timestamp on instantiation? [message #423426] Tue, 30 September 2008 13:13 Go to next message
Andre Dietisheim is currently offline Andre DietisheimFriend
Messages: 131
Registered: July 2009
Senior Member
I noticed the following behaviour when playing around with audits
(denoted by pesudo-code):

createSomeRepo();
createSomeSession();
session.openAudit(1911-11-11);

-> accepted! An exception (ReadonlyException) gets triggered later on,
as soon as I try to get the corresponding resource.

createSomeRepo();
createSomeSession();
session.openAudit(timeStampAfterRepoCreation);
audit.setTimeStamp(1911-11-11)

-> IllegalArgumentException (timeStamp < repository creation time)

My guess is that the timestamp used when instantiating an Audit
(CDOSession#openAudit(long timestamp)) should be validated in the Audit
constructor. If I'm wrong here it's still confusing to me to allow
timestamps prior to repository creation when setting the timestamp when
creating the audit while disallowing it when setting it by setTimeStamp().
The ReadonlyException showed above occurs because a new resource gets
added to the resourceset, the CDOViewSet gets notified of it and tries
to attach it to the audit:

CDOViewSetImpl:

private void notifyAdd(CDOResourceImpl resourceImpl)
{
CDOViewImpl view = resolveUUID(resourceImpl.getURI().authority());
if (view != null && FSMUtil.isTransient(resourceImpl))
{
view.toTransaction().attach(resourceImpl);
}
}


Am I right? Shall I post a bugzilla? I have a supplementary test for
AuditTest and I could try tp patch CDOAuditImpl.

Cheers
André
Re: [CDO] Should Audit validate the timestamp on instantiation? [message #423471 is a reply to message #423426] Tue, 30 September 2008 16:14 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6465
Registered: July 2009
Senior Member
Hi André,

You're right, the behaviour should be the same for session.openAudit()
and audit.setTimeStamp(). Please file a Bugzilla for this one so that we
can track it. Btw. I think the timeStamp must be validated by the
repository (as is done in setTimeStamp) because all time stamps are
always repository-scoped.

The ReadOnlyException looks like a separate bug and I wonder hy we
haven't seen it in the tests. Can you file a separate Bugzilla and
attach your test case?

Thank you
/Eike


André Dietisheim schrieb:
> I noticed the following behaviour when playing around with audits
> (denoted by pesudo-code):
>
> createSomeRepo();
> createSomeSession();
> session.openAudit(1911-11-11);
>
> -> accepted! An exception (ReadonlyException) gets triggered later on,
> as soon as I try to get the corresponding resource.
>
> createSomeRepo();
> createSomeSession();
> session.openAudit(timeStampAfterRepoCreation);
> audit.setTimeStamp(1911-11-11)
>
> -> IllegalArgumentException (timeStamp < repository creation time)
>
> My guess is that the timestamp used when instantiating an Audit
> (CDOSession#openAudit(long timestamp)) should be validated in the
> Audit constructor. If I'm wrong here it's still confusing to me to
> allow timestamps prior to repository creation when setting the
> timestamp when creating the audit while disallowing it when setting it
> by setTimeStamp().
> The ReadonlyException showed above occurs because a new resource gets
> added to the resourceset, the CDOViewSet gets notified of it and tries
> to attach it to the audit:
>
> CDOViewSetImpl:
>
> private void notifyAdd(CDOResourceImpl resourceImpl)
> {
> CDOViewImpl view = resolveUUID(resourceImpl.getURI().authority());
> if (view != null && FSMUtil.isTransient(resourceImpl))
> {
> view.toTransaction().attach(resourceImpl);
> }
> }
>
>
> Am I right? Shall I post a bugzilla? I have a supplementary test for
> AuditTest and I could try tp patch CDOAuditImpl.
>
> Cheers
> André
>


Re: [CDO] Should Audit validate the timestamp on instantiation? [message #423486 is a reply to message #423471] Wed, 01 October 2008 10:11 Go to previous message
Andre Dietisheim is currently offline Andre DietisheimFriend
Messages: 131
Registered: July 2009
Senior Member
Howdie Eike!

> You're right, the behaviour should be the same for session.openAudit()
> and audit.setTimeStamp(). Please file a Bugzilla for this one so that we
> can track it.

done: bug 249282

I added a patch for AuditTest that brings 2 test-methods that check for
illegal timestamps when creating/dealing with audits

I further added a proposed patch for Audit that validates the timeStamp
in the constructor.

> Btw. I think the timeStamp must be validated by the
> repository (as is done in setTimeStamp) because all time stamps are
> always repository-scoped.

looking at the code to use:
I wonder if Repository#validateTimeStamp could be made static?

>
> The ReadOnlyException looks like a separate bug and I wonder hy we
> haven't seen it in the tests. Can you file a separate Bugzilla and
> attach your test case?

I'll check this one right afterwards ;-)


Cheers
André

>
> Thank you
> /Eike
>
>
> André Dietisheim schrieb:
>> I noticed the following behaviour when playing around with audits
>> (denoted by pesudo-code):
>>
>> createSomeRepo();
>> createSomeSession();
>> session.openAudit(1911-11-11);
>>
>> -> accepted! An exception (ReadonlyException) gets triggered later on,
>> as soon as I try to get the corresponding resource.
>>
>> createSomeRepo();
>> createSomeSession();
>> session.openAudit(timeStampAfterRepoCreation);
>> audit.setTimeStamp(1911-11-11)
>>
>> -> IllegalArgumentException (timeStamp < repository creation time)
>>
>> My guess is that the timestamp used when instantiating an Audit
>> (CDOSession#openAudit(long timestamp)) should be validated in the
>> Audit constructor. If I'm wrong here it's still confusing to me to
>> allow timestamps prior to repository creation when setting the
>> timestamp when creating the audit while disallowing it when setting it
>> by setTimeStamp().
>> The ReadonlyException showed above occurs because a new resource gets
>> added to the resourceset, the CDOViewSet gets notified of it and tries
>> to attach it to the audit:
>>
>> CDOViewSetImpl:
>>
>> private void notifyAdd(CDOResourceImpl resourceImpl)
>> {
>> CDOViewImpl view = resolveUUID(resourceImpl.getURI().authority());
>> if (view != null && FSMUtil.isTransient(resourceImpl))
>> {
>> view.toTransaction().attach(resourceImpl);
>> }
>> }
>>
>>
>> Am I right? Shall I post a bugzilla? I have a supplementary test for
>> AuditTest and I could try tp patch CDOAuditImpl.
>>
>> Cheers
>> André
>>
Previous Topic:[CDO] server setup and using an internal API?
Next Topic:EMF Transactions: Listen for rollbacks / clean up resources
Goto Forum:
  


Current Time: Thu Jan 23 01:26:37 GMT 2020

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

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

Back to the top