Package org.apache.jackrabbit.mk.model

Examples of org.apache.jackrabbit.mk.model.Id


    @Nonnull
    @Override
    public String reset(@Nonnull String branchRevisionId,
                        @Nonnull String ancestorRevisionId)
            throws MicroKernelException {
        Id branchId = Id.fromString(branchRevisionId);
        Id ancestorId = Id.fromString(ancestorRevisionId);
        StoredCommit commit;
        try {
            commit = rep.getCommit(branchId);
        } catch (Exception e) {
            throw new MicroKernelException(e);
        }
        Id baseId = commit.getBranchRootId();
        if (baseId == null) {
            throw new MicroKernelException("Not a private branch: " + branchRevisionId);
        }
        // verify ancestorId is in fact an ancestor of branchId
        while (!ancestorId.equals(branchId)) {
View Full Code Here


        head = ids[0];
        if (head == null || head.getBytes().length == 0) {
            // assume virgin repository
            byte[] rawHead = Id.fromLong(commitCounter.incrementAndGet())
                    .getBytes();
            head = new Id(rawHead);

            Id rootNodeId = pm.writeNode(new MutableNode(this));
            MutableCommit initialCommit = new MutableCommit();
            initialCommit.setCommitTS(System.currentTimeMillis());
            initialCommit.setRootNodeId(rootNodeId);
            pm.writeCommit(head, initialCommit);
            pm.writeHead(head);
        } else {
            Id lastCommitId = head;
            if (ids[1] != null && ids[1].compareTo(lastCommitId) > 0) {
                lastCommitId = ids[1];
            }
            commitCounter.set(Long.parseLong(lastCommitId.toString(), 16));
        }

        if (gcpm != null) {
            gcExecutor = Executors.newScheduledThreadPool(1,
                    new ThreadFactory() {
View Full Code Here

         * before we have updated our token
         */
        tokensLock.readLock().lock();

        try {
            Id id = pm.writeNode(node);

            if (callback != null) {
                callback.postPersist(this, token);
            }

View Full Code Here

        if (map instanceof PersistHook) {
            callback = (PersistHook) map;
            callback.prePersist(this, token);
        }

        Id id = pm.writeCNEMap(map);

        if (callback != null) {
            callback.postPersist(this, token);
        }
View Full Code Here

        if (commit.getBranchRootId() != null) {
            // OAK-267
            throw new IllegalStateException("private branch commit [" + commit + "] cannot become HEAD");
        }

        Id id = writeCommit(token, commit);
        setHeadCommitId(id);
       
        putTokens.remove(token);
        if (branchRevId != null) {
            synchronized (branches) {
View Full Code Here

    }

    public Id putCommit(PutToken token, MutableCommit commit) throws Exception {
        verifyInitialized();

        Id commitId = writeCommit(token, commit);
        putTokens.remove(token);

        Id branchRootId = commit.getBranchRootId();
        if (branchRootId != null) {
            synchronized (branches) {
                Id parentId = commit.getParentId();
                if (!parentId.equals(branchRootId)) {
                    /* not the first branch commit, replace its head */
                    branches.remove(parentId);
                }
                branches.put(commitId, branchRootId);
            }
View Full Code Here

        if (commit instanceof PersistHook) {
            callback = (PersistHook) commit;
            callback.prePersist(this, token);
        }

        Id id = commit.getId();
        if (id == null) {
            id = Id.fromLong(commitCounter.incrementAndGet());
        }
        pm.writeCommit(id, commit);
View Full Code Here

        LOG.debug("GC started.");
        markedCommits = markedNodes = 0;

        try {
            markUncommittedNodes();
            Id firstBranchRootId = markBranches();
            if (firstBranchRootId != null) {
                LOG.debug("First branch root to be preserved: {}", firstBranchRootId);
            }
            Id firstCommitId = markCommits();
            LOG.debug("First commit to be preserved: {}", firstCommitId);

            LOG.debug("Marked {} commits, {} nodes.", markedCommits, markedNodes);

            if (firstBranchRootId != null && firstBranchRootId.compareTo(firstCommitId) < 0) {
View Full Code Here

       
        synchronized (branches) {
            tmpBranches = (Map<Id,Id>) branches.clone();
        }
       
        Id firstBranchRootId = null;
       
        /* Mark all branch commits */
        for (Entry<Id, Id> entry : tmpBranches.entrySet()) {
            Id branchRevId = entry.getKey();
            Id branchRootId = entry.getValue();
            while (!branchRevId.equals(branchRootId)) {
                StoredCommit commit = getCommit(branchRevId);
                markCommit(commit);
                branchRevId = commit.getParentId();
            }
View Full Code Here

        StoredCommit commit = getHeadCommit();
        long tsLimit = commit.getCommitTS() - (60 * 60 * 1000);

        for (;;) {
            markCommit(commit);
            Id id = commit.getParentId();
            if (id == null) {
                break;
            }
            StoredCommit parentCommit = getCommit(id);
            if (parentCommit.getCommitTS() < tsLimit) {
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.mk.model.Id

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.