List<DFSCleanerBean> list = new ArrayList<DFSCleanerBean>();
int listSize = noEmptyDirList.size();
for (int i = 0; i < listSize; i++) {
// クリーニングディレクトリを設定
DFSCleanerBean bean = new DFSCleanerBean();
String dirKey = noEmptyDirList.get(i);
// ユーザー名を表す文字列を置換
String strPath = ConfigurationLoader.getProperty(dirKey);
String strCleanPath = strPath.replace(Constants.HDFS_PATH_REPLACE_STR_USER, user);
// ジョブフロー実行IDを表す文字列を排除
boolean isSetexecutionId = false;
if (strCleanPath.endsWith(Constants.HDFS_PATH_REPLACE_STR_ID)) {
isSetexecutionId = true;
strCleanPath = strCleanPath.substring(0, strCleanPath.indexOf(Constants.HDFS_PATH_REPLACE_STR_ID) - 1);
}
bean.setCleanDir(createPath(strCleanPath));
bean.setExecutionId(isSetexecutionId);
// クリーニングパターンを設定
String number = dirKey.substring(dirKey.lastIndexOf(".") + 1, dirKey.length());
String pattarnKey = Constants.PROP_KEY_HDFS_FILE_CLEAN_PATTERN + "." + number;
String pattern = ConfigurationLoader.getProperty(pattarnKey);
if (pattern == null || pattern.equals("")) {
throw new CleanerSystemException(
this.getClass(),
MessageIdConst.HCLN_PATTERN_NOT_FOUND,
dirKey,
strPath,
pattarnKey);
} else {
bean.setPattern(pattern);
}
list.add(bean);
}
return list.toArray(new DFSCleanerBean[list.size()]);