io.github.eliux.mega.cmd.AbstractMegaCmdPathHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of megacmd4j Show documentation
Show all versions of megacmd4j Show documentation
Java client library that works on top of MEGAcmd to provide access to the services of Mega.nz
package io.github.eliux.mega.cmd;
import java.util.LinkedList;
import java.util.List;
public abstract class AbstractMegaCmdPathHandler extends AbstractMegaCmdRunnerWithParams {
private boolean remotePathCreatedIfNotPresent;
private boolean uploadQueued;
private boolean isQuotaWarningIgnored = true;
@Override
List cmdParams() {
List cmdParams = new LinkedList<>();
if (remotePathCreatedIfNotPresent) {
cmdParams.add("-c");
}
if (uploadQueued) {
cmdParams.add("-q");
}
if (isQuotaWarningIgnored) {
cmdParams.add("--ignore-quota-warn");
}
cmdParams.addAll(cmdFileParams());
return cmdParams;
}
public R createRemotePathIfNotPresent() {
remotePathCreatedIfNotPresent = true;
return (R) this;
}
public R skipIfRemotePathNotPresent() {
remotePathCreatedIfNotPresent = false;
return (R) this;
}
public boolean isRemotePathCreatedIfNotPresent() {
return remotePathCreatedIfNotPresent;
}
public R queueUpload() {
uploadQueued = true;
return (R) this;
}
public R waitToUpload() {
uploadQueued = false;
return (R) this;
}
public boolean isUploadQueued() {
return uploadQueued;
}
public R ignoreQuotaSurpassingWarning() {
this.isQuotaWarningIgnored = true;
return (R) this;
}
public R warnQuotaSurpassing() {
this.isQuotaWarningIgnored = false;
return (R) this;
}
public boolean isQuotaWarningIgnored() {
return isQuotaWarningIgnored;
}
protected abstract List cmdFileParams();
}