Jörn Nettingsmeier schrieb:
> hi!
> 
> 
> i'm trying to implement proper checkout (aka locking) for tinymce.
> andreas told me to
> 
>> - set the transaction policy of the usecase to "pessimistic"
>> - return the document's repository node in getNodesToLock()
> 
> in order to find out how to do that, i looked for clues in other
> modules. in webdav, i found the Put.java usecase handler, and i figured
> the same locking that's good for webdav uploads should be ok for an
> editor usecase as well. but it seems there is a whole bunch of nodes
> being locked:
> 
> /**
>  * @see org.apache.lenya.cms.usecase.AbstractUsecase#getNodesToLock()
>  */
> protected Node[] getNodesToLock() throws UsecaseException {
>     try {
>         Document doc = getSourceDocument();
>         List nodes = new ArrayList();
>         NodeSet set = SiteUtil.getSubSite(this.manager,
>                 doc.getLink().getNode());
>         Document[] documents = set.getDocuments();
>         for (int i = 0; i < documents.length; i++) {
>             nodes.add(documents[i].getRepositoryNode());
>         }

That's indeed strange, I don't know why the descendants of the
document are locked.

>         SiteStructure structure = getSourceDocument().area().getSite();
>         nodes.add(structure.getRepositoryNode());

Maybe locking the site structure is not even necessary, since the
WebDAV upload or any other editing step doesn't compromise the
site structure.

>         return (Node[]) nodes.toArray(new Node[nodes.size()]);
>     } catch (Exception e) {
>         throw new UsecaseException(e);
>     }
> }
> 
> let me see. i edit a document
> "mysite.org/mypub/authoring/some/path/to/foo.html".
> does that mean i have to lock "/some.html", "/some/path.html",
> "/some/path/to.html" and finally "/some/path/to/foo.html"?

No, not at all.

> i can see how that made sense with the old repository implementation,
> but is it really necessary now that we have moved to UUIDs and each
> document is addressed directly?
> the answer probably depends on how we want to handle sitetree updates.
> there was some discussion about this a while ago, but i can't remember
> what was decided.

Me neither ...

> if i lock all those nodes, i can be sure that nobody makes changes to
> the relevant sub-sitetree while somebody is editing a file. but it also
> means that when someone is editing *any* document, you can't edit any of
> its ancestors, right?

I guess it would be sufficient to lock the to-be-edited document itself.


-- Andreas


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to