You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lenya.apache.org by Andreas Hartmann <an...@apache.org> on 2005/04/13 09:40:26 UTC
[1.4] Pessimistic offline lock and check-out
Hi Lenya devs,
in 1.4 it is now possible to configure usecases to use pessimistic
offline lock. (This means that all involved objects are checked out
before changes are made, so that nobody else is allowed to make
changes in the meantime.)
This causes the following problems:
1) You end up with checked-out objects when you don't exit a usecase
properly (e.g., if you just close the browser window).
This is a known issue also in 1.2, but in 1.4 it has a larger impact
because checkin/checkout is handled at source level. This means that
not just a document, but a lot of sources are checked out. This makes
it harder to find the corresponding RCML files for a "manual checkin".
2) 1.2 allowed subsequent check-outs of the same user without checking in.
But consider the following scenario:
1. Alice begins to edit document A (A is checked out)
2. she opens another browser window (or even another browser)
3. she edits the <h1> of A (which is allowed by the system)
4. she saves A
5. she returns to the first browser window
6. she edits the <h1> of A
7. she saves A
In this case, either the first changes are lost or a conflict occurs
(depending on the implementation of "save").
In 1.4, step (3) won't be allowed. But this means that you can't checkin
a checked-out document by opening it with an editor. I guess we need
a functionality to check-in all pending documents (the admin may checkin
all documents).
WDYT?
-- Andreas
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org
Re: [1.4] Pessimistic offline lock and check-out
Posted by Andreas Hartmann <an...@apache.org>.
Felix Röthenbacher wrote:
> Andreas Hartmann wrote:
>
>> Hi Lenya devs,
>>
>> in 1.4 it is now possible to configure usecases to use pessimistic
>> offline lock. (This means that all involved objects are checked out
>> before changes are made, so that nobody else is allowed to make
>> changes in the meantime.)
>>
>> This causes the following problems:
>>
>> 1) You end up with checked-out objects when you don't exit a usecase
>> properly (e.g., if you just close the browser window).
>>
>> This is a known issue also in 1.2, but in 1.4 it has a larger impact
>> because checkin/checkout is handled at source level. This means that
>> not just a document, but a lot of sources are checked out. This makes
>> it harder to find the corresponding RCML files for a "manual checkin".
>
>
> You are speaking of RCML files. Is the check-in/check-out mechanism also
> designed to work with a JSR-170 repository as specified in that
> standard? That means that also versioning must be supported for a
> JSR-170 repository.
No, the design doesn't focus on JSR-170 yet. We decided to postpone the
JCR integration to 1.6, so I thought it makes more sense to do only
small steps in 1.4. The first step was to have only a single entry point
to checkin/checkout and versioning, without changing the underlying
revision control mechanism. Currently, we have the following architecture
in 1.4:
+--------------------------------------------------+
| business logic layer (usecases) |
+--------------------------------------------------+
| repository layer (RepositorySource, lenya://...) |
+-------------------------+------------------------+
| Source-based repo impl. | ... other repo impls?
+-------------------------+
| context:// sources |
+-------------------------+
At the business logic layer, you work with lenya:// sources:
ModifiableSource source = resolver.resolveURI("lenya://...");
DocumentHelper.writeDocument(xmlDoc, source.getOutputStream());
At this time, the data are not written to the file system, but
buffered in the repository layer. The file system is only affected
when the transaction is committed.
----
At the repository layer, this is mapped to repository nodes:
public OutputStream getOutputStream() throws IOException {
try {
if (!this.node.isLocked()) {
throw new RuntimeException(
"Cannot write to source [" + getURI() + "]: not locked!");
}
this.identityMap.getUnitOfWork().registerDirty(this.node);
return new DOMOutputStream();
} catch (TransactionException e) {
throw new RuntimeException(e);
}
}
----
The source-based repository implementation uses context:// sources to
store the data:
protected String getRealSourceURI() {
return "context://" + this.sourceUri.substring("lenya://".length());
}
public Document getDocument() {
try {
if (this.document == null && SourceUtil.exists(
getRealSourceURI(), this.manager)) {
this.document = SourceUtil.readDOM(
getRealSourceURI(), this.manager);
}
} catch (Exception e) {
throw new RuntimeException(e);
}
return this.document;
}
At this level, revision control is managed using the existing revision
controller.
It would be nice if another repository implementation (based on JCR) could
be plugged in, but I don't think this will be possible without changes to
the API. But - if you think that the integration would be easy enough, I won't
mind to reconsider adding JCR to 1.4. This will certainly reduce the risk
of breaking backwards compatibility in 1.6.
-- Andreas
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org
Re: [1.4] Pessimistic offline lock and check-out
Posted by Andreas Hartmann <an...@apache.org>.
Felix Röthenbacher wrote:
> Andreas Hartmann wrote:
>
>> Gregor J. Rothfuss wrote:
>>
>>> Felix Röthenbacher wrote:
>>>
>>>> You are speaking of RCML files. Is the check-in/check-out mechanism
>>>> also
>>>> designed to work with a JSR-170 repository as specified in that
>>>> standard? That means that also versioning must be supported for a
>>>> JSR-170 repository.
>>>
>>>
>>>
>>>
>>> we talked about this a while back, and one option was to extend the
>>> document interface to have a simple checkin() method which allows to
>>> hide the rc implementation.
>>
>>
>>
>> Actually this isn't necessary anymore. RC is handled below the document
>> layer - all lenya:// sources which are written to are versioned.
>
>
> What about changes to meta data? Are these changes also versioned?
That depends on the implementation. If you access the source using the
lenya:// protocol, they are versioned by the repository. If not, you have
to take care about versioning by yourself.
-- Andreas
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org
Re: [1.4] Pessimistic offline lock and check-out
Posted by Felix Röthenbacher <fe...@wyona.com>.
Andreas Hartmann wrote:
> Gregor J. Rothfuss wrote:
>
>> Felix Röthenbacher wrote:
>>
>>> You are speaking of RCML files. Is the check-in/check-out mechanism also
>>> designed to work with a JSR-170 repository as specified in that
>>> standard? That means that also versioning must be supported for a
>>> JSR-170 repository.
>>
>>
>>
>> we talked about this a while back, and one option was to extend the
>> document interface to have a simple checkin() method which allows to
>> hide the rc implementation.
>
>
> Actually this isn't necessary anymore. RC is handled below the document
> layer - all lenya:// sources which are written to are versioned.
What about changes to meta data? Are these changes also versioned?
- Felix
>
> -- Andreas
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org
Re: [1.4] Pessimistic offline lock and check-out
Posted by Andreas Hartmann <an...@apache.org>.
Gregor J. Rothfuss wrote:
> Felix Röthenbacher wrote:
>
>> You are speaking of RCML files. Is the check-in/check-out mechanism also
>> designed to work with a JSR-170 repository as specified in that
>> standard? That means that also versioning must be supported for a
>> JSR-170 repository.
>
>
> we talked about this a while back, and one option was to extend the
> document interface to have a simple checkin() method which allows to
> hide the rc implementation.
Actually this isn't necessary anymore. RC is handled below the document
layer - all lenya:// sources which are written to are versioned.
-- Andreas
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org
Re: [1.4] Pessimistic offline lock and check-out
Posted by "Gregor J. Rothfuss" <gr...@apache.org>.
Felix Röthenbacher wrote:
> You are speaking of RCML files. Is the check-in/check-out mechanism also
> designed to work with a JSR-170 repository as specified in that
> standard? That means that also versioning must be supported for a
> JSR-170 repository.
we talked about this a while back, and one option was to extend the
document interface to have a simple checkin() method which allows to
hide the rc implementation.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org
Re: [1.4] Pessimistic offline lock and check-out
Posted by Felix Röthenbacher <fe...@wyona.com>.
Andreas Hartmann wrote:
> Hi Lenya devs,
>
> in 1.4 it is now possible to configure usecases to use pessimistic
> offline lock. (This means that all involved objects are checked out
> before changes are made, so that nobody else is allowed to make
> changes in the meantime.)
>
> This causes the following problems:
>
> 1) You end up with checked-out objects when you don't exit a usecase
> properly (e.g., if you just close the browser window).
>
> This is a known issue also in 1.2, but in 1.4 it has a larger impact
> because checkin/checkout is handled at source level. This means that
> not just a document, but a lot of sources are checked out. This makes
> it harder to find the corresponding RCML files for a "manual checkin".
You are speaking of RCML files. Is the check-in/check-out mechanism also
designed to work with a JSR-170 repository as specified in that
standard? That means that also versioning must be supported for a
JSR-170 repository.
- Felix
>
> 2) 1.2 allowed subsequent check-outs of the same user without checking in.
> But consider the following scenario:
>
> 1. Alice begins to edit document A (A is checked out)
> 2. she opens another browser window (or even another browser)
> 3. she edits the <h1> of A (which is allowed by the system)
> 4. she saves A
> 5. she returns to the first browser window
> 6. she edits the <h1> of A
> 7. she saves A
>
> In this case, either the first changes are lost or a conflict occurs
> (depending on the implementation of "save").
>
> In 1.4, step (3) won't be allowed. But this means that you can't checkin
> a checked-out document by opening it with an editor. I guess we need
> a functionality to check-in all pending documents (the admin may checkin
> all documents).
>
> WDYT?
>
> -- Andreas
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org
Re: logged-in identities [WAS: Re: [1.4] Pessimistic offline lock
and check-out]
Posted by Michael Wechner <mi...@wyona.com>.
Andreas Hartmann wrote:
>>>
>>>
>>> Maybe we could introduce a registry with a WeakHashMap holding
>>> references to the logged-in identities?
>>
>>
>>
>>
>> that should work, but we also would need to find a way to recognize when
>> a session becomes invalid (logout could also be registered of course).
>
>
> If we use a WeakHashMap, that shouldn't be necessary. If the map holds
> the only reference to the object, the reference is automatically removed
> from the map. I.e. when the session expires, the identity is removed
> from the map.
cool, didn't know that WeakHashMap does that automagically.
Michi
>
> -- Andreas
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
> For additional commands, e-mail: dev-help@lenya.apache.org
>
>
--
Michael Wechner
Wyona Inc. - Open Source Content Management - Apache Lenya
http://www.wyona.com http://lenya.apache.org
michael.wechner@wyona.com michi@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org
Re: logged-in identities [WAS: Re: [1.4] Pessimistic offline lock
and check-out]
Posted by Andreas Hartmann <an...@apache.org>.
Michael Wechner wrote:
> Andreas Hartmann wrote:
>
>> Michael Wechner wrote:
>>
>> [...]
>>
>>>> Maybe it would even be possible to store the session ID in the checkout
>>>> entry? This would allow to check if the corresponding session is
>>>> still alive.
>>>
>>>
>>>
>>>
>>>
>>> I think this is another issue and it would certainly be great to see
>>> for an administrator to actually see who is logged in, etc.
>>> Unfortunately IIRC the servlet API was changed (I think for security
>>> reasons) and AFAIK it's not so easy anymore to get all the sessions
>>> and their "parameters" to show who is actually logged into Lenya.
>>
>>
>>
>> Maybe we could introduce a registry with a WeakHashMap holding
>> references to the logged-in identities?
>
>
>
> that should work, but we also would need to find a way to recognize when
> a session becomes invalid (logout could also be registered of course).
If we use a WeakHashMap, that shouldn't be necessary. If the map holds
the only reference to the object, the reference is automatically removed
from the map. I.e. when the session expires, the identity is removed
from the map.
-- Andreas
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org
logged-in identities [WAS: Re: [1.4] Pessimistic offline lock and
check-out]
Posted by Michael Wechner <mi...@wyona.com>.
Andreas Hartmann wrote:
> Michael Wechner wrote:
>
> [...]
>
>>> Maybe it would even be possible to store the session ID in the checkout
>>> entry? This would allow to check if the corresponding session is
>>> still alive.
>>
>>
>>
>>
>> I think this is another issue and it would certainly be great to see
>> for an administrator to actually see who is logged in, etc.
>> Unfortunately IIRC the servlet API was changed (I think for security
>> reasons) and AFAIK it's not so easy anymore to get all the sessions
>> and their "parameters" to show who is actually logged into Lenya.
>
>
> Maybe we could introduce a registry with a WeakHashMap holding
> references to the logged-in identities?
that should work, but we also would need to find a way to recognize when
a session becomes invalid (logout could also be registered of course).
Michi
--
Michael Wechner
Wyona Inc. - Open Source Content Management - Apache Lenya
http://www.wyona.com http://lenya.apache.org
michael.wechner@wyona.com michi@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org
Re: [1.4] Pessimistic offline lock and check-out
Posted by Andreas Hartmann <an...@apache.org>.
Michael Wechner wrote:
[...]
>> Maybe it would even be possible to store the session ID in the checkout
>> entry? This would allow to check if the corresponding session is still
>> alive.
>
>
>
> I think this is another issue and it would certainly be great to see for
> an administrator to actually see who is logged in, etc. Unfortunately
> IIRC the servlet API was changed (I think for security reasons) and
> AFAIK it's not so easy anymore to get all the sessions and their
> "parameters" to show who is actually logged into Lenya.
Maybe we could introduce a registry with a WeakHashMap holding
references to the logged-in identities?
-- Andreas
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org
Re: [1.4] Pessimistic offline lock and check-out
Posted by Michael Wechner <mi...@wyona.com>.
Andreas Hartmann wrote:
> J. Wolfgang Kaltz wrote:
>
> [...]
>
>> 1. should an editor, and not just an admin, have the possibility of
>> checking in pending documents, regardless of whom the checkout
>> belongs to ? (my personal feeling says yes)
>> If so, then when she tries to open a document with an editor, but the
>> document is checked-out, we could provide her with a GUI to tell her
>> and ask "Do you want to override the checkout Yes / No"
>>
>> 2. should there be a sort of "time sanity check" ? Suppose the
>> document has been checked out for over 24 hours, we can assume the
>> use case was not properly completed (browser closed / crashed). In
>> that case we could offer any user to possibility to override the
>> checkout, even if regarding question 1. we decide not to give any
>> user the possibility to override a checkout at any time.
>
>
> Yes, this is certainly reasonable.
it makes sense, but I think it's important to have this configurable,
especially
to make "infinite" resp. disable the "sanity check".
But I think 1 and 2 can be implemented both, because they are actually
independent of each other, whereas I think 1 (breaking the lock) has
higher priority than the "automatic sanity check"
>
>
> Maybe it would even be possible to store the session ID in the checkout
> entry? This would allow to check if the corresponding session is still
> alive.
I think this is another issue and it would certainly be great to see for
an administrator to actually see who is logged in, etc. Unfortunately
IIRC the servlet API was changed (I think for security reasons) and
AFAIK it's not so easy anymore to get all the sessions and their
"parameters" to show who is actually logged into Lenya.
Michi
>
> -- Andreas
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
> For additional commands, e-mail: dev-help@lenya.apache.org
>
>
--
Michael Wechner
Wyona Inc. - Open Source Content Management - Apache Lenya
http://www.wyona.com http://lenya.apache.org
michael.wechner@wyona.com michi@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org
Re: [1.4] Pessimistic offline lock and check-out
Posted by Thorsten Scherler <th...@apache.org>.
On Wed, 2005-04-13 at 11:50 +0200, J. Wolfgang Kaltz wrote:
> Andreas Hartmann schrieb:
> > J. Wolfgang Kaltz wrote:
> >
<snip/>
> >
> > Yes, this is certainly reasonable.
> >
> > Maybe it would even be possible to store the session ID in the checkout
> > entry? This would allow to check if the corresponding session is still
> > alive.
>
> That's an interesting idea.
>
> However I'm concerned about storing session IDs, because this is
> sensitive information. Other users should not have access to a users'
> (potentially still valid) session ID.
If we would you use J2EE architecture I would say the best idea would be
to store it in an Entity Bean. The session ID would be not the actual
session ID but a key for the lookup in the Entity Bean.
Maybe we can use a similar concept (of Entity Beans) and use it like
this.
Store lock
user -> session ID -> entity bean (key: alice, value: session id)
Release lock
user -> entity bean (key:alice, value session id) -> release lock for
session id of alice
This way we will hide the id under the business layer.
salu2
--
thorsten
"Together we stand, divided we fall!"
Hey you (Pink Floyd)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org
Re: [1.4] Pessimistic offline lock and check-out
Posted by "J. Wolfgang Kaltz" <ka...@interactivesystems.info>.
Andreas Hartmann schrieb:
> J. Wolfgang Kaltz wrote:
>
> [...]
>
>> 1. should an editor, and not just an admin, have the possibility of
>> checking in pending documents, regardless of whom the checkout belongs
>> to ? (my personal feeling says yes)
>> If so, then when she tries to open a document with an editor, but the
>> document is checked-out, we could provide her with a GUI to tell her
>> and ask "Do you want to override the checkout Yes / No"
>>
>> 2. should there be a sort of "time sanity check" ? Suppose the
>> document has been checked out for over 24 hours, we can assume the use
>> case was not properly completed (browser closed / crashed). In that
>> case we could offer any user to possibility to override the checkout,
>> even if regarding question 1. we decide not to give any user the
>> possibility to override a checkout at any time.
>
>
> Yes, this is certainly reasonable.
>
> Maybe it would even be possible to store the session ID in the checkout
> entry? This would allow to check if the corresponding session is still
> alive.
That's an interesting idea.
However I'm concerned about storing session IDs, because this is
sensitive information. Other users should not have access to a users'
(potentially still valid) session ID.
It could still be possible to hold this information only in memory, and
not make it available outside. That would require a more complex
mechanism, maybe a CheckOutEntryCache, or a CheckOutManager (stateful)
service, which knows which check-outs were created by which session.
BTW checking for active session IDs only makes sense in a one-container
environment - which of course is what Lenya currently is; just thinking
ahead for a Lenya 2.0 (or whatever); if content handling is uncoupled
from the CMS application, there could be several Lenyas running in
different containers, managing the same content. But, for the time
being, I think it would be worth it to have some form of "which checkout
belongs to which session" knowledge within Lenya.
Wolfgang
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org
Re: [1.4] Pessimistic offline lock and check-out
Posted by "Gregor J. Rothfuss" <gr...@apache.org>.
Andreas Hartmann wrote:
>> 2. should there be a sort of "time sanity check" ? Suppose the
>> document has been checked out for over 24 hours, we can assume the use
>> case was not properly completed (browser closed / crashed). In that
>> case we could offer any user to possibility to override the checkout,
>> even if regarding question 1. we decide not to give any user the
>> possibility to override a checkout at any time.
>
>
> Yes, this is certainly reasonable.
>
> Maybe it would even be possible to store the session ID in the checkout
> entry? This would allow to check if the corresponding session is still
> alive.
+1
those dead checkouts are one of the biggest drawbacks of the revision
controller
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org
Re: [1.4] Pessimistic offline lock and check-out
Posted by Andreas Hartmann <an...@apache.org>.
J. Wolfgang Kaltz wrote:
[...]
> 1. should an editor, and not just an admin, have the possibility of
> checking in pending documents, regardless of whom the checkout belongs
> to ? (my personal feeling says yes)
> If so, then when she tries to open a document with an editor, but the
> document is checked-out, we could provide her with a GUI to tell her and
> ask "Do you want to override the checkout Yes / No"
>
> 2. should there be a sort of "time sanity check" ? Suppose the document
> has been checked out for over 24 hours, we can assume the use case was
> not properly completed (browser closed / crashed). In that case we could
> offer any user to possibility to override the checkout, even if
> regarding question 1. we decide not to give any user the possibility to
> override a checkout at any time.
Yes, this is certainly reasonable.
Maybe it would even be possible to store the session ID in the checkout
entry? This would allow to check if the corresponding session is still alive.
-- Andreas
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org
Re: [1.4] Pessimistic offline lock and check-out
Posted by "J. Wolfgang Kaltz" <ka...@interactivesystems.info>.
Andreas Hartmann schrieb:
> (...)
>
> 2) 1.2 allowed subsequent check-outs of the same user without checking in.
> But consider the following scenario:
>
> 1. Alice begins to edit document A (A is checked out)
> 2. she opens another browser window (or even another browser)
> 3. she edits the <h1> of A (which is allowed by the system)
> 4. she saves A
> 5. she returns to the first browser window
> 6. she edits the <h1> of A
> 7. she saves A
>
> In this case, either the first changes are lost or a conflict occurs
> (depending on the implementation of "save").
>
> In 1.4, step (3) won't be allowed. But this means that you can't checkin
> a checked-out document by opening it with an editor.
+1 in principle (but see below also)
> I guess we need
> a functionality to check-in all pending documents (the admin may checkin
> all documents).
+1
I'm wondering about two things:
1. should an editor, and not just an admin, have the possibility of
checking in pending documents, regardless of whom the checkout belongs
to ? (my personal feeling says yes)
If so, then when she tries to open a document with an editor, but the
document is checked-out, we could provide her with a GUI to tell her and
ask "Do you want to override the checkout Yes / No"
2. should there be a sort of "time sanity check" ? Suppose the document
has been checked out for over 24 hours, we can assume the use case was
not properly completed (browser closed / crashed). In that case we could
offer any user to possibility to override the checkout, even if
regarding question 1. we decide not to give any user the possibility to
override a checkout at any time.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org