Package org.apache.jackrabbit.uuid

Examples of org.apache.jackrabbit.uuid.UUID


     */
    public synchronized NodeIdIterator getAllNodeIds(NodeId bigger, int maxCount)
            throws ItemStateException, RepositoryException {
        ResultSet rs = null;
        try {
            UUID lowUuid;
            Object[] keys;
            String sql;
            if (bigger == null) {
                sql = bundleSelectAllIdsSQL;
                lowUuid = null;
                keys = new Object[0];
            } else {
                sql = bundleSelectAllIdsFromSQL;
                lowUuid = bigger.getUUID();
                keys = getKey(lowUuid);
            }
            if (maxCount > 0) {
                // get some more rows, in case the first row is smaller
                // only required for SM_LONGLONG_KEYS
                // probability is very low to get get the wrong first key, < 1 : 2^64
                // see also bundleSelectAllIdsFrom SQL statement
                maxCount += 10;
            }
            Statement stmt = connectionManager.executeStmt(sql, keys, false, maxCount);
            rs = stmt.getResultSet();
            ArrayList result = new ArrayList();
            while ((maxCount == 0 || result.size() < maxCount) && rs.next()) {
                UUID current;
                if (getStorageModel() == SM_BINARY_KEYS) {
                    current = new UUID(rs.getBytes(1));
                } else {
                    long high = rs.getLong(1);
                    long low = rs.getLong(2);
                    current = new UUID(high, low);
                }
                if (lowUuid != null) {
                    // skip the keys that are smaller or equal (see above, maxCount += 10)
                    if (current.compareTo(lowUuid) <= 0) {
                        continue;
                    }
                }
                result.add(current);
            }       
View Full Code Here


        } catch (IOException e) {
            log.error("Error while reading NodeTypeName: " + e);
            return false;
        }
        try {
            UUID parentUuid = readUUID(in);
            log.debug("ParentUUID: " + parentUuid);
        } catch (IOException e) {
            log.error("Error while reading ParentUUID: " + e);
            return false;
        }
        try {
            String definitionId = in.readUTF();
            log.debug("DefinitionId: " + definitionId);
        } catch (IOException e) {
            log.error("Error while reading DefinitionId: " + e);
            return false;
        }
        try {
            Name mixinName = readIndexedQName(in);
            while (mixinName != null) {
                log.debug("MixinTypeName: " + mixinName);
                mixinName = readIndexedQName(in);
            }
        } catch (IOException e) {
            log.error("Error while reading MixinTypes: " + e);
            return false;
        }
        try {
            Name propName = readIndexedQName(in);
            while (propName != null) {
                log.debug("PropertyName: " + propName);
                if (!checkPropertyState(in)) {
                    return false;
                }
                propName = readIndexedQName(in);
            }
        } catch (IOException e) {
            log.error("Error while reading property names: " + e);
            return false;
        }
        try {
            boolean hasUUID = in.readBoolean();
            log.debug("hasUUID: " + hasUUID);
        } catch (IOException e) {
            log.error("Error while reading 'hasUUID': " + e);
            return false;
        }
        try {
            UUID cneUUID = readUUID(in);
            while (cneUUID != null) {
                Name cneName = readQName(in);
                log.debug("ChildNodentry: " + cneUUID + ":" + cneName);
                cneUUID = readUUID(in);
            }
View Full Code Here

                        return false;
                    }
                    break;
                case PropertyType.REFERENCE:
                    try {
                        UUID uuid = readUUID(in);
                        log.debug("  reference: " + uuid);
                    } catch (IOException e) {
                        log.error("Error while reading reference value: " + e);
                        return false;
                    }
View Full Code Here

                    buff.append('-');
                }
            }
        }
        String u = buff.toString();
        return new UUID(u);
    }   
View Full Code Here

        }
        String[] files = itemFs.listFiles(path);
        Arrays.sort(files);
        for (int i = 0; i < files.length; i++) {
            String f = files[i];
            UUID u = getUUIDFromFileName(path + FileSystem.SEPARATOR + f);
            if (u == null) {
                continue;
            }
            if (bigger != null && bigger.toString().compareTo(u.toString()) >= 0) {
                continue;
            }
            NodeId n = new NodeId(u);
            list.add(n);
            if (maxCount > 0 && list.size() >= maxCount) {
View Full Code Here

            PropertyState[] labels = labelNode.getProperties();
            for (int i = 0; i < labels.length; i++) {
                PropertyState pState = labels[i];
                if (pState.getType() == PropertyType.REFERENCE) {
                    Name labelName = pState.getName();
                    UUID ref = pState.getValues()[0].getUUID();
                    NodeId id = new NodeId(ref);
                    if (node.getState().hasChildNodeEntry(id)) {
                        labelCache.put(labelName, node.getState().getChildNodeEntry(id).getName());
                    } else {
                        log.warn("Error while resolving label reference. Version missing: " + ref);
View Full Code Here

        InternalValue[] predecessors;
        if (src.hasProperty(NameConstants.JCR_PREDECESSORS)) {
            Value[] preds = src.getProperty(NameConstants.JCR_PREDECESSORS).getValues();
            predecessors = new InternalValue[preds.length];
            for (int i = 0; i < preds.length; i++) {
                UUID predId = UUID.fromString(preds[i].getString());
                // check if version exist
                if (!nameCache.containsValue(new NodeId(predId))) {
                    throw new RepositoryException("invalid predecessor in source node");
                }
                predecessors[i] = InternalValue.create(predId);
View Full Code Here

            boolean modified = false;
            InternalValue[] values = prop.getValues();
            InternalValue[] newVals = new InternalValue[values.length];
            for (int i = 0; i < values.length; i++) {
                InternalValue val = values[i];
                UUID original = val.getUUID();
                UUID adjusted = refTracker.getMappedUUID(original);
                if (adjusted != null) {
                    newVals[i] = InternalValue.create(adjusted);
                    modified = true;
                } else {
                    // reference doesn't need adjusting, just copy old value
View Full Code Here

                 * If child is shareble and its UUID has already been remapped,
                 * then simply add a reference to the state with that remapped
                 * UUID instead of copying the whole subtree.
                 */
                if (srcChildState.isShareable()) {
                    UUID uuid = refTracker.getMappedUUID(srcChildState.getNodeId().getUUID());
                    if (uuid != null) {
                        NodeId mappedId = new NodeId(uuid);
                        if (stateMgr.hasItemState(mappedId)) {
                            NodeState destState = (NodeState) stateMgr.getItemState(mappedId);
                            if (!destState.isShareable()) {
View Full Code Here

            try {
                session.getNodeByUUID(uuid);
                throw new ItemExistsException(
                    "A node with this UUID already exists: " + uuid);
            } catch (ItemNotFoundException infe) {
                id = new NodeId(new UUID(uuid));
            }
        }

        NodeType nt = null;
        if (nodeTypeName != null) {
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.uuid.UUID

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.