1 package org.apache.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.archiva.admin.model.beans.ManagedRepository;
24 import java.util.Date;
25 import java.util.List;
28 * A consumer of content (files) in the repository.
32 public interface RepositoryContentConsumer
36 * Get the list of included file patterns for this consumer.
38 * @return the list of {@link String} patterns. (example: <code>"**<span />/*.pom"</code>)
40 List<String> getIncludes();
43 * Get the list of excluded file patterns for this consumer.
45 * @return the list of {@link String} patterns. (example: <code>"**<span />/*.pom"</code>) - (can be null for no exclusions)
47 List<String> getExcludes();
51 * Event that triggers at the beginning of a scan.
55 * NOTE: This would be a good place to initialize the consumer, to lock any resources, and to
56 * generally start tracking the scan as a whole.
59 * @param repository the repository that this consumer is being used for.
60 * @param whenGathered the start of the repository scan
61 * @throws ConsumerException if there was a problem with using the provided repository with the consumer.
63 void beginScan( ManagedRepository repository, Date whenGathered )
64 throws ConsumerException;
68 * Event that triggers at the beginning of a scan, where you can also indicate whether the consumers will be
69 * executed on an entire repository or on a specific resource.
72 * @param repository the repository that this consumer is being used for.
73 * @param whenGathered the start of the repository scan
74 * @param executeOnEntireRepo flags whether the consumer will be executed on an entire repository or just on a specific resource
75 * @throws ConsumerException if there was a problem with using the provided repository with the consumer.
76 * @see RepositoryContentConsumer#beginScan(ManagedRepository, java.util.Date)
78 void beginScan( ManagedRepository repository, Date whenGathered, boolean executeOnEntireRepo )
79 throws ConsumerException;
83 * Event indicating a file is to be processed by this consumer.
87 * NOTE: The consumer does not need to process the file immediately, can can opt to queue and/or track
88 * the files to be processed in batch. Just be sure to complete the processing by the {@link #completeScan()}
92 * @param path the relative file path (in the repository) to process.
93 * @throws ConsumerException if there was a problem processing this file.
95 void processFile( String path )
96 throws ConsumerException;
100 * @param executeOnEntireRepo
103 void processFile( String path, boolean executeOnEntireRepo )
108 * Event that triggers on the completion of a scan.
112 * NOTE: If the consumer opted to batch up processing requests in the {@link #processFile(String)} event
113 * this would be the last opportunity to drain any processing queue's.
119 * @param executeOnEntireRepo
122 void completeScan( boolean executeOnEntireRepo );
125 * Whether the consumer should process files that have not been modified since the time passed in to the scan
128 * @return whether to process the unmodified files
130 boolean isProcessUnmodified();