Package org.apache.jackrabbit.mk.model

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


        }
    }

    @Override
    public String rebase(String branchRevisionId, String newBaseRevisionId) {
        Id branchId = Id.fromString(branchRevisionId);
        Id baseId = getBaseRevisionId(branchId);
        Id newBaseId = newBaseRevisionId == null ? getHeadRevisionId() : Id.fromString(newBaseRevisionId);

        if (baseId.equals(newBaseId)) {
            return branchRevisionId;
        }
        else {
            Id newBranchId = Id.fromString(branch(newBaseRevisionId));
            try {
                CommitBuilder cb = rep.getCommitBuilder(newBranchId,
                        "rebasing " + branchRevisionId + " onto " + newBaseRevisionId);
                return cb.rebase(baseId, branchId).toString();
            }
View Full Code Here


        return ((StoredNodeAsState) node).getId();
    }

    @Override
    public NodeState getRoot() {
        Id id;
        try {
            id = getHeadCommitId();
        } catch (Exception e) {
            throw new RuntimeException(
                    "Failed to access the head commit identifier", e);
View Full Code Here

        head = pm.readHead();
        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);
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 (!headLock.writeLock().isHeldByCurrentThread()) {
            throw new IllegalStateException(
                    "putHeadCommit called without holding write lock.");
        }

        Id id = writeCommit(token, commit);
        setHeadCommitId(id);
       
        putTokens.remove(token);
        if (branchRootId != null) {
            branches.remove(branchRootId);
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) {
            branches.put(branchRootId, commitId);
        }
       
        return commitId;
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

            return;
        }

        try {
            markUncommittedNodes();
            Id firstBranchRootId = markBranches();
            Id firstCommitId = markCommits();

            if (firstBranchRootId != null && firstBranchRootId.compareTo(firstCommitId) < 0) {
                firstCommitId = firstBranchRootId;
            }
            /* repair dangling parent commit of first preserved commit */
 
View Full Code Here

     *             if an error occurs
     */
    private Id markBranches() throws Exception {
        /* Mark all branch commits */
        for (Entry<Id, Id> entry : branches.entrySet()) {
            Id branchRootId = entry.getKey();
            Id branchHeadId = entry.getValue();
            while (!branchHeadId.equals(branchRootId)) {
                StoredCommit commit = getCommit(branchHeadId);
                markCommit(commit);
                branchHeadId = commit.getParentId();
            }
        }
        /* Mark all master commits till the first branch root id */
        if (!branches.isEmpty()) {
            Id firstBranchRootId = branches.keySet().iterator().next();
            StoredCommit commit = getHeadCommit();

            for (;;) {
                markCommit(commit);
                if (commit.getId().equals(firstBranchRootId)) {
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.