Search in sources :

Example 6 with IHdfsFile

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

the class HdfsOperator method setPermission.

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

Example 7 with IHdfsFile

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

the class HdfsOperator method downloadFileFromHDFS.

/**
 * 从HDFS上下载文件或文件夹到本地
 *
 * @throws IOException
 */
public static void downloadFileFromHDFS(Map<String, Object> conf, Map<String, Object> kerberos, String remotePath, String localDir) {
    HdfsSourceDTO sourceDTO = getSourceDTO(conf, kerberos);
    IHdfsFile hdfsClient = ClientCache.getHdfs(DataSourceType.HDFS.getPluginName());
    hdfsClient.downloadFileFromHdfs(sourceDTO, remotePath, localDir);
}
Also used : IHdfsFile(com.dtstack.dtcenter.loader.client.IHdfsFile) HdfsSourceDTO(com.dtstack.dtcenter.loader.dto.source.HdfsSourceDTO)

Example 8 with IHdfsFile

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

the class HdfsOperator method copyFile.

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

Example 9 with IHdfsFile

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

the class HdfsOperator method listAllFilePath.

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

Example 10 with IHdfsFile

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

the class HdfsOperator method delete.

/**
 * 直接删除hdfs上文件
 * @param conf hadoop文件
 * @param kerberos kerberos文件
 * @param remotePath hdfs路径
 * @param recursive 是否递归删除
 * @return 删除结果
 * @throws Exception 异常
 */
public static boolean delete(Map<String, Object> conf, Map<String, Object> kerberos, String remotePath, boolean recursive) {
    HdfsSourceDTO sourceDTO = getSourceDTO(conf, kerberos);
    IHdfsFile hdfsClient = ClientCache.getHdfs(DataSourceType.HDFS.getVal());
    return hdfsClient.delete(sourceDTO, remotePath, recursive);
}
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