Package org.apache.jackrabbit.uuid

Examples of org.apache.jackrabbit.uuid.UUID


     *                           the indexing queue to the index.
     */
    private void checkIndexingQueue(boolean transactionPresent) {
        Map<UUID, Document> finished = new HashMap<UUID, Document>();
        for (Document document : indexingQueue.getFinishedDocuments()) {
            UUID uuid = UUID.fromString(document.get(FieldNames.UUID));
            finished.put(uuid, document);
        }

        // now update index with the remaining ones if there are any
        if (!finished.isEmpty()) {
            log.info("updating index with {} nodes from indexing queue.",
                    new Long(finished.size()));

            // remove documents from the queue
            for (UUID uuid : finished.keySet()) {
                indexingQueue.removeDocument(uuid.toString());
            }

            try {
                if (transactionPresent) {
                    for (UUID uuid : finished.keySet()) {
View Full Code Here


        Set<UUID> removedUUIDs = new HashSet<UUID>();
        Set<UUID> addedUUIDs = new HashSet<UUID>();

        Collection<UUID> removeCollection = new ArrayList<UUID>();
        while (remove.hasNext()) {
            UUID uuid = remove.next().getUUID();
            removeCollection.add(uuid);
            removedUUIDs.add(uuid);
        }

        Collection<Document> addCollection = new ArrayList<Document>();
        while (add.hasNext()) {
            NodeState state = add.next();
            if (state != null) {
                UUID uuid = state.getNodeId().getUUID();
                addedUUIDs.add(uuid);
                removedUUIDs.remove(uuid);
                retrieveAggregateRoot(state, aggregateRoots);

                try {
View Full Code Here

            } finally {
                searcher.close();
            }
            for (Integer doc : docs) {
                Document d = reader.document(doc, FieldSelectors.UUID);
                UUID uuid = UUID.fromString(d.get(FieldNames.UUID));
                ids.add(new NodeId(uuid));
            }
        } finally {
            Util.closeOrRelease(reader);
        }
View Full Code Here

     *
     * @throws Exception if an unexpected error occurs
     */
    public void testReferenceImport() throws Exception {
        try {
            UUID uuid = UUID.randomUUID();
            String xml =
                "<sv:node sv:name=\"a\""
                + " xmlns:jcr=\"http://www.jcp.org/jcr/1.0\""
                + " xmlns:nt=\"http://www.jcp.org/jcr/nt/1.0\""
                + " xmlns:sv=\"http://www.jcp.org/jcr/sv/1.0\">"
View Full Code Here

         * returned by <code>1</code>.
         *
         * @return next UUID
         */
        private UUID nextUUID() {
            return new UUID(0, lsbGenerator++);
        }
View Full Code Here

     */
    private static UUID calculateStableUUID(String name) throws RepositoryException {
        try {
            MessageDigest md = MessageDigest.getInstance("MD5");
            byte[] digest = md.digest(name.getBytes("utf-8"));
            return new UUID(digest);
        } catch (NoSuchAlgorithmException e) {
            throw new RepositoryException(e);
        } catch (UnsupportedEncodingException e) {
            throw new RepositoryException(e);
        }
View Full Code Here

            }
            return false;
        }

        private static int slotIndex(ItemId id) {
            UUID uuid;
            if (id.denotesNode()) {
                uuid = ((NodeId) id).getUUID();
            } else {
                uuid = ((PropertyId) id).getParentId().getUUID();
            }
            return ((int) uuid.getLeastSignificantBits()) & 0xf;
        }
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 = (UUID) val.internalValue();
                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

                     * adjusted accordingly.
                     */
                    if (propName.equals(QName.JCR_VERSIONHISTORY)) {
                        // jcr:versionHistory
                        VersionHistory vh = getOrCreateVersionHistory(newState);
                        newChildState.setValues(new InternalValue[]{InternalValue.create(new UUID(vh.getUUID()))});
                    } else if (propName.equals(QName.JCR_BASEVERSION)) {
                        // jcr:baseVersion
                        VersionHistory vh = getOrCreateVersionHistory(newState);
                        newChildState.setValues(new InternalValue[]{InternalValue.create(new UUID(vh.getRootVersion().getUUID()))});
                    } else if (propName.equals(QName.JCR_PREDECESSORS)) {
                        // jcr:predecessors
                        VersionHistory vh = getOrCreateVersionHistory(newState);
                        newChildState.setValues(new InternalValue[]{InternalValue.create(new UUID(vh.getRootVersion().getUUID()))});
                    } else if (propName.equals(QName.JCR_ISCHECKEDOUT)) {
                        // jcr:isCheckedOut
                        newChildState.setValues(new InternalValue[]{InternalValue.create(true)});
                    }
                }
View Full Code Here

        checkLock();

        Version v = session.getVersionManager().checkin(this);
        Property prop = internalSetProperty(QName.JCR_ISCHECKEDOUT, InternalValue.create(false));
        prop.save();
        prop = internalSetProperty(QName.JCR_BASEVERSION, InternalValue.create(new UUID(v.getUUID())));
        prop.save();
        prop = internalSetProperty(QName.JCR_PREDECESSORS, InternalValue.EMPTY_ARRAY, PropertyType.REFERENCE);
        prop.save();
        return v;
    }
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.