KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > celtix > configuration > impl > InMemoryProvider


1 package org.objectweb.celtix.configuration.impl;
2
3 import java.util.HashMap JavaDoc;
4 import java.util.Map JavaDoc;
5
6 import org.objectweb.celtix.configuration.Configuration;
7 import org.objectweb.celtix.configuration.ConfigurationProvider;
8
9 /**
10  * Temporay class to accept changes to configuration. Should be obsoleted once other providers
11  * have implemented the setObject.
12  */

13 public class InMemoryProvider implements ConfigurationProvider {
14
15     private Map JavaDoc<String JavaDoc, Object JavaDoc> map;
16     
17     public InMemoryProvider() {
18         map = new HashMap JavaDoc<String JavaDoc, Object JavaDoc>();
19     }
20     
21     public void init(Configuration configuration) {
22     }
23
24     public Object JavaDoc getObject(String JavaDoc name) {
25         return map.get(name);
26     }
27
28     public boolean setObject(String JavaDoc name, Object JavaDoc value) {
29         map.put(name, value);
30         return true;
31     }
32
33     public boolean save() {
34         return false;
35     }
36 }
37
Popular Tags