struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject svn commit: r1212532 - in /struts/struts2/trunk/plugins/config-browser/src/main/java/org/apache/struts2/config_browser: ConfigurationHelper.java ShowConfigAction.java
Date Fri, 09 Dec 2011 17:34:15 GMT
Author: lukaszlenart
Date: Fri Dec  9 17:34:15 2011
New Revision: 1212532

URL: http://svn.apache.org/viewvc?rev=1212532&view=rev
Log:
WW-3072 - shows properties of Action object instead of Action class

Modified:
    struts/struts2/trunk/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ConfigurationHelper.java
    struts/struts2/trunk/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ShowConfigAction.java

Modified: struts/struts2/trunk/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ConfigurationHelper.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ConfigurationHelper.java?rev=1212532&r1=1212531&r2=1212532&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ConfigurationHelper.java
(original)
+++ struts/struts2/trunk/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ConfigurationHelper.java
Fri Dec  9 17:34:15 2011
@@ -21,25 +21,20 @@
 
 package org.apache.struts2.config_browser;
 
+import com.opensymphony.xwork2.config.Configuration;
+import com.opensymphony.xwork2.config.entities.ActionConfig;
+import com.opensymphony.xwork2.inject.Inject;
+import com.opensymphony.xwork2.util.ResolverUtil;
+
 import java.io.IOException;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 import java.util.Set;
 
-import org.apache.struts2.dispatcher.Dispatcher;
-import org.apache.struts2.util.ClassLoaderUtils;
-
-import com.opensymphony.xwork2.config.Configuration;
-import com.opensymphony.xwork2.config.entities.ActionConfig;
-import com.opensymphony.xwork2.inject.Inject;
-import com.opensymphony.xwork2.util.ClassLoaderUtil;
-import com.opensymphony.xwork2.util.ResolverUtil;
-
 /**
  * ConfigurationHelper
  */
@@ -52,20 +47,20 @@ public class ConfigurationHelper {
         this.configuration = config;
     }
     
-    public Set getNamespaces() {
-        Set namespaces = Collections.EMPTY_SET;
-        Map allActionConfigs = configuration.getRuntimeConfiguration().getActionConfigs();
+    public Set<String> getNamespaces() {
+        Set<String> namespaces = Collections.emptySet();
+        Map<String, Map<String, ActionConfig>>  allActionConfigs = configuration.getRuntimeConfiguration().getActionConfigs();
         if (allActionConfigs != null) {
             namespaces = allActionConfigs.keySet();
         }
         return namespaces;
     }
 
-    public Set getActionNames(String namespace) {
-        Set actionNames = Collections.EMPTY_SET;
-        Map allActionConfigs = configuration.getRuntimeConfiguration().getActionConfigs();
+    public Set<String> getActionNames(String namespace) {
+        Set<String> actionNames = Collections.emptySet();
+        Map<String, Map<String, ActionConfig>> allActionConfigs = configuration.getRuntimeConfiguration().getActionConfigs();
         if (allActionConfigs != null) {
-            Map actionMappings = (Map) allActionConfigs.get(namespace);
+            Map<String, ActionConfig> actionMappings = allActionConfigs.get(namespace);
             if (actionMappings != null) {
                 actionNames = actionMappings.keySet();
             }
@@ -75,11 +70,11 @@ public class ConfigurationHelper {
 
     public ActionConfig getActionConfig(String namespace, String actionName) {
         ActionConfig config = null;
-        Map allActionConfigs = configuration.getRuntimeConfiguration().getActionConfigs();
+        Map<String, Map<String, ActionConfig>> allActionConfigs = configuration.getRuntimeConfiguration().getActionConfigs();
         if (allActionConfigs != null) {
-            Map actionMappings = (Map) allActionConfigs.get(namespace);
+            Map<String, ActionConfig> actionMappings = allActionConfigs.get(namespace);
             if (actionMappings != null) {
-                config = (ActionConfig) actionMappings.get(actionName);
+                config = actionMappings.get(actionName);
             }
         }
         return config;

Modified: struts/struts2/trunk/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ShowConfigAction.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ShowConfigAction.java?rev=1212532&r1=1212531&r2=1212532&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ShowConfigAction.java
(original)
+++ struts/struts2/trunk/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ShowConfigAction.java
Fri Dec  9 17:34:15 2011
@@ -21,10 +21,6 @@
 
 package org.apache.struts2.config_browser;
 
-import java.beans.PropertyDescriptor;
-import java.util.Set;
-import java.util.TreeSet;
-
 import com.opensymphony.xwork2.ObjectFactory;
 import com.opensymphony.xwork2.config.entities.ActionConfig;
 import com.opensymphony.xwork2.inject.Inject;
@@ -32,6 +28,10 @@ import com.opensymphony.xwork2.util.logg
 import com.opensymphony.xwork2.util.logging.LoggerFactory;
 import com.opensymphony.xwork2.util.reflection.ReflectionProvider;
 
+import java.beans.PropertyDescriptor;
+import java.util.Set;
+import java.util.TreeSet;
+
 /**
  * ShowConfigAction
  */
@@ -44,7 +44,7 @@ public class ShowConfigAction extends Ac
     private String namespace;
     private String actionName;
     private ActionConfig config;
-    private Set actionNames;
+    private Set<String> actionNames;
     private String detailView = "results";
     private PropertyDescriptor[] properties;
     private static Logger LOG = LoggerFactory.getLogger(ShowConfigAction.class);
@@ -105,11 +105,10 @@ public class ShowConfigAction extends Ac
     public String execute() throws Exception {
         super.execute();
         config = configHelper.getActionConfig(namespace, actionName);
-        actionNames =
-                new TreeSet(configHelper.getActionNames(namespace));
+        actionNames = new TreeSet<String>(configHelper.getActionNames(namespace));
         try {
             Class clazz = objectFactory.getClassInstance(getConfig().getClassName());
-            properties = reflectionProvider.getPropertyDescriptors(clazz);
+            properties = reflectionProvider.getPropertyDescriptors(clazz.newInstance());
         } catch (Exception e) {
             LOG.error("Unable to get properties for action " + actionName, e);
             addActionError("Unable to retrieve action properties: " + e.toString());



Mime
View raw message