You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by br...@apache.org on 2006/06/08 09:15:36 UTC
svn commit: r412683 - in /maven/repository-manager/trunk: ./
maven-repository-application/src/main/java/org/apache/maven/repository/manager/cli/
maven-repository-configuration/ maven-repository-configuration/src/
maven-repository-configuration/src/main...
Author: brett
Date: Thu Jun 8 00:15:34 2006
New Revision: 412683
URL: http://svn.apache.org/viewvc?rev=412683&view=rev
Log:
[MRM-46] introduce modello configuration, change indexer API to use a File for the index path, introduce a core module for moving the main application logic to
Added:
maven/repository-manager/trunk/maven-repository-configuration/
maven/repository-manager/trunk/maven-repository-configuration/pom.xml (with props)
maven/repository-manager/trunk/maven-repository-configuration/src/
maven/repository-manager/trunk/maven-repository-configuration/src/main/
maven/repository-manager/trunk/maven-repository-configuration/src/main/mdo/
maven/repository-manager/trunk/maven-repository-configuration/src/main/mdo/configuration.mdo
maven/repository-manager/trunk/maven-repository-core/
maven/repository-manager/trunk/maven-repository-core/pom.xml (with props)
maven/repository-manager/trunk/maven-repository-core/src/
maven/repository-manager/trunk/maven-repository-core/src/main/
maven/repository-manager/trunk/maven-repository-core/src/main/java/
maven/repository-manager/trunk/maven-repository-core/src/main/java/org/
maven/repository-manager/trunk/maven-repository-core/src/main/java/org/apache/
maven/repository-manager/trunk/maven-repository-core/src/main/java/org/apache/maven/
maven/repository-manager/trunk/maven-repository-core/src/main/java/org/apache/maven/repository/
maven/repository-manager/trunk/maven-repository-core/src/test/
maven/repository-manager/trunk/maven-repository-core/src/test/java/
maven/repository-manager/trunk/maven-repository-core/src/test/java/org/
maven/repository-manager/trunk/maven-repository-core/src/test/java/org/apache/
maven/repository-manager/trunk/maven-repository-core/src/test/java/org/apache/maven/
maven/repository-manager/trunk/maven-repository-core/src/test/java/org/apache/maven/repository/
Removed:
maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/Configuration.java
Modified:
maven/repository-manager/trunk/maven-repository-application/src/main/java/org/apache/maven/repository/manager/cli/IndexCli.java
maven/repository-manager/trunk/maven-repository-application/src/main/java/org/apache/maven/repository/manager/cli/IndexSearcherCli.java
maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/AbstractRepositoryIndex.java
maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndex.java
maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/DefaultRepositoryIndexSearcher.java
maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/DefaultRepositoryIndexingFactory.java
maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/EclipseRepositoryIndex.java
maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/MetadataRepositoryIndex.java
maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/PomRepositoryIndex.java
maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndex.java
maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndexingFactory.java
maven/repository-manager/trunk/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndexingTest.java
maven/repository-manager/trunk/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/EclipseRepositoryIndexTest.java
maven/repository-manager/trunk/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/MetadataRepositoryIndexingTest.java
maven/repository-manager/trunk/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/PomRepositoryIndexingTest.java
maven/repository-manager/trunk/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/RepositoryIndexSearchLayerTest.java
maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/DuplicateArtifactFileReportProcessor.java
maven/repository-manager/trunk/maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/DuplicateArtifactFileReportProcessorTest.java
maven/repository-manager/trunk/maven-repository-webapp/pom.xml
maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/BaseAction.java
maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/GeneralSearchAction.java
maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/PackageSearchAction.java
maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/execution/DiscovererExecution.java
maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/DiscovererScheduler.java
maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/WEB-INF/plexus.xml
maven/repository-manager/trunk/pom.xml
Modified: maven/repository-manager/trunk/maven-repository-application/src/main/java/org/apache/maven/repository/manager/cli/IndexCli.java
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-application/src/main/java/org/apache/maven/repository/manager/cli/IndexCli.java?rev=412683&r1=412682&r2=412683&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-application/src/main/java/org/apache/maven/repository/manager/cli/IndexCli.java (original)
+++ maven/repository-manager/trunk/maven-repository-application/src/main/java/org/apache/maven/repository/manager/cli/IndexCli.java Thu Jun 8 00:15:34 2006
@@ -69,7 +69,7 @@
List artifacts = discoverer.discoverArtifacts( repository, null, false );
ArtifactRepositoryIndex index =
- indexFactory.createArtifactRepositoryIndex( new File( args[0], ".index" ).getAbsolutePath(), repository );
+ indexFactory.createArtifactRepositoryIndex( new File( args[0], ".index" ), repository );
long time = System.currentTimeMillis();
try
Modified: maven/repository-manager/trunk/maven-repository-application/src/main/java/org/apache/maven/repository/manager/cli/IndexSearcherCli.java
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-application/src/main/java/org/apache/maven/repository/manager/cli/IndexSearcherCli.java?rev=412683&r1=412682&r2=412683&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-application/src/main/java/org/apache/maven/repository/manager/cli/IndexSearcherCli.java (original)
+++ maven/repository-manager/trunk/maven-repository-application/src/main/java/org/apache/maven/repository/manager/cli/IndexSearcherCli.java Thu Jun 8 00:15:34 2006
@@ -65,7 +65,7 @@
layout, null, null );
ArtifactRepositoryIndex index =
- indexFactory.createArtifactRepositoryIndex( new File( args[0], ".index" ).getAbsolutePath(), repository );
+ indexFactory.createArtifactRepositoryIndex( new File( args[0], ".index" ), repository );
RepositoryIndexSearcher searcher = (RepositoryIndexSearcher) embedder.lookup( RepositoryIndexSearcher.ROLE );
Added: maven/repository-manager/trunk/maven-repository-configuration/pom.xml
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-configuration/pom.xml?rev=412683&view=auto
==============================================================================
--- maven/repository-manager/trunk/maven-repository-configuration/pom.xml (added)
+++ maven/repository-manager/trunk/maven-repository-configuration/pom.xml Thu Jun 8 00:15:34 2006
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+<project>
+ <parent>
+ <artifactId>maven-repository-manager</artifactId>
+ <groupId>org.apache.maven.repository</groupId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.repository</groupId>
+ <artifactId>maven-repository-configuration</artifactId>
+ <name>Maven Repository Manager Configuration</name>
+ <dependencies>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-utils</artifactId>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.modello</groupId>
+ <artifactId>modello-maven-plugin</artifactId>
+ <version>1.0-alpha-8</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>xpp3-writer</goal>
+ <goal>java</goal>
+ <goal>xpp3-reader</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <version>1.0.0</version>
+ <model>src/main/mdo/configuration.mdo</model>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Propchange: maven/repository-manager/trunk/maven-repository-configuration/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/repository-manager/trunk/maven-repository-configuration/pom.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/repository-manager/trunk/maven-repository-configuration/src/main/mdo/configuration.mdo
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-configuration/src/main/mdo/configuration.mdo?rev=412683&view=auto
==============================================================================
--- maven/repository-manager/trunk/maven-repository-configuration/src/main/mdo/configuration.mdo (added)
+++ maven/repository-manager/trunk/maven-repository-configuration/src/main/mdo/configuration.mdo Thu Jun 8 00:15:34 2006
@@ -0,0 +1,82 @@
+<model>
+ <id>configuration</id>
+ <name>Configuration</name>
+ <description>
+ Configuration for the Maven Repository Manager.
+ </description>
+ <defaults>
+ <default>
+ <key>package</key>
+ <value>org.apache.maven.repository.configuration</value>
+ </default>
+ </defaults>
+ <!-- TODO! break out subtypes such as <discovery> and create a list of blacklist -->
+ <classes>
+ <class rootElement="true" xml.tagName="configuration">
+ <name>Configuration</name>
+ <version>1.0.0</version>
+ <fields>
+ <field>
+ <name>repositoryDirectory</name>
+ <version>1.0.0</version>
+ <type>String</type>
+ <required>true</required>
+ <description>
+ The location of the repository to monitor.
+ </description>
+ </field>
+ <field>
+ <name>repositoryLayout</name>
+ <version>1.0.0</version>
+ <type>String</type>
+ <required>true</required>
+ <description>
+ The layout of the repository. Valid values are "default" and "legacy".
+ </description>
+ <!-- TODO: should be able to detect this from the repository (perhaps by metadata at the root) -->
+ <defaultValue>default</defaultValue>
+ </field>
+ <field>
+ <name>indexPath</name>
+ <version>1.0.0</version>
+ <type>String</type>
+ <description>
+ The location of the Lucene index to use for the repository. The default is the .index subdirectory of
+ the repository.
+ </description>
+ </field>
+ <field>
+ <name>minimalIndexPath</name>
+ <version>1.0.0</version>
+ <type>String</type>
+ <description>
+ The location of the reduced Lucene index to use for the repository. The default is the .small-index
+ subdirectory of the repository.
+ </description>
+ </field>
+ <field>
+ <name>discoveryCronExpression</name>
+ <version>1.0.0</version>
+ <type>String</type>
+ <description>When to run the discovery mechanism.</description>
+ <defaultValue>0 0 8 * * ?</defaultValue>
+ </field>
+ <field>
+ <name>discoverSnapshots</name>
+ <version>1.0.0</version>
+ <type>boolean</type>
+ <description>Whether to include snapshot versions in the discovery process</description>
+ <defaultValue>false</defaultValue>
+ </field>
+ <field>
+ <name>discoveryBlackListPatterns</name>
+ <version>1.0.0</version>
+ <type>String</type>
+ <description>Blacklisted patterns in the discovery process</description>
+ </field>
+ </fields>
+ </class>
+ </classes>
+</model>
+
+
Added: maven/repository-manager/trunk/maven-repository-core/pom.xml
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-core/pom.xml?rev=412683&view=auto
==============================================================================
--- maven/repository-manager/trunk/maven-repository-core/pom.xml (added)
+++ maven/repository-manager/trunk/maven-repository-core/pom.xml Thu Jun 8 00:15:34 2006
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<project>
+ <parent>
+ <artifactId>maven-repository-manager</artifactId>
+ <groupId>org.apache.maven.repository</groupId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.repository</groupId>
+ <artifactId>maven-repository-core</artifactId>
+ <name>Maven Repository Manager Core</name>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
Propchange: maven/repository-manager/trunk/maven-repository-core/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/repository-manager/trunk/maven-repository-core/pom.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Modified: maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/AbstractRepositoryIndex.java
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/AbstractRepositoryIndex.java?rev=412683&r1=412682&r2=412683&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/AbstractRepositoryIndex.java (original)
+++ maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/AbstractRepositoryIndex.java Thu Jun 8 00:15:34 2006
@@ -41,7 +41,7 @@
implements RepositoryIndex
{
// TODO: can this be derived from the repository? -- probably a sensible default, but still should be configurable, but this could just be on the call to open()
- private String indexPath;
+ private File indexPath;
private boolean indexOpen;
@@ -58,7 +58,7 @@
* @param indexPath
* @param repository
*/
- protected AbstractRepositoryIndex( String indexPath, ArtifactRepository repository )
+ protected AbstractRepositoryIndex( File indexPath, ArtifactRepository repository )
{
this.repository = repository;
this.indexPath = indexPath;
@@ -144,7 +144,7 @@
/**
* @see org.apache.maven.repository.indexing.RepositoryIndex#getIndexPath()
*/
- public String getIndexPath()
+ public File getIndexPath()
{
return indexPath;
}
@@ -244,19 +244,17 @@
protected boolean indexExists()
throws RepositoryIndexException
{
- File indexDir = new File( indexPath );
-
- if ( IndexReader.indexExists( indexDir ) )
+ if ( IndexReader.indexExists( indexPath ) )
{
return true;
}
- else if ( !indexDir.exists() )
+ else if ( !indexPath.exists() )
{
return false;
}
- else if ( indexDir.isDirectory() )
+ else if ( indexPath.isDirectory() )
{
- if ( indexDir.listFiles().length > 1 )
+ if ( indexPath.listFiles().length > 1 )
{
throw new RepositoryIndexException( indexPath + " is not a valid index directory." );
}
Modified: maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndex.java
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndex.java?rev=412683&r1=412682&r2=412683&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndex.java (original)
+++ maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndex.java Thu Jun 8 00:15:34 2006
@@ -22,6 +22,7 @@
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.repository.digest.Digester;
+import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.security.NoSuchAlgorithmException;
@@ -48,7 +49,7 @@
* @param repository the repository where the indexed artifacts are located
* @param digester the digester object to generate the checksum strings
*/
- public ArtifactRepositoryIndex( String indexPath, ArtifactRepository repository, Digester digester )
+ public ArtifactRepositoryIndex( File indexPath, ArtifactRepository repository, Digester digester )
{
super( indexPath, repository );
this.digester = digester;
Modified: maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/DefaultRepositoryIndexSearcher.java
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/DefaultRepositoryIndexSearcher.java?rev=412683&r1=412682&r2=412683&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/DefaultRepositoryIndexSearcher.java (original)
+++ maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/DefaultRepositoryIndexSearcher.java Thu Jun 8 00:15:34 2006
@@ -78,7 +78,7 @@
IndexSearcher searcher;
try
{
- searcher = new IndexSearcher( index.getIndexPath() );
+ searcher = new IndexSearcher( index.getIndexPath().getAbsolutePath() );
}
catch ( IOException e )
{
Modified: maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/DefaultRepositoryIndexingFactory.java
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/DefaultRepositoryIndexingFactory.java?rev=412683&r1=412682&r2=412683&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/DefaultRepositoryIndexingFactory.java (original)
+++ maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/DefaultRepositoryIndexingFactory.java Thu Jun 8 00:15:34 2006
@@ -20,6 +20,8 @@
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.repository.digest.Digester;
+import java.io.File;
+
/**
* @author Edwin Punzalan
* @plexus.component role="org.apache.maven.repository.indexing.RepositoryIndexingFactory"
@@ -37,28 +39,19 @@
*/
private ArtifactFactory artifactFactory;
- /**
- * @see RepositoryIndexingFactory#createArtifactRepositoryIndex(String, org.apache.maven.artifact.repository.ArtifactRepository)
- */
- public ArtifactRepositoryIndex createArtifactRepositoryIndex( String indexPath, ArtifactRepository repository )
+ public ArtifactRepositoryIndex createArtifactRepositoryIndex( File indexPath, ArtifactRepository repository )
throws RepositoryIndexException
{
return new ArtifactRepositoryIndex( indexPath, repository, digester );
}
- /**
- * @see RepositoryIndexingFactory#createPomRepositoryIndex(String, org.apache.maven.artifact.repository.ArtifactRepository)
- */
- public PomRepositoryIndex createPomRepositoryIndex( String indexPath, ArtifactRepository repository )
+ public PomRepositoryIndex createPomRepositoryIndex( File indexPath, ArtifactRepository repository )
throws RepositoryIndexException
{
return new PomRepositoryIndex( indexPath, repository, digester, artifactFactory );
}
- /**
- * @see RepositoryIndexingFactory#createMetadataRepositoryIndex(String, org.apache.maven.artifact.repository.ArtifactRepository)
- */
- public MetadataRepositoryIndex createMetadataRepositoryIndex( String indexPath, ArtifactRepository repository )
+ public MetadataRepositoryIndex createMetadataRepositoryIndex( File indexPath, ArtifactRepository repository )
throws RepositoryIndexException
{
return new MetadataRepositoryIndex( indexPath, repository );
Modified: maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/EclipseRepositoryIndex.java
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/EclipseRepositoryIndex.java?rev=412683&r1=412682&r2=412683&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/EclipseRepositoryIndex.java (original)
+++ maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/EclipseRepositoryIndex.java Thu Jun 8 00:15:34 2006
@@ -68,7 +68,7 @@
* @param repository the repository where the indexed artifacts are located
* @param digester the digester object to generate the checksum strings
*/
- public EclipseRepositoryIndex( String indexPath, ArtifactRepository repository, Digester digester )
+ public EclipseRepositoryIndex( File indexPath, ArtifactRepository repository, Digester digester )
{
super( indexPath, repository );
@@ -169,7 +169,7 @@
public File getCompressedCopy()
throws IOException
{
- File indexPath = new File( getIndexPath() );
+ File indexPath = getIndexPath();
String name = indexPath.getName();
File outputFile = new File( indexPath.getParent(), name + ".zip" );
Modified: maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/MetadataRepositoryIndex.java
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/MetadataRepositoryIndex.java?rev=412683&r1=412682&r2=412683&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/MetadataRepositoryIndex.java (original)
+++ maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/MetadataRepositoryIndex.java Thu Jun 8 00:15:34 2006
@@ -24,6 +24,7 @@
import org.apache.maven.artifact.repository.metadata.RepositoryMetadata;
import org.apache.maven.artifact.repository.metadata.Versioning;
+import java.io.File;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
@@ -40,7 +41,7 @@
* @param indexPath the path to the index
* @param repository the repository where the metadata to be indexed is located
*/
- public MetadataRepositoryIndex( String indexPath, ArtifactRepository repository )
+ public MetadataRepositoryIndex( File indexPath, ArtifactRepository repository )
{
super( indexPath, repository );
}
Modified: maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/PomRepositoryIndex.java
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/PomRepositoryIndex.java?rev=412683&r1=412682&r2=412683&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/PomRepositoryIndex.java (original)
+++ maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/PomRepositoryIndex.java Thu Jun 8 00:15:34 2006
@@ -56,7 +56,7 @@
* @param digester the digester to be used for generating checksums
* @param artifactFactory the factory for building artifact objects
*/
- public PomRepositoryIndex( String indexPath, ArtifactRepository repository, Digester digester,
+ public PomRepositoryIndex( File indexPath, ArtifactRepository repository, Digester digester,
ArtifactFactory artifactFactory )
{
super( indexPath, repository );
Modified: maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndex.java
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndex.java?rev=412683&r1=412682&r2=412683&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndex.java (original)
+++ maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndex.java Thu Jun 8 00:15:34 2006
@@ -19,6 +19,7 @@
import org.apache.lucene.analysis.Analyzer;
import org.apache.maven.artifact.repository.ArtifactRepository;
+import java.io.File;
import java.util.Arrays;
import java.util.List;
@@ -113,7 +114,7 @@
*
* @return the path where the index resides
*/
- String getIndexPath();
+ File getIndexPath();
/**
* Tests an index field if it is a keyword field
Modified: maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndexingFactory.java
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndexingFactory.java?rev=412683&r1=412682&r2=412683&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndexingFactory.java (original)
+++ maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndexingFactory.java Thu Jun 8 00:15:34 2006
@@ -18,6 +18,8 @@
import org.apache.maven.artifact.repository.ArtifactRepository;
+import java.io.File;
+
/**
* @author Edwin Punzalan
@@ -34,7 +36,7 @@
* @return the ArtifactRepositoryIndex instance
* @throws RepositoryIndexException
*/
- ArtifactRepositoryIndex createArtifactRepositoryIndex( String indexPath, ArtifactRepository repository )
+ ArtifactRepositoryIndex createArtifactRepositoryIndex( File indexPath, ArtifactRepository repository )
throws RepositoryIndexException;
/**
@@ -45,7 +47,7 @@
* @return the PomRepositoryIndex instance
* @throws RepositoryIndexException
*/
- PomRepositoryIndex createPomRepositoryIndex( String indexPath, ArtifactRepository repository )
+ PomRepositoryIndex createPomRepositoryIndex( File indexPath, ArtifactRepository repository )
throws RepositoryIndexException;
/**
@@ -56,7 +58,7 @@
* @return the MetadataRepositoryIndex instance
* @throws RepositoryIndexException
*/
- MetadataRepositoryIndex createMetadataRepositoryIndex( String indexPath, ArtifactRepository repository )
+ MetadataRepositoryIndex createMetadataRepositoryIndex( File indexPath, ArtifactRepository repository )
throws RepositoryIndexException;
}
Modified: maven/repository-manager/trunk/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndexingTest.java
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndexingTest.java?rev=412683&r1=412682&r2=412683&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndexingTest.java (original)
+++ maven/repository-manager/trunk/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndexingTest.java Thu Jun 8 00:15:34 2006
@@ -43,7 +43,7 @@
private ArtifactRepository repository;
- private String indexPath;
+ private File indexPath;
private Digester digester;
@@ -59,7 +59,7 @@
repository = repoFactory.createArtifactRepository( "test", repoDir, layout, null, null );
digester = new DefaultDigester();
- indexPath = "target/index";
+ indexPath = getTestFile( "target/index" );
FileUtils.deleteDirectory( indexPath );
}
@@ -77,7 +77,7 @@
try
{
- String notIndexDir = new File( "pom.xml" ).getAbsolutePath();
+ File notIndexDir = new File( "pom.xml" );
ArtifactRepositoryIndex indexer = factory.createArtifactRepositoryIndex( notIndexDir, repository );
indexer.indexArtifact( artifact );
fail( "Must throw exception on non-directory index directory" );
@@ -89,7 +89,7 @@
try
{
- String notIndexDir = new File( "" ).getAbsolutePath();
+ File notIndexDir = new File( "" );
ArtifactRepositoryIndex indexer = factory.createArtifactRepositoryIndex( notIndexDir, repository );
indexer.indexArtifact( artifact );
fail( "Must throw an exception on a non-index directory" );
@@ -433,7 +433,7 @@
assertTrue( true );
}
- indexer = factory.createArtifactRepositoryIndex( "target/index/sample", repository );
+ indexer = factory.createArtifactRepositoryIndex( getTestFile( "target/index/sample" ), repository );
try
{
Modified: maven/repository-manager/trunk/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/EclipseRepositoryIndexTest.java
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/EclipseRepositoryIndexTest.java?rev=412683&r1=412682&r2=412683&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/EclipseRepositoryIndexTest.java (original)
+++ maven/repository-manager/trunk/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/EclipseRepositoryIndexTest.java Thu Jun 8 00:15:34 2006
@@ -43,7 +43,7 @@
private ArtifactRepository repository;
- private String indexPath;
+ private File indexPath;
private Digester digester;
@@ -63,7 +63,7 @@
repository = repoFactory.createArtifactRepository( "test", repoDir, layout, null, null );
digester = new DefaultDigester();
- indexPath = "target/index";
+ indexPath = getTestFile( "target/index" );
FileUtils.deleteDirectory( indexPath );
}
@@ -125,7 +125,7 @@
try
{
- String notIndexDir = new File( "pom.xml" ).getAbsolutePath();
+ File notIndexDir = new File( "pom.xml" );
EclipseRepositoryIndex indexer = new EclipseRepositoryIndex( notIndexDir, repository, digester );
indexer.indexArtifact( artifact );
fail( "Must throw exception on non-directory index directory" );
@@ -137,7 +137,7 @@
try
{
- String notIndexDir = new File( "" ).getAbsolutePath();
+ File notIndexDir = new File( "" );
EclipseRepositoryIndex indexer = new EclipseRepositoryIndex( notIndexDir, repository, digester );
indexer.indexArtifact( artifact );
fail( "Must throw an exception on a non-index directory" );
@@ -169,7 +169,7 @@
{
EclipseRepositoryIndex index = createTestIndex();
- IndexSearcher searcher = new IndexSearcher( index.getIndexPath() );
+ IndexSearcher searcher = new IndexSearcher( index.getIndexPath().getAbsolutePath() );
try
{
QueryParser parser = new QueryParser( "j", index.getAnalyzer() );
Modified: maven/repository-manager/trunk/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/MetadataRepositoryIndexingTest.java
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/MetadataRepositoryIndexingTest.java?rev=412683&r1=412682&r2=412683&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/MetadataRepositoryIndexingTest.java (original)
+++ maven/repository-manager/trunk/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/MetadataRepositoryIndexingTest.java Thu Jun 8 00:15:34 2006
@@ -52,7 +52,7 @@
{
private ArtifactRepository repository;
- private String indexPath;
+ private File indexPath;
private ArtifactFactory artifactFactory;
@@ -71,7 +71,7 @@
ArtifactRepositoryFactory repoFactory = (ArtifactRepositoryFactory) lookup( ArtifactRepositoryFactory.ROLE );
repository = repoFactory.createArtifactRepository( "test", repoDir, layout, null, null );
- indexPath = "target/index";
+ indexPath = getTestFile( "target/index" );
FileUtils.deleteDirectory( indexPath );
}
Modified: maven/repository-manager/trunk/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/PomRepositoryIndexingTest.java
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/PomRepositoryIndexingTest.java?rev=412683&r1=412682&r2=412683&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/PomRepositoryIndexingTest.java (original)
+++ maven/repository-manager/trunk/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/PomRepositoryIndexingTest.java Thu Jun 8 00:15:34 2006
@@ -48,7 +48,7 @@
private ArtifactFactory artifactFactory;
- private String indexPath;
+ private File indexPath;
private Digester digester;
@@ -64,7 +64,7 @@
repository = repoFactory.createArtifactRepository( "test", repoDir, layout, null, null );
digester = new DefaultDigester();
- indexPath = "target/index";
+ indexPath = getTestFile( "target/index" );
FileUtils.deleteDirectory( indexPath );
}
@@ -77,7 +77,7 @@
try
{
- String notIndexDir = new File( "pom.xml" ).getAbsolutePath();
+ File notIndexDir = new File( "pom.xml" );
PomRepositoryIndex indexer = factory.createPomRepositoryIndex( notIndexDir, repository );
indexer.indexPom( pom );
fail( "Must throw exception on non-directory index directory" );
@@ -89,7 +89,7 @@
try
{
- String notIndexDir = new File( "" ).getAbsolutePath();
+ File notIndexDir = new File( "" );
PomRepositoryIndex indexer = factory.createPomRepositoryIndex( notIndexDir, repository );
indexer.indexPom( pom );
fail( "Must throw an exception on a non-index directory" );
Modified: maven/repository-manager/trunk/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/RepositoryIndexSearchLayerTest.java
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/RepositoryIndexSearchLayerTest.java?rev=412683&r1=412682&r2=412683&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/RepositoryIndexSearchLayerTest.java (original)
+++ maven/repository-manager/trunk/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/RepositoryIndexSearchLayerTest.java Thu Jun 8 00:15:34 2006
@@ -54,7 +54,7 @@
private ArtifactFactory artifactFactory;
- private String indexPath;
+ private File indexPath;
/**
* Setup method
@@ -71,7 +71,7 @@
ArtifactRepositoryFactory repoFactory = (ArtifactRepositoryFactory) lookup( ArtifactRepositoryFactory.ROLE );
repository = repoFactory.createArtifactRepository( "test", repoDir, layout, null, null );
- indexPath = "target/index";
+ indexPath = getTestFile( "target/index" );
FileUtils.deleteDirectory( indexPath );
}
Modified: maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/DuplicateArtifactFileReportProcessor.java
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/DuplicateArtifactFileReportProcessor.java?rev=412683&r1=412682&r2=412683&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/DuplicateArtifactFileReportProcessor.java (original)
+++ maven/repository-manager/trunk/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/DuplicateArtifactFileReportProcessor.java Thu Jun 8 00:15:34 2006
@@ -68,8 +68,8 @@
{
if ( artifact.getFile() != null )
{
- //@todo remove hard-coded value; current value enables tests to pass
- String indexPath = new File( "target/.index" ).getAbsolutePath();
+ //@todo remove hard-coded value; current value enables tests to pass!
+ File indexPath = new File( "target/.index" );
RepositoryIndex index;
try
Modified: maven/repository-manager/trunk/maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/DuplicateArtifactFileReportProcessorTest.java
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/DuplicateArtifactFileReportProcessorTest.java?rev=412683&r1=412682&r2=412683&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/DuplicateArtifactFileReportProcessorTest.java (original)
+++ maven/repository-manager/trunk/maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/DuplicateArtifactFileReportProcessorTest.java Thu Jun 8 00:15:34 2006
@@ -41,7 +41,7 @@
private ArtifactFactory artifactFactory;
- private String indexPath = new File( "target/.index" ).getAbsolutePath();
+ private File indexPath = getTestFile( "target/.index" );
protected void setUp()
throws Exception
Modified: maven/repository-manager/trunk/maven-repository-webapp/pom.xml
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-webapp/pom.xml?rev=412683&r1=412682&r2=412683&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-webapp/pom.xml (original)
+++ maven/repository-manager/trunk/maven-repository-webapp/pom.xml Thu Jun 8 00:15:34 2006
@@ -52,6 +52,10 @@
</dependency>
<dependency>
<groupId>org.apache.maven.repository</groupId>
+ <artifactId>maven-repository-configuration</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.repository</groupId>
<artifactId>maven-repository-artifact-applet</artifactId>
<!-- TODO: actually, just exclude from WAR plugin -->
<scope>provided</scope>
Modified: maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/BaseAction.java
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/BaseAction.java?rev=412683&r1=412682&r2=412683&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/BaseAction.java (original)
+++ maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/BaseAction.java Thu Jun 8 00:15:34 2006
@@ -17,9 +17,12 @@
*/
import com.opensymphony.xwork.Action;
+import org.apache.maven.repository.configuration.Configuration;
import org.apache.maven.repository.manager.web.execution.DiscovererExecution;
import org.apache.maven.repository.manager.web.job.DiscovererScheduler;
+import java.io.File;
+
/**
* This is the Action class of index.jsp, which is the initial page of the web application.
* It invokes the DiscovererScheduler to set the DiscoverJob in the scheduler.
@@ -48,8 +51,9 @@
{
try
{
- execution.executeDiscovererIfIndexDoesNotExist();
- discovererScheduler.setSchedule();
+ Configuration configuration = new Configuration(); // TODO!
+ execution.executeDiscovererIfIndexDoesNotExist( new File( configuration.getIndexPath() ) );
+ discovererScheduler.setSchedule( configuration.getDiscoveryCronExpression() );
}
catch ( Exception e )
{
Modified: maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/GeneralSearchAction.java
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/GeneralSearchAction.java?rev=412683&r1=412682&r2=412683&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/GeneralSearchAction.java (original)
+++ maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/GeneralSearchAction.java Thu Jun 8 00:15:34 2006
@@ -19,16 +19,18 @@
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.configuration.Configuration;
import org.apache.maven.repository.indexing.ArtifactRepositoryIndex;
import org.apache.maven.repository.indexing.RepositoryIndexException;
import org.apache.maven.repository.indexing.RepositoryIndexSearchException;
import org.apache.maven.repository.indexing.RepositoryIndexSearchLayer;
import org.apache.maven.repository.indexing.RepositoryIndexingFactory;
-import org.apache.maven.repository.manager.web.job.Configuration;
import java.io.File;
import java.net.MalformedURLException;
import java.util.List;
+import java.util.Map;
/**
* Searches for searchString in all indexed fields.
@@ -58,24 +60,26 @@
private ArtifactRepositoryFactory repositoryFactory;
/**
- * @plexus.requirement
+ * @plexus.requirement role="org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout"
*/
- private Configuration configuration;
+ private Map repositoryLayouts;
public String execute()
throws MalformedURLException, RepositoryIndexException, RepositoryIndexSearchException
{
if ( searchString != null && searchString.length() != 0 )
{
- String indexPath = configuration.getIndexDirectory();
-
- // TODO: reduce the amount of lookup?
+ Configuration configuration = new Configuration(); // TODO!
+ File indexPath = new File( configuration.getIndexPath() );
+ // TODO: [!] repository should only have been instantiated once
File repositoryDirectory = new File( configuration.getRepositoryDirectory() );
String repoDir = repositoryDirectory.toURL().toString();
+ ArtifactRepositoryLayout layout =
+ (ArtifactRepositoryLayout) repositoryLayouts.get( configuration.getRepositoryLayout() );
ArtifactRepository repository =
- repositoryFactory.createArtifactRepository( "test", repoDir, configuration.getLayout(), null, null );
+ repositoryFactory.createArtifactRepository( "test", repoDir, layout, null, null );
ArtifactRepositoryIndex index = factory.createArtifactRepositoryIndex( indexPath, repository );
Modified: maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/PackageSearchAction.java
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/PackageSearchAction.java?rev=412683&r1=412682&r2=412683&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/PackageSearchAction.java (original)
+++ maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/PackageSearchAction.java Thu Jun 8 00:15:34 2006
@@ -19,6 +19,8 @@
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.configuration.Configuration;
import org.apache.maven.repository.indexing.ArtifactRepositoryIndex;
import org.apache.maven.repository.indexing.RepositoryIndex;
import org.apache.maven.repository.indexing.RepositoryIndexException;
@@ -26,11 +28,11 @@
import org.apache.maven.repository.indexing.RepositoryIndexSearchLayer;
import org.apache.maven.repository.indexing.RepositoryIndexingFactory;
import org.apache.maven.repository.indexing.query.SinglePhraseQuery;
-import org.apache.maven.repository.manager.web.job.Configuration;
import java.io.File;
import java.net.MalformedURLException;
import java.util.List;
+import java.util.Map;
/**
* Search by package name.
@@ -53,19 +55,19 @@
private RepositoryIndexingFactory factory;
/**
- * @plexus.requirement
+ * @plexus.requirement role="org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout"
*/
- private ArtifactRepositoryFactory repositoryFactory;
+ private Map repositoryLayouts;
/**
* @plexus.requirement
*/
- private RepositoryIndexSearchLayer searchLayer;
+ private ArtifactRepositoryFactory repositoryFactory;
/**
* @plexus.requirement
*/
- private Configuration configuration;
+ private RepositoryIndexSearchLayer searchLayer;
public String execute()
throws MalformedURLException, RepositoryIndexException, RepositoryIndexSearchException
@@ -87,15 +89,17 @@
return ERROR;
}
- // TODO: better config [!]
- String indexPath = configuration.getIndexDirectory();
+ // TODO: better config - share with general [!]
+ Configuration configuration = new Configuration();
+ File indexPath = new File( configuration.getIndexPath() );
- // TODO: reduce the amount of lookup?
File repositoryDirectory = new File( configuration.getRepositoryDirectory() );
String repoDir = repositoryDirectory.toURL().toString();
+ ArtifactRepositoryLayout layout =
+ (ArtifactRepositoryLayout) repositoryLayouts.get( configuration.getRepositoryLayout() );
ArtifactRepository repository =
- repositoryFactory.createArtifactRepository( "repository", repoDir, configuration.getLayout(), null, null );
+ repositoryFactory.createArtifactRepository( "repository", repoDir, layout, null, null );
ArtifactRepositoryIndex index = factory.createArtifactRepositoryIndex( indexPath, repository );
Modified: maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/execution/DiscovererExecution.java
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/execution/DiscovererExecution.java?rev=412683&r1=412682&r2=412683&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/execution/DiscovererExecution.java (original)
+++ maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/execution/DiscovererExecution.java Thu Jun 8 00:15:34 2006
@@ -24,6 +24,7 @@
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
import org.apache.maven.artifact.repository.metadata.RepositoryMetadata;
import org.apache.maven.model.Model;
+import org.apache.maven.repository.configuration.Configuration;
import org.apache.maven.repository.discovery.ArtifactDiscoverer;
import org.apache.maven.repository.discovery.MetadataDiscoverer;
import org.apache.maven.repository.indexing.ArtifactRepositoryIndex;
@@ -31,7 +32,6 @@
import org.apache.maven.repository.indexing.PomRepositoryIndex;
import org.apache.maven.repository.indexing.RepositoryIndexException;
import org.apache.maven.repository.indexing.RepositoryIndexingFactory;
-import org.apache.maven.repository.manager.web.job.Configuration;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import java.io.File;
@@ -39,7 +39,6 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.Properties;
/**
* This is the class that executes the discoverer and indexer.
@@ -50,10 +49,6 @@
public class DiscovererExecution
extends AbstractLogEnabled
{
- /**
- * @plexus.requirement
- */
- private Configuration config;
/**
* @plexus.requirement role="org.apache.maven.repository.discovery.ArtifactDiscoverer"
@@ -76,18 +71,20 @@
private ArtifactRepositoryFactory repoFactory;
/**
+ * @plexus.requirement role="org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout"
+ */
+ private Map repositoryLayouts;
+
+ /**
* Executes discoverer and indexer if an index does not exist yet
*
+ * @param indexDir
* @throws MalformedURLException
* @throws RepositoryIndexException
*/
- public void executeDiscovererIfIndexDoesNotExist()
+ public void executeDiscovererIfIndexDoesNotExist( File indexDir )
throws MalformedURLException, RepositoryIndexException
{
- Properties props = config.getProperties();
- String indexPath = props.getProperty( "index.path" );
-
- File indexDir = new File( indexPath );
boolean isExisting = false;
if ( IndexReader.indexExists( indexDir ) )
@@ -107,27 +104,26 @@
public void executeDiscoverer()
throws MalformedURLException, RepositoryIndexException
{
- Properties props = config.getProperties();
- String indexPath = props.getProperty( "index.path" );
- String blacklistedPatterns = props.getProperty( "blacklist.patterns" );
- boolean includeSnapshots = Boolean.valueOf( props.getProperty( "include.snapshots" ) ).booleanValue();
- boolean convertSnapshots = Boolean.valueOf( props.getProperty( "convert.snapshots" ) ).booleanValue();
+ Configuration configuration = new Configuration(); // TODO!
+ File indexPath = new File( configuration.getIndexPath() );
+ String blacklistedPatterns = configuration.getDiscoveryBlackListPatterns();
+ boolean includeSnapshots = configuration.isDiscoverSnapshots();
- ArtifactRepository defaultRepository = getDefaultRepository();
+ ArtifactRepository defaultRepository = getDefaultRepository( configuration );
getLogger().info( "[DiscovererExecution] Started discovery and indexing.." );
- String layoutProperty = props.getProperty( "layout" );
+ String layoutProperty = configuration.getRepositoryLayout();
ArtifactDiscoverer discoverer = (ArtifactDiscoverer) artifactDiscoverers.get( layoutProperty );
List artifacts = discoverer.discoverArtifacts( defaultRepository, blacklistedPatterns, includeSnapshots );
indexArtifact( artifacts, indexPath, defaultRepository );
- List models = discoverer.discoverStandalonePoms( defaultRepository, blacklistedPatterns, convertSnapshots );
+ List models = discoverer.discoverStandalonePoms( defaultRepository, blacklistedPatterns, includeSnapshots );
indexPom( models, indexPath, defaultRepository );
MetadataDiscoverer metadataDiscoverer = (MetadataDiscoverer) metadataDiscoverers.get( layoutProperty );
List metadataList =
metadataDiscoverer.discoverMetadata( new File( defaultRepository.getBasedir() ), blacklistedPatterns );
- indexMetadata( metadataList, indexPath, new File( defaultRepository.getBasedir() ), config.getLayout() );
+ indexMetadata( metadataList, indexPath, defaultRepository );
getLogger().info( "[DiscovererExecution] Finished discovery and indexing." );
}
@@ -138,7 +134,7 @@
* @param indexPath the path to the index file
* @param repository the repository where the artifacts are located
*/
- protected void indexArtifact( List artifacts, String indexPath, ArtifactRepository repository )
+ protected void indexArtifact( List artifacts, File indexPath, ArtifactRepository repository )
throws RepositoryIndexException
{
ArtifactRepositoryIndex artifactIndex = indexFactory.createArtifactRepositoryIndex( indexPath, repository );
@@ -158,18 +154,12 @@
/**
* Index the metadata in the list
*
- * @param metadataList the metadata to be indexed
- * @param indexPath the path to the index file
- * @param repositoryBase the repository where the metadata are located
+ * @param metadataList the metadata to be indexed
+ * @param indexPath the path to the index file
*/
- protected void indexMetadata( List metadataList, String indexPath, File repositoryBase,
- ArtifactRepositoryLayout layout )
+ protected void indexMetadata( List metadataList, File indexPath, ArtifactRepository repository )
throws RepositoryIndexException, MalformedURLException
{
- String repoDir = repositoryBase.toURL().toString();
- ArtifactRepository repository =
- repoFactory.createArtifactRepository( "repository", repoDir, layout, null, null );
-
MetadataRepositoryIndex metadataIndex = indexFactory.createMetadataRepositoryIndex( indexPath, repository );
for ( Iterator iter = metadataList.iterator(); iter.hasNext(); )
{
@@ -191,7 +181,7 @@
* @param indexPath the path to the index
* @param repository the artifact repository where the poms were discovered
*/
- protected void indexPom( List models, String indexPath, ArtifactRepository repository )
+ protected void indexPom( List models, File indexPath, ArtifactRepository repository )
throws RepositoryIndexException
{
PomRepositoryIndex pomIndex = indexFactory.createPomRepositoryIndex( indexPath, repository );
@@ -214,33 +204,16 @@
* @return an ArtifactRepository instance
* @throws java.net.MalformedURLException
*/
- protected ArtifactRepository getDefaultRepository()
+ protected ArtifactRepository getDefaultRepository( Configuration configuration )
throws MalformedURLException
{
- File repositoryDirectory = new File( config.getRepositoryDirectory() );
+ // TODO! share with general search action, should only instantiate once
+ File repositoryDirectory = new File( configuration.getRepositoryDirectory() );
String repoDir = repositoryDirectory.toURL().toString();
ArtifactRepositoryFactory repoFactory = new DefaultArtifactRepositoryFactory();
- return repoFactory.createArtifactRepository( "test", repoDir, config.getLayout(), null, null );
- }
-
- /**
- * Method that sets the configuration object
- *
- * @param config
- */
- public void setConfiguration( Configuration config )
- {
- this.config = config;
- }
-
- /**
- * Returns the cofiguration
- *
- * @return a Configuration object that contains the configuration values
- */
- public Configuration getConfiguration()
- {
- return config;
+ ArtifactRepositoryLayout layout =
+ (ArtifactRepositoryLayout) repositoryLayouts.get( configuration.getRepositoryLayout() );
+ return repoFactory.createArtifactRepository( "test", repoDir, layout, null, null );
}
}
Modified: maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/DiscovererScheduler.java
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/DiscovererScheduler.java?rev=412683&r1=412682&r2=412683&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/DiscovererScheduler.java (original)
+++ maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/DiscovererScheduler.java Thu Jun 8 00:15:34 2006
@@ -26,7 +26,6 @@
import org.quartz.SchedulerException;
import java.text.ParseException;
-import java.util.Properties;
/**
* This class sets the job to be executed in the plexus-quartz scheduler
@@ -39,11 +38,6 @@
/**
* @plexus.requirement
*/
- private Configuration config;
-
- /**
- * @plexus.requirement
- */
private Scheduler scheduler;
/**
@@ -54,43 +48,20 @@
/**
* Method that sets the schedule in the plexus-quartz scheduler
*
+ * @param cronExpression
* @throws ParseException
* @throws SchedulerException
*/
- public void setSchedule()
+ public void setSchedule( String cronExpression )
throws ParseException, SchedulerException
{
- Properties props = config.getProperties();
JobDetail jobDetail = new JobDetail( "discovererJob", "DISCOVERER", DiscovererJob.class );
JobDataMap dataMap = new JobDataMap();
dataMap.put( AbstractJob.LOGGER, getLogger() );
dataMap.put( DiscovererJob.MAP_DISCOVERER_EXECUTION, execution );
jobDetail.setJobDataMap( dataMap );
- CronTrigger trigger =
- new CronTrigger( "DiscovererTrigger", "DISCOVERER", props.getProperty( "cron.expression" ) );
+ CronTrigger trigger = new CronTrigger( "DiscovererTrigger", "DISCOVERER", cronExpression );
scheduler.scheduleJob( jobDetail, trigger );
}
-
- /**
- * Method that sets the configuration object
- *
- * @param config
- */
- public void setConfiguration( Configuration config )
- {
- this.config = config;
- }
-
- /**
- * Returns the cofiguration
- *
- * @return a Configuration object that contains the configuration values
- */
- public Configuration getConfiguration()
- {
- return config;
- }
-
-
}
Modified: maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/WEB-INF/plexus.xml
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/WEB-INF/plexus.xml?rev=412683&r1=412682&r2=412683&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/WEB-INF/plexus.xml (original)
+++ maven/repository-manager/trunk/maven-repository-webapp/src/main/webapp/WEB-INF/plexus.xml Thu Jun 8 00:15:34 2006
@@ -41,47 +41,6 @@
<implementation>org.codehaus.plexus.xwork.PlexusObjectFactory</implementation>
</component>
- <component>
- <role>org.apache.maven.repository.manager.web.job.Configuration</role>
- <implementation>org.apache.maven.repository.manager.web.job.Configuration</implementation>
- <configuration>
- <properties>
- <property>
- <name>layout</name>
- <value>default</value>
- </property>
- <property>
- <name>default.repository.dir</name>
- <value>C:/TEST_REPOS/.m2/repository/</value>
- </property>
- <property>
- <name>legacy.repository.dir</name>
- <value>C:/TEST_REPOS/.maven/repository/</value>
- </property>
- <property>
- <name>index.path</name>
- <value>C:/INDEX</value>
- </property>
- <property>
- <name>cron.expression</name>
- <value>0 0 8 * * ?</value>
- </property>
- <property>
- <name>blacklist.patterns</name>
- <value>null</value>
- </property>
- <property>
- <name>include.snapshots</name>
- <value>true</value>
- </property>
- <property>
- <name>convert.snapshots</name>
- <value>true</value>
- </property>
- </properties>
- </configuration>
- </component>
-
<!--
| Logger manager
-->
Modified: maven/repository-manager/trunk/pom.xml
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/pom.xml?rev=412683&r1=412682&r2=412683&view=diff
==============================================================================
--- maven/repository-manager/trunk/pom.xml (original)
+++ maven/repository-manager/trunk/pom.xml Thu Jun 8 00:15:34 2006
@@ -14,9 +14,7 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.maven</groupId>
@@ -120,6 +118,8 @@
<module>maven-repository-webapp</module>
<module>maven-repository-proxy</module>
<module>maven-repository-manager-site</module>
+ <module>maven-repository-core</module>
+ <module>maven-repository-configuration</module>
</modules>
<dependencies>
<dependency>
@@ -211,6 +211,11 @@
<artifactId>maven-repository-artifact-applet</artifactId>
<version>${pom.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.maven.repository</groupId>
+ <artifactId>maven-repository-configuration</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
</dependencies>
</dependencyManagement>
<reporting>
@@ -329,4 +334,4 @@
</build>
</profile>
</profiles>
-</project>
+</project>
\ No newline at end of file