1 package org.apache.archiva.repository.scanner;
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.consumers.InvalidRepositoryContentConsumer;
23 import org.apache.archiva.consumers.KnownRepositoryContentConsumer;
24 import org.apache.archiva.repository.ManagedRepository;
25
26 import java.util.List;
27 import java.util.Set;
28
29 import static org.apache.archiva.indexer.ArchivaIndexManager.DEFAULT_INDEX_PATH;
30 import static org.apache.archiva.indexer.ArchivaIndexManager.DEFAULT_PACKED_INDEX_PATH;
31
32 /**
33 * RepositoryScanner
34 *
35 *
36 */
37 public interface RepositoryScanner
38 {
39 /**
40 * The value to pass to {@link #scan(ManagedRepository, long)} to have the scan
41 * operate in a fresh fashion, with no check on changes based on timestamp.
42 */
43 long FRESH_SCAN = 0;
44
45 /**
46 * <p>
47 * Typical Ignorable Content patterns.
48 * </p>
49 * <p><strong>
50 * NOTE: Do not use for normal webapp or task driven repository scanning.
51 * </strong></p>
52 * <p>
53 * These patterns are only valid for archiva-cli and archiva-converter use.
54 * </p>
55 */
56 static final String[] IGNORABLE_CONTENT =
57 { "bin/**", "reports/**", DEFAULT_PACKED_INDEX_PATH, ".reports/**", ".maven/**", "**/.svn/**", "**/*snapshot-version",
58 "*/website/**", "*/licences/**", "**/.htaccess", "**/*.html", "**/*.txt", "**/README*", "**/CHANGELOG*",
59 "**/KEYS*", DEFAULT_INDEX_PATH };
60
61 /**
62 * Scan the repository for content changes.
63 * <p>
64 * Internally, this will use the as-configured known and invalid consumer lists.
65 *
66 * @param repository the repository to change.
67 * @param changesSince the timestamp to use as a threshold on what is considered new or changed.
68 * (To have all content be taken into consideration regardless of timestamp,
69 * use the {@link #FRESH_SCAN} constant)
70 * @return the statistics for this scan.
71 * @throws RepositoryScannerException if there was a fundamental problem with getting the discoverer started.
72 */
73 RepositoryScanStatistics scan( ManagedRepository repository, long changesSince )
74 throws RepositoryScannerException;
75
76 /**
77 * Scan the repository for content changes.
78 * <p>
79 * Internally, this will use the as-configured known and invalid consumer lists.
80 *
81 * @param repository the repository to change.
82 * @param knownContentConsumers the list of consumers that follow the {@link KnownRepositoryContentConsumer}
83 * interface that should be used for this scan.
84 * @param invalidContentConsumers the list of consumers that follow the {@link InvalidRepositoryContentConsumer}
85 * interface that should be used for this scan.
86 * @param ignoredContentPatterns list of patterns that should be ignored and not sent to any consumer.
87 * @param changesSince the timestamp to use as a threshold on what is considered new or changed.
88 * (To have all content be taken into consideration regardless of timestamp,
89 * use the {@link #FRESH_SCAN} constant)
90 * @return the statistics for this scan.
91 * @throws RepositoryScannerException if there was a fundamental problem with getting the discoverer started.
92 */
93 RepositoryScanStatistics scan( ManagedRepository repository,
94 List<KnownRepositoryContentConsumer> knownContentConsumers,
95 List<InvalidRepositoryContentConsumer> invalidContentConsumers,
96 List<String> ignoredContentPatterns, long changesSince )
97 throws RepositoryScannerException;
98
99 Set<RepositoryScannerInstance> getInProgressScans();
100 }