Search in sources :

Example 1 with BranchLoadResult

use of com.enonic.xp.dump.BranchLoadResult in project xp by enonic.

the class AbstractDumpReader method loadBranch.

@Override
public BranchLoadResult loadBranch(final RepositoryId repositoryId, final Branch branch, final LineProcessor<EntryLoadResult> processor) {
    final PathRef tarFile = filePaths.branchMetaPath(repositoryId, branch);
    listener.loadingBranch(repositoryId, branch, getBranchSuccessfulCountFromMeta(repositoryId, branch));
    final BranchLoadResult.Builder builder = BranchLoadResult.create(branch);
    if (!exists(tarFile)) {
        return builder.build();
    }
    final EntriesLoadResult result = doLoadEntries(processor, tarFile);
    return builder.successful(result.getSuccessful()).errors(result.getErrors().stream().map(error -> LoadError.error(error.getMessage())).collect(Collectors.toList())).build();
}
Also used : GZIPInputStream(java.util.zip.GZIPInputStream) DumpBlobStore(com.enonic.xp.repo.impl.dump.blobstore.DumpBlobStore) TarArchiveInputStream(org.apache.commons.compress.archivers.tar.TarArchiveInputStream) FilePaths(com.enonic.xp.repo.impl.dump.FilePaths) RepositoryIds(com.enonic.xp.repository.RepositoryIds) BranchDumpResult(com.enonic.xp.dump.BranchDumpResult) Segment(com.enonic.xp.blob.Segment) BlobKey(com.enonic.xp.blob.BlobKey) Branch(com.enonic.xp.branch.Branch) RepoLoadException(com.enonic.xp.repo.impl.dump.RepoLoadException) RepositoryId(com.enonic.xp.repository.RepositoryId) TarArchiveEntry(org.apache.commons.compress.archivers.tar.TarArchiveEntry) RepoDumpResult(com.enonic.xp.dump.RepoDumpResult) DumpMetaJsonSerializer(com.enonic.xp.repo.impl.dump.serializer.json.DumpMetaJsonSerializer) ByteSource(com.google.common.io.ByteSource) DumpConstants(com.enonic.xp.repo.impl.dump.DumpConstants) CommitsLoadResult(com.enonic.xp.dump.CommitsLoadResult) ImmutableSet(com.google.common.collect.ImmutableSet) RepositorySegmentUtils(com.enonic.xp.repository.RepositorySegmentUtils) NodeVersionKey(com.enonic.xp.blob.NodeVersionKey) IOException(java.io.IOException) SystemLoadListener(com.enonic.xp.dump.SystemLoadListener) Branches(com.enonic.xp.branch.Branches) Collectors(java.util.stream.Collectors) StandardCharsets(java.nio.charset.StandardCharsets) UncheckedIOException(java.io.UncheckedIOException) Objects(java.util.Objects) LineProcessor(com.google.common.io.LineProcessor) SystemDumpResult(com.enonic.xp.dump.SystemDumpResult) LoadError(com.enonic.xp.dump.LoadError) Stream(java.util.stream.Stream) DumpMeta(com.enonic.xp.repo.impl.dump.model.DumpMeta) NodeVersion(com.enonic.xp.node.NodeVersion) VersionsLoadResult(com.enonic.xp.dump.VersionsLoadResult) PathRef(com.enonic.xp.repo.impl.dump.PathRef) DumpBlobRecord(com.enonic.xp.repo.impl.dump.blobstore.DumpBlobRecord) NullSystemLoadListener(com.enonic.xp.repo.impl.dump.NullSystemLoadListener) BranchLoadResult(com.enonic.xp.dump.BranchLoadResult) RepoDumpException(com.enonic.xp.repo.impl.dump.RepoDumpException) InputStream(java.io.InputStream) PathRef(com.enonic.xp.repo.impl.dump.PathRef) BranchLoadResult(com.enonic.xp.dump.BranchLoadResult)

Example 2 with BranchLoadResult

use of com.enonic.xp.dump.BranchLoadResult in project xp by enonic.

the class RepoLoader method doExecute.

private void doExecute(final RepoLoadResult.Builder result) {
    final Branch currentBranch = ContextAccessor.current().getBranch();
    verifyOrCreateBranch(currentBranch);
    final BranchLoadResult branchLoadResult = this.reader.loadBranch(repositoryId, currentBranch, this.branchEntryProcessor);
    result.add(branchLoadResult);
}
Also used : Branch(com.enonic.xp.branch.Branch) BranchLoadResult(com.enonic.xp.dump.BranchLoadResult)

Example 3 with BranchLoadResult

use of com.enonic.xp.dump.BranchLoadResult in project xp by enonic.

the class LoadRunnableTask method importSystemRepo.

private RepoLoadResult importSystemRepo(final Path rootDir) {
    final RepoLoadResult.Builder builder = RepoLoadResult.create(SystemConstants.SYSTEM_REPO_ID);
    final NodeImportResult systemRepoImport = importRepoBranch(SystemConstants.SYSTEM_REPO_ID.toString(), SystemConstants.BRANCH_SYSTEM.toString(), rootDir);
    final BranchLoadResult branchLoadResult = NodeImportResultTranslator.translate(systemRepoImport, SystemConstants.BRANCH_SYSTEM);
    builder.add(branchLoadResult);
    return builder.build();
}
Also used : BranchLoadResult(com.enonic.xp.dump.BranchLoadResult) RepoLoadResult(com.enonic.xp.dump.RepoLoadResult) NodeImportResult(com.enonic.xp.export.NodeImportResult)

Aggregations

BranchLoadResult (com.enonic.xp.dump.BranchLoadResult)3 Branch (com.enonic.xp.branch.Branch)2 BlobKey (com.enonic.xp.blob.BlobKey)1 NodeVersionKey (com.enonic.xp.blob.NodeVersionKey)1 Segment (com.enonic.xp.blob.Segment)1 Branches (com.enonic.xp.branch.Branches)1 BranchDumpResult (com.enonic.xp.dump.BranchDumpResult)1 CommitsLoadResult (com.enonic.xp.dump.CommitsLoadResult)1 LoadError (com.enonic.xp.dump.LoadError)1 RepoDumpResult (com.enonic.xp.dump.RepoDumpResult)1 RepoLoadResult (com.enonic.xp.dump.RepoLoadResult)1 SystemDumpResult (com.enonic.xp.dump.SystemDumpResult)1 SystemLoadListener (com.enonic.xp.dump.SystemLoadListener)1 VersionsLoadResult (com.enonic.xp.dump.VersionsLoadResult)1 NodeImportResult (com.enonic.xp.export.NodeImportResult)1 NodeVersion (com.enonic.xp.node.NodeVersion)1 DumpConstants (com.enonic.xp.repo.impl.dump.DumpConstants)1 FilePaths (com.enonic.xp.repo.impl.dump.FilePaths)1 NullSystemLoadListener (com.enonic.xp.repo.impl.dump.NullSystemLoadListener)1 PathRef (com.enonic.xp.repo.impl.dump.PathRef)1