public MergeCommand( AbstractJcrNode targetNode, JcrSession sourceSession, boolean bestEffort, boolean isShallow ) { this.targetNode = targetNode; this.sourceSession = sourceSession; this.cache = this.sourceSession.cache(); this.bestEffort = bestEffort; this.isShallow = isShallow; this.sourceWorkspaceName = sourceSession.getWorkspace().getName(); this.failures = new LinkedList<AbstractJcrNode>(); }
@Override public boolean hasPendingChanges() throws RepositoryException { checkLive(); return cache().hasChanges(); }
@Override public boolean hasPendingChanges() throws RepositoryException { checkLive(); return cache().hasChanges(); }
/** * This method can be called by workspace-write methods, which (if a transaction has started after this session was * created) can persist changes (via their SessionCache.save()) */ private void signalSaveOfSystemChanges() { try { cache().checkForTransaction(); } catch (SystemException e) { throw new SystemFailureException(e); } }
/** * This method can be called by workspace-write methods, which (if a transaction has started after this session was * created) can persist changes (via their SessionCache.save()) */ private void signalSaveOfSystemChanges() { try { cache().checkForTransaction(); } catch (SystemException e) { throw new SystemFailureException(e); } }
@Override public void refresh( boolean keepChanges ) throws RepositoryException { CachedNode node = node(); // TCK: this should throw an exception if the node has been removed if (!keepChanges) { session.cache().clear(node); } }
@Override public long getChildCount( CachedNode node ) { assert node != null; return node.getChildReferences(session.cache()).size(); }
/** * Get the number of shared nodes within this shared set. * * @return the number of shared nodes; always 1 or more * @throws RepositoryException if there's a problem getting the size */ public int getSize() throws RepositoryException { final SessionCache cache = session().cache(); Set<NodeKey> additionalParents = shareableNode.node().getAdditionalParentKeys(cache); return additionalParents.size() + 1; }
/** * Checks if this node belongs to an external source. * * @return true if the node is not repository-local */ protected final boolean isExternal() { return !key().getSourceKey().equals(session().cache().getRootKey().getSourceKey()); }
public JcrVersionManager( JcrSession session ) { super(); this.session = session; versionStoragePath = absolutePath(JcrLexicon.SYSTEM, JcrLexicon.VERSION_STORAGE); ExecutionContext context = session.context(); versionHistoryPathAlgorithm = new HiearchicalPathAlgorithm(versionStoragePath, context); readableSystem = new SystemContent(this.session.cache()); }
public JcrVersionManager( JcrSession session ) { super(); this.session = session; versionStoragePath = absolutePath(JcrLexicon.SYSTEM, JcrLexicon.VERSION_STORAGE); ExecutionContext context = session.context(); versionHistoryPathAlgorithm = new HiearchicalPathAlgorithm(versionStoragePath, context); readableSystem = new SystemContent(this.session.cache()); }
String unlock( JcrSession session, NodeKey lockedNodeKey ) throws LockException { ModeShapeLock existing = locksByNodeKey.remove(lockedNodeKey); if (existing == null) { NodeCache cache = session.cache(); String location = session.stringFactory().create(cache.getNode(lockedNodeKey).getPath(cache)); throw new LockException(JcrI18n.notLocked.text(location)); } unlock(session, Collections.singleton(existing)); return existing.getLockToken(); }
String unlock( JcrSession session, NodeKey lockedNodeKey ) throws LockException { ModeShapeLock existing = locksByNodeKey.remove(lockedNodeKey); if (existing == null) { NodeCache cache = session.cache(); String location = session.stringFactory().create(cache.getNode(lockedNodeKey).getPath(cache)); throw new LockException(JcrI18n.notLocked.text(location)); } unlock(session, Collections.singleton(existing)); return existing.getLockToken(); }
protected Future<Boolean> reindexSinceAsync( final JcrWorkspace workspace, final long timestamp ) { ChangeJournal journal = runningState.journal(); assert journal != null; Iterator<NodeKey> changedNodes = journal.changedNodesSince(timestamp); if (!changedNodes.hasNext()) { // there are no nodes which have been changed since the given timestamp return new ImmediateFuture<>(Boolean.FALSE); } return reindexSinceAsync(workspace.getSession().cache().getWorkspace(), getIndexWriter(), changedNodes); }
protected Future<Boolean> reindexSinceAsync( final JcrWorkspace workspace, final long timestamp ) { ChangeJournal journal = runningState.journal(); assert journal != null; Iterator<NodeKey> changedNodes = journal.changedNodesSince(timestamp); if (!changedNodes.hasNext()) { // there are no nodes which have been changed since the given timestamp return new ImmediateFuture<>(Boolean.FALSE); } return reindexSinceAsync(workspace.getSession().cache().getWorkspace(), getIndexWriter(), changedNodes); }
@Override protected Segment segment() throws RepositoryException { AbstractJcrNode parent = parent(); CachedNode node = parent.node(); SessionCache cache = session.cache(); ChildReference childRef = node.getChildReferences(cache).getChild(sharedSet.key()); return childRef.getSegment(); } }
@Override protected Segment segment() throws RepositoryException { AbstractJcrNode parent = parent(); CachedNode node = parent.node(); SessionCache cache = session.cache(); ChildReference childRef = node.getChildReferences(cache).getChild(sharedSet.key()); return childRef.getSegment(); } }
private ModeShapeLock throwAlreadyLocked(JcrSession session, ModeShapeLock existing) throws LockException { NodeCache cache = session.cache(); CachedNode locked = cache.getNode(existing.getLockedNodeKey()); String lockedPath = session.stringFactory().create(locked.getPath(cache)); throw new LockException(JcrI18n.alreadyLocked.text(lockedPath)); }
@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 Path path() throws ItemNotFoundException, InvalidItemStateException { AbstractJcrNode parent = parent(); CachedNode node = parent.node(); SessionCache cache = session.cache(); ChildReference childRef = node.getChildReferences(cache).getChild(sharedSet.key()); Path parentPath = parent.path(); return session().pathFactory().create(parentPath, childRef.getSegment()); }