|
@@ -7,8 +7,6 @@ import java.util.Objects;
|
|
|
import org.apache.commons.io.FileUtils;
|
|
|
import org.apache.commons.lang3.RandomUtils;
|
|
|
|
|
|
-import com.google.common.collect.Lists;
|
|
|
-
|
|
|
import cn.com.qmth.examcloud.commons.helpers.KeyValuePair;
|
|
|
import cn.com.qmth.examcloud.commons.helpers.pipeline.NodeExecuter;
|
|
|
import cn.com.qmth.examcloud.commons.helpers.pipeline.TaskContext;
|
|
@@ -16,20 +14,20 @@ import cn.com.qmth.examcloud.commons.helpers.pipeline.TaskContext;
|
|
|
public class FileReaderExecuter implements NodeExecuter<String, String, String, String> {
|
|
|
|
|
|
@Override
|
|
|
- public List<KeyValuePair<String, String>> execute(String key, String value, TaskContext context)
|
|
|
- throws Exception {
|
|
|
+ public void execute(String key, String value, List<KeyValuePair<String, String>> outList,
|
|
|
+ Boolean removable, TaskContext context) throws Exception {
|
|
|
|
|
|
String path = (String) context.get("path");
|
|
|
|
|
|
List<String> readLines = FileUtils.readLines(new File(path), "UTF-8");
|
|
|
|
|
|
- List<KeyValuePair<String, String>> list = Lists.newArrayList();
|
|
|
readLines.forEach(e -> {
|
|
|
- list.add(new KeyValuePair<String, String>(Objects.toString((RandomUtils.nextLong())),
|
|
|
+ outList.add(new KeyValuePair<String, String>(Objects.toString((RandomUtils.nextLong())),
|
|
|
e));
|
|
|
});
|
|
|
|
|
|
- return list;
|
|
|
+ removable = true;
|
|
|
+ outList.clear();
|
|
|
}
|
|
|
|
|
|
}
|