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

com.qiniu.datasource.QiniuOssContainer Maven / Gradle / Ivy

There is a newer version: 8.4.8
Show newest version
package com.qiniu.datasource;

import com.qiniu.common.SuitsException;
import com.qiniu.convert.QOSObjToMap;
import com.qiniu.convert.QOSObjToString;
import com.qiniu.interfaces.ITypeConvert;
import com.qiniu.storage.BucketManager;
import com.qiniu.storage.Configuration;
import com.qiniu.storage.model.FileInfo;
import com.qiniu.util.Auth;

import java.io.IOException;
import java.util.*;

public class QiniuOssContainer extends OssContainer {

    private String accessKey;
    private String secretKey;
    private Configuration configuration;

    public QiniuOssContainer(String accessKey, String secretKey, Configuration configuration, String bucket,
                             List antiPrefixes, Map prefixesMap, boolean prefixLeft,
                             boolean prefixRight, Map indexMap, int unitLen, int threads) {
        super(bucket, antiPrefixes, prefixesMap, prefixLeft, prefixRight, indexMap, unitLen, threads);
        this.accessKey = accessKey;
        this.secretKey = secretKey;
        this.configuration = configuration;
    }

    @Override
    public String getSourceName() {
        return "qiniu";
    }

    @Override
    protected ITypeConvert> getNewMapConverter() {
        return new QOSObjToMap(indexMap);
    }

    @Override
    protected ITypeConvert getNewStringConverter() throws IOException {
        return new QOSObjToString(saveFormat, saveSeparator, rmFields);
    }

    @Override
    protected ILister getLister(String prefix, String marker, String end) throws SuitsException {
        return new QiniuLister(new BucketManager(Auth.create(accessKey, secretKey), configuration.clone()), bucket,
                prefix, marker, end, null, unitLen);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy