本文整理了Java中javax.jcr.Node.unlock()
方法的一些代码示例,展示了Node.unlock()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.unlock()
方法的具体详情如下:
包路径:javax.jcr.Node
类名称:Node
方法名:unlock
[英]Removes the lock on this node. Also removes the properties jcr:lockOwner
and jcr:lockIsDeep
from this node. These changes are persisted automatically; there is no need to call save
. As well, the corresponding lock token is removed from the set of lock tokens held by the current Session
.
If this node does not currently hold a lock or holds a lock for which this Session
is not the owner, then a LockException
is thrown. Note however that the system may give permission to a non-owning session to unlock a lock. Typically such "lock-superuser" capability is intended to facilitate administrational clean-up of orphaned open-scoped locks.
Note that it is possible to unlock a node even if it is checked-in (the lock-related properties will be changed despite the checked-in status).
[中]移除此节点上的锁。还将从此节点中删除属性jcr:lockOwner
和jcr:lockIsDeep
。这些变化会自动保持;无需致电save
。此外,相应的锁令牌将从当前Session
持有的锁令牌集中删除。
如果此节点当前未持有锁或持有的锁不是此Session
的所有者,则会抛出LockException
。但是请注意,系统可能会授予非所有者会话解锁锁的权限。通常,这种“锁超级用户”功能旨在促进孤立的开放范围锁的管理清理。
请注意,即使节点已签入,也可以将其解锁(尽管处于签入状态,但与锁定相关的属性仍将更改)。
代码示例来源:origin: info.magnolia/magnolia-core
@Override
public void unlock() throws LockException, RepositoryException {
this.node.unlock();
}
代码示例来源:origin: apache/jackrabbit
public Object run() throws RepositoryException {
getNode(nodeId, sInfo).unlock();
return null;
}
}, sInfo);
代码示例来源:origin: org.apache.jackrabbit/jackrabbit-spi2jcr
public Object run() throws RepositoryException {
getNode(nodeId, sInfo).unlock();
return null;
}
}, sInfo);
代码示例来源:origin: net.adamcin.commons/net.adamcin.commons.jcr
public void unlock() throws RepositoryException {
this.item.unlock();
}
代码示例来源:origin: apache/jackrabbit
/** {@inheritDoc} */
public void unlock() throws RepositoryException, RemoteException {
try {
node.unlock();
} catch (RepositoryException ex) {
throw getRepositoryException(ex);
}
}
代码示例来源:origin: nl.vpro/jcr-criteria
@Override
@Deprecated
public void unlock() throws RepositoryException {
getNode().unlock();
}
代码示例来源:origin: info.magnolia/magnolia-core
@Override
public void unlock() throws UnsupportedRepositoryOperationException, LockException, AccessDeniedException, InvalidItemStateException, RepositoryException {
getWrappedNode().unlock();
}
代码示例来源:origin: brix-cms/brix-cms
public void execute() throws Exception {
getDelegate().unlock();
}
});
代码示例来源:origin: apache/jackrabbit
public void tearDown() throws Exception {
if (testNode.holdsLock()) {
testNode.unlock();
}
testNode = null;
referenceNode = null;
superuser.save();
super.tearDown();
}
代码示例来源:origin: apache/jackrabbit
/**
* @see javax.jcr.lock.LockManager#unlock(String)
*/
public void unlock(String absPath) throws LockException, RepositoryException {
Node n = itemManager.getNode(resolver.getQPath(absPath));
n.unlock();
}
代码示例来源:origin: org.apache.jackrabbit/jackrabbit-jcr2spi
/**
* @see javax.jcr.lock.LockManager#unlock(String)
*/
public void unlock(String absPath) throws LockException, RepositoryException {
Node n = itemManager.getNode(resolver.getQPath(absPath));
n.unlock();
}
代码示例来源:origin: brix-cms/brix-cms
/**
* @deprecated
*/
@Deprecated
public void unlock() throws RepositoryException {
getActionHandler().beforeNodeUnlock(this);
getDelegate().unlock();
getActionHandler().afterNodeUnlock(this);
}
代码示例来源:origin: apache/jackrabbit
public void execute(Session session, Node test) throws RepositoryException {
Node n = test.addNode("test");
n.addMixin(mixLockable);
session.save();
for (int i = 0; i < NUM_OPERATIONS / CONCURRENCY; i++) {
n.lock(false, true);
n.unlock();
}
}
}, CONCURRENCY);
代码示例来源:origin: apache/jackrabbit
@Override
protected void tearDown() throws Exception {
try {
lockedNode.unlock();
} catch (RepositoryException e) {
log.warn(e.getMessage());
}
lockedNode = null;
childNode = null;
lock = null;
super.tearDown();
}
代码示例来源:origin: apache/jackrabbit
public void execute(Session session, Node test) throws RepositoryException {
Node n = test.addNode("test");
n.addMixin(mixLockable);
session.save();
for (int i = 0; i < NUM_OPERATIONS / CONCURRENCY; i++) {
if (n.isLocked()) {
n.unlock();
}
n.lock(false, true);
}
}
}, CONCURRENCY);
代码示例来源:origin: apache/jackrabbit
public void execute(Session session, Node test) throws RepositoryException {
// add versionable nodes
for (int i = 0; i < NUM_OPERATIONS / CONCURRENCY; i++) {
Node n = test.addNode("test" + i);
n.addMixin(mixLockable);
session.save();
Lock l = n.lock(false, true);
l.refresh();
n.unlock();
}
}
}, CONCURRENCY);
代码示例来源:origin: apache/jackrabbit
public void testLock2() throws RepositoryException, NotExecutableException {
Node n = createLockableNode(testRootNode);
modifyPrivileges(n.getPath(), PrivilegeRegistry.REP_WRITE, false);
modifyPrivileges(n.getPath(), Privilege.JCR_LOCK_MANAGEMENT, true);
Node n2 = getTestNode().getNode(nodeName1);
// all lock operations must succeed
Lock l = n2.lock(true, true);
l.refresh();
n2.unlock();
}
代码示例来源:origin: apache/jackrabbit
/**
* If a locked nodes is unlocked again, any Lock instance retrieved by
* another session must change the lock-status. Similarly, the previously
* locked node must not be marked locked any more.
*/
public void testUnlockByOtherSession() throws RepositoryException {
Node ln2 = (Node) otherSession.getItem(lockedNode.getPath());
Lock l2 = ln2.getLock();
lockedNode.unlock();
assertFalse("Lock must be informed if Node is unlocked.", l2.isLive());
}
代码示例来源:origin: apache/jackrabbit
public void testUnlockAfterTokenTransfer() throws Exception {
String lockToken = lock.getLockToken();
try {
superuser.removeLockToken(lockToken);
lockedNode.unlock();
fail("After transfering lock token the original lock object cannot be unlocked by session, that does hold lock any more.");
} catch (LockException e) {
// oK
} finally {
// move lock token back in order to have lock removed properly
superuser.addLockToken(lockToken);
}
}
代码示例来源:origin: apache/jackrabbit
public void testParentChildLock2() throws Exception {
childNode.addMixin(mixLockable);
testRootNode.save();
try {
Lock l = childNode.lock(false, isSessionScoped());
assertTrue("child node must still hold lock", l.getNode().isSame(childNode));
} finally {
childNode.unlock();
}
}
内容来源于网络,如有侵权,请联系作者删除!