struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mr...@apache.org
Subject svn commit: r571991 - in /struts/struts2/trunk/plugins/config-browser: ./ src/main/java/org/apache/struts2/config_browser/ src/main/resources/ src/main/resources/config-browser/
Date Sun, 02 Sep 2007 14:33:16 GMT
Author: mrdon
Date: Sun Sep  2 07:33:15 2007
New Revision: 571991

URL: http://svn.apache.org/viewvc?rev=571991&view=rev
Log:
Adding printing of jar and plugin info
WW-2154

Added:
    struts/struts2/trunk/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ShowJarsAction.java
    struts/struts2/trunk/plugins/config-browser/src/main/resources/config-browser/showJars.ftl
Modified:
    struts/struts2/trunk/plugins/config-browser/pom.xml
    struts/struts2/trunk/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ActionNamesAction.java
    struts/struts2/trunk/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ConfigurationHelper.java
    struts/struts2/trunk/plugins/config-browser/src/main/resources/config-browser/page-header.ftl
    struts/struts2/trunk/plugins/config-browser/src/main/resources/struts-plugin.xml

Modified: struts/struts2/trunk/plugins/config-browser/pom.xml
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/config-browser/pom.xml?rev=571991&r1=571990&r2=571991&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/config-browser/pom.xml (original)
+++ struts/struts2/trunk/plugins/config-browser/pom.xml Sun Sep  2 07:33:15 2007
@@ -40,13 +40,4 @@
        <url>http://svn.apache.org/viewcvs.cgi/struts/struts2/trunk/plugins/config-browser/</url>
     </scm>
 
-    <!--
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.struts</groupId>
-            <artifactId>struts-core</artifactId>
-            <version>1.3.5</version>
-        </dependency>
-    </dependencies>
-    -->
 </project>

Modified: struts/struts2/trunk/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ActionNamesAction.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ActionNamesAction.java?rev=571991&r1=571990&r2=571991&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ActionNamesAction.java
(original)
+++ struts/struts2/trunk/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ActionNamesAction.java
Sun Sep  2 07:33:15 2007
@@ -44,7 +44,7 @@
     private Set namespaces;
     private String extension;
     
-    private ConfigurationHelper configHelper;
+    ConfigurationHelper configHelper;
 
     @Inject
     public void setConfigurationHelper(ConfigurationHelper cfg) {

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=571991&r1=571990&r2=571991&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
Sun Sep  2 07:33:15 2007
@@ -20,15 +20,24 @@
  */
 package org.apache.struts2.config_browser;
 
+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
@@ -73,5 +82,18 @@
             }
         }
         return config;
+    }
+    
+    public List<Properties> getJarProperties() throws IOException {
+        ResolverUtil resolver = new ResolverUtil();
+        List<Properties> poms = new ArrayList<Properties>();
+        resolver.findNamedResource("pom.properties", "META-INF/maven");
+        Set<URL> urls = resolver.getResources();
+        for (URL url : urls) {
+            Properties p = new Properties();
+            p.load(url.openStream());
+            poms.add(p);
+        }
+        return poms;
     }
 }

Added: struts/struts2/trunk/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ShowJarsAction.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ShowJarsAction.java?rev=571991&view=auto
==============================================================================
--- struts/struts2/trunk/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ShowJarsAction.java
(added)
+++ struts/struts2/trunk/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ShowJarsAction.java
Sun Sep  2 07:33:15 2007
@@ -0,0 +1,62 @@
+/*
+ * $Id: ActionNamesAction.java 474191 2006-11-13 08:30:40Z mrdon $
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.struts2.config_browser;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import com.opensymphony.xwork2.inject.Container;
+import com.opensymphony.xwork2.inject.Inject;
+import com.opensymphony.xwork2.util.ClassLoaderUtil;
+
+/**
+ * Shows all constants as loaded by Struts
+ */
+public class ShowJarsAction extends ActionNamesAction {
+
+    List<Properties> poms;
+    
+    @Inject
+    public void setContainer(Container container) throws IOException {
+        poms = configHelper.getJarProperties();
+    }
+    
+    public List<Properties> getJarPoms()
+    {
+        return poms;
+    }
+    
+    public Iterator<URL> getPluginsLoaded() 
+    {
+        try {
+            return ClassLoaderUtil.getResources("struts-plugin.xml", ShowJarsAction.class,
false);
+        } catch (IOException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        return null;
+    }
+}

Modified: struts/struts2/trunk/plugins/config-browser/src/main/resources/config-browser/page-header.ftl
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/config-browser/src/main/resources/config-browser/page-header.ftl?rev=571991&r1=571990&r2=571991&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/config-browser/src/main/resources/config-browser/page-header.ftl
(original)
+++ struts/struts2/trunk/plugins/config-browser/src/main/resources/config-browser/page-header.ftl
Sun Sep  2 07:33:15 2007
@@ -55,6 +55,9 @@
 						<div><@s.url id="beansLink" action="showBeans" includeParams="none" />
 							<a href="${beansLink}">Beans</a>
 						</div>
+						<div><@s.url id="jarsLink" action="showJars" includeParams="none" />
+							<a href="${jarsLink}">Jars (requires Maven 2 data)</a>
+						</div>
 					</div>
 				</div>
 				<div id="projecttools" class="toolgroup">

Added: struts/struts2/trunk/plugins/config-browser/src/main/resources/config-browser/showJars.ftl
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/config-browser/src/main/resources/config-browser/showJars.ftl?rev=571991&view=auto
==============================================================================
--- struts/struts2/trunk/plugins/config-browser/src/main/resources/config-browser/showJars.ftl
(added)
+++ struts/struts2/trunk/plugins/config-browser/src/main/resources/config-browser/showJars.ftl
Sun Sep  2 07:33:15 2007
@@ -0,0 +1,50 @@
+<#--
+/*
+ * $Id: pom.xml 559206 2007-07-24 21:01:18Z apetrelli $
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+-->
+<#include "tigris-macros.ftl"/>
+<@startPage pageTitle="Jars and Struts Plugins"/>
+<h3>Jars and Struts Plugins</h3>
+
+<table width="100%">
+	<tr>
+		<th>Artifact ID</th>
+		<th>Group ID</th>
+		<th>Version</th>
+	</tr>
+	<#list jarPoms as pom>
+		<tr <#if pom_index%2 gt 0>class="b"<#else>class="a"</#if>>
+		<td>${pom.artifactId}</td>
+		<td>${pom.groupId}</td>
+		<td>${pom.version}</td>
+		</tr>
+	</#list>
+</table>
+
+<br />
+<h4> Discovered plugin XML</h4>
+<ul>
+	<#list pluginsLoaded as url>
+		<li>${url}</li>
+	</#list>
+</ul>
+
+<@endPage />

Modified: struts/struts2/trunk/plugins/config-browser/src/main/resources/struts-plugin.xml
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/config-browser/src/main/resources/struts-plugin.xml?rev=571991&r1=571990&r2=571991&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/config-browser/src/main/resources/struts-plugin.xml (original)
+++ struts/struts2/trunk/plugins/config-browser/src/main/resources/struts-plugin.xml Sun Sep
 2 07:33:15 2007
@@ -62,6 +62,10 @@
         <action name="showBeans" class="org.apache.struts2.config_browser.ShowBeansAction">
             <result type="freemarker" name="success">/config-browser/showBeans.ftl</result>
         </action>
+        
+        <action name="showJars" class="org.apache.struts2.config_browser.ShowJarsAction">
+            <result type="freemarker" name="success">/config-browser/showJars.ftl</result>
+        </action>
 
         <action name="showValidators" class="org.apache.struts2.config_browser.ListValidatorsAction">
             <result name="error" type="freemarker">/config-browser/simple-error.ftl</result>



Mime
View raw message