KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opensymphony > webwork > config_browser > ConfigurationHelper


1 package com.opensymphony.webwork.config_browser;
2
3 import com.opensymphony.xwork.config.ConfigurationManager;
4 import com.opensymphony.xwork.config.entities.ActionConfig;
5
6 import java.util.Collections JavaDoc;
7 import java.util.Map JavaDoc;
8 import java.util.Set JavaDoc;
9
10 /**
11  * ConfigurationHelper
12  *
13  * @author Jason Carreira
14  * Created Aug 11, 2003 8:41:17 PM
15  */

16 public class ConfigurationHelper {
17
18     public static Set JavaDoc getNamespaces() {
19         Set JavaDoc namespaces = Collections.EMPTY_SET;
20         Map JavaDoc allActionConfigs = ConfigurationManager.getConfiguration().getRuntimeConfiguration().getActionConfigs();
21         if (allActionConfigs != null) {
22             namespaces = allActionConfigs.keySet();
23         }
24         return namespaces;
25     }
26
27     public static Set JavaDoc getActionNames(String JavaDoc namespace) {
28         Set JavaDoc actionNames = Collections.EMPTY_SET;
29         Map JavaDoc allActionConfigs = ConfigurationManager.getConfiguration().getRuntimeConfiguration().getActionConfigs();
30         if (allActionConfigs != null) {
31             Map JavaDoc actionMappings = (Map JavaDoc) allActionConfigs.get(namespace);
32             if (actionMappings != null) {
33                 actionNames = actionMappings.keySet();
34             }
35         }
36         return actionNames;
37     }
38
39     public static ActionConfig getActionConfig(String JavaDoc namespace, String JavaDoc actionName) {
40         ActionConfig config = null;
41         Map JavaDoc allActionConfigs = ConfigurationManager.getConfiguration().getRuntimeConfiguration().getActionConfigs();
42         if (allActionConfigs != null) {
43             Map JavaDoc actionMappings = (Map JavaDoc) allActionConfigs.get(namespace);
44             if (actionMappings != null) {
45                 config = (ActionConfig) actionMappings.get(actionName);
46             }
47         }
48         return config;
49     }
50 }
51
Popular Tags