@Override public void cancelMerge( String absPath, Version version ) throws VersionException, InvalidItemStateException, UnsupportedRepositoryOperationException, RepositoryException { // Create a new session in which we'll perform the cancel, so this session remains thread-safe ... JcrSession cancelSession = session.spawnSession(false); cancelMerge(cancelSession.getNode(absPath), version); }
@Override public void cancelMerge( String absPath, Version version ) throws VersionException, InvalidItemStateException, UnsupportedRepositoryOperationException, RepositoryException { // Create a new session in which we'll perform the cancel, so this session remains thread-safe ... JcrSession cancelSession = session.spawnSession(false); cancelMerge(cancelSession.getNode(absPath), version); }
@Override public void createWorkspace( String name, String srcWorkspace ) throws AccessDeniedException, UnsupportedRepositoryOperationException, NoSuchWorkspaceException, RepositoryException { validateCrossWorkspaceAction(srcWorkspace); createWorkspace(name); JcrSession newWorkspaceSession = session.spawnSession(name, false); JcrSession srcWorkspaceSession = session.spawnSession(srcWorkspace, true); deepClone(srcWorkspaceSession, srcWorkspaceSession.getRootNode().key(), newWorkspaceSession, newWorkspaceSession.getRootNode().key()); }
@Override public void createWorkspace( String name, String srcWorkspace ) throws AccessDeniedException, UnsupportedRepositoryOperationException, NoSuchWorkspaceException, RepositoryException { validateCrossWorkspaceAction(srcWorkspace); createWorkspace(name); JcrSession newWorkspaceSession = session.spawnSession(name, false); JcrSession srcWorkspaceSession = session.spawnSession(srcWorkspace, true); deepClone(srcWorkspaceSession, srcWorkspaceSession.getRootNode().key(), newWorkspaceSession, newWorkspaceSession.getRootNode().key()); }
@Override public void doneMerge( String absPath, Version version ) throws VersionException, InvalidItemStateException, UnsupportedRepositoryOperationException, RepositoryException { if (LOGGER.isDebugEnabled()) LOGGER.debug("VersionManager.doneMerge('{0}',{1})", absPath, version); // Create a new session in which we'll finish the merge, so this session remains thread-safe ... JcrSession mergeSession = session.spawnSession(false); doneMerge(mergeSession.getNode(absPath), version); }
@Override public void doneMerge( String absPath, Version version ) throws VersionException, InvalidItemStateException, UnsupportedRepositoryOperationException, RepositoryException { if (LOGGER.isDebugEnabled()) LOGGER.debug("VersionManager.doneMerge('{0}',{1})", absPath, version); // Create a new session in which we'll finish the merge, so this session remains thread-safe ... JcrSession mergeSession = session.spawnSession(false); doneMerge(mergeSession.getNode(absPath), version); }
@Override public void move( String srcAbsPath, String destAbsPath ) throws ConstraintViolationException, VersionException, AccessDeniedException, PathNotFoundException, ItemExistsException, LockException, RepositoryException { session.checkLive(); CheckArg.isNotEmpty(srcAbsPath, "srcAbsPath"); CheckArg.isNotEmpty(destAbsPath, "destAbsPath"); // Create a new JCR session, perform the move, and then save the session ... JcrSession moveSession = this.session.spawnSession(false); moveSession.move(srcAbsPath, destAbsPath); moveSession.save(); }
@Override public void move( String srcAbsPath, String destAbsPath ) throws ConstraintViolationException, VersionException, AccessDeniedException, PathNotFoundException, ItemExistsException, LockException, RepositoryException { session.checkLive(); CheckArg.isNotEmpty(srcAbsPath, "srcAbsPath"); CheckArg.isNotEmpty(destAbsPath, "destAbsPath"); // Create a new JCR session, perform the move, and then save the session ... JcrSession moveSession = this.session.spawnSession(false); moveSession.move(srcAbsPath, destAbsPath); moveSession.save(); }
@Override public void restoreByLabel( String absPath, String versionLabel, boolean removeExisting ) throws VersionException, ItemExistsException, UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException { if (LOGGER.isDebugEnabled()) LOGGER.debug("VersionManager.restoreByLabel('{0}','{1}',{2})", absPath, versionLabel, removeExisting); validateSessionLiveWithoutPendingChanges(); // Create a new session in which we'll finish the restore, so this session remains thread-safe ... JcrSession restoreSession = session.spawnSession(false); restoreSession.getNode(absPath).restoreByLabel(versionLabel, removeExisting); }
@Override public void restoreByLabel( String absPath, String versionLabel, boolean removeExisting ) throws VersionException, ItemExistsException, UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException { if (LOGGER.isDebugEnabled()) LOGGER.debug("VersionManager.restoreByLabel('{0}','{1}',{2})", absPath, versionLabel, removeExisting); validateSessionLiveWithoutPendingChanges(); // Create a new session in which we'll finish the restore, so this session remains thread-safe ... JcrSession restoreSession = session.spawnSession(false); restoreSession.getNode(absPath).restoreByLabel(versionLabel, removeExisting); }
@Override public NodeIterator merge( String absPath, String srcWorkspace, boolean bestEffort, boolean isShallow ) throws NoSuchWorkspaceException, AccessDeniedException, MergeException, LockException, InvalidItemStateException, RepositoryException { if (LOGGER.isDebugEnabled()) LOGGER.debug("VersionManager.merge('{0}','{1}',{2})", absPath, srcWorkspace, bestEffort); CheckArg.isNotNull(srcWorkspace, "source workspace name"); // Create a new session in which we'll finish the merge, so this session remains thread-safe ... JcrSession mergeSession = session.spawnSession(false); AbstractJcrNode node = mergeSession.getNode(absPath); return merge(node, srcWorkspace, bestEffort, isShallow); }
@Override public NodeIterator merge( String absPath, String srcWorkspace, boolean bestEffort, boolean isShallow ) throws NoSuchWorkspaceException, AccessDeniedException, MergeException, LockException, InvalidItemStateException, RepositoryException { if (LOGGER.isDebugEnabled()) LOGGER.debug("VersionManager.merge('{0}','{1}',{2})", absPath, srcWorkspace, bestEffort); CheckArg.isNotNull(srcWorkspace, "source workspace name"); // Create a new session in which we'll finish the merge, so this session remains thread-safe ... JcrSession mergeSession = session.spawnSession(false); AbstractJcrNode node = mergeSession.getNode(absPath); return merge(node, srcWorkspace, bestEffort, isShallow); }
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); }
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 remove( String absPath ) throws UnsupportedOperationException, PathNotFoundException, VersionException, RepositoryException { if (LOGGER.isDebugEnabled()) LOGGER.debug("VersionManager.remove('{0}')", absPath); JcrSession removeSession = session.spawnSession(false); AbstractJcrNode node = removeSession.getNode(absPath); checkVersionable(node); SessionCache systemCache = session.createSystemCache(false); removeHistories(node, systemCache); node.remove(); removeSession.cache().save(systemCache, null); }
@Override public void remove( String absPath ) throws UnsupportedOperationException, PathNotFoundException, VersionException, RepositoryException { if (LOGGER.isDebugEnabled()) LOGGER.debug("VersionManager.remove('{0}')", absPath); JcrSession removeSession = session.spawnSession(false); AbstractJcrNode node = removeSession.getNode(absPath); checkVersionable(node); SessionCache systemCache = session.createSystemCache(false); removeHistories(node, systemCache); node.remove(); removeSession.cache().save(systemCache, null); }
@Override public void restore( String absPath, String versionName, boolean removeExisting ) throws VersionException, ItemExistsException, UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException { if (LOGGER.isDebugEnabled()) LOGGER.debug("VersionManager.restore('{0}','{1}',{2})", absPath, versionName, removeExisting); validateSessionLiveWithoutPendingChanges(); // Create a new session in which we'll finish the restore, so this session remains thread-safe ... JcrSession restoreSession = session.spawnSession(false); Version version = null; // See if the node at absPath exists and has version storage. Path path = restoreSession.absolutePathFor(absPath); AbstractJcrNode existingNode = restoreSession.node(path); VersionHistory historyNode = existingNode.getVersionHistory(); version = historyNode.getVersion(versionName); assert version != null; restore(restoreSession, path, version, null, removeExisting); }
@Override public void restore( String absPath, String versionName, boolean removeExisting ) throws VersionException, ItemExistsException, UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException { if (LOGGER.isDebugEnabled()) LOGGER.debug("VersionManager.restore('{0}','{1}',{2})", absPath, versionName, removeExisting); validateSessionLiveWithoutPendingChanges(); // Create a new session in which we'll finish the restore, so this session remains thread-safe ... JcrSession restoreSession = session.spawnSession(false); Version version = null; // See if the node at absPath exists and has version storage. Path path = restoreSession.absolutePathFor(absPath); AbstractJcrNode existingNode = restoreSession.node(path); VersionHistory historyNode = existingNode.getVersionHistory(); version = historyNode.getVersion(versionName); assert version != null; restore(restoreSession, path, version, null, removeExisting); }
@Override public void restore( Version version, boolean removeExisting ) throws VersionException, ItemExistsException, InvalidItemStateException, UnsupportedRepositoryOperationException, LockException, RepositoryException { if (LOGGER.isDebugEnabled()) LOGGER.debug("VersionManager.restore({0},{1})", version, removeExisting); validateSessionLiveWithoutPendingChanges(); // Create a new session in which we'll finish the restore, so this session remains thread-safe ... JcrSession restoreSession = session.spawnSession(false); String identifier = version.getContainingHistory().getVersionableIdentifier(); AbstractJcrNode node = null; try { node = restoreSession.getNonSystemNodeByIdentifier(identifier); } catch (ItemNotFoundException e) { throw new VersionException(JcrI18n.invalidVersionForRestore.text()); } Path path = node.path(); restore(restoreSession, path, version, null, removeExisting); }
@Override public void restore( Version version, boolean removeExisting ) throws VersionException, ItemExistsException, InvalidItemStateException, UnsupportedRepositoryOperationException, LockException, RepositoryException { if (LOGGER.isDebugEnabled()) LOGGER.debug("VersionManager.restore({0},{1})", version, removeExisting); validateSessionLiveWithoutPendingChanges(); // Create a new session in which we'll finish the restore, so this session remains thread-safe ... JcrSession restoreSession = session.spawnSession(false); String identifier = version.getContainingHistory().getVersionableIdentifier(); AbstractJcrNode node = null; try { node = restoreSession.getNonSystemNodeByIdentifier(identifier); } catch (ItemNotFoundException e) { throw new VersionException(JcrI18n.invalidVersionForRestore.text()); } Path path = node.path(); restore(restoreSession, path, version, null, removeExisting); }