[MRM-131] add dependencies page

git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@437175 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Porter 2006-08-26 16:01:32 +00:00
parent 88b4ca99fd
commit 8c3eb496f9
8 changed files with 390 additions and 252 deletions

View File

@ -70,48 +70,90 @@ public class ShowArtifactAction
private Model model;
public String execute()
private List dependencies;
public String artifact()
throws ConfigurationStoreException, IOException, XmlPullParserException, ProjectBuildingException
{
if ( StringUtils.isEmpty( groupId ) )
if ( !checkParameters() )
{
// TODO: i18n
addActionError( "You must specify a group ID to browse" );
return ERROR;
}
if ( StringUtils.isEmpty( artifactId ) )
{
// TODO: i18n
addActionError( "You must specify a artifact ID to browse" );
return ERROR;
}
if ( StringUtils.isEmpty( version ) )
{
// TODO: i18n
addActionError( "You must specify a version to browse" );
return ERROR;
}
Configuration configuration = configurationStore.getConfigurationFromStore();
List repositories = repositoryFactory.createRepositories( configuration );
Artifact artifact = artifactFactory.createProjectArtifact( groupId, artifactId, version );
// TODO: maybe we can decouple the assembly parts of the project builder from the repository handling to get rid of the temp repo
ArtifactRepository localRepository = repositoryFactory.createLocalRepository( configuration );
MavenProject project = projectBuilder.buildFromRepository( artifact, repositories, localRepository );
MavenProject project = readProject();
model = project.getModel();
return SUCCESS;
}
public String dependencies()
throws ConfigurationStoreException, IOException, XmlPullParserException, ProjectBuildingException
{
if ( !checkParameters() )
{
return ERROR;
}
MavenProject project = readProject();
model = project.getModel();
// TODO: should this be the whole set of artifacts, and be more like the maven dependencies report?
dependencies = project.getModel().getDependencies();
return SUCCESS;
}
private MavenProject readProject()
throws ConfigurationStoreException, ProjectBuildingException
{
Configuration configuration = configurationStore.getConfigurationFromStore();
List repositories = repositoryFactory.createRepositories( configuration );
Artifact artifact = artifactFactory.createProjectArtifact( groupId, artifactId, version );
// TODO: maybe we can decouple the assembly parts of the project builder from the repository handling to get rid of the temp repo
ArtifactRepository localRepository = repositoryFactory.createLocalRepository( configuration );
return projectBuilder.buildFromRepository( artifact, repositories, localRepository );
}
private boolean checkParameters()
{
boolean result = true;
if ( StringUtils.isEmpty( groupId ) )
{
// TODO: i18n
addActionError( "You must specify a group ID to browse" );
result = false;
}
else if ( StringUtils.isEmpty( artifactId ) )
{
// TODO: i18n
addActionError( "You must specify a artifact ID to browse" );
result = false;
}
else if ( StringUtils.isEmpty( version ) )
{
// TODO: i18n
addActionError( "You must specify a version to browse" );
result = false;
}
return result;
}
public Model getModel()
{
return model;
}
public List getDependencies()
{
return dependencies;
}
public String getGroupId()
{
return groupId;

View File

@ -51,6 +51,11 @@ public class RepositoryActionMapper
return BROWSE_PREFIX + params.remove( "groupId" ) + "/" + params.remove( "artifactId" ) + "/" +
params.remove( "version" );
}
else if ( "showArtifactDependencies".equals( actionMapping.getName() ) )
{
return BROWSE_PREFIX + params.remove( "groupId" ) + "/" + params.remove( "artifactId" ) + "/" +
params.remove( "version" ) + "/dependencies";
}
else if ( "proxy".equals( actionMapping.getName() ) )
{
return PROXY_PREFIX + params.remove( "path" );
@ -93,6 +98,18 @@ public class RepositoryActionMapper
params.put( "version", parts[2] );
return new ActionMapping( "showArtifact", "/", "", params );
}
else if ( parts.length == 4 )
{
Map params = new HashMap();
params.put( "groupId", parts[0] );
params.put( "artifactId", parts[1] );
params.put( "version", parts[2] );
if ( "dependencies".equals( parts[3] ) )
{
return new ActionMapping( "showArtifactDependencies", "/", "", params );
}
}
}
}
else if ( path.startsWith( PROXY_PREFIX ) )

View File

@ -107,7 +107,11 @@
<result>/WEB-INF/jsp/browseArtifact.jsp</result>
</action>
<action name="showArtifact" class="showArtifactAction">
<action name="showArtifact" class="showArtifactAction" method="artifact">
<result>/WEB-INF/jsp/showArtifact.jsp</result>
</action>
<action name="showArtifactDependencies" class="showArtifactAction" method="dependencies">
<result>/WEB-INF/jsp/showArtifact.jsp</result>
</action>

View File

@ -36,12 +36,14 @@
<c:set var="cumulativeGroup" value="${part}"/>
</c:when>
<c:otherwise>
<c:set var="cumulativeGroup" value="${cumulativeGroup}/${part}" />
<c:set var="cumulativeGroup" value="${cumulativeGroup}.${part}"/>
</c:otherwise>
</c:choose>
<ww:url id="url" action="browseGroup" namespace="/">
<c:set var="url">
<ww:url action="browseGroup" namespace="/">
<ww:param name="groupId" value="%{'${cumulativeGroup}'}"/>
</ww:url>
</c:set>
<a href="${url}">${part}</a> /
</c:forTokens>
<strong>${artifactId}</strong>

View File

@ -0,0 +1,44 @@
<c:forEach items="${dependencies}" var="dependency">
<h3>
<c:set var="url">
<ww:url action="showArtifact" namespace="/">
<ww:param name="groupId" value="%{'${dependency.groupId}'}"/>
<ww:param name="artifactId" value="%{'${dependency.artifactId}'}"/>
<ww:param name="version" value="%{'${dependency.version}'}"/>
</ww:url>
</c:set>
<%-- TODO: showing the name and description would be nice, but that would require loading the POMs --%>
<a href="${url}">${dependency.artifactId}</a>
</h3>
<%-- TODO! use CSS, share with search results --%>
<p>
<span style="font-size: x-small">
<%-- TODO! share with browse as a tag --%>
<c:forTokens items="${dependency.groupId}" delims="." var="part">
<c:choose>
<c:when test="${empty(cumulativeGroup)}">
<c:set var="cumulativeGroup" value="${part}"/>
</c:when>
<c:otherwise>
<c:set var="cumulativeGroup" value="${cumulativeGroup}.${part}"/>
</c:otherwise>
</c:choose>
<c:set var="url">
<ww:url action="browseGroup" namespace="/">
<ww:param name="groupId" value="%{'${cumulativeGroup}'}"/>
</ww:url>
</c:set>
<a href="${url}">${part}</a> /
</c:forTokens>
<strong>${dependency.artifactId}</strong>
| <strong>Version(s):</strong> ${dependency.version}
<c:if test="${!empty(dependency.scope)}">
| <strong>Scope:</strong> ${dependency.scope}
</c:if>
<c:if test="${!empty(dependency.classifier)}">
| <strong>Classifier:</strong> ${dependency.classifier}
</c:if>
</span>
</p>
</c:forEach>

View File

@ -0,0 +1,200 @@
<%@ taglib prefix="ww" uri="/webwork" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<p>
<c:forTokens items="${model.groupId}" delims="." var="part">
<c:choose>
<c:when test="${empty(cumulativeGroup)}">
<c:set var="cumulativeGroup" value="${part}"/>
</c:when>
<c:otherwise>
<c:set var="cumulativeGroup" value="${cumulativeGroup}/${part}"/>
</c:otherwise>
</c:choose>
<ww:url id="url" action="browseGroup" namespace="/">
<ww:param name="groupId" value="%{'${cumulativeGroup}'}"/>
</ww:url>
<a href="${url}">${part}</a> /
</c:forTokens>
<ww:url id="url" action="browseArtifact" namespace="/">
<ww:param name="groupId" value="%{'${model.groupId}'}"/>
<ww:param name="artifactId" value="%{'${model.artifactId}'}"/>
</ww:url>
<a href="${url}">${model.artifactId}</a> /
<strong>${model.version}</strong>
<!-- TODO: new versions?
(<strong class="statusFailed">Newer version available:</strong>
<a href="artifact.html">2.0.3</a>)
-->
</p>
<p>${mode.description}</p>
<table>
<tr>
<th>Group ID</th>
<td>${model.groupId}</td>
</tr>
<tr>
<th>Artifact ID</th>
<td>${model.artifactId}</td>
</tr>
<tr>
<th>Version</th>
<td>${model.version}</td>
</tr>
<tr>
<th>Packaging</th>
<td><code>${model.packaging}</code></td>
</tr>
<%-- TODO: derivatives
<tr>
<th>Derivatives</th>
<td>
<a href="#">Source</a>
|
<a href="#">Javadoc</a>
</td>
</tr>
--%>
<c:if test="${model.parent != null}">
<tr>
<th>Parent</th>
<td>
${model.parent.groupId} ${model.parent.artifactId} ${model.parent.version}
<ww:url id="url" action="showArtifact" namespace="/">
<ww:param name="groupId" value="%{'${model.parent.groupId}'}"/>
<ww:param name="artifactId" value="%{'${model.parent.artifactId}'}"/>
<ww:param name="version" value="%{'${model.parent.version}'}"/>
</ww:url>
(<a href="${url}">View</a>)
</td>
</tr>
</c:if>
<%-- TODO: deployment timestamp
<tr>
<th>Deployment Date</th>
<td>
15 Jan 2006, 20:38:00 +1000
</td>
</tr>
--%>
<!-- TODO: origin
<tr>
<th>Origin</th>
<td>
<a href="TODO">Apache Repository</a>
</td>
</tr>
-->
</table>
<c:if test="${!empty(model.url) || model.organization != null || !empty(model.licenses)
|| model.issueManagement != null || model.ciManagement != null}">
<h2>Other Details</h2>
<table>
<c:if test="${!empty(model.url)}">
<tr>
<th>URL</th>
<td>
<a href="${model.url}">${model.url}</a>
</td>
</tr>
</c:if>
<c:if test="${model.organization != null}">
<tr>
<th>Organisation</th>
<td>
<c:choose>
<c:when test="${model.organization != null}">
<a href="${model.organization.url}">${model.organization.name}</a>
</c:when>
<c:otherwise>
${model.organization.name}
</c:otherwise>
</c:choose>
</td>
</tr>
</c:if>
<c:if test="${!empty(model.licenses)}">
<c:forEach items="${model.licenses}" var="license">
<tr>
<th>License</th>
<td>
<c:choose>
<c:when test="${!empty(license.url)}">
<a href="${license.url}">${license.name}</a>
</c:when>
<c:otherwise>
${license.name}
</c:otherwise>
</c:choose>
</td>
</tr>
</c:forEach>
</c:if>
<c:if test="${model.issueManagement != null}">
<tr>
<th>Issue Tracker</th>
<td>
<c:choose>
<c:when test="${!empty(model.issueManagement.url)}">
<a href="${model.issueManagement.url}">${model.issueManagement.system}</a>
</c:when>
<c:otherwise>
${model.issueManagement.system}
</c:otherwise>
</c:choose>
</td>
</tr>
</c:if>
<c:if test="${model.ciManagement != null}">
<tr>
<th>Continuous Integration</th>
<td>
<c:choose>
<c:when test="${!empty(model.ciManagement.url)}">
<a href="${model.ciManagement.url}">${model.ciManagement.system}</a>
</c:when>
<c:otherwise>
${model.ciManagement.system}
</c:otherwise>
</c:choose>
</td>
</tr>
</c:if>
</table>
</c:if>
<c:if test="${model.scm != null}">
<h2>SCM</h2>
<table>
<c:if test="${!empty(model.scm.connection)}">
<tr>
<th>Connection</th>
<td>
<code>${model.scm.connection}</code>
</td>
</tr>
</c:if>
<c:if test="${!empty(model.scm.developerConnection)}">
<tr>
<th>Dev. Connection</th>
<td>
<code>${model.scm.developerConnection}</code>
</td>
</tr>
</c:if>
<c:if test="${!empty(model.scm.url)}">
<tr>
<th>Viewer</th>
<td>
<a href="${model.scm.url}">${model.scm.url}</a>
</td>
</tr>
</c:if>
</table>
</c:if>

View File

@ -16,6 +16,7 @@
<%@ taglib prefix="ww" uri="/webwork" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="my" tagdir="/WEB-INF/tags" %>
<html>
<head>
@ -50,215 +51,40 @@
<div id="contentArea">
<div id="tabs">
<p>
<strong>Info</strong>
<%-- TODO: perhaps using ajax?
<a href="TODO">Dependencies</a>
<c:set var="url">
<ww:url action="showArtifact">
<ww:param name="groupId" value="%{groupId}"/>
<ww:param name="artifactId" value="%{artifactId}"/>
<ww:param name="version" value="%{version}"/>
</ww:url>
</c:set>
<my:currentWWUrl url="${url}">Info</my:currentWWUrl>
<c:set var="url">
<ww:url action="showArtifactDependencies">
<ww:param name="groupId" value="%{groupId}"/>
<ww:param name="artifactId" value="%{artifactId}"/>
<ww:param name="version" value="%{version}"/>
</ww:url>
</c:set>
<my:currentWWUrl url="${url}">Dependencies</my:currentWWUrl>
<%-- TODO:
<a href="TODO">Depended On</a>
<a href="TODO">Mailing Lists</a>
<a href="TODO">Developers</a>
<a href="TODO">POM</a>
--%>
</p>
</div>
<%-- TODO: perhaps using ajax? --%>
<%-- TODO: panels? this is ugly as is! --%>
<div id="tabArea">
<p>
<c:forTokens items="${model.groupId}" delims="." var="part">
<c:choose>
<c:when test="${empty(cumulativeGroup)}">
<c:set var="cumulativeGroup" value="${part}" />
<c:when test="${dependencies != null}">
<%@ include file="/WEB-INF/jsp/include/artifactDependencies.jspf" %>
</c:when>
<c:otherwise>
<c:set var="cumulativeGroup" value="${cumulativeGroup}/${part}" />
<%@ include file="/WEB-INF/jsp/include/artifactInfo.jspf" %>
</c:otherwise>
</c:choose>
<ww:url id="url" action="browseGroup" namespace="/">
<ww:param name="groupId" value="%{'${cumulativeGroup}'}" />
</ww:url>
<a href="${url}">${part}</a> /
</c:forTokens>
<ww:url id="url" action="browseArtifact" namespace="/">
<ww:param name="groupId" value="%{'${model.groupId}'}" />
<ww:param name="artifactId" value="%{'${model.artifactId}'}" />
</ww:url>
<a href="${url}">${model.artifactId}</a> /
<strong>${model.version}</strong>
<!-- TODO: new versions?
(<strong class="statusFailed">Newer version available:</strong>
<a href="artifact.html">2.0.3</a>)
-->
</p>
<p>${mode.description}</p>
<table>
<tr>
<th>Group ID</th>
<td>${model.groupId}</td>
</tr>
<tr>
<th>Artifact ID</th>
<td>${model.artifactId}</td>
</tr>
<tr>
<th>Version</th>
<td>${model.version}</td>
</tr>
<tr>
<th>Packaging</th>
<td><code>${model.packaging}</code></td>
</tr>
<%-- TODO: derivatives
<tr>
<th>Derivatives</th>
<td>
<a href="#">Source</a>
|
<a href="#">Javadoc</a>
</td>
</tr>
--%>
<c:if test="${model.parent != null}">
<tr>
<th>Parent</th>
<td>
${model.parent.groupId} ${model.parent.artifactId} ${model.parent.version}
<ww:url id="url" action="showArtifact" namespace="/">
<ww:param name="groupId" value="%{'${model.parent.groupId}'}" />
<ww:param name="artifactId" value="%{'${model.parent.artifactId}'}" />
<ww:param name="version" value="%{'${model.parent.version}'}" />
</ww:url>
(<a href="${url}">View</a>)
</td>
</tr>
</c:if>
<%-- TODO: deployment timestamp
<tr>
<th>Deployment Date</th>
<td>
15 Jan 2006, 20:38:00 +1000
</td>
</tr>
--%>
<!-- TODO: origin
<tr>
<th>Origin</th>
<td>
<a href="TODO">Apache Repository</a>
</td>
</tr>
-->
</table>
<c:if test="${!empty(model.url) || model.organization != null || !empty(model.licenses)
|| model.issueManagement != null || model.ciManagement != null}">
<h2>Other Details</h2>
<table>
<c:if test="${!empty(model.url)}">
<tr>
<th>URL</th>
<td>
<a href="${model.url}">${model.url}</a>
</td>
</tr>
</c:if>
<c:if test="${model.organization != null}">
<tr>
<th>Organisation</th>
<td>
<c:choose>
<c:when test="${model.organization != null}">
<a href="${model.organization.url}">${model.organization.name}</a>
</c:when>
<c:otherwise>
${model.organization.name}
</c:otherwise>
</c:choose>
</td>
</tr>
</c:if>
<c:if test="${!empty(model.licenses)}">
<c:forEach items="${model.licenses}" var="license">
<tr>
<th>License</th>
<td>
<c:choose>
<c:when test="${!empty(license.url)}">
<a href="${license.url}">${license.name}</a>
</c:when>
<c:otherwise>
${license.name}
</c:otherwise>
</c:choose>
</td>
</tr>
</c:forEach>
</c:if>
<c:if test="${model.issueManagement != null}">
<tr>
<th>Issue Tracker</th>
<td>
<c:choose>
<c:when test="${!empty(model.issueManagement.url)}">
<a href="${model.issueManagement.url}">${model.issueManagement.system}</a>
</c:when>
<c:otherwise>
${model.issueManagement.system}
</c:otherwise>
</c:choose>
</td>
</tr>
</c:if>
<c:if test="${model.ciManagement != null}">
<tr>
<th>Continuous Integration</th>
<td>
<c:choose>
<c:when test="${!empty(model.ciManagement.url)}">
<a href="${model.ciManagement.url}">${model.ciManagement.system}</a>
</c:when>
<c:otherwise>
${model.ciManagement.system}
</c:otherwise>
</c:choose>
</td>
</tr>
</c:if>
</table>
</c:if>
<c:if test="${model.scm != null}">
<h2>SCM</h2>
<table>
<c:if test="${!empty(model.scm.connection)}">
<tr>
<th>Connection</th>
<td>
<code>${model.scm.connection}</code>
</td>
</tr>
</c:if>
<c:if test="${!empty(model.scm.developerConnection)}">
<tr>
<th>Dev. Connection</th>
<td>
<code>${model.scm.developerConnection}</code>
</td>
</tr>
</c:if>
<c:if test="${!empty(model.scm.url)}">
<tr>
<th>Viewer</th>
<td>
<a href="${model.scm.url}">${model.scm.url}</a>
</td>
</tr>
</c:if>
</table>
</c:if>
</div>
</div>

View File

@ -16,14 +16,17 @@
<%@ taglib uri="/webwork" prefix="ww" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ attribute name="action" required="true" %>
<%@ attribute name="namespace" required="true" %>
<%@ attribute name="action" %>
<%@ attribute name="namespace" %>
<%@ attribute name="url" %>
<c:set var="currentUrl">
<ww:url/>
</c:set>
<c:if test="${empty(url)}">
<c:set var="url">
<ww:url action="${action}" namespace="${namespace}"/>
</c:set>
</c:if>
<c:choose>
<c:when test="${currentUrl == url}">
<strong>