From 8c3eb496f945e9e4dbd754cd40b0632c16155445 Mon Sep 17 00:00:00 2001 From: Brett Porter Date: Sat, 26 Aug 2006 16:01:32 +0000 Subject: [PATCH] [MRM-131] add dependencies page git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@437175 13f79535-47bb-0310-9956-ffa450edef68 --- .../web/action/ShowArtifactAction.java | 92 +++++-- .../web/mapper/RepositoryActionMapper.java | 17 ++ archiva-webapp/src/main/resources/xwork.xml | 6 +- .../webapp/WEB-INF/jsp/browseArtifact.jsp | 22 +- .../jsp/include/artifactDependencies.jspf | 44 ++++ .../WEB-INF/jsp/include/artifactInfo.jspf | 200 +++++++++++++++ .../main/webapp/WEB-INF/jsp/showArtifact.jsp | 242 +++--------------- .../main/webapp/WEB-INF/tags/currentWWUrl.tag | 19 +- 8 files changed, 390 insertions(+), 252 deletions(-) create mode 100644 archiva-webapp/src/main/webapp/WEB-INF/jsp/include/artifactDependencies.jspf create mode 100644 archiva-webapp/src/main/webapp/WEB-INF/jsp/include/artifactInfo.jspf diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java index 31ab2cc0f..438934f6c 100644 --- a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java +++ b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java @@ -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; diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/mapper/RepositoryActionMapper.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/mapper/RepositoryActionMapper.java index c686f727d..9ebb14719 100644 --- a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/mapper/RepositoryActionMapper.java +++ b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/mapper/RepositoryActionMapper.java @@ -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 ) ) diff --git a/archiva-webapp/src/main/resources/xwork.xml b/archiva-webapp/src/main/resources/xwork.xml index db1d796a7..6075bf321 100644 --- a/archiva-webapp/src/main/resources/xwork.xml +++ b/archiva-webapp/src/main/resources/xwork.xml @@ -107,7 +107,11 @@ /WEB-INF/jsp/browseArtifact.jsp - + + /WEB-INF/jsp/showArtifact.jsp + + + /WEB-INF/jsp/showArtifact.jsp diff --git a/archiva-webapp/src/main/webapp/WEB-INF/jsp/browseArtifact.jsp b/archiva-webapp/src/main/webapp/WEB-INF/jsp/browseArtifact.jsp index f7ba822ee..95ee19f67 100644 --- a/archiva-webapp/src/main/webapp/WEB-INF/jsp/browseArtifact.jsp +++ b/archiva-webapp/src/main/webapp/WEB-INF/jsp/browseArtifact.jsp @@ -20,7 +20,7 @@ Browse Repository - + @@ -33,15 +33,17 @@ - + - + - - - + + + + + ${part} / ${artifactId} @@ -49,12 +51,12 @@

Versions

    - + - - - + + +
  • ${version}/
  • diff --git a/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/artifactDependencies.jspf b/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/artifactDependencies.jspf new file mode 100644 index 000000000..984425ccf --- /dev/null +++ b/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/artifactDependencies.jspf @@ -0,0 +1,44 @@ + +

    + + + + + + + + <%-- TODO: showing the name and description would be nice, but that would require loading the POMs --%> + ${dependency.artifactId} +

    + + <%-- TODO! use CSS, share with search results --%> +

    + + <%-- TODO! share with browse as a tag --%> + + + + + + + + + + + + + + + ${part} / + + ${dependency.artifactId} + | Version(s): ${dependency.version} + + | Scope: ${dependency.scope} + + + | Classifier: ${dependency.classifier} + + +

    +
    \ No newline at end of file diff --git a/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/artifactInfo.jspf b/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/artifactInfo.jspf new file mode 100644 index 000000000..a2687b1ce --- /dev/null +++ b/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/artifactInfo.jspf @@ -0,0 +1,200 @@ +<%@ taglib prefix="ww" uri="/webwork" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + +

    + + + + + + + + + + + + + ${part} / + + + + + + ${model.artifactId} / + ${model.version} + + +

    + +

    ${mode.description}

    + + + + + + + + + + + + + + + + + + + <%-- TODO: derivatives + + + + + --%> + + + + + + + <%-- TODO: deployment timestamp + + + + + --%> + +
    Group ID${model.groupId}
    Artifact ID${model.artifactId}
    Version${model.version}
    Packaging${model.packaging}
    Derivatives + Source + | + Javadoc +
    Parent + ${model.parent.groupId} ${model.parent.artifactId} ${model.parent.version} + + + + + + (View) +
    Deployment Date + 15 Jan 2006, 20:38:00 +1000 +
    + + + +

    Other Details

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    URL + ${model.url} +
    Organisation + + + ${model.organization.name} + + + ${model.organization.name} + + +
    License + + + ${license.name} + + + ${license.name} + + +
    Issue Tracker + + + ${model.issueManagement.system} + + + ${model.issueManagement.system} + + +
    Continuous Integration + + + ${model.ciManagement.system} + + + ${model.ciManagement.system} + + +
    +
    + + +

    SCM

    + + + + + + + + + + + + + + + + + + + +
    Connection + ${model.scm.connection} +
    Dev. Connection + ${model.scm.developerConnection} +
    Viewer + ${model.scm.url} +
    +
    + diff --git a/archiva-webapp/src/main/webapp/WEB-INF/jsp/showArtifact.jsp b/archiva-webapp/src/main/webapp/WEB-INF/jsp/showArtifact.jsp index ed843a634..62630465a 100644 --- a/archiva-webapp/src/main/webapp/WEB-INF/jsp/showArtifact.jsp +++ b/archiva-webapp/src/main/webapp/WEB-INF/jsp/showArtifact.jsp @@ -16,11 +16,12 @@ <%@ taglib prefix="ww" uri="/webwork" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="my" tagdir="/WEB-INF/tags" %> Browse Repository - + @@ -35,7 +36,7 @@ --%> - +

    @@ -48,218 +49,43 @@

    -
    -

    - Info - <%-- TODO: perhaps using ajax? - Dependencies - Depended On - Mailing Lists - Developers - POM - --%> -

    -
    +
    +

    + + + + + + + + Info + + + + + + + + Dependencies + <%-- TODO: + Depended On + Mailing Lists + --%> +

    +
    -
    -

    - + <%-- TODO: perhaps using ajax? --%> + <%-- TODO: panels? this is ugly as is! --%> +

    - - + + <%@ include file="/WEB-INF/jsp/include/artifactDependencies.jspf" %> - + <%@ include file="/WEB-INF/jsp/include/artifactInfo.jspf" %> - - - - ${part} / - - - - - - ${model.artifactId} / - ${model.version} - - -

    - -

    ${mode.description}

    - - - - - - - - - - - - - - - - - - - <%-- TODO: derivatives - - - - - --%> - - - - - - - <%-- TODO: deployment timestamp - - - - - --%> - -
    Group ID${model.groupId}
    Artifact ID${model.artifactId}
    Version${model.version}
    Packaging${model.packaging}
    Derivatives - Source - | - Javadoc -
    Parent - ${model.parent.groupId} ${model.parent.artifactId} ${model.parent.version} - - - - - - (View) -
    Deployment Date - 15 Jan 2006, 20:38:00 +1000 -
    - - - -

    Other Details

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    URL - ${model.url} -
    Organisation - - - ${model.organization.name} - - - ${model.organization.name} - - -
    License - - - ${license.name} - - - ${license.name} - - -
    Issue Tracker - - - ${model.issueManagement.system} - - - ${model.issueManagement.system} - - -
    Continuous Integration - - - ${model.ciManagement.system} - - - ${model.ciManagement.system} - - -
    -
    - - -

    SCM

    - - - - - - - - - - - - - - - - - - - -
    Connection - ${model.scm.connection} -
    Dev. Connection - ${model.scm.developerConnection} -
    Viewer - ${model.scm.url} -
    -
    - -
    +
    diff --git a/archiva-webapp/src/main/webapp/WEB-INF/tags/currentWWUrl.tag b/archiva-webapp/src/main/webapp/WEB-INF/tags/currentWWUrl.tag index 6febd7f06..fcc5cecb0 100644 --- a/archiva-webapp/src/main/webapp/WEB-INF/tags/currentWWUrl.tag +++ b/archiva-webapp/src/main/webapp/WEB-INF/tags/currentWWUrl.tag @@ -16,23 +16,26 @@ <%@ 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" %> - - - - + + + + + + - + - +