1 package org.apache.archiva.indexer.merger;
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
22 import org.apache.archiva.redback.components.scheduler.AbstractJob;
23 import org.apache.maven.index.context.IndexingContext;
24 import org.quartz.JobExecutionContext;
25 import org.quartz.JobExecutionException;
26 import org.slf4j.Logger;
27 import org.slf4j.LoggerFactory;
32 * @author Olivier Lamy
35 public class MergedRemoteIndexesTask
39 private Logger logger = LoggerFactory.getLogger( getClass() );
41 private MergedRemoteIndexesTaskRequest mergedRemoteIndexesTaskRequest;
43 public MergedRemoteIndexesTask( MergedRemoteIndexesTaskRequest mergedRemoteIndexesTaskRequest )
45 this.mergedRemoteIndexesTaskRequest = mergedRemoteIndexesTaskRequest;
55 catch ( IndexMergerException e )
57 logger.error( e.getMessage(), e );
61 public MergedRemoteIndexesTaskResult execute( )
62 throws IndexMergerException
64 IndexMerger indexMerger = mergedRemoteIndexesTaskRequest.indexMerger;
66 IndexingContext indexingContext =
67 indexMerger.buildMergedIndex( mergedRemoteIndexesTaskRequest.indexMergerRequest );
69 return new MergedRemoteIndexesTaskResult( indexingContext );
72 public static class MergedRemoteIndexesTaskRequest
74 private IndexMergerRequest indexMergerRequest;
76 private IndexMerger indexMerger;
78 public MergedRemoteIndexesTaskRequest( IndexMergerRequest indexMergerRequest, IndexMerger indexMerger )
80 this.indexMergerRequest = indexMergerRequest;
81 this.indexMerger = indexMerger;
84 public IndexMergerRequest getIndexMergerRequest()
86 return indexMergerRequest;
89 public void setIndexMergerRequest( IndexMergerRequest indexMergerRequest )
91 this.indexMergerRequest = indexMergerRequest;
94 public IndexMerger getIndexMerger()
99 public void setIndexMerger( IndexMerger indexMerger )
101 this.indexMerger = indexMerger;
105 public static class MergedRemoteIndexesTaskResult
107 private IndexingContext indexingContext;
109 public MergedRemoteIndexesTaskResult( IndexingContext indexingContext )
111 this.indexingContext = indexingContext;
114 public IndexingContext getIndexingContext()
116 return indexingContext;
119 public void setIndexingContext( IndexingContext indexingContext )
121 this.indexingContext = indexingContext;