1 package org.apache.maven.archiva.consumers;
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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
22 import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
24 import java.util.Date;
25 import java.util.List;
28 * A consumer of content (files) in the repository.
32 public interface RepositoryContentConsumer extends Consumer
35 * Get the list of included file patterns for this consumer.
37 * @return the list of {@link String} patterns. (example: <code>"**<span />/*.pom"</code>)
39 public List<String> getIncludes();
42 * Get the list of excluded file patterns for this consumer.
44 * @return the list of {@link String} patterns. (example: <code>"**<span />/*.pom"</code>) - (can be null for no exclusions)
46 public List<String> getExcludes();
50 * Event that triggers at the beginning of a scan.
54 * NOTE: This would be a good place to initialize the consumer, to lock any resources, and to
55 * generally start tracking the scan as a whole.
58 * @param repository the repository that this consumer is being used for.
59 * @param whenGathered the start of the repository scan
60 * @throws ConsumerException if there was a problem with using the provided repository with the consumer.
62 public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered ) throws ConsumerException;
66 * Event indicating a file is to be processed by this consumer.
70 * NOTE: The consumer does not need to process the file immediately, can can opt to queue and/or track
71 * the files to be processed in batch. Just be sure to complete the processing by the {@link #completeScan()}
75 * @param path the relative file path (in the repository) to process.
76 * @throws ConsumerException if there was a problem processing this file.
78 public void processFile( String path ) throws ConsumerException;
82 * Event that triggers on the completion of a scan.
86 * NOTE: If the consumer opted to batch up processing requests in the {@link #processFile(String)} event
87 * this would be the last opportunity to drain any processing queue's.
90 public void completeScan();
93 * Whether the consumer should process files that have not been modified since the time passed in to the scan
95 * @return whether to process the unmodified files
97 boolean isProcessUnmodified();