1 | |
package org.jtheque.core.managers.state; |
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
import org.jtheque.utils.collections.CollectionUtils; |
20 | |
|
21 | |
import java.util.Collection; |
22 | |
import java.util.HashMap; |
23 | |
import java.util.Map; |
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | 0 | public abstract class AbstractState implements IState { |
31 | 0 | private final Map<String, String> properties = new HashMap<String, String>(10); |
32 | |
|
33 | |
@Override |
34 | |
public final String getProperty(String key) { |
35 | 0 | return properties.get(key); |
36 | |
} |
37 | |
|
38 | |
@Override |
39 | |
public final String getProperty(String key, String defaults) { |
40 | 0 | String property = properties.get(key); |
41 | |
|
42 | 0 | if (property == null) { |
43 | 0 | property = defaults; |
44 | |
} |
45 | |
|
46 | 0 | return property; |
47 | |
} |
48 | |
|
49 | |
@Override |
50 | |
public final void setProperty(String key, String value) { |
51 | 0 | properties.put(key, value); |
52 | 0 | } |
53 | |
|
54 | |
@Override |
55 | |
public final Collection<String> getProperties() { |
56 | 0 | return CollectionUtils.copyOf(properties.keySet()); |
57 | |
} |
58 | |
|
59 | |
@Override |
60 | |
public boolean isDelegated() { |
61 | 0 | return false; |
62 | |
} |
63 | |
|
64 | |
@Override |
65 | |
public Collection<NodeState> delegateSave() { |
66 | 0 | return null; |
67 | |
} |
68 | |
|
69 | |
@Override |
70 | |
public void delegateLoad(Collection<NodeState> nodes) { |
71 | |
|
72 | 0 | } |
73 | |
} |