From: Edwin L. Punzalan Date: Fri, 3 Mar 2006 02:41:52 +0000 (+0000) Subject: PR: MRM-98 X-Git-Tag: archiva-0.9-alpha-1~897 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=49c31dcdb8537c8f1a1b5dd6e9589a8abaf52caa;p=archiva.git PR: MRM-98 Submitted by: John Tolentino Applied to use the plexus configuration for index and repository path git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@382623 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/PackageSearchAction.java b/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/PackageSearchAction.java index 458272b0a..73175382c 100644 --- a/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/PackageSearchAction.java +++ b/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/PackageSearchAction.java @@ -19,14 +19,14 @@ package org.apache.maven.repository.manager.web.action; import com.opensymphony.xwork.Action; 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.indexing.ArtifactRepositoryIndex; import org.apache.maven.repository.indexing.DefaultRepositoryIndexSearcher; import org.apache.maven.repository.indexing.RepositoryIndexException; import org.apache.maven.repository.indexing.RepositoryIndexSearchException; import org.apache.maven.repository.indexing.RepositoryIndexingFactory; +import org.apache.maven.repository.indexing.RepositoryIndex; import org.apache.maven.repository.indexing.query.SinglePhraseQuery; -import org.codehaus.plexus.scheduler.Scheduler; +import org.apache.maven.repository.manager.web.job.Configuration; import java.io.File; import java.net.MalformedURLException; @@ -45,11 +45,6 @@ public class PackageSearchAction private String md5; - /** - * @plexus.requirement - */ - private Scheduler scheduler; - /** * @plexus.requirement */ @@ -61,9 +56,9 @@ public class PackageSearchAction private ArtifactRepositoryFactory repositoryFactory; /** - * @plexus.requirement role-hint="legacy" + * @plexus.requirement */ - private ArtifactRepositoryLayout layout; + private Configuration configuration; private List artifacts; @@ -75,7 +70,7 @@ public class PackageSearchAction if ( packageName != null && packageName.length() != 0 ) { searchTerm = packageName; - key = "packages"; + key = RepositoryIndex.FLD_PACKAGES; } else if ( md5 != null && md5.length() != 0 ) { @@ -88,11 +83,14 @@ public class PackageSearchAction } // TODO: better config - String indexPath = "C:/0John/java/projects/repository-manager/maven-repository-indexer/target/index"; + String indexPath = configuration.getIndexDirectory(); // TODO: reduce the amount of lookup? - ArtifactRepository repository = repositoryFactory.createArtifactRepository( "repository", new File( - indexPath ).toURL().toString(), layout, null, null ); + File repositoryDirectory = new File( configuration.getRepositoryDirectory() ); + String repoDir = repositoryDirectory.toURL().toString(); + + ArtifactRepository repository = + repositoryFactory.createArtifactRepository( "repository", repoDir, configuration.getLayout(), null, null ); ArtifactRepositoryIndex index = factory.createArtifactRepositoryIndex( indexPath, repository ); diff --git a/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/generalresults.jsp b/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/generalresults.jsp index bd9b1246b..921a5e7c2 100644 --- a/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/generalresults.jsp +++ b/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/generalresults.jsp @@ -50,7 +50,7 @@ - +