javax.jcr.Node.unlock()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(178)

本文整理了Java中javax.jcr.Node.unlock()方法的一些代码示例,展示了Node.unlock()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.unlock()方法的具体详情如下:
包路径:javax.jcr.Node
类名称:Node
方法名:unlock

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:lockOwnerjcr:lockIsDeep。这些变化会自动保持;无需致电save。此外,相应的锁令牌将从当前Session持有的锁令牌集中删除。
如果此节点当前未持有锁或持有的锁不是此Session的所有者,则会抛出LockException。但是请注意,系统可能会授予非所有者会话解锁锁的权限。通常,这种“锁超级用户”功能旨在促进孤立的开放范围锁的管理清理。
请注意,即使节点已签入,也可以将其解锁(尽管处于签入状态,但与锁定相关的属性仍将更改)。

代码示例

代码示例来源:origin: info.magnolia/magnolia-core

  1. @Override
  2. public void unlock() throws LockException, RepositoryException {
  3. this.node.unlock();
  4. }

代码示例来源:origin: apache/jackrabbit

  1. public Object run() throws RepositoryException {
  2. getNode(nodeId, sInfo).unlock();
  3. return null;
  4. }
  5. }, sInfo);

代码示例来源:origin: org.apache.jackrabbit/jackrabbit-spi2jcr

  1. public Object run() throws RepositoryException {
  2. getNode(nodeId, sInfo).unlock();
  3. return null;
  4. }
  5. }, sInfo);

代码示例来源:origin: net.adamcin.commons/net.adamcin.commons.jcr

  1. public void unlock() throws RepositoryException {
  2. this.item.unlock();
  3. }

代码示例来源:origin: apache/jackrabbit

  1. /** {@inheritDoc} */
  2. public void unlock() throws RepositoryException, RemoteException {
  3. try {
  4. node.unlock();
  5. } catch (RepositoryException ex) {
  6. throw getRepositoryException(ex);
  7. }
  8. }

代码示例来源:origin: nl.vpro/jcr-criteria

  1. @Override
  2. @Deprecated
  3. public void unlock() throws RepositoryException {
  4. getNode().unlock();
  5. }

代码示例来源:origin: info.magnolia/magnolia-core

  1. @Override
  2. public void unlock() throws UnsupportedRepositoryOperationException, LockException, AccessDeniedException, InvalidItemStateException, RepositoryException {
  3. getWrappedNode().unlock();
  4. }

代码示例来源:origin: brix-cms/brix-cms

  1. public void execute() throws Exception {
  2. getDelegate().unlock();
  3. }
  4. });

代码示例来源:origin: apache/jackrabbit

  1. public void tearDown() throws Exception {
  2. if (testNode.holdsLock()) {
  3. testNode.unlock();
  4. }
  5. testNode = null;
  6. referenceNode = null;
  7. superuser.save();
  8. super.tearDown();
  9. }

代码示例来源:origin: apache/jackrabbit

  1. /**
  2. * @see javax.jcr.lock.LockManager#unlock(String)
  3. */
  4. public void unlock(String absPath) throws LockException, RepositoryException {
  5. Node n = itemManager.getNode(resolver.getQPath(absPath));
  6. n.unlock();
  7. }

代码示例来源:origin: org.apache.jackrabbit/jackrabbit-jcr2spi

  1. /**
  2. * @see javax.jcr.lock.LockManager#unlock(String)
  3. */
  4. public void unlock(String absPath) throws LockException, RepositoryException {
  5. Node n = itemManager.getNode(resolver.getQPath(absPath));
  6. n.unlock();
  7. }

代码示例来源:origin: brix-cms/brix-cms

  1. /**
  2. * @deprecated
  3. */
  4. @Deprecated
  5. public void unlock() throws RepositoryException {
  6. getActionHandler().beforeNodeUnlock(this);
  7. getDelegate().unlock();
  8. getActionHandler().afterNodeUnlock(this);
  9. }

代码示例来源:origin: apache/jackrabbit

  1. public void execute(Session session, Node test) throws RepositoryException {
  2. Node n = test.addNode("test");
  3. n.addMixin(mixLockable);
  4. session.save();
  5. for (int i = 0; i < NUM_OPERATIONS / CONCURRENCY; i++) {
  6. n.lock(false, true);
  7. n.unlock();
  8. }
  9. }
  10. }, CONCURRENCY);

代码示例来源:origin: apache/jackrabbit

  1. @Override
  2. protected void tearDown() throws Exception {
  3. try {
  4. lockedNode.unlock();
  5. } catch (RepositoryException e) {
  6. log.warn(e.getMessage());
  7. }
  8. lockedNode = null;
  9. childNode = null;
  10. lock = null;
  11. super.tearDown();
  12. }

代码示例来源:origin: apache/jackrabbit

  1. public void execute(Session session, Node test) throws RepositoryException {
  2. Node n = test.addNode("test");
  3. n.addMixin(mixLockable);
  4. session.save();
  5. for (int i = 0; i < NUM_OPERATIONS / CONCURRENCY; i++) {
  6. if (n.isLocked()) {
  7. n.unlock();
  8. }
  9. n.lock(false, true);
  10. }
  11. }
  12. }, CONCURRENCY);

代码示例来源:origin: apache/jackrabbit

  1. public void execute(Session session, Node test) throws RepositoryException {
  2. // add versionable nodes
  3. for (int i = 0; i < NUM_OPERATIONS / CONCURRENCY; i++) {
  4. Node n = test.addNode("test" + i);
  5. n.addMixin(mixLockable);
  6. session.save();
  7. Lock l = n.lock(false, true);
  8. l.refresh();
  9. n.unlock();
  10. }
  11. }
  12. }, CONCURRENCY);

代码示例来源:origin: apache/jackrabbit

  1. public void testLock2() throws RepositoryException, NotExecutableException {
  2. Node n = createLockableNode(testRootNode);
  3. modifyPrivileges(n.getPath(), PrivilegeRegistry.REP_WRITE, false);
  4. modifyPrivileges(n.getPath(), Privilege.JCR_LOCK_MANAGEMENT, true);
  5. Node n2 = getTestNode().getNode(nodeName1);
  6. // all lock operations must succeed
  7. Lock l = n2.lock(true, true);
  8. l.refresh();
  9. n2.unlock();
  10. }

代码示例来源:origin: apache/jackrabbit

  1. /**
  2. * If a locked nodes is unlocked again, any Lock instance retrieved by
  3. * another session must change the lock-status. Similarly, the previously
  4. * locked node must not be marked locked any more.
  5. */
  6. public void testUnlockByOtherSession() throws RepositoryException {
  7. Node ln2 = (Node) otherSession.getItem(lockedNode.getPath());
  8. Lock l2 = ln2.getLock();
  9. lockedNode.unlock();
  10. assertFalse("Lock must be informed if Node is unlocked.", l2.isLive());
  11. }

代码示例来源:origin: apache/jackrabbit

  1. public void testUnlockAfterTokenTransfer() throws Exception {
  2. String lockToken = lock.getLockToken();
  3. try {
  4. superuser.removeLockToken(lockToken);
  5. lockedNode.unlock();
  6. fail("After transfering lock token the original lock object cannot be unlocked by session, that does hold lock any more.");
  7. } catch (LockException e) {
  8. // oK
  9. } finally {
  10. // move lock token back in order to have lock removed properly
  11. superuser.addLockToken(lockToken);
  12. }
  13. }

代码示例来源:origin: apache/jackrabbit

  1. public void testParentChildLock2() throws Exception {
  2. childNode.addMixin(mixLockable);
  3. testRootNode.save();
  4. try {
  5. Lock l = childNode.lock(false, isSessionScoped());
  6. assertTrue("child node must still hold lock", l.getNode().isSame(childNode));
  7. } finally {
  8. childNode.unlock();
  9. }
  10. }

相关文章