01: package com.opensymphony.webwork.config_browser;
02:
03: import com.opensymphony.xwork.config.ConfigurationManager;
04: import com.opensymphony.xwork.config.entities.ActionConfig;
05:
06: import java.util.Collections;
07: import java.util.Map;
08: import java.util.Set;
09:
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 getNamespaces() {
19: Set namespaces = Collections.EMPTY_SET;
20: Map allActionConfigs = ConfigurationManager.getConfiguration()
21: .getRuntimeConfiguration().getActionConfigs();
22: if (allActionConfigs != null) {
23: namespaces = allActionConfigs.keySet();
24: }
25: return namespaces;
26: }
27:
28: public static Set getActionNames(String namespace) {
29: Set actionNames = Collections.EMPTY_SET;
30: Map allActionConfigs = ConfigurationManager.getConfiguration()
31: .getRuntimeConfiguration().getActionConfigs();
32: if (allActionConfigs != null) {
33: Map actionMappings = (Map) allActionConfigs.get(namespace);
34: if (actionMappings != null) {
35: actionNames = actionMappings.keySet();
36: }
37: }
38: return actionNames;
39: }
40:
41: public static ActionConfig getActionConfig(String namespace,
42: String actionName) {
43: ActionConfig config = null;
44: Map allActionConfigs = ConfigurationManager.getConfiguration()
45: .getRuntimeConfiguration().getActionConfigs();
46: if (allActionConfigs != null) {
47: Map actionMappings = (Map) allActionConfigs.get(namespace);
48: if (actionMappings != null) {
49: config = (ActionConfig) actionMappings.get(actionName);
50: }
51: }
52: return config;
53: }
54: }
|