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

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

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

Node.getLock介绍

[英]Returns the Lock object that applies to this node. This may be either a lock on this node itself or a deep lock on a node above this node.
[中]返回应用于此节点的Lock对象。这可能是此节点本身上的锁,也可能是此节点上方节点上的深锁。

代码示例

代码示例来源:origin: org.apache.sling/org.apache.sling.scripting.javascript

  1. public Object jsFunction_getLock() {
  2. try {
  3. return node.getLock();
  4. } catch (RepositoryException re) {
  5. return Undefined.instance;
  6. }
  7. }

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

  1. @Override
  2. public Lock getLock() throws LockException, RepositoryException {
  3. return this.node.getLock();
  4. }

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

  1. @Override
  2. @Deprecated
  3. public Lock getLock() throws RepositoryException {
  4. return getNode().getLock();
  5. }

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

  1. /**
  2. * @deprecated
  3. */
  4. @Deprecated
  5. public Lock getLock() throws RepositoryException {
  6. return getDelegate().getLock();
  7. }

代码示例来源:origin: net.adamcin.oakpal/oakpal-core

  1. @Override
  2. public Lock getLock() throws RepositoryException {
  3. Lock internal = delegate.getLock();
  4. return new LockFacade<>(internal, session);
  5. }

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

  1. @Override
  2. public Lock getLock() throws UnsupportedRepositoryOperationException, LockException, AccessDeniedException, RepositoryException {
  3. return getWrappedNode().getLock();
  4. }

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

  1. public void testGetLockOnChild() throws RepositoryException {
  2. // get lock must succeed even if child is not lockable.
  3. childNode.getLock();
  4. }

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

  1. public void testGetLockOnNewChild() throws RepositoryException {
  2. // get lock must succeed even if child is not lockable.
  3. Node newChild = lockedNode.addNode(nodeName3, testNodeType);
  4. newChild.getLock();
  5. }

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

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

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

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

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

  1. public void testGetNodeOnLockObtainedFromNewChild() throws RepositoryException {
  2. Node newChild = lockedNode.addNode(nodeName3, testNodeType);
  3. javax.jcr.lock.Lock lock = newChild.getLock();
  4. assertTrue("Lock.getNode() must return the lock holding node even if lock is obtained from child node.", lock.getNode().isSame(lockedNode));
  5. }

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

  1. /**
  2. * {@inheritDoc}
  3. */
  4. public void refreshLock(SessionInfo sessionInfo, NodeId nodeId)
  5. throws LockException, RepositoryException {
  6. getNode(nodeId, getSessionInfoImpl(sessionInfo)).getLock().refresh();
  7. }

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

  1. /**
  2. * {@inheritDoc}
  3. */
  4. public void refreshLock(SessionInfo sessionInfo, NodeId nodeId)
  5. throws LockException, RepositoryException {
  6. getNode(nodeId, getSessionInfoImpl(sessionInfo)).getLock().refresh();
  7. }

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

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

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

  1. public void testGetNodeOnLockObtainedFromChild() throws RepositoryException {
  2. javax.jcr.lock.Lock lock = childNode.getLock();
  3. assertTrue("Lock.getNode() must return the lock holding node even if lock is obtained from child node.", lock.getNode().isSame(lockedNode));
  4. }

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

  1. public void testGetNodeOnLockObtainedFromNewChild() throws RepositoryException {
  2. Node newChild = lockedNode.addNode(nodeName3, testNodeType);
  3. Lock lock = newChild.getLock();
  4. assertTrue("Lock.getNode() must return the lock holding node even if lock is obtained from child node.", lock.getNode().isSame(lockedNode));
  5. }

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

  1. public void testReadLockContent() throws RepositoryException, NotExecutableException {
  2. Node n = createLockedNode(testRootNode);
  3. Node childN = n.addNode(nodeName2);
  4. modifyPrivileges(n.getPath(), Privilege.JCR_READ, false);
  5. modifyPrivileges(childN.getPath(), Privilege.JCR_READ, true);
  6. Node childN2 = (Node) getTestSession().getItem(childN.getPath());
  7. try {
  8. childN2.getLock();
  9. fail("TestUser doesn't have permission to read the jcr:lockIsDeep property.");
  10. } catch (AccessDeniedException e) {
  11. // success
  12. }
  13. }

代码示例来源: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 testGetNodeOnLockObtainedFromChild() throws RepositoryException {
  2. Lock lock = childNode.getLock();
  3. assertTrue("Lock.getNode() must return the lock holding node even if lock is obtained from child node.", lock.getNode().isSame(lockedNode));
  4. }

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

  1. public void testRefreshAfterTokenTransfer2() throws Exception {
  2. String lockToken = lock.getLockToken();
  3. Node n2 = (Node) otherSession.getItem(lockedNode.getPath());
  4. try {
  5. superuser.removeLockToken(lockToken);
  6. otherSession.addLockToken(lockToken);
  7. n2.getLock().refresh();
  8. } finally {
  9. // move lock token back in order to have lock removed properly
  10. otherSession.removeLockToken(lockToken);
  11. superuser.addLockToken(lockToken);
  12. }
  13. }

相关文章