Package org.apache.jackrabbit.core

Examples of org.apache.jackrabbit.core.NodeId


     * @throws ItemStateException  if an node state cannot be found.
     * @throws RepositoryException if any other error occurs
     */
    private void createIndex(NodeState node, ItemStateManager stateMgr)
            throws IOException, ItemStateException, RepositoryException {
        NodeId id = node.getNodeId();
        if (excludedIDs.contains(id)) {
            return;
        }
        executeAndLog(new AddNode(getTransactionId(), id.getUUID()));
        checkVolatileCommit();
        List children = node.getChildNodeEntries();
        for (Iterator it = children.iterator(); it.hasNext();) {
            NodeState.ChildNodeEntry child = (NodeState.ChildNodeEntry) it.next();
            NodeState childState = (NodeState) stateMgr.getItemState(child.getId());
View Full Code Here


         * @inheritDoc
         */
        public void execute(MultiIndex index) throws IOException {
            if (doc == null) {
                try {
                    doc = index.createDocument(new NodeId(uuid));
                } catch (RepositoryException e) {
                    // node does not exist anymore
                    log.debug(e.getMessage());
                }
            }
View Full Code Here

            result = index.executeQuery(this, query, orderProperties, ascSpecs);
            ids = new ArrayList(result.length());
            scores = new ArrayList(result.length());

            for (int i = 0; i < result.length(); i++) {
                NodeId id = NodeId.valueOf(result.doc(i).get(FieldNames.UUID));
                // check access
                if (accessMgr.isGranted(id, AccessManager.READ)) {
                    ids.add(id);
                    scores.add(new Float(result.score(i)));
                }
View Full Code Here

                if (reader.isDeleted(i)) {
                    continue;
                }
                Document d = reader.document(i);
                UUID uuid = UUID.fromString(d.get(FieldNames.UUID));
                if (stateMgr.hasItemState(new NodeId(uuid))) {
                    if (!documentUUIDs.add(uuid)) {
                        multipleEntries.add(uuid);
                    }
                } else {
                    errors.add(new NodeDeleted(uuid));
                }
            }
        } finally {
            reader.close();
        }

        // create multiple entries errors
        for (Iterator it = multipleEntries.iterator(); it.hasNext();) {
            errors.add(new MultipleEntries((UUID) it.next()));
        }

        reader = index.getIndexReader();
        try {
            // run through documents again and check parent
            for (int i = 0; i < reader.maxDoc(); i++) {
                if (i > 0 && i % (reader.maxDoc() / 5) == 0) {
                    long progress = Math.round((100.0 * (float) i) / ((float) reader.maxDoc() * 2f));
                    log.info("progress: " + (progress + 50) + "%");
                }
                if (reader.isDeleted(i)) {
                    continue;
                }
                Document d = reader.document(i);
                UUID uuid = UUID.fromString(d.get(FieldNames.UUID));
                String parentUUIDString = d.get(FieldNames.PARENT);
                UUID parentUUID = null;
                if (parentUUIDString.length() > 0) {
                    parentUUID = UUID.fromString(parentUUIDString);
                }
                if (parentUUID == null || documentUUIDs.contains(parentUUID)) {
                    continue;
                }
                // parent is missing
                NodeId parentId = new NodeId(parentUUID);
                if (stateMgr.hasItemState(parentId)) {
                    errors.add(new MissingAncestor(uuid, parentUUID));
                } else {
                    errors.add(new UnknownParent(uuid, parentUUID));
                }
View Full Code Here

        String uuid = node.getNodeId().toString();
        StringBuffer path = new StringBuffer();
        List elements = new ArrayList();
        try {
            while (node.getParentId() != null) {
                NodeId parentId = node.getParentId();
                NodeState parent = (NodeState) stateMgr.getItemState(parentId);
                NodeState.ChildNodeEntry entry = parent.getChildNodeEntry(node.getNodeId());
                elements.add(entry);
                node = parent;
            }
View Full Code Here

        /**
         * Repairs the missing node by indexing the missing ancestors.
         * @throws IOException if an error occurs while repairing.
         */
        public void repair() throws IOException {
            NodeId parentId = new NodeId(parentUUID);
            while (parentId != null && !documentUUIDs.contains(parentId.getUUID())) {
                try {
                    NodeState n = (NodeState) stateMgr.getItemState(parentId);
                    log.info("Reparing missing node " + getPath(n));
                    Document d = index.createDocument(n);
                    index.addDocument(d);
View Full Code Here

        public void repair() throws IOException {
            // first remove all occurrences
            index.removeAllDocuments(uuid);
            // then re-index the node
            try {
                NodeState node = (NodeState) stateMgr.getItemState(new NodeId(uuid));
                log.info("Re-indexing duplicate node occurrences in index: " + getPath(node));
                Document d = index.createDocument(node);
                index.addDocument(d);
                documentUUIDs.add(node.getNodeId().getUUID());
            } catch (ItemStateException e) {
View Full Code Here

        state.setNodeTypeName(QName.valueOf(s));
        // parentUUID (may be null)
        byte[] uuidBytes = new byte[UUID.UUID_BYTE_LENGTH];
        in.readFully(uuidBytes);
        if (!Arrays.equals(uuidBytes, NULL_UUID_PLACEHOLDER_BYTES)) {
            state.setParentId(new NodeId(new UUID(uuidBytes)));
        }
        // definitionId
        s = in.readUTF();
        state.setDefinitionId(NodeDefId.valueOf(s));
        // mixin types
        int count = in.readInt();   // count
        Set set = new HashSet(count);
        for (int i = 0; i < count; i++) {
            set.add(QName.valueOf(in.readUTF())); // name
        }
        if (set.size() > 0) {
            state.setMixinTypeNames(set);
        }
        // modCount
        short modCount = in.readShort();
        state.setModCount(modCount);
        // properties (names)
        count = in.readInt();   // count
        for (int i = 0; i < count; i++) {
            state.addPropertyName(QName.valueOf(in.readUTF())); // name
        }
        // child nodes (list of name/uuid pairs)
        count = in.readInt();   // count
        for (int i = 0; i < count; i++) {
            QName name = QName.valueOf(in.readUTF());    // name
            // uuid
            in.readFully(uuidBytes);
            state.addChildNodeEntry(name, new NodeId(new UUID(uuidBytes)));
        }
    }
View Full Code Here

        }

        // check whether targets of modified node references exist
        for (Iterator iter = changes.modifiedRefs(); iter.hasNext();) {
            NodeReferences refs = (NodeReferences) iter.next();
            NodeId id = refs.getTargetId();
            // no need to check existence of target if there are no references
            if (refs.hasReferences()) {
                // please note:
                // virtual providers are indirectly checked via 'hasItemState()'
                if (!changes.has(id) && !hasItemState(id)) {
View Full Code Here

                // filter out virtual node references for later processing
                // (see comment above)
                for (Iterator iter = local.modifiedRefs(); iter.hasNext();) {
                    NodeReferences refs = (NodeReferences) iter.next();
                    boolean virtual = false;
                    NodeId id = refs.getId().getTargetId();
                    for (int i = 0; i < virtualProviders.length; i++) {
                        if (virtualProviders[i].hasItemState(id)) {
                            List virtualRefs = virtualNodeReferences[i];
                            if (virtualRefs == null) {
                                virtualRefs = new LinkedList();
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.