Package org.apache.jackrabbit.core

Examples of org.apache.jackrabbit.core.NodeId


     * @throws RepositoryException if an error occurs
     */
    public AbstractLockInfo lock(NodeImpl node, boolean isDeep, boolean isSessionScoped, long timeoutHint, String ownerInfo)
            throws LockException, RepositoryException {

        NodeId id = node.getNodeId();

        // check negative set first
        LockInfo info = (LockInfo) unlockedNodesMap.get(id);
        if (info != null) {
            // if settings are compatible, this is effectively a no-op
View Full Code Here


     * @param node node to unlock
     * @throws LockException if the node is not locked
     * @throws RepositoryException if an error occurs
     */
    public void unlock(NodeImpl node) throws LockException, RepositoryException {
        NodeId id = node.getNodeId();

        // check positive set first
        AbstractLockInfo info = (LockInfo) lockedNodesMap.get(id);
        if (info != null) {
            lockedNodesMap.remove(id);
View Full Code Here

     * @param node node
     * @return LockInfo lock info or <code>null</code> if node is not locked
     * @throws RepositoryException if an error occurs
     */
    public AbstractLockInfo getLockInfo(NodeImpl node) throws RepositoryException {
        NodeId id = node.getNodeId();

        // check negative set
        if (unlockedNodesMap.containsKey(id)) {
            return null;
        }
View Full Code Here

        // gather modified node states
        iter = changeLog.modifiedStates();
        while (iter.hasNext()) {
            ItemState state = (ItemState) iter.next();
            if (state.isNode()) {
                NodeId nodeId = (NodeId) state.getId();
                NodePropBundle bundle = (NodePropBundle) modified.get(nodeId);
                if (bundle == null) {
                    bundle = getBundle(nodeId);
                    if (bundle == null) {
                        throw new NoSuchItemStateException(nodeId.toString());
                    }
                    modified.put(nodeId, bundle);
                }
                bundle.update((NodeState) state);
            } else {
                PropertyId id = (PropertyId) state.getId();
                // skip redundant primaryType, mixinTypes and uuid properties
                if (id.getName().equals(NameConstants.JCR_PRIMARYTYPE)
                    || id.getName().equals(NameConstants.JCR_MIXINTYPES)
                    || id.getName().equals(NameConstants.JCR_UUID)) {
                    continue;
                }
                NodeId nodeId = id.getParentId();
                NodePropBundle bundle = (NodePropBundle) modified.get(nodeId);
                if (bundle == null) {
                    bundle = getBundle(nodeId);
                    if (bundle == null) {
                        throw new NoSuchItemStateException(nodeId.toString());
                    }
                    modified.put(nodeId, bundle);
                }
                bundle.addProperty((PropertyState) state);
            }
        }
        // add removed properties
        iter = changeLog.deletedStates();
        while (iter.hasNext()) {
            ItemState state = (ItemState) iter.next();
            if (state.isNode()) {
                // check consistency
                NodeId parentId = state.getParentId();
                if (!modified.containsKey(parentId) && !deleted.contains(parentId)) {
                    log.warn("Deleted node state's parent is not modified or deleted: " + parentId + "/" + state.getId());
                }
            } else {
                PropertyId id = (PropertyId) state.getId();
                NodeId nodeId = id.getParentId();
                if (!deleted.contains(nodeId)) {
                    NodePropBundle bundle = (NodePropBundle) modified.get(nodeId);
                    if (bundle == null) {
                        // should actually not happen
                        log.warn("deleted property state's parent not modified!");
                        bundle = getBundle(nodeId);
                        if (bundle == null) {
                            throw new NoSuchItemStateException(nodeId.toString());
                        }
                        modified.put(nodeId, bundle);
                    }
                    bundle.removeProperty(id.getName());
                }
            }
        }
        // add added properties
        iter = changeLog.addedStates();
        while (iter.hasNext()) {
            ItemState state = (ItemState) iter.next();
            if (!state.isNode()) {
                PropertyId id = (PropertyId) state.getId();
                // skip primaryType pr mixinTypes properties
                if (id.getName().equals(NameConstants.JCR_PRIMARYTYPE)
                    || id.getName().equals(NameConstants.JCR_MIXINTYPES)
                    || id.getName().equals(NameConstants.JCR_UUID)) {
                    continue;
                }
                NodeId nodeId = id.getParentId();
                NodePropBundle bundle = (NodePropBundle) modified.get(nodeId);
                if (bundle == null) {
                    // should actually not happen
                    log.warn("added property state's parent not modified!");
                    bundle = getBundle(nodeId);
                    if (bundle == null) {
                        throw new NoSuchItemStateException(nodeId.toString());
                    }
                    modified.put(nodeId, bundle);
                }
                bundle.addProperty((PropertyState) state);
            }
View Full Code Here

        NodeImpl parent = (NodeImpl) parents.peek();

        // process node

        NodeImpl node = null;
        NodeId id = nodeInfo.getId();
        Name nodeName = nodeInfo.getName();
        Name ntName = nodeInfo.getNodeTypeName();
        Name[] mixins = nodeInfo.getMixinNames();

        if (parent == null) {
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public Node createActivity(String title) throws RepositoryException {
        NodeId id = session.getVersionManager().createActivity(session, title);
        return session.getNodeById(id);
    }
View Full Code Here

    public void removeActivity(Node node) throws RepositoryException {
        NodeImpl actNode = (NodeImpl) node;
        if (!actNode.isNodeType(NameConstants.NT_ACTIVITY)) {
            throw new UnsupportedRepositoryOperationException("Given node is not an activity.");
        }
        NodeId actId = actNode.getNodeId();
        session.getVersionManager().removeActivity(session, actId);
        if (currentActivity.equals(actId)) {
            currentActivity = null;
        }
    }
View Full Code Here

        Map<NodeId, InternalVersion> changeSet = activity.getChangeSet();
        ChangeSetVersionSelector vsel = new ChangeSetVersionSelector(changeSet);
        Iterator<NodeId> iter = changeSet.keySet().iterator();
        while (iter.hasNext()) {
            InternalVersion v = changeSet.remove(iter.next());
            NodeId nodeId = new NodeId(v.getVersionHistory().getVersionableUUID());
            try {
                NodeImpl node = session.getNodeById(nodeId);
                InternalVersion base = ((VersionImpl) node.getBaseVersion()).getInternalVersion();
                VersionImpl version = (VersionImpl) session.getNodeById(v.getId());
                // if base version is newer than version, add to failed list
View Full Code Here

    private void scanPersistenceManagers() throws ItemStateException, RepositoryException {
        for (IterablePersistenceManager pm : pmList) {
            NodeIdIterator it = pm.getAllNodeIds(null, 0);
            while (it.hasNext()) {
                NodeId id = it.nextNodeId();
                if (callback != null) {
                    callback.beforeScanning(null);
                }
                try {
                    NodeState state = pm.load(id);
View Full Code Here

                AbstractBundlePersistenceManager apm = (AbstractBundlePersistenceManager) pm;
                log("PM: " + pm.getClass().getName());

                log("All nodes in one step");
                NodeIdIterator it = apm.getAllNodeIds(null, 0);
                NodeId after = null;
                NodeId first = null;
                while (it.hasNext()) {
                    NodeId id = it.nextNodeId();
                    log("  " + id.toString());
                    if (first == null) {
                        // initialize first node id
                        first = id;
                    }
                    if (after != null) {
                        assertFalse(id.getUUID().compareTo(after.getUUID()) == 0);
                    }
                    after = id;
                }

                // start with first
                after = first;
                log("All nodes using batches");
                while (true) {
                    log(" bigger than: " + after);
                    it = apm.getAllNodeIds(after, 2);
                    if (!it.hasNext()) {
                        break;
                    }
                    while (it.hasNext()) {
                        NodeId id = it.nextNodeId();
                        log("    " + id.toString());
                        assertFalse(id.getUUID().compareTo(after.getUUID()) == 0);
                        after = id;
                    }
                }

                log("Random access");
                for (int j = 0; j < 50; j++) {
                    after = new NodeId(UUID.randomUUID());
                    log(" bigger than: " + after);
                    it = apm.getAllNodeIds(after, 2);
                    while (it.hasNext()) {
                        NodeId id = it.nextNodeId();
                        log("    " + id.toString());
                        assertFalse(id.getUUID().compareTo(after.getUUID()) == 0);
                        after = id;
                    }
                }
            } finally {
                s.logout();
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.core.NodeId

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.