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
This commit is contained in:
Edwin L. Punzalan 2006-03-03 02:41:52 +00:00
parent 679c02737a
commit 49c31dcdb8
2 changed files with 12 additions and 14 deletions

View File

@ -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 );

View File

@ -50,7 +50,7 @@
<tr>
<td valign="top" width="15%" align="right"><ww:property value="Key"/></td>
<td valign="top">
<ww:iterator value="Value" id="test" status="">
<ww:iterator value="Value">
<ww:property/>
</ww:iterator>
<br/>