001package org.apache.archiva.repository.scanner; 002 003/* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 */ 021 022import org.apache.archiva.consumers.InvalidRepositoryContentConsumer; 023import org.apache.archiva.consumers.KnownRepositoryContentConsumer; 024import org.apache.archiva.repository.ManagedRepository; 025 026import java.util.List; 027import java.util.Set; 028 029import static org.apache.archiva.indexer.ArchivaIndexManager.DEFAULT_INDEX_PATH; 030import static org.apache.archiva.indexer.ArchivaIndexManager.DEFAULT_PACKED_INDEX_PATH; 031 032/** 033 * RepositoryScanner 034 * 035 * 036 */ 037public interface RepositoryScanner 038{ 039 /** 040 * The value to pass to {@link #scan(ManagedRepository, long)} to have the scan 041 * operate in a fresh fashion, with no check on changes based on timestamp. 042 */ 043 long FRESH_SCAN = 0; 044 045 /** 046 * <p> 047 * Typical Ignorable Content patterns. 048 * </p> 049 * <p><strong> 050 * NOTE: Do not use for normal webapp or task driven repository scanning. 051 * </strong></p> 052 * <p> 053 * These patterns are only valid for archiva-cli and archiva-converter use. 054 * </p> 055 */ 056 static final String[] IGNORABLE_CONTENT = 057 { "bin/**", "reports/**", DEFAULT_PACKED_INDEX_PATH, ".reports/**", ".maven/**", "**/.svn/**", "**/*snapshot-version", 058 "*/website/**", "*/licences/**", "**/.htaccess", "**/*.html", "**/*.txt", "**/README*", "**/CHANGELOG*", 059 "**/KEYS*", DEFAULT_INDEX_PATH }; 060 061 /** 062 * Scan the repository for content changes. 063 * <p> 064 * Internally, this will use the as-configured known and invalid consumer lists. 065 * 066 * @param repository the repository to change. 067 * @param changesSince the timestamp to use as a threshold on what is considered new or changed. 068 * (To have all content be taken into consideration regardless of timestamp, 069 * use the {@link #FRESH_SCAN} constant) 070 * @return the statistics for this scan. 071 * @throws RepositoryScannerException if there was a fundamental problem with getting the discoverer started. 072 */ 073 RepositoryScanStatistics scan( ManagedRepository repository, long changesSince ) 074 throws RepositoryScannerException; 075 076 /** 077 * Scan the repository for content changes. 078 * <p> 079 * Internally, this will use the as-configured known and invalid consumer lists. 080 * 081 * @param repository the repository to change. 082 * @param knownContentConsumers the list of consumers that follow the {@link KnownRepositoryContentConsumer} 083 * interface that should be used for this scan. 084 * @param invalidContentConsumers the list of consumers that follow the {@link InvalidRepositoryContentConsumer} 085 * interface that should be used for this scan. 086 * @param ignoredContentPatterns list of patterns that should be ignored and not sent to any consumer. 087 * @param changesSince the timestamp to use as a threshold on what is considered new or changed. 088 * (To have all content be taken into consideration regardless of timestamp, 089 * use the {@link #FRESH_SCAN} constant) 090 * @return the statistics for this scan. 091 * @throws RepositoryScannerException if there was a fundamental problem with getting the discoverer started. 092 */ 093 RepositoryScanStatistics scan( ManagedRepository repository, 094 List<KnownRepositoryContentConsumer> knownContentConsumers, 095 List<InvalidRepositoryContentConsumer> invalidContentConsumers, 096 List<String> ignoredContentPatterns, long changesSince ) 097 throws RepositoryScannerException; 098 099 Set<RepositoryScannerInstance> getInProgressScans(); 100}