01: package org.wso2.esb.util;
02:
03: import org.wso2.utils.ServerException;
04:
05: import java.util.HashMap;
06: import java.util.Map;
07:
08: public class XmlConfigurationFactory {
09: private static final Map configurations = new HashMap();
10:
11: public static void init(String configKey, String configFile)
12: throws ServerException {
13: init(configKey, configFile, null);
14: }
15:
16: public static void init(String configKey, String configFile,
17: String serverNamespace) throws ServerException {
18: if (serverNamespace != null) {
19: configurations.put(configKey, new XmlConfiguration(
20: configFile, serverNamespace));
21: } else {
22: configurations.put(configKey, new XmlConfiguration(
23: configFile));
24: }
25: }
26:
27: public static XmlConfiguration getXmlConfiguration(String configKey) {
28: XmlConfiguration config = null;
29: Object obj = configurations.get(configKey);
30: if (obj != null) {
31: config = (XmlConfiguration) obj;
32: }
33: return config;
34: }
35: }
|