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;
- }
+ MavenProject project = readProject();
+
+ model = project.getModel();
+
+ return SUCCESS;
+ }
- if ( StringUtils.isEmpty( version ) )
+ public String dependencies()
+ throws ConfigurationStoreException, IOException, XmlPullParserException, ProjectBuildingException
+ {
+ if ( !checkParameters() )
{
- // TODO: i18n
- addActionError( "You must specify a version to browse" );
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 );
- MavenProject project = projectBuilder.buildFromRepository( artifact, repositories, localRepository );
+ return projectBuilder.buildFromRepository( artifact, repositories, localRepository );
+ }
- model = project.getModel();
+ private boolean checkParameters()
+ {
+ boolean result = true;
- return SUCCESS;
+ 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;
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" );
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 ) )
<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>
<html>
<head>
<title>Browse Repository</title>
- <ww:head />
+ <ww:head/>
</head>
<body>
<c:forTokens items="${groupId}" delims="./" var="part">
<c:choose>
<c:when test="${empty(cumulativeGroup)}">
- <c:set var="cumulativeGroup" value="${part}" />
+ <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="/">
- <ww:param name="groupId" value="%{'${cumulativeGroup}'}" />
- </ww:url>
+ <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>
<h2>Versions</h2>
<ul>
- <ww:set name="versions" value="versions" />
+ <ww:set name="versions" value="versions"/>
<c:forEach items="${versions}" var="version">
<ww:url id="url" action="showArtifact" namespace="/">
- <ww:param name="groupId" value="%{'${groupId}'}" />
- <ww:param name="artifactId" value="%{'${artifactId}'}" />
- <ww:param name="version" value="%{'${version}'}" />
+ <ww:param name="groupId" value="%{'${groupId}'}"/>
+ <ww:param name="artifactId" value="%{'${artifactId}'}"/>
+ <ww:param name="version" value="%{'${version}'}"/>
</ww:url>
<li><a href="${url}">${version}/</a></li>
</c:forEach>
--- /dev/null
+<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>
\ No newline at end of file
--- /dev/null
+<%@ 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>
+
<%@ 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>
<title>Browse Repository</title>
- <ww:head />
+ <ww:head/>
</head>
<body>
</div>
--%>
-<ww:set name="model" value="model" />
+<ww:set name="model" value="model"/>
<h1>
<c:choose>
<c:when test="${empty(model.name)}">
</h1>
<div id="contentArea">
-<div id="tabs">
- <p>
- <strong>Info</strong>
- <%-- TODO: perhaps using ajax?
- <a href="TODO">Dependencies</a>
- <a href="TODO">Depended On</a>
- <a href="TODO">Mailing Lists</a>
- <a href="TODO">Developers</a>
- <a href="TODO">POM</a>
- --%>
- </p>
-</div>
-
-<div id="tabArea">
-<p>
- <c:forTokens items="${model.groupId}" delims="." var="part">
+ <div id="tabs">
+ <p>
+ <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>
+ --%>
+ </p>
+ </div>
+
+ <%-- TODO: perhaps using ajax? --%>
+ <%-- TODO: panels? this is ugly as is! --%>
+ <div id="tabArea">
<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>
</div>
</body>
\r
<%@ taglib uri="/webwork" prefix="ww" %>\r
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>\r
-<%@ attribute name="action" required="true" %>\r
-<%@ attribute name="namespace" required="true" %>\r
+<%@ attribute name="action" %>\r
+<%@ attribute name="namespace" %>\r
+<%@ attribute name="url" %>\r
<c:set var="currentUrl">\r
- <ww:url />\r
-</c:set>\r
-<c:set var="url">\r
- <ww:url action="${action}" namespace="${namespace}" />\r
+ <ww:url/>\r
</c:set>\r
+<c:if test="${empty(url)}">\r
+ <c:set var="url">\r
+ <ww:url action="${action}" namespace="${namespace}"/>\r
+ </c:set>\r
+</c:if>\r
<c:choose>\r
<c:when test="${currentUrl == url}">\r
<strong>\r
- <jsp:doBody />\r
+ <jsp:doBody/>\r
</strong>\r
</c:when>\r
<c:otherwise>\r
<a href="${url}">\r
- <jsp:doBody />\r
+ <jsp:doBody/>\r
</a>\r
</c:otherwise>\r
</c:choose>\r