From 86db5311d45b14c134307b9c8ee81d9d0e14f30e Mon Sep 17 00:00:00 2001 From: Brett Porter Date: Thu, 8 Jun 2006 07:15:34 +0000 Subject: [PATCH] [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 git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@412683 13f79535-47bb-0310-9956-ffa450edef68 --- .../repository/manager/cli/IndexCli.java | 2 +- .../manager/cli/IndexSearcherCli.java | 2 +- maven-repository-configuration/pom.xml | 40 ++++++++ .../src/main/mdo/configuration.mdo | 82 +++++++++++++++ maven-repository-core/pom.xml | 20 ++++ .../indexing/AbstractRepositoryIndex.java | 16 ++- .../indexing/ArtifactRepositoryIndex.java | 3 +- .../DefaultRepositoryIndexSearcher.java | 2 +- .../DefaultRepositoryIndexingFactory.java | 17 +--- .../indexing/EclipseRepositoryIndex.java | 4 +- .../indexing/MetadataRepositoryIndex.java | 3 +- .../indexing/PomRepositoryIndex.java | 2 +- .../repository/indexing/RepositoryIndex.java | 3 +- .../indexing/RepositoryIndexingFactory.java | 8 +- .../ArtifactRepositoryIndexingTest.java | 10 +- .../indexing/EclipseRepositoryIndexTest.java | 10 +- .../MetadataRepositoryIndexingTest.java | 4 +- .../indexing/PomRepositoryIndexingTest.java | 8 +- .../RepositoryIndexSearchLayerTest.java | 4 +- .../DuplicateArtifactFileReportProcessor.java | 4 +- ...licateArtifactFileReportProcessorTest.java | 2 +- maven-repository-webapp/pom.xml | 4 + .../manager/web/action/BaseAction.java | 8 +- .../web/action/GeneralSearchAction.java | 18 ++-- .../web/action/PackageSearchAction.java | 24 +++-- .../web/execution/DiscovererExecution.java | 81 +++++---------- .../manager/web/job/Configuration.java | 99 ------------------- .../manager/web/job/DiscovererScheduler.java | 35 +------ .../src/main/webapp/WEB-INF/plexus.xml | 41 -------- pom.xml | 13 ++- 30 files changed, 266 insertions(+), 303 deletions(-) create mode 100644 maven-repository-configuration/pom.xml create mode 100644 maven-repository-configuration/src/main/mdo/configuration.mdo create mode 100644 maven-repository-core/pom.xml delete mode 100644 maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/Configuration.java diff --git a/maven-repository-application/src/main/java/org/apache/maven/repository/manager/cli/IndexCli.java b/maven-repository-application/src/main/java/org/apache/maven/repository/manager/cli/IndexCli.java index edbcc8568..fd3bead98 100644 --- a/maven-repository-application/src/main/java/org/apache/maven/repository/manager/cli/IndexCli.java +++ b/maven-repository-application/src/main/java/org/apache/maven/repository/manager/cli/IndexCli.java @@ -69,7 +69,7 @@ public class IndexCli 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 diff --git a/maven-repository-application/src/main/java/org/apache/maven/repository/manager/cli/IndexSearcherCli.java b/maven-repository-application/src/main/java/org/apache/maven/repository/manager/cli/IndexSearcherCli.java index b7e410bb3..b4b04ed69 100644 --- a/maven-repository-application/src/main/java/org/apache/maven/repository/manager/cli/IndexSearcherCli.java +++ b/maven-repository-application/src/main/java/org/apache/maven/repository/manager/cli/IndexSearcherCli.java @@ -65,7 +65,7 @@ public class IndexSearcherCli 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 ); diff --git a/maven-repository-configuration/pom.xml b/maven-repository-configuration/pom.xml new file mode 100644 index 000000000..783bade26 --- /dev/null +++ b/maven-repository-configuration/pom.xml @@ -0,0 +1,40 @@ + + + + maven-repository-manager + org.apache.maven.repository + 1.0-SNAPSHOT + + 4.0.0 + org.apache.maven.repository + maven-repository-configuration + Maven Repository Manager Configuration + + + org.codehaus.plexus + plexus-utils + + + + + + org.codehaus.modello + modello-maven-plugin + 1.0-alpha-8 + + + + xpp3-writer + java + xpp3-reader + + + + + 1.0.0 + src/main/mdo/configuration.mdo + + + + + diff --git a/maven-repository-configuration/src/main/mdo/configuration.mdo b/maven-repository-configuration/src/main/mdo/configuration.mdo new file mode 100644 index 000000000..37b2175c5 --- /dev/null +++ b/maven-repository-configuration/src/main/mdo/configuration.mdo @@ -0,0 +1,82 @@ + + configuration + Configuration + + Configuration for the Maven Repository Manager. + + + + package + org.apache.maven.repository.configuration + + + + + + Configuration + 1.0.0 + + + repositoryDirectory + 1.0.0 + String + true + + The location of the repository to monitor. + + + + repositoryLayout + 1.0.0 + String + true + + The layout of the repository. Valid values are "default" and "legacy". + + + default + + + indexPath + 1.0.0 + String + + The location of the Lucene index to use for the repository. The default is the .index subdirectory of + the repository. + + + + minimalIndexPath + 1.0.0 + String + + The location of the reduced Lucene index to use for the repository. The default is the .small-index + subdirectory of the repository. + + + + discoveryCronExpression + 1.0.0 + String + When to run the discovery mechanism. + 0 0 8 * * ? + + + discoverSnapshots + 1.0.0 + boolean + Whether to include snapshot versions in the discovery process + false + + + discoveryBlackListPatterns + 1.0.0 + String + Blacklisted patterns in the discovery process + + + + + + + diff --git a/maven-repository-core/pom.xml b/maven-repository-core/pom.xml new file mode 100644 index 000000000..feb702fe3 --- /dev/null +++ b/maven-repository-core/pom.xml @@ -0,0 +1,20 @@ + + + + maven-repository-manager + org.apache.maven.repository + 1.0-SNAPSHOT + + 4.0.0 + org.apache.maven.repository + maven-repository-core + Maven Repository Manager Core + + + junit + junit + 3.8.1 + test + + + diff --git a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/AbstractRepositoryIndex.java b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/AbstractRepositoryIndex.java index f65c6ff9d..2c21027ad 100644 --- a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/AbstractRepositoryIndex.java +++ b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/AbstractRepositoryIndex.java @@ -41,7 +41,7 @@ public abstract class AbstractRepositoryIndex 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 @@ public abstract class AbstractRepositoryIndex * @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 @@ public abstract class AbstractRepositoryIndex /** * @see org.apache.maven.repository.indexing.RepositoryIndex#getIndexPath() */ - public String getIndexPath() + public File getIndexPath() { return indexPath; } @@ -244,19 +244,17 @@ public abstract class AbstractRepositoryIndex 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." ); } diff --git a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndex.java b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndex.java index bb410b815..09b1674af 100644 --- a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndex.java +++ b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndex.java @@ -22,6 +22,7 @@ import org.apache.maven.artifact.Artifact; 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 @@ public class ArtifactRepositoryIndex * @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; diff --git a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/DefaultRepositoryIndexSearcher.java b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/DefaultRepositoryIndexSearcher.java index f83c0d5de..953145747 100644 --- a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/DefaultRepositoryIndexSearcher.java +++ b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/DefaultRepositoryIndexSearcher.java @@ -78,7 +78,7 @@ public class DefaultRepositoryIndexSearcher IndexSearcher searcher; try { - searcher = new IndexSearcher( index.getIndexPath() ); + searcher = new IndexSearcher( index.getIndexPath().getAbsolutePath() ); } catch ( IOException e ) { diff --git a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/DefaultRepositoryIndexingFactory.java b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/DefaultRepositoryIndexingFactory.java index 62276d717..b03f93209 100644 --- a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/DefaultRepositoryIndexingFactory.java +++ b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/DefaultRepositoryIndexingFactory.java @@ -20,6 +20,8 @@ import org.apache.maven.artifact.factory.ArtifactFactory; 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 @@ public class DefaultRepositoryIndexingFactory */ 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 ); diff --git a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/EclipseRepositoryIndex.java b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/EclipseRepositoryIndex.java index c54ea9f3c..61d15e537 100644 --- a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/EclipseRepositoryIndex.java +++ b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/EclipseRepositoryIndex.java @@ -68,7 +68,7 @@ public class EclipseRepositoryIndex * @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 class EclipseRepositoryIndex 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" ); diff --git a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/MetadataRepositoryIndex.java b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/MetadataRepositoryIndex.java index 8fcea8667..8e38f3070 100644 --- a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/MetadataRepositoryIndex.java +++ b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/MetadataRepositoryIndex.java @@ -24,6 +24,7 @@ import org.apache.maven.artifact.repository.metadata.Plugin; 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 @@ public class MetadataRepositoryIndex * @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 ); } diff --git a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/PomRepositoryIndex.java b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/PomRepositoryIndex.java index b4f7260b0..6e95e85d6 100644 --- a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/PomRepositoryIndex.java +++ b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/PomRepositoryIndex.java @@ -56,7 +56,7 @@ public class PomRepositoryIndex * @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 ); diff --git a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndex.java b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndex.java index 52064e9d7..6735f864f 100644 --- a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndex.java +++ b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndex.java @@ -19,6 +19,7 @@ package org.apache.maven.repository.indexing; 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 @@ public interface RepositoryIndex * * @return the path where the index resides */ - String getIndexPath(); + File getIndexPath(); /** * Tests an index field if it is a keyword field diff --git a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndexingFactory.java b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndexingFactory.java index 8a8891d15..e51701cbb 100644 --- a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndexingFactory.java +++ b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndexingFactory.java @@ -18,6 +18,8 @@ package org.apache.maven.repository.indexing; import org.apache.maven.artifact.repository.ArtifactRepository; +import java.io.File; + /** * @author Edwin Punzalan @@ -34,7 +36,7 @@ public interface RepositoryIndexingFactory * @return the ArtifactRepositoryIndex instance * @throws RepositoryIndexException */ - ArtifactRepositoryIndex createArtifactRepositoryIndex( String indexPath, ArtifactRepository repository ) + ArtifactRepositoryIndex createArtifactRepositoryIndex( File indexPath, ArtifactRepository repository ) throws RepositoryIndexException; /** @@ -45,7 +47,7 @@ public interface RepositoryIndexingFactory * @return the PomRepositoryIndex instance * @throws RepositoryIndexException */ - PomRepositoryIndex createPomRepositoryIndex( String indexPath, ArtifactRepository repository ) + PomRepositoryIndex createPomRepositoryIndex( File indexPath, ArtifactRepository repository ) throws RepositoryIndexException; /** @@ -56,7 +58,7 @@ public interface RepositoryIndexingFactory * @return the MetadataRepositoryIndex instance * @throws RepositoryIndexException */ - MetadataRepositoryIndex createMetadataRepositoryIndex( String indexPath, ArtifactRepository repository ) + MetadataRepositoryIndex createMetadataRepositoryIndex( File indexPath, ArtifactRepository repository ) throws RepositoryIndexException; } diff --git a/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndexingTest.java b/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndexingTest.java index fce15eefe..b04e80433 100644 --- a/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndexingTest.java +++ b/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndexingTest.java @@ -43,7 +43,7 @@ public class ArtifactRepositoryIndexingTest private ArtifactRepository repository; - private String indexPath; + private File indexPath; private Digester digester; @@ -59,7 +59,7 @@ public class ArtifactRepositoryIndexingTest 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 @@ public class ArtifactRepositoryIndexingTest 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 @@ public class ArtifactRepositoryIndexingTest 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 @@ public class ArtifactRepositoryIndexingTest assertTrue( true ); } - indexer = factory.createArtifactRepositoryIndex( "target/index/sample", repository ); + indexer = factory.createArtifactRepositoryIndex( getTestFile( "target/index/sample" ), repository ); try { diff --git a/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/EclipseRepositoryIndexTest.java b/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/EclipseRepositoryIndexTest.java index 39670273f..19974cbd9 100644 --- a/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/EclipseRepositoryIndexTest.java +++ b/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/EclipseRepositoryIndexTest.java @@ -43,7 +43,7 @@ public class EclipseRepositoryIndexTest private ArtifactRepository repository; - private String indexPath; + private File indexPath; private Digester digester; @@ -63,7 +63,7 @@ public class EclipseRepositoryIndexTest 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 @@ public class EclipseRepositoryIndexTest 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 @@ public class EclipseRepositoryIndexTest 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 @@ public class EclipseRepositoryIndexTest { EclipseRepositoryIndex index = createTestIndex(); - IndexSearcher searcher = new IndexSearcher( index.getIndexPath() ); + IndexSearcher searcher = new IndexSearcher( index.getIndexPath().getAbsolutePath() ); try { QueryParser parser = new QueryParser( "j", index.getAnalyzer() ); diff --git a/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/MetadataRepositoryIndexingTest.java b/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/MetadataRepositoryIndexingTest.java index 34e80e2a0..ba3a072db 100644 --- a/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/MetadataRepositoryIndexingTest.java +++ b/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/MetadataRepositoryIndexingTest.java @@ -52,7 +52,7 @@ public class MetadataRepositoryIndexingTest { private ArtifactRepository repository; - private String indexPath; + private File indexPath; private ArtifactFactory artifactFactory; @@ -71,7 +71,7 @@ public class MetadataRepositoryIndexingTest ArtifactRepositoryFactory repoFactory = (ArtifactRepositoryFactory) lookup( ArtifactRepositoryFactory.ROLE ); repository = repoFactory.createArtifactRepository( "test", repoDir, layout, null, null ); - indexPath = "target/index"; + indexPath = getTestFile( "target/index" ); FileUtils.deleteDirectory( indexPath ); } diff --git a/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/PomRepositoryIndexingTest.java b/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/PomRepositoryIndexingTest.java index a7087736f..fe0aa1d41 100644 --- a/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/PomRepositoryIndexingTest.java +++ b/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/PomRepositoryIndexingTest.java @@ -48,7 +48,7 @@ public class PomRepositoryIndexingTest private ArtifactFactory artifactFactory; - private String indexPath; + private File indexPath; private Digester digester; @@ -64,7 +64,7 @@ public class PomRepositoryIndexingTest 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 @@ public class PomRepositoryIndexingTest 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 @@ public class PomRepositoryIndexingTest 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" ); diff --git a/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/RepositoryIndexSearchLayerTest.java b/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/RepositoryIndexSearchLayerTest.java index 9c48ddc23..5b425a552 100644 --- a/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/RepositoryIndexSearchLayerTest.java +++ b/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/RepositoryIndexSearchLayerTest.java @@ -54,7 +54,7 @@ public class RepositoryIndexSearchLayerTest private ArtifactFactory artifactFactory; - private String indexPath; + private File indexPath; /** * Setup method @@ -71,7 +71,7 @@ public class RepositoryIndexSearchLayerTest ArtifactRepositoryFactory repoFactory = (ArtifactRepositoryFactory) lookup( ArtifactRepositoryFactory.ROLE ); repository = repoFactory.createArtifactRepository( "test", repoDir, layout, null, null ); - indexPath = "target/index"; + indexPath = getTestFile( "target/index" ); FileUtils.deleteDirectory( indexPath ); } diff --git a/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/DuplicateArtifactFileReportProcessor.java b/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/DuplicateArtifactFileReportProcessor.java index 076e3b81a..e865e8cec 100644 --- a/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/DuplicateArtifactFileReportProcessor.java +++ b/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/DuplicateArtifactFileReportProcessor.java @@ -68,8 +68,8 @@ public class DuplicateArtifactFileReportProcessor { 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 diff --git a/maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/DuplicateArtifactFileReportProcessorTest.java b/maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/DuplicateArtifactFileReportProcessorTest.java index 5f97f05ea..7c6b31702 100644 --- a/maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/DuplicateArtifactFileReportProcessorTest.java +++ b/maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/DuplicateArtifactFileReportProcessorTest.java @@ -41,7 +41,7 @@ public class DuplicateArtifactFileReportProcessorTest private ArtifactFactory artifactFactory; - private String indexPath = new File( "target/.index" ).getAbsolutePath(); + private File indexPath = getTestFile( "target/.index" ); protected void setUp() throws Exception diff --git a/maven-repository-webapp/pom.xml b/maven-repository-webapp/pom.xml index 6e275db52..070b49098 100644 --- a/maven-repository-webapp/pom.xml +++ b/maven-repository-webapp/pom.xml @@ -50,6 +50,10 @@ org.apache.maven.repository maven-repository-discovery + + org.apache.maven.repository + maven-repository-configuration + org.apache.maven.repository maven-repository-artifact-applet diff --git a/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/BaseAction.java b/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/BaseAction.java index fe4a615a6..79d5f7d68 100644 --- a/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/BaseAction.java +++ b/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/BaseAction.java @@ -17,9 +17,12 @@ package org.apache.maven.repository.manager.web.action; */ 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 @@ public class BaseAction { try { - execution.executeDiscovererIfIndexDoesNotExist(); - discovererScheduler.setSchedule(); + Configuration configuration = new Configuration(); // TODO! + execution.executeDiscovererIfIndexDoesNotExist( new File( configuration.getIndexPath() ) ); + discovererScheduler.setSchedule( configuration.getDiscoveryCronExpression() ); } catch ( Exception e ) { diff --git a/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/GeneralSearchAction.java b/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/GeneralSearchAction.java index b80ab6013..a0927b660 100644 --- a/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/GeneralSearchAction.java +++ b/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/GeneralSearchAction.java @@ -19,16 +19,18 @@ 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.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 @@ public class GeneralSearchAction 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 ); 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 543b45143..cbd28f1e0 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,6 +19,8 @@ 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.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.RepositoryIndexSearchException; 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. @@ -52,6 +54,11 @@ public class PackageSearchAction */ private RepositoryIndexingFactory factory; + /** + * @plexus.requirement role="org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout" + */ + private Map repositoryLayouts; + /** * @plexus.requirement */ @@ -62,11 +69,6 @@ public class PackageSearchAction */ private RepositoryIndexSearchLayer searchLayer; - /** - * @plexus.requirement - */ - private Configuration configuration; - public String execute() throws MalformedURLException, RepositoryIndexException, RepositoryIndexSearchException { @@ -87,15 +89,17 @@ public class PackageSearchAction 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 ); diff --git a/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/execution/DiscovererExecution.java b/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/execution/DiscovererExecution.java index 1c056e69d..4e1dfbff2 100644 --- a/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/execution/DiscovererExecution.java +++ b/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/execution/DiscovererExecution.java @@ -24,6 +24,7 @@ import org.apache.maven.artifact.repository.DefaultArtifactRepositoryFactory; 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.MetadataRepositoryIndex; 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.net.MalformedURLException; 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 @@ import java.util.Properties; public class DiscovererExecution extends AbstractLogEnabled { - /** - * @plexus.requirement - */ - private Configuration config; /** * @plexus.requirement role="org.apache.maven.repository.discovery.ArtifactDiscoverer" @@ -75,19 +70,21 @@ public class DiscovererExecution */ 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 class DiscovererExecution 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 @@ public class DiscovererExecution * @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 @@ public class DiscovererExecution /** * 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 @@ public class DiscovererExecution * @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 @@ public class DiscovererExecution * @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 ); } } diff --git a/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/Configuration.java b/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/Configuration.java deleted file mode 100644 index 0da84405d..000000000 --- a/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/Configuration.java +++ /dev/null @@ -1,99 +0,0 @@ -package org.apache.maven.repository.manager.web.job; - -/* - * Copyright 2005-2006 The Apache Software Foundation. - * - * Licensed 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.artifact.repository.layout.ArtifactRepositoryLayout; -import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout; -import org.apache.maven.artifact.repository.layout.LegacyRepositoryLayout; -import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable; -import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException; - -import java.util.Properties; - -/** - * This class contains the configuration values to be used by the scheduler - * - * @todo should not need to be initializable [!] Should have individual configuration items, and they could well be configured on the job itself, not in this class - */ -public class Configuration - implements Initializable -{ - - private Properties props; - - /** - * @throws InitializationException - */ - public void initialize() - throws InitializationException - { - } - - /** - * Set the properties object - * - * @param properties - */ - public void setProperties( Properties properties ) - { - this.props = properties; - } - - /** - * Returns the properties object - * - * @return a Properties object that contains the configuration values - */ - public Properties getProperties() - { - return props; - } - - public ArtifactRepositoryLayout getLayout() - { - // TODO: lookup from map [!] - ArtifactRepositoryLayout layout; - if ( "legacy".equals( props.getProperty( "layout" ) ) ) - { - layout = new LegacyRepositoryLayout(); - } - else - { - layout = new DefaultRepositoryLayout(); - } - return layout; - } - - public String getIndexDirectory() - { - return props.getProperty( "index.path" ); - } - - public String getRepositoryDirectory() - { - String repositoryDir = ""; - if ( "default".equals( props.getProperty( "layout" ) ) ) - { - repositoryDir = props.getProperty( "default.repository.dir" ); - } - else if ( "legacy".equals( props.getProperty( "layout" ) ) ) - { - repositoryDir = props.getProperty( "legacy.repository.dir" ); - } - return repositoryDir; - } -} diff --git a/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/DiscovererScheduler.java b/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/DiscovererScheduler.java index 8d66dfe0d..bad9471a2 100644 --- a/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/DiscovererScheduler.java +++ b/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/DiscovererScheduler.java @@ -26,7 +26,6 @@ import org.quartz.JobDetail; 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 @@ -36,11 +35,6 @@ import java.util.Properties; public class DiscovererScheduler extends AbstractLogEnabled { - /** - * @plexus.requirement - */ - private Configuration config; - /** * @plexus.requirement */ @@ -54,43 +48,20 @@ public class DiscovererScheduler /** * 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; - } - - } diff --git a/maven-repository-webapp/src/main/webapp/WEB-INF/plexus.xml b/maven-repository-webapp/src/main/webapp/WEB-INF/plexus.xml index d34d3cd0d..852ec21dd 100644 --- a/maven-repository-webapp/src/main/webapp/WEB-INF/plexus.xml +++ b/maven-repository-webapp/src/main/webapp/WEB-INF/plexus.xml @@ -41,47 +41,6 @@ org.codehaus.plexus.xwork.PlexusObjectFactory - - org.apache.maven.repository.manager.web.job.Configuration - org.apache.maven.repository.manager.web.job.Configuration - - - - layout - default - - - default.repository.dir - C:/TEST_REPOS/.m2/repository/ - - - legacy.repository.dir - C:/TEST_REPOS/.maven/repository/ - - - index.path - C:/INDEX - - - cron.expression - 0 0 8 * * ? - - - blacklist.patterns - null - - - include.snapshots - true - - - convert.snapshots - true - - - - - diff --git a/pom.xml b/pom.xml index 42afaad77..1e5231bd4 100644 --- a/pom.xml +++ b/pom.xml @@ -14,9 +14,7 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - - + 4.0.0 org.apache.maven @@ -120,6 +118,8 @@ maven-repository-webapp maven-repository-proxy maven-repository-manager-site + maven-repository-core + maven-repository-configuration @@ -211,6 +211,11 @@ maven-repository-artifact-applet ${pom.version} + + org.apache.maven.repository + maven-repository-configuration + ${pom.version} + @@ -329,4 +334,4 @@ - + \ No newline at end of file