jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gazi Mushfiqur Rahman <gazimushfiqurrah...@gmail.com>
Subject Locking on nodes are not preserved in following sessions or requests
Date Tue, 25 Jan 2011 15:18:31 GMT
Hi all,

I am facing a problem on locking a node or resource. I am using Jackrabbit
from Apache Sling and I have the following code (esp file) to lock a node:

<!DOCTYPE html>
var session =
var wasLockableNode = currentNode.isNodeType("mix:lockable");
if (!wasLockableNode) {
var lockOwner = null;
var workspace = session.workspace;
var lockManager = workspace.lockManager;
var wasLocked = lockManager.isLocked(currentNode.path);
var locked = false;
if (!wasLocked) {
    var lock = lockManager.lock(currentNode.path, true, false, 120,
    locked = true;
} else {
    var lock = lockManager.getLock(currentNode.path);
        <title><%= currentNode.title %> is locked: <%= locked %></title>
            Is Locking Supported by Repository <%=
%><br />
            Is Locked <%= locked %><br />
            Lock Owner: <span id="owner"><%= lock.lockOwner %></span><br/>
            Lock Token: <span id="token"><%= lock.lockToken %></span><br
            Is Deep: <span id="deep"><%= lock.deep %></span><br />
            Is Session Scoped: <span><%= lock.sessionScoped %></span><br
            Is Current Session Owning Lock: <span
id="isLockOwningSession"><%= lock.lockOwningSession %></span><br/>
            Was lockable node: <%= wasLockableNode %><br />
            Was Locked: <%= wasLocked %><br />
            Remaining Seconds for the Lock <%= lock.secondsRemaining %><br
            Current Lock Tokens: <%=
Packages.java.util.Arrays.toString(lockManager.lockTokens) %><br />

After executing the above script, I find that the node was locked. But if I
execute the following script just after executing the previous one, I find
that node ia not locked!:
<!DOCTYPE html>
    <title><%= currentNode.title %></title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<h1><%= currentNode.title %></h1>
Title: <span id="title"><%= currentNode.title %></span><br />
Is Locked: <span id="locked"><%= currentNode.locked %></span><br />

Can anyone help me to find out the problem in my code or give me suggestion
on how to implement locking on nodes using Sling?

Thanks & Regards.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message