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.admin.model.beans.ManagedRepository; 023import org.apache.archiva.consumers.InvalidRepositoryContentConsumer; 024import org.apache.archiva.consumers.KnownRepositoryContentConsumer; 025 026import java.util.List; 027import java.util.Set; 028 029/** 030 * RepositoryScanner 031 * 032 * 033 */ 034public interface RepositoryScanner 035{ 036 /** 037 * The value to pass to {@link #scan(ManagedRepository, long)} to have the scan 038 * operate in a fresh fashion, with no check on changes based on timestamp. 039 */ 040 long FRESH_SCAN = 0; 041 042 /** 043 * <p> 044 * Typical Ignorable Content patterns. 045 * </p> 046 * <p><strong> 047 * NOTE: Do not use for normal webapp or task driven repository scanning. 048 * </strong></p> 049 * <p> 050 * These patterns are only valid for archiva-cli and archiva-converter use. 051 * </p> 052 */ 053 static final String[] IGNORABLE_CONTENT = 054 { "bin/**", "reports/**", ".index", ".reports/**", ".maven/**", "**/.svn/**", "**/*snapshot-version", 055 "*/website/**", "*/licences/**", "**/.htaccess", "**/*.html", "**/*.txt", "**/README*", "**/CHANGELOG*", 056 "**/KEYS*", ".indexer" }; 057 058 /** 059 * Scan the repository for content changes. 060 * <p> 061 * Internally, this will use the as-configured known and invalid consumer lists. 062 * 063 * @param repository the repository to change. 064 * @param changesSince the timestamp to use as a threshold on what is considered new or changed. 065 * (To have all content be taken into consideration regardless of timestamp, 066 * use the {@link #FRESH_SCAN} constant) 067 * @return the statistics for this scan. 068 * @throws RepositoryScannerException if there was a fundamental problem with getting the discoverer started. 069 */ 070 RepositoryScanStatistics scan( ManagedRepository repository, long changesSince ) 071 throws RepositoryScannerException; 072 073 /** 074 * Scan the repository for content changes. 075 * <p> 076 * Internally, this will use the as-configured known and invalid consumer lists. 077 * 078 * @param repository the repository to change. 079 * @param knownContentConsumers the list of consumers that follow the {@link KnownRepositoryContentConsumer} 080 * interface that should be used for this scan. 081 * @param invalidContentConsumers the list of consumers that follow the {@link InvalidRepositoryContentConsumer} 082 * interface that should be used for this scan. 083 * @param ignoredContentPatterns list of patterns that should be ignored and not sent to any consumer. 084 * @param changesSince the timestamp to use as a threshold on what is considered new or changed. 085 * (To have all content be taken into consideration regardless of timestamp, 086 * use the {@link #FRESH_SCAN} constant) 087 * @return the statistics for this scan. 088 * @throws RepositoryScannerException if there was a fundamental problem with getting the discoverer started. 089 */ 090 RepositoryScanStatistics scan( ManagedRepository repository, 091 List<KnownRepositoryContentConsumer> knownContentConsumers, 092 List<InvalidRepositoryContentConsumer> invalidContentConsumers, 093 List<String> ignoredContentPatterns, long changesSince ) 094 throws RepositoryScannerException; 095 096 Set<RepositoryScannerInstance> getInProgressScans(); 097}