1 package org.apache.archiva.indexer.merger.base; 2 3 /* 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 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 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 19 * under the License. 20 */ 21 22 import org.apache.archiva.indexer.ArchivaIndexingContext; 23 import org.apache.archiva.indexer.merger.IndexMerger; 24 import org.apache.archiva.indexer.merger.IndexMergerException; 25 import org.slf4j.Logger; 26 import org.slf4j.LoggerFactory; 27 28 /** 29 * @author Olivier Lamy 30 * @since 2.0.0 31 */ 32 public class MergedRemoteIndexesTask 33 implements Runnable 34 { 35 36 private Logger logger = LoggerFactory.getLogger( getClass() ); 37 38 private MergedRemoteIndexesTaskRequest mergedRemoteIndexesTaskRequest; 39 40 public MergedRemoteIndexesTask( MergedRemoteIndexesTaskRequest mergedRemoteIndexesTaskRequest ) 41 { 42 this.mergedRemoteIndexesTaskRequest = mergedRemoteIndexesTaskRequest; 43 } 44 45 @Override 46 public void run() 47 { 48 try 49 { 50 this.execute(); 51 } 52 catch ( IndexMergerException e ) 53 { 54 logger.error( e.getMessage(), e ); 55 } 56 } 57 58 public MergedRemoteIndexesTaskResult execute() 59 throws IndexMergerException 60 { 61 IndexMerger indexMerger = mergedRemoteIndexesTaskRequest.getIndexMerger(); 62 63 ArchivaIndexingContext indexingContext = 64 indexMerger.buildMergedIndex( mergedRemoteIndexesTaskRequest.getIndexMergerRequest() ); 65 66 return new MergedRemoteIndexesTaskResult( indexingContext ); 67 } 68 69 @Override 70 public boolean equals( Object o ) 71 { 72 if ( this == o ) 73 { 74 return true; 75 } 76 if ( !( o instanceof MergedRemoteIndexesTask ) ) 77 { 78 return false; 79 } 80 81 MergedRemoteIndexesTask../org/apache/archiva/indexer/merger/base/MergedRemoteIndexesTask.html#MergedRemoteIndexesTask">MergedRemoteIndexesTask that = (MergedRemoteIndexesTask) o; 82 83 return mergedRemoteIndexesTaskRequest.equals( that.mergedRemoteIndexesTaskRequest ); 84 } 85 86 @Override 87 public int hashCode() 88 { 89 return mergedRemoteIndexesTaskRequest.hashCode(); 90 } 91 }