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 that triggers at the beginning of a scan, where you can also indicate whether the consumers will be
67 * executed on an entire repository or on a specific resource.
70 * @see RepositoryContentConsumer#beginScan(org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration, java.util.Date )
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.
77 public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo )
78 throws ConsumerException;
82 * Event indicating a file is to be processed by this consumer.
86 * NOTE: The consumer does not need to process the file immediately, can can opt to queue and/or track
87 * the files to be processed in batch. Just be sure to complete the processing by the {@link #completeScan()}
91 * @param path the relative file path (in the repository) to process.
92 * @throws ConsumerException if there was a problem processing this file.
94 public void processFile( String path ) throws ConsumerException;
99 * @param executeOnEntireRepo
102 public void processFile( String path, boolean executeOnEntireRepo ) throws Exception;
106 * Event that triggers on the completion of a scan.
110 * NOTE: If the consumer opted to batch up processing requests in the {@link #processFile(String)} event
111 * this would be the last opportunity to drain any processing queue's.
114 public void completeScan();
118 * @param executeOnEntireRepo
121 public void completeScan( boolean executeOnEntireRepo );
124 * Whether the consumer should process files that have not been modified since the time passed in to the scan
126 * @return whether to process the unmodified files
128 boolean isProcessUnmodified();