Search in sources :

Example 1 with PathRef

use of com.enonic.xp.repo.impl.dump.PathRef in project xp by enonic.

the class AbstractDumpReader method loadCommits.

@Override
public CommitsLoadResult loadCommits(final RepositoryId repositoryId, final LineProcessor<EntryLoadResult> processor) {
    final PathRef tarFile = filePaths.commitMetaPath(repositoryId);
    listener.loadingCommits(repositoryId);
    final CommitsLoadResult.Builder builder = CommitsLoadResult.create();
    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) CommitsLoadResult(com.enonic.xp.dump.CommitsLoadResult)

Example 2 with PathRef

use of com.enonic.xp.repo.impl.dump.PathRef 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 3 with PathRef

use of com.enonic.xp.repo.impl.dump.PathRef in project xp by enonic.

the class AbstractDumpReader method loadVersions.

@Override
public VersionsLoadResult loadVersions(final RepositoryId repositoryId, final LineProcessor<EntryLoadResult> processor) {
    final PathRef tarFile = filePaths.versionMetaPath(repositoryId);
    listener.loadingVersions(repositoryId);
    final VersionsLoadResult.Builder builder = VersionsLoadResult.create();
    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) VersionsLoadResult(com.enonic.xp.dump.VersionsLoadResult)

Example 4 with PathRef

use of com.enonic.xp.repo.impl.dump.PathRef in project xp by enonic.

the class AbstractDumpWriter method openBranchMeta.

@Override
public void openBranchMeta(final RepositoryId repositoryId, final Branch branch) {
    final PathRef branchMetaPath = filePaths.branchMetaPath(repositoryId, branch);
    openTarStream(branchMetaPath);
}
Also used : PathRef(com.enonic.xp.repo.impl.dump.PathRef)

Example 5 with PathRef

use of com.enonic.xp.repo.impl.dump.PathRef in project xp by enonic.

the class AbstractDumpWriter method openCommitsMeta.

@Override
public void openCommitsMeta(final RepositoryId repositoryId) {
    final PathRef commitMetaPath = filePaths.commitMetaPath(repositoryId);
    openTarStream(commitMetaPath);
}
Also used : PathRef(com.enonic.xp.repo.impl.dump.PathRef)

Aggregations

PathRef (com.enonic.xp.repo.impl.dump.PathRef)6 BlobKey (com.enonic.xp.blob.BlobKey)3 NodeVersionKey (com.enonic.xp.blob.NodeVersionKey)3 Segment (com.enonic.xp.blob.Segment)3 Branch (com.enonic.xp.branch.Branch)3 Branches (com.enonic.xp.branch.Branches)3 BranchDumpResult (com.enonic.xp.dump.BranchDumpResult)3 BranchLoadResult (com.enonic.xp.dump.BranchLoadResult)3 CommitsLoadResult (com.enonic.xp.dump.CommitsLoadResult)3 LoadError (com.enonic.xp.dump.LoadError)3 RepoDumpResult (com.enonic.xp.dump.RepoDumpResult)3 SystemDumpResult (com.enonic.xp.dump.SystemDumpResult)3 SystemLoadListener (com.enonic.xp.dump.SystemLoadListener)3 VersionsLoadResult (com.enonic.xp.dump.VersionsLoadResult)3 NodeVersion (com.enonic.xp.node.NodeVersion)3 DumpConstants (com.enonic.xp.repo.impl.dump.DumpConstants)3 FilePaths (com.enonic.xp.repo.impl.dump.FilePaths)3 NullSystemLoadListener (com.enonic.xp.repo.impl.dump.NullSystemLoadListener)3 RepoDumpException (com.enonic.xp.repo.impl.dump.RepoDumpException)3 RepoLoadException (com.enonic.xp.repo.impl.dump.RepoLoadException)3