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