comparison artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultArtifactContext.java @ 90:68285f7bc476

More javadoc. artifacts/trunk@846 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 26 Mar 2010 17:59:50 +0000
parents 48d1a9a082c2
children 933bbc9fc11f
comparison
equal deleted inserted replaced
89:d348fe1fd822 90:68285f7bc476
10 * 10 *
11 * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> 11 * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
12 */ 12 */
13 public class DefaultArtifactContext 13 public class DefaultArtifactContext
14 { 14 {
15 /**
16 * The global configuration document of the artifact database.
17 */
15 protected Document config; 18 protected Document config;
16 19
20 /**
21 * Custom key/value pairs to be used globally in the whole server.
22 */
17 protected HashMap map; 23 protected HashMap map;
18 24
25 /**
26 * Default constructor
27 */
19 public DefaultArtifactContext() { 28 public DefaultArtifactContext() {
20 this(null); 29 this(null);
21 } 30 }
22 31
32 /**
33 * Constructor to create a context with a given global
34 * configuration document and an empty map of custom
35 * key/value pairs.
36 * @param config
37 */
23 public DefaultArtifactContext(Document config) { 38 public DefaultArtifactContext(Document config) {
24 this.config = config; 39 this.config = config;
25 map = new HashMap(); 40 map = new HashMap();
26 } 41 }
27 42
43 /**
44 * Fetch a custom value from the global key/value map using
45 * a given key.
46 * @param key The key.
47 * @return The stored value or null if no value was found under
48 * this key.
49 */
28 public synchronized Object get(Object key) { 50 public synchronized Object get(Object key) {
29 return map.get(key); 51 return map.get(key);
30 } 52 }
31 53
54 /**
55 * Store a custom key/value pair in the global map.
56 * @param key The key to store
57 * @param value The value to store
58 * @return The old value registered under the key or null
59 * if none wa there before.
60 */
32 public synchronized Object put(Object key, Object value) { 61 public synchronized Object put(Object key, Object value) {
33 return map.put(key, value); 62 return map.put(key, value);
34 } 63 }
35 64
65 /**
66 * Returns a reference to the global configuration document.
67 * @return The global configuration document.
68 */
36 public Document getConfig() { 69 public Document getConfig() {
37 return config; 70 return config;
38 } 71 }
39 } 72 }
40 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: 73 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org