Package org.apache.jackrabbit.core

Examples of org.apache.jackrabbit.core.NodeId


        }
        // child nodes (list of name/uuid pairs)
        count = in.readInt();   // count
        for (int i = 0; i < count; i++) {
            Name name = readQName(in);
            NodeId parentId = readID(in);
            state.addChildNodeEntry(name, parentId);
        }

        if (version >= VERSION_1) {
            state.setModCount(readModCount(in));
View Full Code Here


            byte[] bytes = new byte[16];
            int pos = 0;
            while (pos < 16) {
                pos += in.read(bytes, pos, 16 - pos);
            }
            return new NodeId(new UUID(bytes));
        } else {
            return null;
        }
    }
View Full Code Here

     * @throws IOException in an I/O error occurs.
     */
    public PropertyId readPropertyId(DataInputStream in) throws IOException {
        UUID uuid = readUUID(in);
        Name name = readQName(in);
        return new PropertyId(new NodeId(uuid), name);
    }
View Full Code Here

                NodePropBundle child = loadBundle(entry.getId(), true);
                if (child == null) {
                    log.error("NodeState '" + getBundlePath(id, bundle) + "' ('" + id + "') references inexistent child '" + entry.getName() + "' with id '" + entry.getId() + "'");
                    missingChildren.add(entry);
                } else {
                    NodeId cp = child.getParentId();
                    if (cp == null) {
                        log.error("ChildNode '" + entry.getName() + "' has invalid parent uuid: <null>");
                    } else if (!cp.equals(id)) {
                        log.error("ChildNode '" + entry.getName() + "' has invalid parent uuid: '" + cp + "' (instead of '" + id + "')");
                    }
                }
            } catch (ItemStateException e) {
                // problem already logged (loadBundle called with logDetailedErrors=true)
            }
        }
        // remove child node entry (if fixing is enabled)
        if (fix && !missingChildren.isEmpty()) {
            Iterator iterator = missingChildren.iterator();
            while (iterator.hasNext()) {
                bundle.getChildNodeEntries().remove(iterator.next());
            }
            modifications.add(bundle);
        }

        // check parent reference
        NodeId parentId = bundle.getParentId();
        try {
            // skip root nodes (that point to itself)
            if (parentId != null && !id.toString().endsWith("babecafebabe")) {
                if (!existsBundle(parentId)) {
                    log.error("NodeState '" + id + "' references inexistent parent uuid '" + parentId + "'");
View Full Code Here

                stmt = connectionManager.executeStmt(sql, new Object[0]);
                rs = stmt.getResultSet();

                // iterate over all node bundles in the db
                while (rs.next()) {
                    NodeId id;
                    if (getStorageModel() == SM_BINARY_KEYS) {
                        id = new NodeId(new UUID(rs.getBytes(1)));
                    } else {
                        id = new NodeId(new UUID(rs.getLong(1), rs.getLong(2)));
                    }

                    // issuing 2nd statement to circumvent issue JCR-1474
                    ResultSet bRs = null;
                    byte[] data = null;
                    try {
                        Statement bSmt = connectionManager.executeStmt(bundleSelectSQL, getKey(id.getUUID()));
                        bRs = bSmt.getResultSet();
                        if (!bRs.next()) {
                            throw new SQLException("bundle cannot be retrieved?");
                        }
                        Blob blob = bRs.getBlob(1);
                        data = getBytes(blob);
                    } finally {
                        closeResultSet(bRs);
                    }


                    try {
                        // parse and check bundle
                        // checkBundle will log any problems itself
                        DataInputStream din = new DataInputStream(new ByteArrayInputStream(data));
                        if (binding.checkBundle(din)) {
                            // reset stream for readBundle()
                            din = new DataInputStream(new ByteArrayInputStream(data));
                            NodePropBundle bundle = binding.readBundle(din, id);
                            checkBundleConsistency(id, bundle, fix, modifications);
                        } else {
                            log.error("invalid bundle '" + id + "', see previous BundleBinding error log entry");
                        }
                    } catch (Exception e) {
                        log.error("Error in bundle " + id + ": " + e);
                    }
                    count++;
                    if (count % 1000 == 0) {
                        log.info(name + ": checked " + count + "/" + total + " bundles...");
                    }
                }
            } catch (Exception e) {
                log.error("Error loading bundle", e);
            } finally {
                closeResultSet(rs);
                total = count;
            }
        } else {
            // check only given uuids, handle recursive flag

            // 1) convert uuid array to modifiable list
            // 2) for each uuid do
            //     a) load node bundle
            //     b) check bundle, store any bundle-to-be-modified in collection
            //     c) if recursive, add child uuids to list of uuids

            List uuidList = new ArrayList(uuids.length);
            // convert uuid string array to list of UUID objects
            for (int i = 0; i < uuids.length; i++) {
                try {
                    uuidList.add(new UUID(uuids[i]));
                } catch (IllegalArgumentException e) {
                    log.error("Invalid uuid for consistency check, skipping: '" + uuids[i] + "': " + e);
                }
            }

            // iterate over UUIDs (including ones that are newly added inside the loop!)
            for (int i = 0; i < uuidList.size(); i++) {
                final UUID uuid = (UUID) uuidList.get(i);
                try {
                    // load the node from the database
                    NodeId id = new NodeId(uuid);
                    NodePropBundle bundle = loadBundle(id, true);

                    if (bundle == null) {
                        log.error("No bundle found for uuid '" + uuid + "'");
                        continue;
View Full Code Here

        // set referenceable flag
        bundle.setReferenceable(in.readBoolean());

        // child nodes (list of uuid/name pairs)
        NodeId childId = readID(in);
        while (childId != null) {
            bundle.addChildNodeEntry(readQName(in), childId);
            childId = readID(in);
        }
View Full Code Here

                NodePropBundle child = loadBundle(entry.getId(), true);
                if (child == null) {
                    log.error("NodeState '" + getBundlePath(id, bundle) + "' ('" + id + "') references inexistent child '" + entry.getName() + "' with id '" + entry.getId() + "'");
                    missingChildren.add(entry);
                } else {
                    NodeId cp = child.getParentId();
                    if (cp == null) {
                        log.error("ChildNode '" + entry.getName() + "' has invalid parent uuid: <null>");
                    } else if (!cp.equals(id)) {
                        log.error("ChildNode '" + entry.getName() + "' has invalid parent uuid: '" + cp + "' (instead of '" + id + "')");
                    }
                }
            } catch (ItemStateException e) {
                // problem already logged (loadBundle called with logDetailedErrors=true)
            }
        }
        // remove child node entry (if fixing is enabled)
        if (fix && !missingChildren.isEmpty()) {
            Iterator iterator = missingChildren.iterator();
            while (iterator.hasNext()) {
                bundle.getChildNodeEntries().remove(iterator.next());
            }
            modifications.add(bundle);
        }

        // check parent reference
        NodeId parentId = bundle.getParentId();
        try {
            // skip root nodes (that point to itself)
            if (parentId != null && !id.toString().endsWith("babecafebabe")) {
                if (!existsBundle(parentId)) {
                    log.error("NodeState '" + id + "' references inexistent parent uuid '" + parentId + "'");
View Full Code Here

                stmt = connectionManager.executeStmt(sql, new Object[0]);
                rs = stmt.getResultSet();

                // iterate over all node bundles in the db
                while (rs.next()) {
                    NodeId id;
                    if (getStorageModel() == SM_BINARY_KEYS) {
                        id = new NodeId(new UUID(rs.getBytes(1)));
                    } else {
                        id = new NodeId(new UUID(rs.getLong(1), rs.getLong(2)));
                    }

                    // issuing 2nd statement to circumvent issue JCR-1474
                    ResultSet bRs = null;
                    byte[] data = null;
                    try {
                        Statement bSmt = connectionManager.executeStmt(bundleSelectSQL, getKey(id.getUUID()));
                        bRs = bSmt.getResultSet();
                        if (!bRs.next()) {
                            throw new SQLException("bundle cannot be retrieved?");
                        }
                        Blob blob = bRs.getBlob(1);
                        data = getBytes(blob);
                    } finally {
                        closeResultSet(bRs);
                    }


                    try {
                        // parse and check bundle
                        // checkBundle will log any problems itself
                        DataInputStream din = new DataInputStream(new ByteArrayInputStream(data));
                        if (binding.checkBundle(din)) {
                            // reset stream for readBundle()
                            din = new DataInputStream(new ByteArrayInputStream(data));
                            NodePropBundle bundle = binding.readBundle(din, id);
                            checkBundleConsistency(id, bundle, fix, modifications);
                        } else {
                            log.error("invalid bundle '" + id + "', see previous BundleBinding error log entry");
                        }
                    } catch (Exception e) {
                        log.error("Error in bundle " + id + ": " + e);
                    }
                    count++;
                    if (count % 1000 == 0) {
                        log.info(name + ": checked " + count + "/" + total + " bundles...");
                    }
                }
            } catch (Exception e) {
                log.error("Error loading bundle", e);
            } finally {
                closeResultSet(rs);
                total = count;
            }
        } else {
            // check only given uuids, handle recursive flag

            // 1) convert uuid array to modifiable list
            // 2) for each uuid do
            //     a) load node bundle
            //     b) check bundle, store any bundle-to-be-modified in collection
            //     c) if recursive, add child uuids to list of uuids

            List uuidList = new ArrayList(uuids.length);
            // convert uuid string array to list of UUID objects
            for (int i = 0; i < uuids.length; i++) {
                try {
                    uuidList.add(new UUID(uuids[i]));
                } catch (IllegalArgumentException e) {
                    log.error("Invalid uuid for consistency check, skipping: '" + uuids[i] + "': " + e);
                }
            }

            // iterate over UUIDs (including ones that are newly added inside the loop!)
            for (int i = 0; i < uuidList.size(); i++) {
                final UUID uuid = (UUID) uuidList.get(i);
                try {
                    // load the node from the database
                    NodeId id = new NodeId(uuid);
                    NodePropBundle bundle = loadBundle(id, true);

                    if (bundle == null) {
                        log.error("No bundle found for uuid '" + uuid + "'");
                        continue;
View Full Code Here

        }
        // child nodes (list of name/uuid pairs)
        count = in.readInt();   // count
        for (int i = 0; i < count; i++) {
            Name name = readQName(in);
            NodeId parentId = readID(in);
            state.addChildNodeEntry(name, parentId);
        }

        if (version >= VERSION_1) {
            state.setModCount(readModCount(in));
View Full Code Here

            byte[] bytes = new byte[16];
            int pos = 0;
            while (pos < 16) {
                pos += in.read(bytes, pos, 16 - pos);
            }
            return new NodeId(new UUID(bytes));
        } else {
            return null;
        }
    }
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.