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

com.alipay.rdf.file.model.MergerConfig Maven / Gradle / Ivy

There is a newer version: 2.2.11
Show newest version
package com.alipay.rdf.file.model;

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

/**
 * Copyright (C) 2013-2018 Ant Financial Services Group
 * 
 * @author hongwei.quhw
 * @version $Id: MergerConfig.java, v 0.1 2017年4月20日 下午7:37:44 hongwei.quhw Exp $
 */
public class MergerConfig {
    /** 头分片路径*/
    private List headFilePaths;
    /** body分片路径*/
    private List bodyFilePaths;
    /** tail分片路径*/
    private List tailFilePaths;
    /** 已经存在的完整文件路径*/
    private List existFilePaths;
    /**是否采用输入流合并*/
    private boolean          streamAppend;

    public List getHeadFilePaths() {
        return headFilePaths;
    }

    public void setHeadFilePaths(List headFilePaths) {
        this.headFilePaths = popluate(headFilePaths);
    }

    public void setHeadFilePaths(List headFilePaths, StorageConfig storageConfig) {
        this.headFilePaths = popluate(headFilePaths, storageConfig);
    }

    public void setHeadFilePathHolders(List headFilePaths) {
        this.headFilePaths = headFilePaths;
    }

    public List getBodyFilePaths() {
        return bodyFilePaths;
    }

    public void setBodyFilePaths(List bodyFilePaths) {
        this.bodyFilePaths = popluate(bodyFilePaths);
    }

    public void setBodyFilePaths(List bodyFilePaths, StorageConfig storageConfig) {
        this.bodyFilePaths = popluate(bodyFilePaths, storageConfig);
    }

    public void setBodyFilePathHolders(List bodyFilePaths) {
        this.bodyFilePaths = bodyFilePaths;
    }

    public List getTailFilePaths() {
        return tailFilePaths;
    }

    public void setTailFilePaths(List tailFilePaths) {
        this.tailFilePaths = popluate(tailFilePaths);
    }

    public void setTailFilePaths(List tailFilePaths, StorageConfig storageConfig) {
        this.tailFilePaths = popluate(tailFilePaths, storageConfig);
    }

    public void setTailFilePathHolders(List tailFilePaths) {
        this.tailFilePaths = tailFilePaths;
    }

    public List getExistFilePaths() {
        return existFilePaths;
    }

    public void setExistFilePaths(List existFilePaths) {
        this.existFilePaths = popluate(existFilePaths);
    }

    public void setExistFilePathHolders(List existFilePaths) {
        this.existFilePaths = existFilePaths;
    }

    public boolean isStreamAppend() {
        return streamAppend;
    }

    public void setStreamAppend(boolean streamAppend) {
        this.streamAppend = streamAppend;
    }

    private List popluate(List filePaths) {
        return popluate(filePaths, null);
    }

    private List popluate(List filePaths, StorageConfig storageConfig) {
        if (null == filePaths || 0 == filePaths.size()) {
            return null;
        }

        List holders = new ArrayList();
        for (String path : filePaths) {
            holders.add(new PathHolder(path, storageConfig));
        }

        return holders;
    }

    @Override
    public String toString() {
        StringBuffer buffer = new StringBuffer("MergerConfig=[");
        buffer.append("streamAppend=").append(streamAppend);
        buffer.append(",headFilePaths=").append(headFilePaths);
        buffer.append(",bodyFilePaths=").append(bodyFilePaths);
        buffer.append(",tailFilePaths=").append(tailFilePaths);
        buffer.append(",existFilePaths=").append(existFilePaths);
        buffer.append("]");

        return buffer.toString();
    }

    public static final class PathHolder {
        private String        filePath;
        private StorageConfig storageConfig;

        public PathHolder(String filePath, StorageConfig storageConfig) {
            this.filePath = filePath;
            this.storageConfig = storageConfig;
        }

        public String getFilePath() {
            return filePath;
        }

        public StorageConfig getStorageConfig() {
            return storageConfig;
        }

        public void setStorageConfig(StorageConfig storageConfig) {
            this.storageConfig = storageConfig;
        }

        @Override
        public String toString() {
            return "PathHolder[filePath=" + filePath + ", storageConfig=" + storageConfig + "]";
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy