AbstractSyncInputProcessor.java
2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.adobe.aemfd.docmanager.Document
*/
package com.adobe.aemfd.watchfolder.util;
import com.adobe.aemfd.docmanager.Document;
import com.adobe.aemfd.watchfolder.config.WatchFolderConfiguration;
import com.adobe.aemfd.watchfolder.service.ProcessorContextImpl;
import com.adobe.aemfd.watchfolder.service.api.ProcessorContext;
import com.adobe.aemfd.watchfolder.spi.InputProcessor;
import com.adobe.aemfd.watchfolder.util.DocUtil;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
/*
* This class specifies class file version 49.0 but uses Java 6 signatures. Assumed Java 6.
*/
public abstract class AbstractSyncInputProcessor
implements InputProcessor {
@Override
public boolean isSynch() {
return true;
}
protected Map<String, Document> toDocumentMap(Map<String, File> inputs) throws Exception {
if (inputs == null) {
return null;
}
HashMap<String, Document> result = new HashMap<String, Document>(inputs.size());
for (Map.Entry<String, File> ie : inputs.entrySet()) {
result.put(ie.getKey(), new Document(ie.getValue()));
}
return result;
}
protected abstract void doProcess(String var1, WatchFolderConfiguration var2, File var3, ProcessorContext var4) throws Exception;
@Override
public Object processInputs(String jobId, WatchFolderConfiguration config, File source, Map<String, File> inputs) throws Exception {
ProcessorContextImpl ctxt = new ProcessorContextImpl();
try {
ctxt.watchFolderId = config.getId();
ctxt.inputMap = this.toDocumentMap(inputs);
ctxt.configParameters = config.getParams();
try {
this.doProcess(jobId, config, source, ctxt);
Map<String, Document> map = ctxt.resultMap;
return map;
}
catch (Exception e) {
DocUtil.disposeAll(ctxt.resultMap);
throw e;
}
}
finally {
Map<String, Document> toDispose = DocUtil.pruneForDisposal(ctxt.inputMap, ctxt.resultMap);
DocUtil.disposeAll(toDispose);
}
}
}