use of com.dtstack.taier.common.exception.DtCenterDefException in project Taier by DTStack.
the class ResponseAdvisor method exceptionHandler.
@ResponseBody
@ExceptionHandler(value = Throwable.class)
public R exceptionHandler(Throwable e) {
ExceptionEnums errorCode = ErrorCode.UNKNOWN_ERROR;
String errorMsg = null;
RdosDefineException rdosDefineException = null;
if (e.getCause() instanceof DtCenterDefException) {
rdosDefineException = (RdosDefineException) e.getCause();
if (rdosDefineException.getErrorCode() != null) {
errorCode = rdosDefineException.getErrorCode();
}
errorMsg = rdosDefineException.getErrorMsg();
if (e.getCause().getCause() != null) {
LOGGER.error("", e.getCause().getCause());
}
} else if (e instanceof RdosDefineException) {
rdosDefineException = (RdosDefineException) e;
if (rdosDefineException.getErrorCode() != null) {
errorCode = rdosDefineException.getErrorCode();
}
errorMsg = rdosDefineException.getErrorMsg();
if (e.getCause() != null) {
LOGGER.error("", e.getCause());
}
} else {
errorCode = ErrorCode.SERVER_EXCEPTION;
errorMsg = ErrorCode.SERVER_EXCEPTION.getDescription();
LOGGER.error("", e);
}
if (errorCode.equals(ErrorCode.PERMISSION_LIMIT)) {
return R.fail(errorCode.getCode(), errorMsg);
}
return R.fail(errorCode.getCode(), errorMsg);
}
use of com.dtstack.taier.common.exception.DtCenterDefException 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()));
}
}
use of com.dtstack.taier.common.exception.DtCenterDefException in project Taier by DTStack.
the class HdfsOperator method fileMerge.
/**
* 获取hdfs上指定路径集合的ContentSummary
*
* @param conf hadoop配置
* @param kerberos kerberos配置
* @param src 原路径
* @param mergePath 合并临时目录
* @param fileFormat 文件存储格式
* @param needCombineFileSizeLimit 需要合并的文件大小阈值
* @param maxCombinedFileSize 合并后的最大大小
*/
public static void fileMerge(Map<String, Object> conf, Map<String, Object> kerberos, String src, String mergePath, FileFormat fileFormat, Long maxCombinedFileSize, Long needCombineFileSizeLimit) {
try {
HdfsSourceDTO sourceDTO = getSourceDTO(conf, kerberos);
IHdfsFile hdfsClient = ClientCache.getHdfs(DataSourceType.HDFS.getVal());
hdfsClient.fileMerge(sourceDTO, src, mergePath, fileFormat, maxCombinedFileSize, needCombineFileSizeLimit);
} catch (Exception e) {
throw new DtCenterDefException(String.format("文件合并异常!原因是:%s", e.getMessage()));
}
}
use of com.dtstack.taier.common.exception.DtCenterDefException in project Taier by DTStack.
the class HdfsOperator method getContentSummary.
/**
* 获取hdfs上指定路径的ContentSummary
*
* @param conf
* @param kerberos
* @param targetPath
* @return
*/
public static HDFSContentSummary getContentSummary(Map<String, Object> conf, Map<String, Object> kerberos, String targetPath) {
try {
HdfsSourceDTO sourceDTO = getSourceDTO(conf, kerberos);
IHdfsFile hdfsClient = ClientCache.getHdfs(DataSourceType.HDFS.getVal());
return hdfsClient.getContentSummary(sourceDTO, targetPath);
} catch (Exception e) {
throw new DtCenterDefException(String.format("获取hdfs文件内容摘要异常!原因是:%s", e.getMessage()));
}
}
use of com.dtstack.taier.common.exception.DtCenterDefException in project Taier by DTStack.
the class HdfsOperator method copyDirector.
/**
* 获取hdfs上指定路径集合的ContentSummary
*
* @param conf hadoop配置
* @param kerberos kerberos配置
* @param src 原路径
* @param dist 复制路径
*/
public static void copyDirector(Map<String, Object> conf, Map<String, Object> kerberos, String src, String dist) {
try {
HdfsSourceDTO sourceDTO = getSourceDTO(conf, kerberos);
IHdfsFile hdfsClient = ClientCache.getHdfs(DataSourceType.HDFS.getVal());
hdfsClient.copyDirector(sourceDTO, src, dist);
} catch (Exception e) {
throw new DtCenterDefException(String.format("hdfs内复制文件夹异常!原因是:%s", e.getMessage()));
}
}
Aggregations