@Override public Lock lock( String absPath, boolean isDeep, boolean isSessionScoped, long timeoutHint, String ownerInfo ) throws LockException, PathNotFoundException, AccessDeniedException, InvalidItemStateException, RepositoryException { AbstractJcrNode node = session.node(session.absolutePathFor(absPath)); return lock(node, isDeep, isSessionScoped, timeoutHint, ownerInfo); }
@Override public void unlock( String absPath ) throws PathNotFoundException, LockException, AccessDeniedException, InvalidItemStateException, RepositoryException { AbstractJcrNode node = session.node(session.absolutePathFor(absPath)); unlock(node); }
@Override public boolean isLocked( String absPath ) throws PathNotFoundException, RepositoryException { return getLowestLockAlongPath(session.node(session.absolutePathFor(absPath)), true) != null; }
@Override public Lock lock( String absPath, boolean isDeep, boolean isSessionScoped, long timeoutHint, String ownerInfo ) throws LockException, PathNotFoundException, AccessDeniedException, InvalidItemStateException, RepositoryException { AbstractJcrNode node = session.node(session.absolutePathFor(absPath)); return lock(node, isDeep, isSessionScoped, timeoutHint, ownerInfo); }
@Override public void unlock( String absPath ) throws PathNotFoundException, LockException, AccessDeniedException, InvalidItemStateException, RepositoryException { AbstractJcrNode node = session.node(session.absolutePathFor(absPath)); unlock(node); }
@Override public boolean isLocked( String absPath ) throws PathNotFoundException, RepositoryException { return getLowestLockAlongPath(session.node(session.absolutePathFor(absPath)), true) != null; }
@Override public AbstractJcrItem getItem( String absPath ) throws PathNotFoundException, RepositoryException { checkLive(); CheckArg.isNotEmpty(absPath, "absPath"); Path path = absolutePathFor(absPath); return getItem(path); }
@Override public boolean nodeExists( String absPath ) throws RepositoryException { // This is an optimized version of 'getNode(absPath)' ... checkLive(); CheckArg.isNotEmpty(absPath, "absPath"); Path absolutePath = absolutePathFor(absPath); try { return node(absolutePath) != null; } catch (PathNotFoundException e) { return false; } }
@Override public boolean nodeExists( String absPath ) throws RepositoryException { // This is an optimized version of 'getNode(absPath)' ... checkLive(); CheckArg.isNotEmpty(absPath, "absPath"); Path absolutePath = absolutePathFor(absPath); try { return node(absolutePath) != null; } catch (PathNotFoundException e) { return false; } }
@Override public boolean holdsLock( String absPath ) throws PathNotFoundException, RepositoryException { AbstractJcrNode node = session.node(session.absolutePathFor(absPath)); return lockManager.findLockFor(node.key()) != null; }
@Override public AbstractJcrItem getItem( String absPath ) throws PathNotFoundException, RepositoryException { checkLive(); CheckArg.isNotEmpty(absPath, "absPath"); Path path = absolutePathFor(absPath); return getItem(path); }
@Override public boolean holdsLock( String absPath ) throws PathNotFoundException, RepositoryException { AbstractJcrNode node = session.node(session.absolutePathFor(absPath)); return lockManager.findLockFor(node.key()) != null; }
@Override public Lock getLock( String absPath ) throws PathNotFoundException, LockException, AccessDeniedException, RepositoryException { ModeShapeLock lock = getLowestLockAlongPath(session.node(session.absolutePathFor(absPath)), false); if (lock != null) return lock.lockFor(session); throw new LockException(JcrI18n.notLocked.text(absPath)); }
@Override public boolean hasPermission( String absPath, String actions ) throws RepositoryException { checkLive(); CheckArg.isNotEmpty(absPath, "absPath"); PathSupplier pathSupplier = pathSupplierFor(absolutePathFor(absPath)); String[] actionsArray = actions.split(","); String workspaceName = this.workspace().getName(); return hasPermission(workspaceName, pathSupplier, actionsArray) && hasPermissionOnExternalPath(pathSupplier, actionsArray); }
@Override public boolean hasPermission( String absPath, String actions ) throws RepositoryException { checkLive(); CheckArg.isNotEmpty(absPath, "absPath"); PathSupplier pathSupplier = pathSupplierFor(absolutePathFor(absPath)); String[] actionsArray = actions.split(","); String workspaceName = this.workspace().getName(); return hasPermission(workspaceName, pathSupplier, actionsArray) && hasPermissionOnExternalPath(pathSupplier, actionsArray); }
@Override public Lock getLock( String absPath ) throws PathNotFoundException, LockException, AccessDeniedException, RepositoryException { ModeShapeLock lock = getLowestLockAlongPath(session.node(session.absolutePathFor(absPath)), false); if (lock != null) return lock.lockFor(session); throw new LockException(JcrI18n.notLocked.text(absPath)); }
protected AbstractJcrNode getNode( String absPath, boolean accessControlScope ) throws PathNotFoundException, RepositoryException { checkLive(); CheckArg.isNotEmpty(absPath, "absolutePath"); Path path = absolutePathFor(absPath); if (!accessControlScope) { checkPermission(path, ModeShapePermissions.READ); } // Return root node if path is "/" ... if (path.isRoot()) { return getRootNode(); } return node(path); }
protected AbstractJcrNode getNode( String absPath, boolean accessControlScope ) throws PathNotFoundException, RepositoryException { checkLive(); CheckArg.isNotEmpty(absPath, "absolutePath"); Path path = absolutePathFor(absPath); if (!accessControlScope) { checkPermission(path, ModeShapePermissions.READ); } // Return root node if path is "/" ... if (path.isRoot()) { return getRootNode(); } return node(path); }
protected void restoreAtAbsPath( String absPath, Version version, boolean removeExisting, boolean failIfNodeAlreadyExists ) throws RepositoryException { validateSessionLiveWithoutPendingChanges(); // Create a new session in which we'll finish the restore, so this session remains thread-safe ... JcrSession restoreSession = session.spawnSession(false); Path path = restoreSession.absolutePathFor(absPath); if (failIfNodeAlreadyExists) { try { AbstractJcrNode existingNode = restoreSession.node(path); String msg = JcrI18n.unableToRestoreAtAbsPathNodeAlreadyExists.text(absPath, existingNode.key()); throw new VersionException(msg); } catch (PathNotFoundException e) { // expected } } restore(restoreSession, path, version, null, removeExisting); }
@Override public void checkPermission( String path, String actions ) { CheckArg.isNotEmpty(path, "path"); CheckArg.isNotEmpty(actions, "actions"); try { PathSupplier supplier = pathSupplierFor(absolutePathFor(path)); String[] actionsArray = actions.split(","); checkPermission(workspace().getName(), supplier, actionsArray); if (!hasPermissionOnExternalPath(supplier, actionsArray)) { String absPath = supplier.getAbsolutePath().getString(namespaces()); throw new AccessDeniedException(JcrI18n.permissionDenied.text(absPath, actions)); } } catch (RepositoryException e) { throw new AccessControlException(JcrI18n.permissionDenied.text(path, actions)); } }