All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.eliux.mega.cmd.AbstractMegaCmdPathHandler Maven / Gradle / Ivy

Go to download

Java client library that works on top of MEGAcmd to provide access to the services of Mega.nz

There is a newer version: 1.6.2
Show newest version
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();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy