MainBranchImpl(long baseTimestamp) { super(MAIN_PATH, "", baseTimestamp, new MetadataImpl()); }
public CDOBranchManagerImpl(final InternalRepository repository, ObjectMapper mapper) { super(repository.getIndex()); this.repository = repository; final CDOBranch cdoMainBranch = repository.getCdoMainBranch(); final long baseTimestamp = repository.getBaseTimestamp(cdoMainBranch); // assign first segment to MAIN final int segmentId = segmentIds.getAndIncrement(); initBranchStore(new CDOMainBranchImpl(baseTimestamp, repository.getHeadTimestamp(cdoMainBranch), new MetadataImpl(), segmentId, ImmutableSet.of(segmentId))); int maxExistingSegment = segmentId; for (Branch branch : getBranches()) { if (branch instanceof InternalCDOBasedBranch) { final int branchSegmentId = ((InternalCDOBasedBranch) branch).segmentId(); if (branchSegmentId > maxExistingSegment) { maxExistingSegment = branchSegmentId; } } } segmentIds.set(maxExistingSegment+1); this.mapper = mapper; }
@Override public void replicateBranch(final org.eclipse.emf.cdo.common.branch.CDOBranch branch) { if (!branch.isMainBranch()) { final int cdoBranchId = branch.getID(); // if content already available with this cdoBranchId then skip Branch existingBranch = getBranch(cdoBranchId); if (existingBranch == null) { try { // get existing branch by name, this can be null, if this is the first replication of the branch existingBranch = getBranch(branch.getPathName()); } catch (NotFoundException e) { // ignore not found branches } final int parentCdoBranchId = branch.getBase().getBranch().getID(); final InternalCDOBasedBranch parent = (InternalCDOBasedBranch) getBranch(parentCdoBranchId); if (parent == null) { throw new SkipBranchException(branch); } final String name = branch.getName(); final long baseTimestamp = repository.getBaseTimestamp(branch); final long headTimestamp = repository.getHeadTimestamp(branch); doReopen(parent.path(), name, existingBranch == null ? new MetadataImpl() : existingBranch.metadata(), baseTimestamp, headTimestamp, cdoBranchId); } } }