From 9b278ded3b2024981f97111ecbaa0999f2c0be43 Mon Sep 17 00:00:00 2001 From: "Maria Odea B. Ching" Date: Thu, 1 Jun 2006 02:29:57 +0000 Subject: [PATCH] PR: MRM-114 Submitted by: Pete Marvin King Extended AbstractLogEnabled to get the Logger object that is used by the DiscovererJob. git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@410716 13f79535-47bb-0310-9956-ffa450edef68 --- .../manager/web/job/DiscovererJob.java | 11 ++++++----- .../manager/web/job/DiscovererScheduler.java | 18 ++++++++++-------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/DiscovererJob.java b/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/DiscovererJob.java index 49ceefa50..7e98023e9 100644 --- a/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/DiscovererJob.java +++ b/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/DiscovererJob.java @@ -98,9 +98,10 @@ public class DiscovererJob public void execute( JobExecutionContext context ) throws JobExecutionException { - getLogger().info( "Start execution of DiscovererJob.." ); JobDataMap dataMap = context.getJobDetail().getJobDataMap(); + setJobDataMap( dataMap ); + getLogger().info( "[DiscovererJob] Start execution of DiscovererJob.." ); //configuration values specified in properties file String indexPath = (String) dataMap.get( MAP_INDEXPATH ); ArtifactRepository defaultRepository = (ArtifactRepository) dataMap.get( MAP_DEFAULT_REPOSITORY ); @@ -129,8 +130,8 @@ public class DiscovererJob convertSnapshots ); indexPom( models, indexPath, defaultRepository ); - List metadataList = defaultMetadataDiscoverer.discoverMetadata( - new File( defaultRepository.getBasedir() ), blacklistedPatterns ); + List metadataList = defaultMetadataDiscoverer.discoverMetadata( new File( defaultRepository + .getBasedir() ), blacklistedPatterns ); indexMetadata( metadataList, indexPath, new File( defaultRepository.getBasedir() ) ); } else if ( dataMap.get( MAP_LAYOUT ).equals( "legacy" ) ) @@ -197,8 +198,8 @@ public class DiscovererJob throws RepositoryIndexException, MalformedURLException { String repoDir = repositoryBase.toURL().toString(); - ArtifactRepository repository = - repoFactory.createArtifactRepository( "repository", repoDir, layout, null, null ); + ArtifactRepository repository = repoFactory + .createArtifactRepository( "repository", repoDir, layout, null, null ); MetadataRepositoryIndex metadataIndex = indexFactory.createMetadataRepositoryIndex( indexPath, repository ); for ( Iterator iter = metadataList.iterator(); iter.hasNext(); ) 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 202c86714..acf062e95 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 @@ -16,30 +16,32 @@ package org.apache.maven.repository.manager.web.job; * limitations under the License. */ +import java.io.File; +import java.io.IOException; +import java.net.MalformedURLException; +import java.text.ParseException; +import java.util.Properties; + 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.repository.discovery.ArtifactDiscoverer; import org.apache.maven.repository.discovery.MetadataDiscoverer; import org.apache.maven.repository.indexing.RepositoryIndexingFactory; +import org.codehaus.plexus.logging.AbstractLogEnabled; import org.codehaus.plexus.scheduler.Scheduler; import org.quartz.CronTrigger; import org.quartz.JobDataMap; import org.quartz.JobDetail; import org.quartz.SchedulerException; -import java.io.File; -import java.io.IOException; -import java.net.MalformedURLException; -import java.text.ParseException; -import java.util.Properties; - /** * This class sets the job to be executed in the plexus-quartz scheduler * * @plexus.component role="org.apache.maven.repository.manager.web.job.DiscovererScheduler" */ public class DiscovererScheduler + extends AbstractLogEnabled { /** * @plexus.requirement @@ -91,6 +93,7 @@ public class DiscovererScheduler props = config.getProperties(); JobDetail jobDetail = new JobDetail( "discovererJob", "DISCOVERER", DiscovererJob.class ); JobDataMap dataMap = new JobDataMap(); + dataMap.put( DiscovererJob.LOGGER, getLogger() ); dataMap.put( DiscovererJob.MAP_INDEXPATH, props.getProperty( "index.path" ) ); dataMap.put( DiscovererJob.MAP_BLACKLIST, props.getProperty( "blacklist.patterns" ) ); dataMap.put( DiscovererJob.MAP_DEFAULT_REPOSITORY, getDefaultRepository() ); @@ -105,8 +108,7 @@ public class DiscovererScheduler dataMap.put( DiscovererJob.MAP_REPO_FACTORY, repoFactory ); jobDetail.setJobDataMap( dataMap ); - CronTrigger trigger = - new CronTrigger( "DiscovererTrigger", "DISCOVERER", props.getProperty( "cron.expression" ) ); + CronTrigger trigger = new CronTrigger( "DiscovererTrigger", "DISCOVERER", props.getProperty( "cron.expression" ) ); scheduler.scheduleJob( jobDetail, trigger ); }