com.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 com.github.eliux.mega.cmd;
public abstract class AbstractMegaCmdPathHandler extends AbstractMegaCmdRunnerWithParams {
private boolean remoteFolderCreatedIfNotPresent;
private boolean uploadQueued;
private boolean isQuotaWarningIgnored;
@Override
String cmdParams() {
StringBuilder cmdParamsBuilder = new StringBuilder();
if (remoteFolderCreatedIfNotPresent) {
cmdParamsBuilder.append("-c ");
}
if (uploadQueued) {
cmdParamsBuilder.append("-q ");
}
if (isQuotaWarningIgnored) {
cmdParamsBuilder.append("--ignore-quota-warn ");
}
cmdParamsBuilder.append(cmdFileParams());
return cmdParamsBuilder.toString();
}
public R createRemoteIfNotPresent() {
remoteFolderCreatedIfNotPresent = true;
return (R) this;
}
public R skipIfRemoteNotPresent() {
remoteFolderCreatedIfNotPresent = false;
return (R) this;
}
public boolean isRemoteFolderCreatedIfNotPresent() {
return remoteFolderCreatedIfNotPresent;
}
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 String cmdFileParams();
}