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

com.fastchar.oss.ali.AliOSSConfig Maven / Gradle / Ivy

There is a newer version: 1.6.1
Show newest version
package com.fastchar.oss.ali;

import com.fastchar.core.FastChar;
import com.fastchar.interfaces.IFastConfig;
import com.fastchar.oss.core.FastOSSFile;
import com.fastchar.oss.exception.FastAliBlockException;

import java.util.ArrayList;
import java.util.List;

/**
 * 阿里OSS 配置
 */
public class AliOSSConfig implements IFastConfig {
    private String accessKeyId;
    private String accessKeySecret;
    private String endPoint;
    private List blocks = new ArrayList<>();
    private int minute = 60;

    public AliOSSConfig() {
        FastChar.getOverrides().add(FastOSSFile.class);
    }

    public String getAccessKeyId() {
        return accessKeyId;
    }

    public AliOSSConfig setAccessKeyId(String accessKeyId) {
        this.accessKeyId = accessKeyId;
        return this;
    }

    public String getAccessKeySecret() {
        return accessKeySecret;
    }

    public AliOSSConfig setAccessKeySecret(String accessKeySecret) {
        this.accessKeySecret = accessKeySecret;
        return this;
    }

    public String getEndPoint() {
        return endPoint;
    }

    public AliOSSConfig setEndPoint(String endPoint) {
        this.endPoint = endPoint;
        return this;
    }

    public AliOSSConfig addBlock(String blockName, String blockHttp, AliOSSBlock.SecurityEnum blockSecurity) {
        this.blocks.add(new AliOSSBlock().setBlockName(blockName).setBlockHttp(blockHttp).setBlockSecurity(blockSecurity));
        return this;
    }

    public AliOSSBlock getBlock(String blockName) {
        for (AliOSSBlock block : blocks) {
            if (block.getBlockName().equals(blockName)) {
                return block;
            }
        }
        throw new FastAliBlockException("not found block '" + blockName + "'!");
    }

    public int getMinute() {
        return minute;
    }

    public AliOSSConfig setMinute(int minute) {
        this.minute = minute;
        return this;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy