From f457d052aedd640e2cf53d89c581de8414eb7154 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Wed, 30 May 2007 17:20:20 +0000 Subject: [PATCH] [MRM-378]: Clicking on the tabs in the artifact detail page doesn't change the view git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@542881 13f79535-47bb-0310-9956-ffa450edef68 --- .../database/DeclarativeConstraint.java | 18 +++ .../browsing/DefaultRepositoryBrowsing.java | 25 +++- .../database/browsing/RepositoryBrowsing.java | 45 ++++++- .../AbstractDeclarativeConstraint.java | 12 ++ .../ProjectsByArtifactUsageConstraint.java | 81 ++++++++++++ .../maven/archiva/database/jdo/JdoAccess.java | 62 +++++----- .../AbstractArchivaDatabaseTestCase.java | 42 +++++++ ...ProjectsByArtifactUsageConstraintTest.java | 115 ++++++++++++++++++ .../web/action/ShowArtifactAction.java | 9 +- .../WEB-INF/jsp/include/projectDependees.jspf | 39 ++++++ .../main/webapp/WEB-INF/jsp/showArtifact.jsp | 3 + .../webapp/WEB-INF/tags/showArtifactLink.tag | 5 +- 12 files changed, 415 insertions(+), 41 deletions(-) create mode 100644 archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/ProjectsByArtifactUsageConstraint.java create mode 100644 archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/ProjectsByArtifactUsageConstraintTest.java create mode 100644 archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/projectDependees.jspf diff --git a/archiva-database/src/main/java/org/apache/maven/archiva/database/DeclarativeConstraint.java b/archiva-database/src/main/java/org/apache/maven/archiva/database/DeclarativeConstraint.java index 54b0b4724..c2bca5f05 100644 --- a/archiva-database/src/main/java/org/apache/maven/archiva/database/DeclarativeConstraint.java +++ b/archiva-database/src/main/java/org/apache/maven/archiva/database/DeclarativeConstraint.java @@ -44,6 +44,15 @@ public interface DeclarativeConstraint extends Constraint * @return the parameters. (can be null) */ public abstract String[] getDeclaredParameters(); + + /** + * The JDOQL filter to apply to the query. (optional) + * + * NOTE: This is DAO implementation specific. + * + * @return the filter to apply. (can be null) + */ + public abstract String getFilter(); /** * Get the parameters used for this query. (required if using {@link #getDeclaredParameters()} ) @@ -67,6 +76,15 @@ public interface DeclarativeConstraint extends Constraint * @return the sort column name. (can be null) */ public abstract String getSortColumn(); + + /** + * Get the variables used within the query. + * + * NOTE: This is DAO implementation specific. + * + * @return the variables used within the query. + */ + public abstract String[] getVariables(); /** * Get the SELECT WHERE (condition) value for the constraint. diff --git a/archiva-database/src/main/java/org/apache/maven/archiva/database/browsing/DefaultRepositoryBrowsing.java b/archiva-database/src/main/java/org/apache/maven/archiva/database/browsing/DefaultRepositoryBrowsing.java index 7ce38abf7..1a1d80787 100644 --- a/archiva-database/src/main/java/org/apache/maven/archiva/database/browsing/DefaultRepositoryBrowsing.java +++ b/archiva-database/src/main/java/org/apache/maven/archiva/database/browsing/DefaultRepositoryBrowsing.java @@ -22,6 +22,7 @@ package org.apache.maven.archiva.database.browsing; import org.apache.maven.archiva.database.ArchivaDAO; import org.apache.maven.archiva.database.ArchivaDatabaseException; import org.apache.maven.archiva.database.ObjectNotFoundException; +import org.apache.maven.archiva.database.constraints.ProjectsByArtifactUsageConstraint; import org.apache.maven.archiva.database.constraints.UniqueArtifactIdConstraint; import org.apache.maven.archiva.database.constraints.UniqueGroupIdConstraint; import org.apache.maven.archiva.database.constraints.UniqueVersionConstraint; @@ -30,6 +31,7 @@ import org.apache.maven.archiva.model.ArchivaArtifact; import org.apache.maven.archiva.model.ArchivaProjectModel; import org.codehaus.plexus.logging.AbstractLogEnabled; +import java.util.Collections; import java.util.List; /** @@ -111,7 +113,7 @@ public class DefaultRepositoryBrowsing { throw e; } - + ArchivaProjectModel model; if ( pomArtifact.getModel().isProcessed() ) @@ -128,11 +130,11 @@ public class DefaultRepositoryBrowsing try { model = dao.getProjectModelDAO().getProjectModel( groupId, artifactId, version ); - + if ( model == null ) { - throw new ObjectNotFoundException( "Unable to find project model for [" + groupId + ":" + artifactId + ":" - + version + "]" ); + throw new ObjectNotFoundException( "Unable to find project model for [" + groupId + ":" + artifactId + + ":" + version + "]" ); } return model; @@ -142,4 +144,19 @@ public class DefaultRepositoryBrowsing throw e; } } + + public List getUsedBy( String groupId, String artifactId, String version ) + throws ArchivaDatabaseException + { + ProjectsByArtifactUsageConstraint constraint = new ProjectsByArtifactUsageConstraint( groupId, artifactId, + version ); + List results = dao.getProjectModelDAO().queryProjectModels( constraint ); + if ( results == null ) + { + // defensive. to honor contract as specified. never null. + return Collections.EMPTY_LIST; + } + + return results; + } } diff --git a/archiva-database/src/main/java/org/apache/maven/archiva/database/browsing/RepositoryBrowsing.java b/archiva-database/src/main/java/org/apache/maven/archiva/database/browsing/RepositoryBrowsing.java index ead8a7913..9ce3833d7 100644 --- a/archiva-database/src/main/java/org/apache/maven/archiva/database/browsing/RepositoryBrowsing.java +++ b/archiva-database/src/main/java/org/apache/maven/archiva/database/browsing/RepositoryBrowsing.java @@ -23,20 +23,63 @@ import org.apache.maven.archiva.database.ArchivaDatabaseException; import org.apache.maven.archiva.database.ObjectNotFoundException; import org.apache.maven.archiva.model.ArchivaProjectModel; +import java.util.List; + /** - * RepositoryBrowsing + * Repository Browsing component * * @author Joakim Erdfelt * @version $Id$ */ public interface RepositoryBrowsing { + /** + * Get the {@link BrowsingResults} for the root of the repository. + * + * @return the root browsing results. + */ public BrowsingResults getRoot(); + /** + * Get the {@link BrowsingResults} for the selected groupId. + * + * @param groupId the groupId to select. + * @return the {@link BrowsingResults} for the specified groupId. + */ public BrowsingResults selectGroupId( String groupId ); + /** + * Get the {@link BrowsingResults} for the selected groupId & artifactId. + * + * @param groupId the groupId selected + * @param artifactId the artifactId selected + * @return the {@link BrowsingResults} for the specified groupId / artifactId combo. + */ public BrowsingResults selectArtifactId( String groupId, String artifactId ); + /** + * Get the {@link ArchivaProjectModel} for the selected groupId / artifactId / version combo. + * + * @param groupId the groupId selected + * @param artifactId the artifactId selected + * @param version the version selected + * @return the {@link ArchivaProjectModel} for the selected groupId / artifactId / version combo. + * @throws ObjectNotFoundException if the artifact object or project object isn't found in the database. + * @throws ArchivaDatabaseException if there is a fundamental database error. + */ public ArchivaProjectModel selectVersion( String groupId, String artifactId, String version ) throws ObjectNotFoundException, ArchivaDatabaseException; + + /** + * Get the {@link List} of {@link ArchivaProjectModel} that are used by the provided + * groupId, artifactId, and version specified. + * + * @param groupId the groupId selected + * @param artifactId the artifactId selected + * @param version the version selected + * @return the {@link List} of {@link ArchivaProjectModel} objects. (never null, but can be empty) + * @throws ArchivaDatabaseException if there is a fundamental database error. + */ + public List getUsedBy( String groupId, String artifactId, String version ) + throws ArchivaDatabaseException; } diff --git a/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/AbstractDeclarativeConstraint.java b/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/AbstractDeclarativeConstraint.java index 48a4a3d21..87afa9b79 100644 --- a/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/AbstractDeclarativeConstraint.java +++ b/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/AbstractDeclarativeConstraint.java @@ -34,9 +34,16 @@ public abstract class AbstractDeclarativeConstraint protected String[] declImports; protected String[] declParams; + + protected String[] variables; protected Object[] params; + public String getFilter() + { + return null; + } + public String getFetchLimits() { return null; @@ -61,4 +68,9 @@ public abstract class AbstractDeclarativeConstraint { return Constraint.ASCENDING; } + + public String[] getVariables() + { + return variables; + } } diff --git a/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/ProjectsByArtifactUsageConstraint.java b/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/ProjectsByArtifactUsageConstraint.java new file mode 100644 index 000000000..2964be7eb --- /dev/null +++ b/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/ProjectsByArtifactUsageConstraint.java @@ -0,0 +1,81 @@ +package org.apache.maven.archiva.database.constraints; + +/* + * 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. + */ + +import org.apache.maven.archiva.database.DeclarativeConstraint; +import org.apache.maven.archiva.model.ArchivaArtifact; +import org.apache.maven.archiva.model.Dependency; + +/** + * ProjectsByArtifactUsageConstraint + * + * @author Joakim Erdfelt + * @version $Id$ + */ +public class ProjectsByArtifactUsageConstraint + extends AbstractDeclarativeConstraint + implements DeclarativeConstraint +{ + private String filter; + + public ProjectsByArtifactUsageConstraint( ArchivaArtifact artifact ) + { + this( artifact.getGroupId(), artifact.getArtifactId(), artifact.getBaseVersion() ); + } + + public ProjectsByArtifactUsageConstraint( String groupId, String artifactId, String version ) + { + super.declImports = new String[] { + "import " + Dependency.class.getName() + }; + + super.variables = new String[] { + "Dependency dep" + }; + + super.declParams = new String[] { + "String selectedGroupId", + "String selectedArtifactId", + "String selectedVersion" + }; + + filter = "dependencies.contains( dep ) && " + + "dep.groupId == selectedGroupId && " + + "dep.artifactId == selectedArtifactId && " + + "dep.version == selectedVersion"; + + super.params = new Object[] { groupId, artifactId, version }; + } + + public String getSortColumn() + { + return "groupId"; + } + + public String getWhereCondition() + { + return null; + } + + public String getFilter() + { + return filter; + } +} diff --git a/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoAccess.java b/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoAccess.java index b02cf1106..2161b7bee 100644 --- a/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoAccess.java +++ b/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoAccess.java @@ -31,12 +31,8 @@ import org.codehaus.plexus.jdo.JdoFactory; import org.codehaus.plexus.logging.AbstractLogEnabled; import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable; import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException; -import org.jpox.PMFConfiguration; -import org.jpox.SchemaTool; -import java.io.File; import java.io.PrintStream; -import java.net.URL; import java.util.ArrayList; import java.util.List; @@ -80,35 +76,35 @@ public class JdoAccess pmf = jdoFactory.getPersistenceManagerFactory(); /* Primitive (and failed) attempt at creating the schema on startup. - Just to prevent the multiple stack trace warnings on auto-gen of schema. + Just to prevent the multiple stack trace warnings on auto-gen of schema. - // Create the schema (if needed) - URL jdoFileUrls[] = new URL[] { getClass().getResource( "/org/apache/maven/archiva/model/package.jdo" ) }; + // Create the schema (if needed) + URL jdoFileUrls[] = new URL[] { getClass().getResource( "/org/apache/maven/archiva/model/package.jdo" ) }; - File propsFile = null; // intentional - boolean verbose = true; + File propsFile = null; // intentional + boolean verbose = true; - try - { - String connectionFactoryName = pmf.getConnectionFactoryName(); - if ( StringUtils.isNotBlank( connectionFactoryName ) && connectionFactoryName.startsWith( "java:comp" ) ) - { - // We have a JNDI datasource! - String jndiDatasource = connectionFactoryName; - System.setProperty( PMFConfiguration.JDO_DATASTORE_URL_PROPERTY, jndiDatasource ); - } - - // TODO: figure out how to get the jdbc driver details from JNDI to pass into SchemaTool. + try + { + String connectionFactoryName = pmf.getConnectionFactoryName(); + if ( StringUtils.isNotBlank( connectionFactoryName ) && connectionFactoryName.startsWith( "java:comp" ) ) + { + // We have a JNDI datasource! + String jndiDatasource = connectionFactoryName; + System.setProperty( PMFConfiguration.JDO_DATASTORE_URL_PROPERTY, jndiDatasource ); + } + + // TODO: figure out how to get the jdbc driver details from JNDI to pass into SchemaTool. - SchemaTool.createSchemaTables( jdoFileUrls, new URL[] {}, propsFile, verbose, null ); - } - catch ( Exception e ) - { - getLogger().error( "Unable to create schema: " + e.getMessage(), e ); - } + SchemaTool.createSchemaTables( jdoFileUrls, new URL[] {}, propsFile, verbose, null ); + } + catch ( Exception e ) + { + getLogger().error( "Unable to create schema: " + e.getMessage(), e ); + } - pmf.getPersistenceManager(); - */ + pmf.getPersistenceManager(); + */ // Add the lifecycle listener. pmf.addInstanceLifecycleListener( this, null ); @@ -324,6 +320,16 @@ public class JdoAccess Extent extent = pm.getExtent( clazz, true ); Query query = pm.newQuery( extent ); + if ( constraint.getFilter() != null ) + { + query.setFilter( constraint.getFilter() ); + } + + if ( constraint.getVariables() != null ) + { + query.declareVariables( StringUtils.join( constraint.getVariables(), "; " ) ); + } + if ( constraint.getSortColumn() != null ) { String ordering = constraint.getSortColumn(); diff --git a/archiva-database/src/test/java/org/apache/maven/archiva/database/AbstractArchivaDatabaseTestCase.java b/archiva-database/src/test/java/org/apache/maven/archiva/database/AbstractArchivaDatabaseTestCase.java index 935ff5a0c..d433c4424 100644 --- a/archiva-database/src/test/java/org/apache/maven/archiva/database/AbstractArchivaDatabaseTestCase.java +++ b/archiva-database/src/test/java/org/apache/maven/archiva/database/AbstractArchivaDatabaseTestCase.java @@ -19,10 +19,13 @@ package org.apache.maven.archiva.database; * under the License. */ +import org.apache.commons.lang.StringUtils; import org.apache.maven.archiva.consumers.DatabaseCleanupConsumer; import org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer; import org.apache.maven.archiva.database.updater.TestDatabaseCleanupConsumer; import org.apache.maven.archiva.database.updater.TestDatabaseUnprocessedConsumer; +import org.apache.maven.archiva.model.ArtifactReference; +import org.apache.maven.archiva.model.VersionedReference; import org.codehaus.plexus.PlexusTestCase; import org.codehaus.plexus.jdo.DefaultConfigurableJdoFactory; import org.codehaus.plexus.jdo.JdoFactory; @@ -163,4 +166,43 @@ public class AbstractArchivaDatabaseTestCase SimpleDateFormat sdf = new SimpleDateFormat( TIMESTAMP ); return sdf.format( date ); } + + protected VersionedReference toVersionedReference( String id ) + { + String parts[] = StringUtils.splitPreserveAllTokens( id, ':' ); + assertEquals( "Should have 3 parts [" + id + "]", 3, parts.length ); + + VersionedReference ref = new VersionedReference(); + ref.setGroupId( parts[0] ); + ref.setArtifactId( parts[1] ); + ref.setVersion( parts[2] ); + + assertTrue( "Group ID should not be blank [" + id + "]", StringUtils.isNotBlank( ref.getGroupId() ) ); + assertTrue( "Artifact ID should not be blank [" + id + "]", StringUtils.isNotBlank( ref.getArtifactId() ) ); + assertTrue( "Version should not be blank [" + id + "]", StringUtils.isNotBlank( ref.getVersion() ) ); + + return ref; + } + + protected ArtifactReference toArtifactReference( String id ) + { + String parts[] = StringUtils.splitPreserveAllTokens( id, ':' ); + assertEquals( "Should have 5 parts [" + id + "]", 5, parts.length ); + + ArtifactReference ref = new ArtifactReference(); + ref.setGroupId( parts[0] ); + ref.setArtifactId( parts[1] ); + ref.setVersion( parts[2] ); + ref.setClassifier( parts[3] ); + ref.setType( parts[4] ); + + assertTrue( "Group ID should not be blank [" + id + "]", StringUtils.isNotBlank( ref.getGroupId() ) ); + assertTrue( "Artifact ID should not be blank [" + id + "]", StringUtils.isNotBlank( ref.getArtifactId() ) ); + assertTrue( "Version should not be blank [" + id + "]", StringUtils.isNotBlank( ref.getVersion() ) ); + // Blank string is ok for classifier, NULL is not. + assertNotNull( "Classifier should not be null [" + id + "]", ref.getClassifier() ); + assertTrue( "Type should not be blank [" + id + "]", StringUtils.isNotBlank( ref.getType() ) ); + + return ref; + } } diff --git a/archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/ProjectsByArtifactUsageConstraintTest.java b/archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/ProjectsByArtifactUsageConstraintTest.java new file mode 100644 index 000000000..cd6951a0c --- /dev/null +++ b/archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/ProjectsByArtifactUsageConstraintTest.java @@ -0,0 +1,115 @@ +package org.apache.maven.archiva.database.constraints; + +/* + * 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. + */ + +import org.apache.maven.archiva.database.AbstractArchivaDatabaseTestCase; +import org.apache.maven.archiva.database.DeclarativeConstraint; +import org.apache.maven.archiva.model.ArchivaArtifact; +import org.apache.maven.archiva.model.ArchivaProjectModel; +import org.apache.maven.archiva.model.ArtifactReference; +import org.apache.maven.archiva.model.Dependency; +import org.apache.maven.archiva.model.VersionedReference; + +import java.util.Date; +import java.util.List; + +/** + * ProjectsByArtifactUsageConstraintTest + * + * @author Joakim Erdfelt + * @version $Id$ + */ +public class ProjectsByArtifactUsageConstraintTest + extends AbstractArchivaDatabaseTestCase +{ + protected void setUp() + throws Exception + { + super.setUp(); + } + + private void saveModel( String modelId, String deps[] ) + throws Exception + { + ArchivaProjectModel model = new ArchivaProjectModel(); + // Piece together a simple model. + VersionedReference ref = toVersionedReference( modelId ); + model.setGroupId( ref.getGroupId() ); + model.setArtifactId( ref.getArtifactId() ); + model.setVersion( ref.getVersion() ); + model.setPackaging( "jar" ); + model.setOrigin( "testcase" ); + + if ( deps != null ) + { + for ( int i = 0; i < deps.length; i++ ) + { + ArtifactReference artiref = toArtifactReference( deps[i] ); + Dependency dep = new Dependency(); + dep.setGroupId( artiref.getGroupId() ); + dep.setArtifactId( artiref.getArtifactId() ); + dep.setVersion( artiref.getVersion() ); + dep.setClassifier( artiref.getClassifier() ); + dep.setClassifier( artiref.getType() ); + + model.addDependency( dep ); + } + } + + dao.getProjectModelDAO().saveProjectModel( model ); + } + + public ArchivaArtifact toArtifact( String id ) + { + ArtifactReference ref = toArtifactReference( id ); + + ArchivaArtifact artifact = new ArchivaArtifact( ref.getGroupId(), ref.getArtifactId(), ref.getVersion(), ref + .getClassifier(), ref.getType() ); + artifact.getModel().setLastModified( new Date() ); + artifact.getModel().setRepositoryId( "testable_repo" ); + return artifact; + } + + public void testContraint() + throws Exception + { + saveModel( "org.apache.maven.archiva:archiva-configuration:1.0", + new String[] { "org.codehaus.plexus:plexus-digest:1.0::jar" } ); + + saveModel( "org.apache.maven.archiva:archiva-common:1.0", new String[] { + "org.codehaus.plexus:plexus-digest:1.0::jar", + "junit:junit:3.8.1::jar" } ); + + ArchivaArtifact artifact; + + artifact = toArtifact( "org.foo:bar:4.0::jar" ); + assertConstraint( 0, new ProjectsByArtifactUsageConstraint( artifact ) ); + artifact = toArtifact( "org.codehaus.plexus:plexus-digest:1.0::jar" ); + assertConstraint( 2, new ProjectsByArtifactUsageConstraint( artifact ) ); + } + + private void assertConstraint( int expectedHits, DeclarativeConstraint constraint ) + throws Exception + { + List results = dao.getProjectModelDAO().queryProjectModels( constraint ); + assertNotNull( "Projects By Artifact Usage: Not Null", results ); + assertEquals( "Projects By Artifact Usage: Results.size", expectedHits, results.size() ); + } +} diff --git a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java index 342c6b7e2..408335bbd 100644 --- a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java +++ b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java @@ -26,13 +26,10 @@ import org.apache.maven.archiva.database.ArchivaDatabaseException; import org.apache.maven.archiva.database.ObjectNotFoundException; import org.apache.maven.archiva.database.browsing.RepositoryBrowsing; import org.apache.maven.archiva.model.ArchivaProjectModel; -import org.apache.maven.archiva.model.ProjectRepository; import org.codehaus.plexus.xwork.action.PlexusActionSupport; -import java.util.ArrayList; import java.util.Collections; import java.util.List; -import java.util.Iterator; /** * Browse the repository. @@ -144,8 +141,7 @@ public class ShowArtifactAction { this.model = repoBrowsing.selectVersion( groupId, artifactId, version ); - // TODO: create depends on collector. - this.dependees = Collections.EMPTY_LIST; + this.dependees = repoBrowsing.getUsedBy( groupId, artifactId, version ); return SUCCESS; } @@ -158,7 +154,7 @@ public class ShowArtifactAction { this.model = repoBrowsing.selectVersion( groupId, artifactId, version ); - this.dependencyTree = new ArrayList(); + this.dependencyTree = Collections.EMPTY_LIST; return SUCCESS; } @@ -231,6 +227,7 @@ public class ShowArtifactAction return dependencies; } + public List getDependees() { return dependees; diff --git a/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/projectDependees.jspf b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/projectDependees.jspf new file mode 100644 index 000000000..7690d183d --- /dev/null +++ b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/projectDependees.jspf @@ -0,0 +1,39 @@ +<%-- + ~ 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. + --%> + +<%@ taglib prefix="ww" uri="/webwork" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="my" tagdir="/WEB-INF/tags" %> + +<%-- TODO: paginate! --%> + +

+ + +

+ +

+ +

+
+ + No results + diff --git a/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/showArtifact.jsp b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/showArtifact.jsp index 5b3cf3225..ab40ad175 100644 --- a/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/showArtifact.jsp +++ b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/showArtifact.jsp @@ -146,6 +146,9 @@ <%@ include file="/WEB-INF/jsp/include/dependencyTree.jspf" %> + + <%@ include file="/WEB-INF/jsp/include/projectDependees.jspf" %> + <%@ include file="/WEB-INF/jsp/include/mailingLists.jspf" %> diff --git a/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/tags/showArtifactLink.tag b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/tags/showArtifactLink.tag index 53676a6ab..6ebbb6d3b 100644 --- a/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/tags/showArtifactLink.tag +++ b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/tags/showArtifactLink.tag @@ -20,6 +20,7 @@ <%@ taglib prefix="ww" uri="/webwork" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib prefix="archiva" uri="http://maven.apache.org/archiva" %> + <%@ attribute name="groupId" required="true" %> <%@ attribute name="artifactId" %> <%@ attribute name="version" %> @@ -28,7 +29,7 @@ <%@ attribute name="versions" type="java.util.List" %> - + @@ -37,7 +38,7 @@ - / ${artifactId} + ${artifactId} | Version(s):