Search in sources :

Example 11 with IHdfsFile

use of com.dtstack.dtcenter.loader.client.IHdfsFile in project Taier by DTStack.

the class HdfsOperator method checkAndDele.

/**
 * 文件检测并删除,递归删除
 *
 * @return
 */
public static boolean checkAndDele(Map<String, Object> conf, Map<String, Object> kerberos, String fileUri) {
    HdfsSourceDTO sourceDTO = getSourceDTO(conf, kerberos);
    IHdfsFile hdfsClient = ClientCache.getHdfs(DataSourceType.HDFS.getVal());
    return hdfsClient.checkAndDelete(sourceDTO, fileUri);
}
Also used : IHdfsFile(com.dtstack.dtcenter.loader.client.IHdfsFile) HdfsSourceDTO(com.dtstack.dtcenter.loader.dto.source.HdfsSourceDTO)

Example 12 with IHdfsFile

use of com.dtstack.dtcenter.loader.client.IHdfsFile in project Taier by DTStack.

the class HdfsOperator method createDir.

public static boolean createDir(Map<String, Object> conf, Map<String, Object> kerberos, String dir, short permission) {
    HdfsSourceDTO sourceDTO = getSourceDTO(conf, kerberos);
    IHdfsFile hdfsClient = ClientCache.getHdfs(DataSourceType.HDFS.getVal());
    dir = uri(dir);
    return hdfsClient.createDir(sourceDTO, dir, permission);
}
Also used : IHdfsFile(com.dtstack.dtcenter.loader.client.IHdfsFile) HdfsSourceDTO(com.dtstack.dtcenter.loader.dto.source.HdfsSourceDTO)

Example 13 with IHdfsFile

use of com.dtstack.dtcenter.loader.client.IHdfsFile in project Taier by DTStack.

the class HdfsOperator method getContentSummary.

/**
 * 获取hdfs上指定路径集合的ContentSummary
 *
 * @param conf
 * @param kerberos
 * @param targetPaths
 * @return
 */
public static List<HDFSContentSummary> getContentSummary(Map<String, Object> conf, Map<String, Object> kerberos, List<String> targetPaths) {
    try {
        HdfsSourceDTO sourceDTO = getSourceDTO(conf, kerberos);
        IHdfsFile hdfsClient = ClientCache.getHdfs(DataSourceType.HDFS.getVal());
        return hdfsClient.getContentSummary(sourceDTO, targetPaths);
    } catch (Exception e) {
        throw new DtCenterDefException(String.format("获取hdfs文件内容摘要异常!原因是:%s", e.getMessage()));
    }
}
Also used : IHdfsFile(com.dtstack.dtcenter.loader.client.IHdfsFile) DtCenterDefException(com.dtstack.taier.common.exception.DtCenterDefException) HdfsSourceDTO(com.dtstack.dtcenter.loader.dto.source.HdfsSourceDTO) DtCenterDefException(com.dtstack.taier.common.exception.DtCenterDefException) IOException(java.io.IOException) UnknownHostException(java.net.UnknownHostException)

Example 14 with IHdfsFile

use of com.dtstack.dtcenter.loader.client.IHdfsFile in project Taier by DTStack.

the class HdfsOperator method deleteFiles.

public static boolean deleteFiles(Map<String, Object> conf, Map<String, Object> kerberos, List<String> fileNames) {
    HdfsSourceDTO sourceDTO = getSourceDTO(conf, kerberos);
    IHdfsFile hdfsClient = ClientCache.getHdfs(DataSourceType.HDFS.getVal());
    return hdfsClient.deleteFiles(sourceDTO, fileNames);
}
Also used : IHdfsFile(com.dtstack.dtcenter.loader.client.IHdfsFile) HdfsSourceDTO(com.dtstack.dtcenter.loader.dto.source.HdfsSourceDTO)

Example 15 with IHdfsFile

use of com.dtstack.dtcenter.loader.client.IHdfsFile in project Taier by DTStack.

the class HdfsOperator method isFileExist.

public static boolean isFileExist(Map<String, Object> conf, Map<String, Object> kerberos, String dir) {
    HdfsSourceDTO sourceDTO = getSourceDTO(conf, kerberos);
    IHdfsFile hdfsClient = ClientCache.getHdfs(DataSourceType.HDFS.getVal());
    dir = uri(dir);
    return hdfsClient.isFileExist(sourceDTO, dir);
}
Also used : IHdfsFile(com.dtstack.dtcenter.loader.client.IHdfsFile) HdfsSourceDTO(com.dtstack.dtcenter.loader.dto.source.HdfsSourceDTO)

Aggregations

IHdfsFile (com.dtstack.dtcenter.loader.client.IHdfsFile)26 HdfsSourceDTO (com.dtstack.dtcenter.loader.dto.source.HdfsSourceDTO)26 DtCenterDefException (com.dtstack.taier.common.exception.DtCenterDefException)6 IOException (java.io.IOException)5 UnknownHostException (java.net.UnknownHostException)5 SqlQueryDTO (com.dtstack.dtcenter.loader.dto.SqlQueryDTO)1 Map (java.util.Map)1