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