in oak-upgrade/src/main/java/org/apache/jackrabbit/oak/upgrade/cli/parser/DatastoreArguments.java [203:242]
private BlobMigrationCase discoverBlobMigrationCase() throws IOException {
boolean srcDefined = options.isSrcBlobStoreDefined() || storeArguments.getSrcType() == JCR2_DIR_XML;
boolean dstDefined = options.isDstBlobStoreDefined();
boolean copyBinaries = options.isCopyBinaries();
boolean srcSegment = storeArguments.getSrcType().isSegment();
boolean dstSegment = storeArguments.getDstType().isSegment();
// default case, no datastore-related arguments given, but blobs are stored externally
if (!srcDefined && !dstDefined && !srcEmbedded && !copyBinaries) {
if (srcSegment && !dstSegment) { // segment -> document is not supported for this case
return BlobMigrationCase.UNSUPPORTED;
} else { // we try to copy references using MissingBlobStore
return BlobMigrationCase.COPY_REFERENCES;
}
// can't copy binaries if they are stored externally and we don't know where
} else if (!srcDefined && !dstDefined && !srcEmbedded && copyBinaries) {
return BlobMigrationCase.UNSUPPORTED;
// can't copy binaries if they are stored externally and we don't know where
// (even if the destination datastore is defined)
} else if (!srcDefined && !srcEmbedded && dstDefined) {
return BlobMigrationCase.UNSUPPORTED;
// source is embedded and no destination given
} else if (!srcDefined && srcEmbedded && !dstDefined) {
return BlobMigrationCase.EMBEDDED_TO_EMBEDDED;
// source is embedded and the destination is given
} else if (!srcDefined && srcEmbedded && dstDefined) {
return BlobMigrationCase.EMBEDDED_TO_EXTERNAL;
// source is given, no destination, but also no --copy-binaries -> copy references
} else if (srcDefined && !dstDefined && !copyBinaries) {
return BlobMigrationCase.COPY_REFERENCES;
// source is given, no destination, but --copy-binaries -> copy to embedded
} else if (srcDefined && !dstDefined && copyBinaries) {
return BlobMigrationCase.EXTERNAL_TO_EMBEDDED;
// source and destination is given
} else if (srcDefined && dstDefined) {
return BlobMigrationCase.EXTERNAL_TO_EXTERNAL;
}
return BlobMigrationCase.UNSUPPORTED;
}