WatchFolderConfigCache.java
2.3 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
67
68
69
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* org.apache.felix.scr.annotations.Component
* org.apache.felix.scr.annotations.Service
*/
package com.adobe.aemfd.watchfolder.config;
import com.adobe.aemfd.watchfolder.config.WatchFolderConfiguration;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Service;
/*
* This class specifies class file version 49.0 but uses Java 6 signatures. Assumed Java 6.
*/
@Component(metatype=0, immediate=1)
@Service(value={WatchFolderConfigCache.class})
public class WatchFolderConfigCache {
private Map<String, WatchFolderConfiguration> configMap = new HashMap<String, WatchFolderConfiguration>();
public WatchFolderConfiguration getConfiguration(String wfId) throws Exception {
WatchFolderConfiguration res = this.configMap.get(wfId);
if (res == null) {
throw new Exception("No configuration found for watch-folder " + wfId);
}
return res;
}
public boolean containsConfiguration(String wfId) {
return this.configMap.containsKey(wfId);
}
public Collection<WatchFolderConfiguration> getAllConfigurations() {
return this.configMap.values();
}
public void addConfiguration(WatchFolderConfiguration c) throws Exception {
String cid = c.getId();
if (this.configMap.containsKey(cid)) {
throw new Exception("Watch-folder configuration with ID " + cid + " already registered!");
}
this.configMap.put(cid, c);
}
public WatchFolderConfiguration updateConfiguration(WatchFolderConfiguration c) throws Exception {
String cid = c.getId();
if (!this.configMap.containsKey(cid)) {
throw new Exception("No watch-folder configuration found with ID " + cid);
}
return this.configMap.put(cid, c);
}
public WatchFolderConfiguration deleteConfiguration(String wfId) throws Exception {
WatchFolderConfiguration c = this.configMap.remove(wfId);
if (c == null) {
throw new Exception("No watch-folder configuration found with ID " + wfId);
}
return c;
}
public void clearAllConfigurations() {
this.configMap.clear();
}
}