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

com.qiniu.util.ProcessUtils Maven / Gradle / Ivy

package com.qiniu.util;

import java.util.HashSet;
import java.util.Set;

public final class ProcessUtils {

    public static Set needUrlProcesses = new HashSet(){{
        add("asyncfetch");
        add("privateurl");
        add("qhash");
        add("avinfo");
        add("exportts");
        add("tenprivate");
        add("awsprivate");
        add("s3private");
        add("aliprivate");
        add("huaweiprivate");
        add("baiduprivate");
        add("download");
        add("imagecensor");
        add("videocensor");
        add("cdnrefresh");
        add("cdnprefetch");
        add("fetch");
        add("syncupload");
    }};
    public static Set needToKeyProcesses = new HashSet(){{
        add("copy");
        add("move");
        add("rename");
    }};
    public static Set needFopsProcesses = new HashSet(){{
        add("pfop");
    }};
    public static Set needIdProcesses = new HashSet(){{
        add("pfopresult");
        add("censorresult");
    }};
    public static Set needAvinfoProcesses = new HashSet(){{
        add("pfopcmd");
    }};
    public static Set needFilepathProcesses = new HashSet(){{
        add("qupload");
    }};
    public static Set qiniuProcessesWithBucket = new HashSet(){{
        add("status");
        add("type");
        add("lifecycle");
        add("delete");
        add("copy");
        add("rename");
        add("move");
        add("pfop");
        add("stat");
        add("qupload");
        add("mime");
        add("metadata");
    }};
    public static Set canBatchProcesses = new HashSet(){{
        add("status");
        add("type");
        add("lifecycle");
        add("copy");
        add("move");
        add("rename");
        add("delete");
        add("stat");
        add("mime");
        add("metadata");
        add("cdnrefresh");
        add("cdnprefetch");
    }};
    public static Set tenProcesses = new HashSet(){{
        add("tenprivate");
    }};
    public static Set awsS3Processes = new HashSet(){{
        add("awsprivate");
        add("s3private");
    }};
    public static Set aliProcesses = new HashSet(){{
        add("aliprivate");
    }};
    public static Set huaweiProcesses = new HashSet(){{
        add("huaweiprivate");
    }};
    public static Set baiduProcesses = new HashSet(){{
        add("baiduprivate");
    }};
    public static Set needBucketProcesses = new HashSet(){{
        addAll(qiniuProcessesWithBucket);
        addAll(tenProcesses);
        addAll(awsS3Processes);
        addAll(aliProcesses);
        addAll(huaweiProcesses);
        addAll(baiduProcesses);
    }};
    public static Set needQiniuAuthProcesses = new HashSet(){{
        addAll(qiniuProcessesWithBucket);
        add("mirror");
        add("fetch");
        add("asyncfetch");
        add("syncupload");
        add("privateurl");
        add("imagecensor");
        add("videocensor");
        add("censorresult");
        add("cdnrefresh");
        add("cdnprefetch");
    }};
    public static Set supportStorageSource = new HashSet(){{
        addAll(needQiniuAuthProcesses);
        addAll(needBucketProcesses);
        add("qhash");
        add("avinfo");
        add("exportts");
        add("download");
        add("filter");
    }};
    public static Set dangerousProcesses = new HashSet(){{
        add("status");
        add("lifecycle");
        add("move");
        add("rename");
        add("delete");
    }};
//    public static Set processes = new HashSet(){{
//        addAll(needUrlProcesses);
//        addAll(needToKeyProcesses);
//        addAll(needFopsProcesses);
//        addAll(needPidProcesses);
//        addAll(needAvinfoProcesses);
//        addAll(needBucketAnKeyProcesses);
//        addAll(supportListSourceProcesses);
//    }};
    public static Set canPrivateToNextProcesses = new HashSet(){{
        add("asyncfetch");
        add("download");
        add("imagecensor");
        add("videocensor");
        add("fetch");
        add("syncupload");
    }};

    public static boolean needUrl(String process) {
        return needUrlProcesses.contains(process);
    }

    public static boolean needToKey(String process) {
        return needToKeyProcesses.contains(process);
    }

    public static boolean needFops(String process) {
        return needFopsProcesses.contains(process);
    }

    public static boolean needId(String process) {
        return needIdProcesses.contains(process);
    }

    public static boolean needAvinfo(String process) {
        return needAvinfoProcesses.contains(process);
    }

    public static boolean needFilepath(String process) {
        return needFilepathProcesses.contains(process);
    }

    public static boolean needBucket(String process) {
        return needBucketProcesses.contains(process);
    }

    public static boolean needQiniuAuth(String process) {
        return needQiniuAuthProcesses.contains(process);
    }

    public static boolean needTencentAuth(String process) {
        return tenProcesses.contains(process);
    }

    public static boolean needAliyunAuth(String process) {
        return aliProcesses.contains(process);
    }

    public static boolean needAwsS3Auth(String process) {
        return awsS3Processes.contains(process);
    }

    public static boolean needHuaweiAuth(String process) {
        return huaweiProcesses.contains(process);
    }

    public static boolean needBaiduAuth(String process) {
        return baiduProcesses.contains(process);
    }

    public static boolean canBatch(String process) {
        return canBatchProcesses.contains(process);
    }

    public static boolean supportStorageSource(String process) {
        return supportStorageSource.contains(process);
    }

    public static boolean isDangerous(String process) {
        return dangerousProcesses.contains(process);
    }

//    public static boolean isSupportedProcess(String process) {
//        return processes.contains(process);
//    }

    public static boolean canPrivateToNext(String process) {
        return canPrivateToNextProcesses.contains(process);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy