Hello devs,

I am a wee bit lost in regards of the lock mechanism in the usecase-fw.
Can somebody explain me how it is working?

Has the lock a state? I mean if the node is locked, is it locked in the
whole application till it get unlocked?

I debugged my usecase and it seems that this lock is invoked on the
beginning and on the end of the processing. In the meantime (within the
view) that lock is not up. The following scenario could IMO happen:

Scenario: Alice calls a usecase on a document and is now editing this
usecase within the view. It got locked on the beginning. While editing
this doc in the view it is IMO not locked (!) which means in my eyes
that e.g. user Specter can as well change it. Then Alice finish the
usecase and the lock will be raised again. But Specter already changed
it.

Is that understanding right? My assumption are coming from usecase.js.
Where we first create the usecase (line 73):
 usecase = usecaseResolver.resolve(sourceUrl, usecaseName);
to then release it in line 90 again:
 usecaseResolver.release(usecase);

Then the view processing takes place. After the processing of the view
we then create it again in line 221 and releasing it again in line 255. 

BTW why is this design? Why not resolving the usecase, store it in a var
and after completion release it again? That would have IMO the benefit
that it can be used throughout the flow and I expect that the nodes keep
the lock up. 

Everything is alright if you are using the usecase-fw with java only.
Now like you may have noticed I activated custom flow/cforms within the
usecase-fw. Here I noticed the problem. In my java usecase I am locking
the nodes and enter in the custom flow of the cforms. As soon as I am
using the javascript function saveDocument(document, uri) in my custom
flow I get:
Cannot write to source
[lenya://lenya/pubs/myPub/content/authoring/samples/sample/index_en.xml]: not 
locked!

I debugged my class and like I said on the beginning the nodes get
locked, when I do not use the saveDocument() on the uri and debugging I
see the nodes got locked again on the usecase.execute(). 

Why are they not locked in between?

My view definition for my usecase look like:
<view template="modules/sample/usecases/sample/sample.jx" type="cforms">
      <intro/>
      <definition template="modules/sample/usecases/sample/sample.xml">
          form.setAttribute("counter", new java.lang.Integer(0));
      </definition>
      <binding
template="modules/sample/usecases/sample/sample_binding.xml">
          generic.doc =
loadDocument(generic.proxy.getParameter('sourceUri'));
          form.load(generic.doc);
      </binding>    
      <outro>
        form.save(generic.doc);
        saveDocument(generic.doc, "/home/thorsten/testen.xml");
        saveDocument(generic.doc,
generic.proxy.getParameter('sourceUri'));
      </outro>
    </view>

How can we overcome this problem.

TIA for any ideas

salu2
-- 
thorsten

"Together we stand, divided we fall!" 
Hey you (Pink Floyd)


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

Reply via email to