in gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/CopyableFile.java [289:336]
public CopyableFile build() throws IOException {
if (!this.destination.isAbsolute()) {
throw new IOException("Destination must be absolute: " + this.destination);
}
if (this.destinationOwnerAndPermission == null) {
String owner = this.preserve.preserve(Option.OWNER) ? this.origin.getOwner() : null;
String group = null;
if (this.preserve.preserve(Option.GROUP)) {
group = this.origin.getGroup();
} else if (this.configuration.getTargetGroup().isPresent()) {
group = this.configuration.getTargetGroup().get();
}
FsPermission permission = this.preserve.preserve(Option.PERMISSION) ? this.origin.getPermission() : null;
List<AclEntry> aclEntries = this.preserve.preserve(Option.ACLS) ? getAclEntries(this.originFs, this.origin.getPath()) : Lists.newArrayList();
this.destinationOwnerAndPermission = new OwnerAndPermission(owner, group, permission, aclEntries);
}
if (this.ancestorsOwnerAndPermission == null) {
this.ancestorsOwnerAndPermission = replicateAncestorsOwnerAndPermission(this.originFs, this.origin.getPath(),
this.configuration.getTargetFs(), this.destination);
}
if (this.checksum == null) {
if (ConfigUtils.getBoolean(this.configuration.getConfig(), "copy.skipChecksum", true)) {
this.checksum = EMPTY_CHECKSUM;
} else {
FileChecksum checksumTmp = this.origin.isDirectory() ? null : this.originFs.getFileChecksum(this.origin.getPath());
this.checksum = checksumTmp == null ? EMPTY_CHECKSUM : checksumTmp.getBytes();
}
}
if (this.fileSet == null) {
// Default file set per dataset
this.fileSet = "";
}
if (this.originTimestamp == 0) {
this.originTimestamp = this.origin.getModificationTime();
}
if (this.upstreamTimestamp == 0) {
this.upstreamTimestamp = this.origin.getModificationTime();
}
return new CopyableFile(this.origin, this.destination, this.destinationOwnerAndPermission,
this.ancestorsOwnerAndPermission, this.checksum, this.preserve, this.fileSet, this.originTimestamp,
this.upstreamTimestamp, this.additionalMetadata, this.datasetOutputPath, this.dataFileVersionStrategy);
}