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;
private String md5;
- /**
- * @plexus.requirement
- */
- private Scheduler scheduler;
-
/**
* @plexus.requirement
*/
private ArtifactRepositoryFactory repositoryFactory;
/**
- * @plexus.requirement role-hint="legacy"
+ * @plexus.requirement
*/
- private ArtifactRepositoryLayout layout;
+ private Configuration configuration;
private List artifacts;
if ( packageName != null && packageName.length() != 0 )
{
searchTerm = packageName;
- key = "packages";
+ key = RepositoryIndex.FLD_PACKAGES;
}
else if ( md5 != null && md5.length() != 0 )
{
}
// 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 );