]> source.dussan.org Git - archiva.git/commitdiff
PR: MRM-116
authorMaria Odea B. Ching <oching@apache.org>
Tue, 6 Jun 2006 02:09:38 +0000 (02:09 +0000)
committerMaria Odea B. Ching <oching@apache.org>
Tue, 6 Jun 2006 02:09:38 +0000 (02:09 +0000)
Created a class (DiscovererExecution) that would be executed when the repository webapp is accessed and no index exists yet. It would also be invoked by the DiscovererJob once it is executed by the scheduler.

git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@411971 13f79535-47bb-0310-9956-ffa450edef68

maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/BaseAction.java
maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/execution/DiscovererExecution.java [new file with mode: 0644]
maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/DiscovererJob.java
maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/DiscovererScheduler.java

index eaedb634215d8f158edd1869471e60ff46d4733c..e05cf20b4caed2dee983beac6ec0266ade313e51 100644 (file)
@@ -18,6 +18,7 @@ package org.apache.maven.repository.manager.web.action;
 \r
 import com.opensymphony.xwork.Action;\r
 import org.apache.maven.repository.manager.web.job.DiscovererScheduler;\r
+import org.apache.maven.repository.manager.web.execution.DiscovererExecution;\r
 \r
 /**\r
  * This is the Action class of index.jsp, which is the initial page of the web application.\r
@@ -28,6 +29,10 @@ import org.apache.maven.repository.manager.web.job.DiscovererScheduler;
 public class BaseAction\r
     implements Action\r
 {\r
+    /**\r
+     * @plexus.requirement\r
+     */\r
+    private DiscovererExecution execution;\r
 \r
     /**\r
      * @plexus.requirement\r
@@ -43,6 +48,7 @@ public class BaseAction
     {\r
         try\r
         {\r
+            execution.executeDiscovererIfIndexDoesNotExist();\r
             discovererScheduler.setSchedule();\r
         }\r
         catch ( Exception e )\r
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
new file mode 100644 (file)
index 0000000..7b3de21
--- /dev/null
@@ -0,0 +1,339 @@
+package org.apache.maven.repository.manager.web.execution;
+
+/*
+ * Copyright 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.ArtifactRepository;
+import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
+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.artifact.Artifact;
+import org.apache.maven.repository.indexing.RepositoryIndexException;
+import org.apache.maven.repository.indexing.ArtifactRepositoryIndex;
+import org.apache.maven.repository.indexing.MetadataRepositoryIndex;
+import org.apache.maven.repository.indexing.PomRepositoryIndex;
+import org.apache.maven.repository.indexing.RepositoryIndexingFactory;
+import org.apache.maven.repository.manager.web.job.Configuration;
+import org.apache.maven.repository.discovery.ArtifactDiscoverer;
+import org.apache.maven.repository.discovery.MetadataDiscoverer;
+import org.apache.maven.model.Model;
+import org.apache.lucene.index.IndexReader;
+import org.codehaus.plexus.logging.AbstractLogEnabled;
+
+import java.util.List;
+import java.util.Iterator;
+import java.util.Properties;
+import java.io.File;
+import java.net.MalformedURLException;
+
+/**
+ * This is the class that executes the discoverer and indexer.
+ *
+ * @plexus.component role="org.apache.maven.repository.manager.web.execution.DiscovererExecution"
+ */
+public class DiscovererExecution
+    extends AbstractLogEnabled
+{
+    /**
+     * @plexus.requirement
+     */
+    private Configuration config;
+
+    /**
+     * @plexus.requirement role="org.apache.maven.repository.discovery.ArtifactDiscoverer" role-hint="org.apache.maven.repository.discovery.DefaultArtifactDiscoverer"
+     */
+    private ArtifactDiscoverer defaultArtifactDiscoverer;
+
+    /**
+     * @plexus.requirement role="org.apache.maven.repository.discovery.ArtifactDiscoverer" role-hint="org.apache.maven.repository.discovery.LegacyArtifactDiscoverer"
+     */
+    private ArtifactDiscoverer legacyArtifactDiscoverer;
+
+    /**
+     * @plexus.requirement role="org.apache.maven.repository.discovery.MetadataDiscoverer" role-hint="org.apache.maven.repository.discovery.DefaultMetadataDiscoverer"
+     */
+    private MetadataDiscoverer defaultMetadataDiscoverer;
+
+    /**
+     * @plexus.requirement
+     */
+    private RepositoryIndexingFactory indexFactory;
+
+    /**
+     * @plexus.requirement
+     */
+    private ArtifactRepositoryFactory repoFactory;
+
+    private ArtifactRepositoryLayout layout;
+
+    private Properties props;
+
+    private String indexPath;
+
+    private String blacklistedPatterns;
+
+    private boolean includeSnapshots;
+
+    private boolean convertSnapshots;
+
+    private ArtifactRepository defaultRepository;
+
+    /**
+     * Executes discoverer and indexer if an index does not exist yet
+     *
+     * @throws MalformedURLException
+     * @throws RepositoryIndexException
+     */
+    public void executeDiscovererIfIndexDoesNotExist()
+        throws MalformedURLException, RepositoryIndexException
+    {
+        props = config.getProperties();
+        indexPath = props.getProperty( "index.path" );
+
+        File indexDir = new File( indexPath );
+        boolean isExisting;
+
+        if ( IndexReader.indexExists( indexDir ) )
+        {
+            isExisting = true;
+        }
+        else if ( !indexDir.exists() )
+        {
+            isExisting = false;
+        }
+        else
+        {
+            isExisting = false;
+        }
+
+        if ( !isExisting )
+        {
+            executeDiscoverer();
+        }
+    }
+
+    /**
+     * Method that executes the discoverer and indexer
+     */
+    public void executeDiscoverer()
+        throws MalformedURLException, RepositoryIndexException
+    {
+        props = config.getProperties();
+        indexPath = props.getProperty( "index.path" );
+        layout = config.getLayout();
+        blacklistedPatterns = props.getProperty( "blacklist.patterns" );
+        includeSnapshots = new Boolean( props.getProperty( "include.snapshots" ) ).booleanValue();
+        convertSnapshots = new Boolean( props.getProperty( "convert.snapshots" ) ).booleanValue();
+
+        try
+        {
+            defaultRepository = getDefaultRepository();
+        }
+        catch ( MalformedURLException me )
+        {
+            getLogger().error( me.getMessage() );
+        }
+
+        getLogger().info( "[DiscovererExecution] Started discovery and indexing.." );
+        if ( props.getProperty( "layout" ).equals( "default" ) )
+        {
+            executeDiscovererInDefaultRepo();
+        }
+        else if ( props.getProperty( "layout" ).equals( "legacy" ) )
+        {
+            executeDiscovererInLegacyRepo();
+        }
+        getLogger().info( "[DiscovererExecution] Finished discovery and indexing." );
+    }
+
+    /**
+     * Method that discovers and indexes artifacts, poms and metadata in a default
+     * m2 repository structure
+     *
+     * @throws MalformedURLException
+     * @throws RepositoryIndexException
+     */
+    protected void executeDiscovererInDefaultRepo()
+        throws MalformedURLException, RepositoryIndexException
+    {
+        List artifacts =
+            defaultArtifactDiscoverer.discoverArtifacts( defaultRepository, blacklistedPatterns, includeSnapshots );
+        indexArtifact( artifacts, indexPath, defaultRepository );
+
+        List models = defaultArtifactDiscoverer.discoverStandalonePoms( defaultRepository, blacklistedPatterns,
+                                                                        convertSnapshots );
+        indexPom( models, indexPath, defaultRepository );
+
+        List metadataList = defaultMetadataDiscoverer.discoverMetadata( new File( defaultRepository
+            .getBasedir() ), blacklistedPatterns );
+        indexMetadata( metadataList, indexPath, new File( defaultRepository.getBasedir() ) );
+    }
+
+    /**
+     * Method that discovers and indexes artifacts in a legacy type repository
+     *
+     * @throws RepositoryIndexException
+     */
+    protected void executeDiscovererInLegacyRepo()
+        throws RepositoryIndexException
+    {
+        List artifacts =
+            legacyArtifactDiscoverer.discoverArtifacts( defaultRepository, blacklistedPatterns, includeSnapshots );
+        indexArtifact( artifacts, indexPath, defaultRepository );
+    }
+
+    /**
+     * Index the artifacts in the list
+     *
+     * @param artifacts  the artifacts to be indexed
+     * @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 )
+        throws RepositoryIndexException
+    {
+        ArtifactRepositoryIndex artifactIndex = indexFactory.createArtifactRepositoryIndex( indexPath, repository );
+        for ( Iterator iter = artifacts.iterator(); iter.hasNext(); )
+        {
+            Artifact artifact = (Artifact) iter.next();
+            try
+            {
+                artifactIndex.indexArtifact( artifact );
+            }
+            catch ( Exception e )
+            {
+                if ( e instanceof RepositoryIndexException )
+                {
+                    throw (RepositoryIndexException) e;
+                }
+            }
+
+            if ( artifactIndex.isOpen() )
+            {
+                artifactIndex.optimize();
+                artifactIndex.close();
+            }
+        }
+    }
+
+    /**
+     * 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
+     */
+    protected void indexMetadata( List metadataList, String indexPath, File repositoryBase )
+        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(); )
+        {
+            RepositoryMetadata repoMetadata = (RepositoryMetadata) iter.next();
+            try
+            {
+                metadataIndex.index( repoMetadata );
+            }
+            catch ( Exception e )
+            {
+                if ( e instanceof RepositoryIndexException )
+                {
+                    throw (RepositoryIndexException) e;
+                }
+            }
+            if ( metadataIndex.isOpen() )
+            {
+                metadataIndex.optimize();
+                metadataIndex.close();
+            }
+        }
+    }
+
+    /**
+     * Index the poms in the list
+     *
+     * @param models     list of poms that will be indexed
+     * @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 )
+        throws RepositoryIndexException
+    {
+        PomRepositoryIndex pomIndex = indexFactory.createPomRepositoryIndex( indexPath, repository );
+        for ( Iterator iter = models.iterator(); iter.hasNext(); )
+        {
+            Model model = (Model) iter.next();
+            try
+            {
+                pomIndex.indexPom( model );
+            }
+            catch ( Exception e )
+            {
+                if ( e instanceof RepositoryIndexException )
+                {
+                    throw (RepositoryIndexException) e;
+                }
+            }
+
+            if ( pomIndex.isOpen() )
+            {
+                pomIndex.optimize();
+                pomIndex.close();
+            }
+        }
+    }
+
+    /**
+     * Method that creates the artifact repository
+     *
+     * @return an ArtifactRepository instance
+     * @throws java.net.MalformedURLException
+     */
+    protected ArtifactRepository getDefaultRepository()
+        throws MalformedURLException
+    {
+        File repositoryDirectory = new File( config.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;
+    }
+}
index 7e98023e9cee0335f83da6b729fffc913856b3d8..f7a27ce5dad49939b2cbbb8f2975be0410bbdef3 100644 (file)
@@ -32,6 +32,7 @@ import org.apache.maven.repository.indexing.MetadataRepositoryIndex;
 import org.apache.maven.repository.indexing.PomRepositoryIndex;\r
 import org.apache.maven.repository.indexing.RepositoryIndexException;\r
 import org.apache.maven.repository.indexing.RepositoryIndexingFactory;\r
+import org.apache.maven.repository.manager.web.execution.DiscovererExecution;\r
 import org.codehaus.plexus.scheduler.AbstractJob;\r
 import org.quartz.JobDataMap;\r
 import org.quartz.JobExecutionContext;\r
@@ -43,7 +44,7 @@ import java.util.Iterator;
 import java.util.List;\r
 \r
 /**\r
- * This class executes the discoverer and the indexer.\r
+ * This class is the discoverer job that is executed by the scheduler.\r
  *\r
  * @plexus.component role="org.apache.maven.repository.manager.web.job.DiscovererJob"\r
  */\r
@@ -52,41 +53,7 @@ public class DiscovererJob
 {\r
     public static final String ROLE = DiscovererJob.class.getName();\r
 \r
-    private ArtifactDiscoverer defaultArtifactDiscoverer;\r
-\r
-    private ArtifactDiscoverer legacyArtifactDiscoverer;\r
-\r
-    private MetadataDiscoverer defaultMetadataDiscoverer;\r
-\r
-    private RepositoryIndexingFactory indexFactory;\r
-\r
-    private ArtifactRepositoryLayout layout;\r
-\r
-    private ArtifactRepositoryFactory repoFactory;\r
-\r
-    public static String MAP_INDEXPATH = "INDEXPATH";\r
-\r
-    public static String MAP_LAYOUT = "LAYOUT";\r
-\r
-    public static String MAP_DEFAULT_REPOSITORY = "DEFAULT_REPOSITORY";\r
-\r
-    public static String MAP_BLACKLIST = "BLACKLISTED_PATTERNS";\r
-\r
-    public static String MAP_SNAPSHOTS = "INCLUDE_SNAPSHOTS";\r
-\r
-    public static String MAP_CONVERT = "CONVERT_SNAPSHOTS";\r
-\r
-    public static String MAP_DEF_ARTIFACT_DISCOVERER = "DEFAULT_ARTIFACT_DISCOVERER";\r
-\r
-    public static String MAP_LEG_ARTIFACT_DISCOVERER = "LEGACY_ARTIFACT_DISCOVERER";\r
-\r
-    public static String MAP_DEF_METADATA_DISCOVERER = "DEFAULT_METADATA_DISCOVERER";\r
-\r
-    public static String MAP_IDX_FACTORY = "INDEX_FACTORY";\r
-\r
-    public static String MAP_REPO_LAYOUT = "REPOSITORY_LAYOUT";\r
-\r
-    public static String MAP_REPO_FACTORY = "REPOSITORY_FACTORY";\r
+    public static String MAP_DISCOVERER_EXECUTION = "EXECUTION";\r
 \r
     /**\r
      * Execute the discoverer and the indexer.\r
@@ -99,47 +66,13 @@ public class DiscovererJob
         throws JobExecutionException\r
     {\r
         JobDataMap dataMap = context.getJobDetail().getJobDataMap();\r
-\r
         setJobDataMap( dataMap );\r
         getLogger().info( "[DiscovererJob] Start execution of DiscovererJob.." );\r
-        //configuration values specified in properties file\r
-        String indexPath = (String) dataMap.get( MAP_INDEXPATH );\r
-        ArtifactRepository defaultRepository = (ArtifactRepository) dataMap.get( MAP_DEFAULT_REPOSITORY );\r
-        String blacklistedPatterns = (String) dataMap.get( MAP_BLACKLIST );\r
-        boolean includeSnapshots = ( (Boolean) dataMap.get( MAP_SNAPSHOTS ) ).booleanValue();\r
-        boolean convertSnapshots = ( (Boolean) dataMap.get( MAP_CONVERT ) ).booleanValue();\r
-\r
-        //plexus components created in BaseAction\r
-        defaultArtifactDiscoverer = (DefaultArtifactDiscoverer) dataMap.get( MAP_DEF_ARTIFACT_DISCOVERER );\r
-        legacyArtifactDiscoverer = (LegacyArtifactDiscoverer) dataMap.get( MAP_LEG_ARTIFACT_DISCOVERER );\r
-        defaultMetadataDiscoverer = (DefaultMetadataDiscoverer) dataMap.get( MAP_DEF_METADATA_DISCOVERER );\r
-        indexFactory = (RepositoryIndexingFactory) dataMap.get( MAP_IDX_FACTORY );\r
-        layout = (ArtifactRepositoryLayout) dataMap.get( MAP_REPO_LAYOUT );\r
-        repoFactory = (ArtifactRepositoryFactory) dataMap.get( MAP_REPO_FACTORY );\r
 \r
         try\r
         {\r
-            List artifacts;\r
-            if ( dataMap.get( MAP_LAYOUT ).equals( "default" ) )\r
-            {\r
-                artifacts = defaultArtifactDiscoverer.discoverArtifacts( defaultRepository, blacklistedPatterns,\r
-                                                                         includeSnapshots );\r
-                indexArtifact( artifacts, indexPath, defaultRepository );\r
-\r
-                List models = defaultArtifactDiscoverer.discoverStandalonePoms( defaultRepository, blacklistedPatterns,\r
-                                                                                convertSnapshots );\r
-                indexPom( models, indexPath, defaultRepository );\r
-\r
-                List metadataList = defaultMetadataDiscoverer.discoverMetadata( new File( defaultRepository\r
-                    .getBasedir() ), blacklistedPatterns );\r
-                indexMetadata( metadataList, indexPath, new File( defaultRepository.getBasedir() ) );\r
-            }\r
-            else if ( dataMap.get( MAP_LAYOUT ).equals( "legacy" ) )\r
-            {\r
-                artifacts = legacyArtifactDiscoverer.discoverArtifacts( defaultRepository, blacklistedPatterns,\r
-                                                                        includeSnapshots );\r
-                indexArtifact( artifacts, indexPath, defaultRepository );\r
-            }\r
+            DiscovererExecution execution = (DiscovererExecution) dataMap.get( MAP_DISCOVERER_EXECUTION );\r
+            execution.executeDiscoverer();\r
         }\r
         catch ( RepositoryIndexException e )\r
         {\r
@@ -153,109 +86,4 @@ public class DiscovererJob
         getLogger().info( "[DiscovererJob] DiscovererJob has finished executing." );\r
     }\r
 \r
-    /**\r
-     * Index the artifacts in the list\r
-     *\r
-     * @param artifacts  the artifacts to be indexed\r
-     * @param indexPath  the path to the index file\r
-     * @param repository the repository where the artifacts are located\r
-     */\r
-    private void indexArtifact( List artifacts, String indexPath, ArtifactRepository repository )\r
-        throws RepositoryIndexException\r
-    {\r
-        ArtifactRepositoryIndex artifactIndex = indexFactory.createArtifactRepositoryIndex( indexPath, repository );\r
-        for ( Iterator iter = artifacts.iterator(); iter.hasNext(); )\r
-        {\r
-            Artifact artifact = (Artifact) iter.next();\r
-            try\r
-            {\r
-                artifactIndex.indexArtifact( artifact );\r
-            }\r
-            catch ( Exception e )\r
-            {\r
-                if ( e instanceof RepositoryIndexException )\r
-                {\r
-                    throw (RepositoryIndexException) e;\r
-                }\r
-            }\r
-\r
-            if ( artifactIndex.isOpen() )\r
-            {\r
-                artifactIndex.optimize();\r
-                artifactIndex.close();\r
-            }\r
-        }\r
-    }\r
-\r
-    /**\r
-     * Index the metadata in the list\r
-     *\r
-     * @param metadataList   the metadata to be indexed\r
-     * @param indexPath      the path to the index file\r
-     * @param repositoryBase the repository where the metadata are located\r
-     */\r
-    private void indexMetadata( List metadataList, String indexPath, File repositoryBase )\r
-        throws RepositoryIndexException, MalformedURLException\r
-    {\r
-        String repoDir = repositoryBase.toURL().toString();\r
-        ArtifactRepository repository = repoFactory\r
-            .createArtifactRepository( "repository", repoDir, layout, null, null );\r
-\r
-        MetadataRepositoryIndex metadataIndex = indexFactory.createMetadataRepositoryIndex( indexPath, repository );\r
-        for ( Iterator iter = metadataList.iterator(); iter.hasNext(); )\r
-        {\r
-            RepositoryMetadata repoMetadata = (RepositoryMetadata) iter.next();\r
-            try\r
-            {\r
-                metadataIndex.index( repoMetadata );\r
-            }\r
-            catch ( Exception e )\r
-            {\r
-                if ( e instanceof RepositoryIndexException )\r
-                {\r
-                    throw (RepositoryIndexException) e;\r
-                }\r
-            }\r
-            if ( metadataIndex.isOpen() )\r
-            {\r
-                metadataIndex.optimize();\r
-                metadataIndex.close();\r
-            }\r
-        }\r
-    }\r
-\r
-    /**\r
-     * Index the poms in the list\r
-     *\r
-     * @param models     list of poms that will be indexed\r
-     * @param indexPath  the path to the index\r
-     * @param repository the artifact repository where the poms were discovered\r
-     */\r
-    private void indexPom( List models, String indexPath, ArtifactRepository repository )\r
-        throws RepositoryIndexException\r
-    {\r
-        PomRepositoryIndex pomIndex = indexFactory.createPomRepositoryIndex( indexPath, repository );\r
-        for ( Iterator iter = models.iterator(); iter.hasNext(); )\r
-        {\r
-            Model model = (Model) iter.next();\r
-            try\r
-            {\r
-                pomIndex.indexPom( model );\r
-            }\r
-            catch ( Exception e )\r
-            {\r
-                if ( e instanceof RepositoryIndexException )\r
-                {\r
-                    throw (RepositoryIndexException) e;\r
-                }\r
-            }\r
-\r
-            if ( pomIndex.isOpen() )\r
-            {\r
-                pomIndex.optimize();\r
-                pomIndex.close();\r
-            }\r
-        }\r
-    }\r
-\r
 }\r
index acf062e95d878756211be4585427eec772b3c213..bc708234cde45b68bf8c34bd0e2d6d7ce74b4229 100644 (file)
@@ -28,6 +28,7 @@ import org.apache.maven.artifact.repository.DefaultArtifactRepositoryFactory;
 import org.apache.maven.repository.discovery.ArtifactDiscoverer;\r
 import org.apache.maven.repository.discovery.MetadataDiscoverer;\r
 import org.apache.maven.repository.indexing.RepositoryIndexingFactory;\r
+import org.apache.maven.repository.manager.web.execution.DiscovererExecution;\r
 import org.codehaus.plexus.logging.AbstractLogEnabled;\r
 import org.codehaus.plexus.scheduler.Scheduler;\r
 import org.quartz.CronTrigger;\r
@@ -53,32 +54,12 @@ public class DiscovererScheduler
      */\r
     private Scheduler scheduler;\r
 \r
-    /**\r
-     * @plexus.requirement role="org.apache.maven.repository.discovery.ArtifactDiscoverer" role-hint="org.apache.maven.repository.discovery.DefaultArtifactDiscoverer"\r
-     */\r
-    private ArtifactDiscoverer defaultArtifactDiscoverer;\r
-\r
-    /**\r
-     * @plexus.requirement role="org.apache.maven.repository.discovery.ArtifactDiscoverer" role-hint="org.apache.maven.repository.discovery.LegacyArtifactDiscoverer"\r
-     */\r
-    private ArtifactDiscoverer legacyArtifactDiscoverer;\r
-\r
-    /**\r
-     * @plexus.requirement role="org.apache.maven.repository.discovery.MetadataDiscoverer" role-hint="org.apache.maven.repository.discovery.DefaultMetadataDiscoverer"\r
-     */\r
-    private MetadataDiscoverer defaultMetadataDiscoverer;\r
-\r
-    /**\r
-     * @plexus.requirement\r
-     */\r
-    private RepositoryIndexingFactory indexFactory;\r
+    private Properties props;\r
 \r
     /**\r
      * @plexus.requirement\r
      */\r
-    private ArtifactRepositoryFactory repoFactory;\r
-\r
-    private Properties props;\r
+    private DiscovererExecution execution;\r
 \r
     /**\r
      * Method that sets the schedule in the plexus-quartz scheduler\r
@@ -94,40 +75,14 @@ public class DiscovererScheduler
         JobDetail jobDetail = new JobDetail( "discovererJob", "DISCOVERER", DiscovererJob.class );\r
         JobDataMap dataMap = new JobDataMap();\r
         dataMap.put( DiscovererJob.LOGGER, getLogger() );\r
-        dataMap.put( DiscovererJob.MAP_INDEXPATH, props.getProperty( "index.path" ) );\r
-        dataMap.put( DiscovererJob.MAP_BLACKLIST, props.getProperty( "blacklist.patterns" ) );\r
-        dataMap.put( DiscovererJob.MAP_DEFAULT_REPOSITORY, getDefaultRepository() );\r
-        dataMap.put( DiscovererJob.MAP_LAYOUT, props.getProperty( "layout" ) );\r
-        dataMap.put( DiscovererJob.MAP_SNAPSHOTS, new Boolean( props.getProperty( "include.snapshots" ) ) );\r
-        dataMap.put( DiscovererJob.MAP_CONVERT, new Boolean( props.getProperty( "convert.snapshots" ) ) );\r
-        dataMap.put( DiscovererJob.MAP_DEF_ARTIFACT_DISCOVERER, defaultArtifactDiscoverer );\r
-        dataMap.put( DiscovererJob.MAP_LEG_ARTIFACT_DISCOVERER, legacyArtifactDiscoverer );\r
-        dataMap.put( DiscovererJob.MAP_DEF_METADATA_DISCOVERER, defaultMetadataDiscoverer );\r
-        dataMap.put( DiscovererJob.MAP_IDX_FACTORY, indexFactory );\r
-        dataMap.put( DiscovererJob.MAP_REPO_LAYOUT, config.getLayout() );\r
-        dataMap.put( DiscovererJob.MAP_REPO_FACTORY, repoFactory );\r
+        dataMap.put( DiscovererJob.MAP_DISCOVERER_EXECUTION, execution );\r
         jobDetail.setJobDataMap( dataMap );\r
 \r
-        CronTrigger trigger = new CronTrigger( "DiscovererTrigger", "DISCOVERER", props.getProperty( "cron.expression" ) );\r
+        CronTrigger trigger =\r
+            new CronTrigger( "DiscovererTrigger", "DISCOVERER", props.getProperty( "cron.expression" ) );\r
         scheduler.scheduleJob( jobDetail, trigger );\r
     }\r
 \r
-    /**\r
-     * Method that creates the artifact repository\r
-     *\r
-     * @return an ArtifactRepository instance\r
-     * @throws java.net.MalformedURLException\r
-     */\r
-    private ArtifactRepository getDefaultRepository()\r
-        throws MalformedURLException\r
-    {\r
-        File repositoryDirectory = new File( config.getRepositoryDirectory() );\r
-        String repoDir = repositoryDirectory.toURL().toString();\r
-        ArtifactRepositoryFactory repoFactory = new DefaultArtifactRepositoryFactory();\r
-\r
-        return repoFactory.createArtifactRepository( "test", repoDir, config.getLayout(), null, null );\r
-    }\r
-\r
     /**\r
      * Method that sets the configuration object\r
      *\r
@@ -148,4 +103,5 @@ public class DiscovererScheduler
         return config;\r
     }\r
 \r
+\r
 }\r