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

io.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 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();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy