Package org.apache.jackrabbit.jcr2spi.state

Examples of org.apache.jackrabbit.jcr2spi.state.NodeState


     */
    public void loggingOut(Session session) {
        // remove any session scoped locks:
        NodeState[] lhStates = (NodeState[]) lockMap.keySet().toArray(new NodeState[lockMap.size()]);
        for (int i = 0; i < lhStates.length; i++) {
            NodeState nState = lhStates[i];
            LockImpl l = (LockImpl) lockMap.get(nState);
            if (l.isSessionScoped() && l.isLockOwningSession()) {
                try {
                    unlock(nState);
                } catch (RepositoryException e) {
View Full Code Here


        }
    }

    private LockState buildLockState(NodeState nodeState) throws RepositoryException {
        NodeId nId = nodeState.getNodeId();
        NodeState lockHoldingState = null;
        LockInfo lockInfo = wspManager.getLockInfo(nId);
        if (lockInfo == null) {
            // no lock present
            return null;
        }
View Full Code Here

     * is asked if a lock is present.
     * @return LockImpl that applies to the given state or <code>null</code>.
     * @throws RepositoryException
     */
    private LockImpl getLockImpl(NodeState nodeState, boolean lazyLockDiscovery) throws RepositoryException {
        NodeState nState = nodeState;
        // access first non-NEW state
        while (nState.getStatus() == Status.NEW) {
            nState = nState.getParent();
        }

        // shortcut: check if a given state holds a lock, which has been
        // store in the lock map. see below (LockImpl) for the conditions that
        // must be met in order a lock can be stored.
        LockImpl l = getLockFromMap(nState);
        if (l != null && l.lockState.appliesToNodeState(nodeState)) {
            return l;
        }

        LockState lState;
        if (lazyLockDiscovery) {
            // try to retrieve a state (ev. a parent state) that holds a lock.
            NodeState lockHoldingState = getLockHoldingState(nState);
            if (lockHoldingState == null) {
                // assume no lock is present (might not be correct due to incomplete hierarchy)
                return null;
            } else {
                // check lockMap again with the lockholding state
View Full Code Here

    }

    public NodeEntry resolve(NodeId nodeId, NodeEntry rootEntry) throws ItemNotFoundException, RepositoryException {
        NodeEntry entry = lookup(nodeId.getUniqueID());
        if (entry == null) {
            NodeState state = isf.createDeepNodeState(nodeId, rootEntry);
            entry = state.getNodeEntry();
        }
        return entry;
    }
View Full Code Here

     * @see HierarchyManager#getNodeState(Path)
     */
    public NodeState getNodeState(Path qPath) throws PathNotFoundException, RepositoryException {
        NodeEntry entry = getNodeEntry(qPath);
        try {
            NodeState state = entry.getNodeState();
            if (state.isValid()) {
                return state;
            } else {
                throw new PathNotFoundException();
            }
        } catch (ItemNotFoundException e) {
View Full Code Here

     * @see NodeEntry#addNewNodeEntry(Name, String, Name, QNodeDefinition)
     */
    public NodeEntry addNewNodeEntry(Name nodeName, String uniqueID,
                                     Name primaryNodeType, QNodeDefinition definition) throws RepositoryException {
        NodeEntry entry = internalAddNodeEntry(nodeName, uniqueID, Path.INDEX_UNDEFINED);
        NodeState state = factory.getItemStateFactory().createNewNodeState(entry, primaryNodeType, definition);
        entry.setItemState(state);
        return entry;
    }
View Full Code Here

        }

        if (wspIndex && revertInfo != null) {
            return revertInfo.oldIndex;
        } else {
            NodeState state = (NodeState) internalGetItemState();
            if (state == null || !state.hasDefinition() || state.getDefinition().allowsSameNameSiblings()) {
                return parent.getChildIndex(this, wspIndex);
            } else {
                return Path.INDEX_DEFAULT;
            }
        }
View Full Code Here

     * @return the entry or <code>null</code> if building the corresponding
     * <code>NodeState</code> failed with <code>ItemNotFoundException</code>.
     */
    private NodeEntry loadNodeEntry(NodeId childId) throws RepositoryException {
        try {
            NodeState state = factory.getItemStateFactory().createDeepNodeState(childId, this);
            return state.getNodeEntry();
        } catch (ItemNotFoundException e) {
            return null;
        }
    }
View Full Code Here

        try {
            if (NameConstants.JCR_UUID.equals(child.getName())) {
                PropertyState ps = child.getPropertyState();
                setUniqueID(ps.getValue().getString());
            } else if (NameConstants.JCR_MIXINTYPES.equals(child.getName())) {
                NodeState state = (NodeState) internalGetItemState();
                if (state != null) {
                    PropertyState ps = child.getPropertyState();
                    state.setMixinTypeNames(StateUtility.getMixinNames(ps));
                } // nodestate not yet loaded -> ignore change
            }
        } catch (ItemNotFoundException e) {
            log.debug("Property with name " + child.getName() + " does not exist (anymore)");
        } catch (RepositoryException e) {
View Full Code Here

     */
    private void notifyUUIDorMIXINRemoved(Name propName) {
        if (NameConstants.JCR_UUID.equals(propName)) {
            setUniqueID(null);
        } else if (NameConstants.JCR_MIXINTYPES.equals(propName)) {
            NodeState state = (NodeState) internalGetItemState();
            if (state != null) {
                state.setMixinTypeNames(Name.EMPTY_ARRAY);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.jcr2spi.state.NodeState

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.