mirror of https://github.com/apache/archiva.git
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
This commit is contained in:
parent
cf102ca5ba
commit
9b278ded3b
|
@ -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(); )
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue