You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ep...@apache.org on 2006/02/23 07:53:25 UTC
svn commit: r380051 - in
/maven/repository-manager/trunk/maven-repository-webapp: ./
src/main/java/org/apache/maven/repository/manager/web/action/
src/main/resources/ src/main/webapp/WEB-INF/ src/main/webapp/WEB-INF/jsp/
Author: epunzalan
Date: Wed Feb 22 22:53:23 2006
New Revision: 380051
URL: http://svn.apache.org/viewcvs?rev=380051&view=rev
Log:
PR: MRM-74
Submitted by: Nick Gonzalez
Applied patch for browse user interface and applied code formatting
Added:
maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/RepositoryBrowseAction.java
maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/browse.jsp
Modified:
maven/repository-manager/trunk/maven-repository-webapp/pom.xml
maven/repository-manager/trunk/maven-repository-webapp/src/main/resources/xwork.xml
maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/WEB-INF/web.xml
Modified: maven/repository-manager/trunk/maven-repository-webapp/pom.xml
URL: http://svn.apache.org/viewcvs/maven/repository-manager/trunk/maven-repository-webapp/pom.xml?rev=380051&r1=380050&r2=380051&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-webapp/pom.xml (original)
+++ maven/repository-manager/trunk/maven-repository-webapp/pom.xml Wed Feb 22 22:53:23 2006
@@ -21,6 +21,10 @@
</dependency>
<dependency>
<groupId>org.apache.maven.repository</groupId>
+ <artifactId>maven-repository-discovery</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.repository</groupId>
<artifactId>maven-repository-artifact-applet</artifactId>
<!-- TODO: actually, just exclude from WAR plugin -->
<scope>provided</scope>
@@ -38,8 +42,8 @@
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty6-plugin</artifactId>
<configuration>
+ <webAppSourceDirectory>${basedir}/target/${artifactId}</webAppSourceDirectory >
<scanIntervalSeconds>10</scanIntervalSeconds>
- <contextPath>/</contextPath>
</configuration>
</plugin>
<plugin>
Added: maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/RepositoryBrowseAction.java
URL: http://svn.apache.org/viewcvs/maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/RepositoryBrowseAction.java?rev=380051&view=auto
==============================================================================
--- maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/RepositoryBrowseAction.java (added)
+++ maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/RepositoryBrowseAction.java Wed Feb 22 22:53:23 2006
@@ -0,0 +1,146 @@
+package org.apache.maven.repository.manager.web.action;
+
+import com.opensymphony.xwork.Action;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
+import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
+import org.apache.maven.repository.discovery.ArtifactDiscoverer;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.TreeMap;
+
+/**
+ * TODO: Description.
+ *
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="org.apache.maven.repository.manager.web.action.RepositoryBrowseAction"
+ */
+public class RepositoryBrowseAction
+ implements Action
+{
+ /**
+ * @plexus.requirement role-hint="default"
+ */
+ private ArtifactDiscoverer discoverer;
+
+ /**
+ * @plexus.requirement
+ */
+ private ArtifactRepositoryFactory repositoryFactory;
+
+ /**
+ * @plexus.requirement role-hint="default"
+ */
+ private ArtifactRepositoryLayout layout;
+
+ private String group;
+
+ private TreeMap artifactMap;
+
+ private String folder;
+
+ private int idx;
+
+ public String execute()
+ throws Exception
+ {
+ String path = "E:/jeprox/maven-repository-manager/trunk/maven-repository-discovery/src/test/repository";
+
+ ArtifactRepository repository =
+ repositoryFactory.createArtifactRepository( "discoveryRepo", "file://" + path, layout, null, null );
+
+ List artifacts = discoverer.discoverArtifacts( repository, null, true );
+
+ Iterator iterator = artifacts.iterator();
+
+ artifactMap = new TreeMap();
+
+ String groupId;
+
+ while ( iterator.hasNext() )
+ {
+ Artifact artifact = (Artifact) iterator.next();
+
+ groupId = artifact.getGroupId();
+
+ String key = groupId.replace( '.', '/' ) + "/" + artifact.getArtifactId() + "/" + artifact.getVersion();
+
+ ArrayList artifactList;
+
+ if ( artifactMap.containsKey( key ) )
+ {
+ artifactList = (ArrayList) artifactMap.get( key );
+ }
+ else
+ {
+ artifactList = new ArrayList();
+ }
+
+ artifactList.add( artifact );
+
+ Collections.sort( artifactList );
+
+ artifactMap.put( key, artifactList );
+ }
+
+ //set the index for folder level to be displayed
+ setIdx( 1 );
+
+ setFolder( "" );
+
+ return SUCCESS;
+ }
+
+ public String doEdit()
+ throws Exception
+ {
+ setIdx( getIdx() + 1 );
+
+ //set folder to "" if we are at the root directory
+ if ( getIdx() == 1 )
+ {
+ setFolder( "" );
+ }
+
+ return SUCCESS;
+ }
+
+ public TreeMap getArtifactMap()
+ {
+ return artifactMap;
+ }
+
+ public String getGroup()
+ {
+ return group;
+ }
+
+ public void setGroup( String group )
+ {
+ this.group = group;
+ }
+
+ public String getFolder()
+ {
+ return folder;
+ }
+
+ public void setFolder( String folder )
+ {
+ this.folder = folder;
+ }
+
+ public int getIdx()
+ {
+ return idx;
+ }
+
+ public void setIdx( int index )
+ {
+ this.idx = index;
+ }
+
+}
Modified: maven/repository-manager/trunk/maven-repository-webapp/src/main/resources/xwork.xml
URL: http://svn.apache.org/viewcvs/maven/repository-manager/trunk/maven-repository-webapp/src/main/resources/xwork.xml?rev=380051&r1=380050&r2=380051&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-webapp/src/main/resources/xwork.xml (original)
+++ maven/repository-manager/trunk/maven-repository-webapp/src/main/resources/xwork.xml Wed Feb 22 22:53:23 2006
@@ -35,6 +35,11 @@
<result name="success" type="dispatcher">/WEB-INF/jsp/results.jsp</result>
<result name="error" type="dispatcher">/WEB-INF/jsp/index.jsp</result>
</action>
+
+ <action name="browse" class="org.apache.maven.repository.manager.web.action.RepositoryBrowseAction">
+ <result name="success" type="dispatcher">/WEB-INF/jsp/browse.jsp</result>
+ <result name="error" type="dispatcher">/WEB-INF/jsp/browse.jsp</result>
+ </action>
</package>
</xwork>
Added: maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/browse.jsp
URL: http://svn.apache.org/viewcvs/maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/browse.jsp?rev=380051&view=auto
==============================================================================
--- maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/browse.jsp (added)
+++ maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/browse.jsp Wed Feb 22 22:53:23 2006
@@ -0,0 +1,82 @@
+<%@ taglib uri="webwork" prefix="ww" %>
+<%@page import="java.util.*"%>
+<html>
+<head>
+<title>Repository Browser</title>
+</head>
+<body>
+<h3><a href="<ww:url value="browse!edit.action"><ww:param name="idx" value="0"/></ww:url>">basedir</a> /
+<ww:set name="previousFolder" value="''"/>
+<ww:set name="counter" value="0"/>
+<ww:if test="folder != ''">
+ <ww:set name="folderHeader" value="folder.split('/')"/>
+ <ww:iterator value="#folderHeader">
+ <ww:set name="counter" value="#counter + 1"/>
+ <ww:if test="#previousFolder == ''">
+ <ww:set name="previousFolder" value="top"/>
+ </ww:if>
+ <ww:else>
+ <ww:set name="previousFolder" value="#previousFolder + '/' + top"/>
+ </ww:else>
+ <ww:if test="idx > (#counter + 1)"><a href="<ww:url value="browse!edit.action"><ww:param name="idx"><ww:property value="#counter"/></ww:param><ww:param name="folder"></ww:param></ww:url>"></ww:if><ww:property/></a> /
+ </ww:iterator>
+</ww:if>
+</h3>
+<br/>
+
+<ww:set name="previousFolder" value="'the previous folder'"/>
+<ww:set name="in" value="idx" scope="page"/>
+<ww:iterator value="artifactMap.keySet().iterator()">
+ <ww:set name="groupName" value="top"/>
+<ww:if test="idx == 1 || (folder != '' and #groupName.startsWith(folder))">
+<%
+int ctr = 1;
+%>
+ <ww:set name="groupFolder" value="#groupName.split('/')"/>
+ <ww:iterator value="#groupFolder">
+<%
+if (ctr == ((Integer)pageContext.getAttribute("in")).intValue()) {%>
+ <ww:if test="top != #previousFolder">
+ <ww:set name="previousFolder" value="top"/>
+ <a href="<ww:url value="browse!edit.action"><ww:param name="folder"><ww:property value="folder"/><ww:if test="folder != ''">/</ww:if><ww:property/></ww:param><ww:param name="idx" value="idx"/></ww:url>"">
+ <ww:property/>/
+ </a><br>
+ </ww:if>
+<%
+}
+ctr++;
+%>
+ </ww:iterator>
+</ww:if>
+</ww:iterator>
+
+<ww:if test="folder != ''">
+ <ww:set name="previousFolder" value="''"/>
+ <ww:set name="artifactList" value="artifactMap.get(folder)"/>
+ <ww:iterator value="#artifactList">
+<table border="1">
+ <tr align="left">
+ <th>Group ID</th>
+ <td><ww:property value="groupId"/></td>
+ </tr>
+ <tr align="left">
+ <th>Artifact ID</th>
+ <td><ww:property value="artifactId"/></td>
+ </tr>
+ <tr align="left">
+ <th>Version</th>
+ <td><ww:property value="version"/></td>
+ </tr>
+ <tr align="left">
+ <th>Derivatives</th>
+ <td><ww:property value="groupId"/></td>
+ </tr>
+ <tr align="left">
+ <th>Parent</th>
+ <td><ww:property value="folder"/></td>
+ </tr>
+</table><br/>
+ </ww:iterator>
+</ww:if>
+</body>
+</html>
Modified: maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewcvs/maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/WEB-INF/web.xml?rev=380051&r1=380050&r2=380051&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/WEB-INF/web.xml (original)
+++ maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/WEB-INF/web.xml Wed Feb 22 22:53:23 2006
@@ -30,4 +30,9 @@
<welcome-file-list>
<welcome-file>index.action</welcome-file>
</welcome-file-list>
+
+ <taglib>
+ <taglib-uri>webwork</taglib-uri>
+ <taglib-location>/WEB-INF/lib/webwork-2.1.7.jar</taglib-location>
+ </taglib>
</web-app>
Re: svn commit: r380051 - in /maven/repository-manager/trunk/maven-repository-webapp:
./ src/main/java/org/apache/maven/repository/manager/web/action/ src/main/resources/
src/main/webapp/WEB-INF/ src/main/webapp/WEB-INF/jsp/
Posted by Brett Porter <br...@apache.org>.
ping
Brett Porter wrote:
> Why was this needed?
>
> epunzalan@apache.org wrote:
>> <configuration>
>> + <webAppSourceDirectory>${basedir}/target/${artifactId}</webAppSourceDirectory >
>> <scanIntervalSeconds>10</scanIntervalSeconds>
>> - <contextPath>/</contextPath>
>> </configuration>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: svn commit: r380051 - in /maven/repository-manager/trunk/maven-repository-webapp:
./ src/main/java/org/apache/maven/repository/manager/web/action/ src/main/resources/
src/main/webapp/WEB-INF/ src/main/webapp/WEB-INF/jsp/
Posted by Brett Porter <br...@apache.org>.
Why was this needed?
epunzalan@apache.org wrote:
> <configuration>
> + <webAppSourceDirectory>${basedir}/target/${artifactId}</webAppSourceDirectory >
> <scanIntervalSeconds>10</scanIntervalSeconds>
> - <contextPath>/</contextPath>
> </configuration>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org