Search in sources :

Example 1 with DumpBlobRecord

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

the class AbstractDumpReader method getBinary.

@Override
public ByteSource getBinary(final RepositoryId repositoryId, final String blobKey) {
    final Segment segment = RepositorySegmentUtils.toSegment(repositoryId, DumpConstants.DUMP_BINARY_SEGMENT_LEVEL);
    final DumpBlobRecord record = this.dumpBlobStore.getRecord(segment, BlobKey.from(blobKey));
    if (record == null) {
        throw new RepoLoadException("Cannot find referred blob id " + blobKey + " in dump");
    }
    return record.getBytes();
}
Also used : RepoLoadException(com.enonic.xp.repo.impl.dump.RepoLoadException) DumpBlobRecord(com.enonic.xp.repo.impl.dump.blobstore.DumpBlobRecord) Segment(com.enonic.xp.blob.Segment)

Example 2 with DumpBlobRecord

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

the class FlattenedPageDumpUpgrader method upgradeVersionMeta.

private void upgradeVersionMeta(final Pre4VersionDumpEntryJson version, final FlattenedPageDataUpgrader dataUpgrader) {
    final DumpBlobRecord dumpBlobRecord = dumpReader.getDumpBlobStore().getRecord(SEGMENT, BlobKey.from(version.getBlobKey()));
    upgradeBlobRecord(dumpBlobRecord, dataUpgrader);
}
Also used : DumpBlobRecord(com.enonic.xp.repo.impl.dump.blobstore.DumpBlobRecord)

Example 3 with DumpBlobRecord

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

the class AbstractDumpReader method get.

@Override
public NodeVersion get(final RepositoryId repositoryId, final NodeVersionKey nodeVersionKey) {
    final Segment nodeSegment = RepositorySegmentUtils.toSegment(repositoryId, DumpConstants.DUMP_NODE_SEGMENT_LEVEL);
    final DumpBlobRecord dataRecord = this.dumpBlobStore.getRecord(nodeSegment, nodeVersionKey.getNodeBlobKey());
    final Segment indexConfigSegment = RepositorySegmentUtils.toSegment(repositoryId, DumpConstants.DUMP_INDEX_CONFIG_SEGMENT_LEVEL);
    final DumpBlobRecord indexConfigRecord = this.dumpBlobStore.getRecord(indexConfigSegment, nodeVersionKey.getIndexConfigBlobKey());
    final Segment accessControlSegment = RepositorySegmentUtils.toSegment(repositoryId, DumpConstants.DUMP_ACCESS_CONTROL_SEGMENT_LEVEL);
    final DumpBlobRecord accessControlRecord = this.dumpBlobStore.getRecord(accessControlSegment, nodeVersionKey.getAccessControlBlobKey());
    return this.factory.create(dataRecord.getBytes(), indexConfigRecord.getBytes(), accessControlRecord.getBytes());
}
Also used : DumpBlobRecord(com.enonic.xp.repo.impl.dump.blobstore.DumpBlobRecord) Segment(com.enonic.xp.blob.Segment)

Example 4 with DumpBlobRecord

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

the class IndexConfigUpgrader method upgradeVersionMeta.

private VersionDumpEntryJson upgradeVersionMeta(final VersionDumpEntryJson version) {
    final DumpBlobRecord nodeBlobRecord = dumpReader.getDumpBlobStore().getRecord(NODE_SEGMENT, BlobKey.from(version.getNodeBlobKey()));
    final NodeVersionDataJson nodeVersionDataJson = getNode(nodeBlobRecord);
    final NodeVersion nodeVersion = nodeVersionDataJson.fromJson().build();
    if (ContentConstants.CONTENT_NODE_COLLECTION.equals(nodeVersion.getNodeType())) {
        final BlobKey newIndexConfigBlob = upgradeIndexConfigDocument(BlobKey.from(version.getIndexConfigBlobKey()), nodeVersion);
        return VersionDumpEntryJson.create(version).indexConfigBlobKey(newIndexConfigBlob.toString()).build();
    }
    return version;
}
Also used : NodeVersion(com.enonic.xp.node.NodeVersion) BlobKey(com.enonic.xp.blob.BlobKey) DumpBlobRecord(com.enonic.xp.repo.impl.dump.blobstore.DumpBlobRecord) NodeVersionDataJson(com.enonic.xp.repo.impl.node.json.NodeVersionDataJson)

Example 5 with DumpBlobRecord

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

the class IndexConfigUpgrader method upgradeIndexConfigDocument.

private BlobKey upgradeIndexConfigDocument(final BlobKey blobKey, final NodeVersion nodeVersion) {
    final DumpBlobRecord indexConfigBlobRecord = dumpReader.getDumpBlobStore().getRecord(INDEX_CONFIG_SEGMENT, blobKey);
    final PatternIndexConfigDocument sourceDocument = getIndexConfigDocument(indexConfigBlobRecord);
    PatternIndexConfigDocument upgradedDocument = this.upgradeLanguageIndexConfig(sourceDocument, nodeVersion);
    upgradedDocument = this.upgradePageIndexConfig(upgradedDocument, nodeVersion);
    return !upgradedDocument.equals(sourceDocument) ? storeIndexConfigBlob(upgradedDocument) : blobKey;
}
Also used : DumpBlobRecord(com.enonic.xp.repo.impl.dump.blobstore.DumpBlobRecord) PatternIndexConfigDocument(com.enonic.xp.index.PatternIndexConfigDocument)

Aggregations

DumpBlobRecord (com.enonic.xp.repo.impl.dump.blobstore.DumpBlobRecord)9 Segment (com.enonic.xp.blob.Segment)3 NodeVersion (com.enonic.xp.node.NodeVersion)3 BlobKey (com.enonic.xp.blob.BlobKey)2 NodeVersionDataJson (com.enonic.xp.repo.impl.node.json.NodeVersionDataJson)2 PatternIndexConfigDocument (com.enonic.xp.index.PatternIndexConfigDocument)1 RepoLoadException (com.enonic.xp.repo.impl.dump.RepoLoadException)1 Pre4NodeVersionJson (com.enonic.xp.repo.impl.dump.upgrade.obsoletemodel.pre4.Pre4NodeVersionJson)1