mirror of https://github.com/apache/archiva.git
refactoring to ease cron scheduling
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1551472 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
dcd4afcdb8
commit
b67de4117e
|
@ -32,20 +32,33 @@ import java.io.File;
|
||||||
* @author Olivier Lamy
|
* @author Olivier Lamy
|
||||||
* @since 2.0.0
|
* @since 2.0.0
|
||||||
*/
|
*/
|
||||||
public class MergedRemoteIndexesTaskJob
|
public class MergedRemoteIndexesTask
|
||||||
extends AbstractJob
|
implements Runnable
|
||||||
{
|
{
|
||||||
|
|
||||||
private Logger logger = LoggerFactory.getLogger( getClass() );
|
private Logger logger = LoggerFactory.getLogger( getClass() );
|
||||||
|
|
||||||
@Override
|
private MergedRemoteIndexesTaskRequest mergedRemoteIndexesTaskRequest;
|
||||||
public void execute( JobExecutionContext context )
|
|
||||||
throws JobExecutionException
|
|
||||||
{
|
|
||||||
|
|
||||||
|
public MergedRemoteIndexesTask( MergedRemoteIndexesTaskRequest mergedRemoteIndexesTaskRequest )
|
||||||
|
{
|
||||||
|
this.mergedRemoteIndexesTaskRequest = mergedRemoteIndexesTaskRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MergedRemoteIndexesTaskResult execute( MergedRemoteIndexesTaskRequest mergedRemoteIndexesTaskRequest )
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this.execute();
|
||||||
|
}
|
||||||
|
catch ( IndexMergerException e )
|
||||||
|
{
|
||||||
|
logger.error( e.getMessage(), e );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public MergedRemoteIndexesTaskResult execute( )
|
||||||
throws IndexMergerException
|
throws IndexMergerException
|
||||||
{
|
{
|
||||||
IndexMerger indexMerger = mergedRemoteIndexesTaskRequest.indexMerger;
|
IndexMerger indexMerger = mergedRemoteIndexesTaskRequest.indexMerger;
|
|
@ -38,7 +38,7 @@ import org.apache.archiva.configuration.RepositoryGroupConfiguration;
|
||||||
import org.apache.archiva.indexer.merger.IndexMerger;
|
import org.apache.archiva.indexer.merger.IndexMerger;
|
||||||
import org.apache.archiva.indexer.merger.IndexMergerException;
|
import org.apache.archiva.indexer.merger.IndexMergerException;
|
||||||
import org.apache.archiva.indexer.merger.IndexMergerRequest;
|
import org.apache.archiva.indexer.merger.IndexMergerRequest;
|
||||||
import org.apache.archiva.indexer.merger.MergedRemoteIndexesTaskJob;
|
import org.apache.archiva.indexer.merger.MergedRemoteIndexesTask;
|
||||||
import org.apache.archiva.indexer.merger.TemporaryGroupIndex;
|
import org.apache.archiva.indexer.merger.TemporaryGroupIndex;
|
||||||
import org.apache.archiva.indexer.search.RepositorySearch;
|
import org.apache.archiva.indexer.search.RepositorySearch;
|
||||||
import org.apache.archiva.maven2.metadata.MavenMetadataReader;
|
import org.apache.archiva.maven2.metadata.MavenMetadataReader;
|
||||||
|
@ -72,7 +72,6 @@ import org.apache.archiva.repository.metadata.RepositoryMetadataWriter;
|
||||||
import org.apache.archiva.scheduler.repository.model.RepositoryArchivaTaskScheduler;
|
import org.apache.archiva.scheduler.repository.model.RepositoryArchivaTaskScheduler;
|
||||||
import org.apache.archiva.security.ServletAuthenticator;
|
import org.apache.archiva.security.ServletAuthenticator;
|
||||||
import org.apache.archiva.webdav.util.MimeTypes;
|
import org.apache.archiva.webdav.util.MimeTypes;
|
||||||
import org.apache.archiva.webdav.util.RepositoryPathUtil;
|
|
||||||
import org.apache.archiva.webdav.util.TemporaryGroupIndexSessionCleaner;
|
import org.apache.archiva.webdav.util.TemporaryGroupIndexSessionCleaner;
|
||||||
import org.apache.archiva.webdav.util.WebdavMethodUtil;
|
import org.apache.archiva.webdav.util.WebdavMethodUtil;
|
||||||
import org.apache.archiva.xml.XMLException;
|
import org.apache.archiva.xml.XMLException;
|
||||||
|
@ -1317,12 +1316,14 @@ public class ArchivaDavResourceFactory
|
||||||
repositoryGroupConfiguration.getMergedIndexTtl() ).mergedIndexDirectory(
|
repositoryGroupConfiguration.getMergedIndexTtl() ).mergedIndexDirectory(
|
||||||
tempRepoFile );
|
tempRepoFile );
|
||||||
|
|
||||||
MergedRemoteIndexesTaskJob job = new MergedRemoteIndexesTaskJob();
|
|
||||||
|
|
||||||
MergedRemoteIndexesTaskJob.MergedRemoteIndexesTaskRequest taskRequest =
|
|
||||||
new MergedRemoteIndexesTaskJob.MergedRemoteIndexesTaskRequest(indexMergerRequest, indexMerger);
|
|
||||||
|
|
||||||
IndexingContext indexingContext = job.execute( taskRequest ).getIndexingContext();
|
MergedRemoteIndexesTask.MergedRemoteIndexesTaskRequest taskRequest =
|
||||||
|
new MergedRemoteIndexesTask.MergedRemoteIndexesTaskRequest(indexMergerRequest, indexMerger);
|
||||||
|
|
||||||
|
MergedRemoteIndexesTask job = new MergedRemoteIndexesTask( taskRequest );
|
||||||
|
|
||||||
|
IndexingContext indexingContext = job.execute().getIndexingContext();
|
||||||
|
|
||||||
File mergedRepoDir = indexingContext.getIndexDirectoryFile();
|
File mergedRepoDir = indexingContext.getIndexDirectoryFile();
|
||||||
TemporaryGroupIndex temporaryGroupIndex =
|
TemporaryGroupIndex temporaryGroupIndex =
|
||||||
|
|
Loading…
Reference in New Issue