1 package org.apache.archiva.repository.validation;
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
20 import org.apache.archiva.repository.Repository;
21 import org.apache.archiva.repository.RepositoryRegistry;
22 import org.apache.archiva.repository.RepositoryType;
24 import java.util.List;
26 import java.util.function.Function;
29 * A repository validator validates given repository data against certain rules.
31 * @author Martin Stockhammer <martin_s@apache.org>
33 public interface RepositoryValidator<R extends Repository> extends RepositoryChecker<R, Map<String, List<ValidationError>>>, Comparable<RepositoryValidator<R>>
36 int DEFAULT_PRIORITY=1000;
39 * Returns the repository type for which this validator can be used. If the validator is applicable
40 * to all types, it should return {@link RepositoryType#ALL}
42 * @return the repository type for which this validator is applicable
44 default RepositoryType getType() {
45 return RepositoryType.ALL;
49 * Returns the priority of this validator. Smaller values mean higher priority.
50 * All common validators have priority {@link #DEFAULT_PRIORITY}
52 * Validators are called in numerical order of their priority.
56 default int getPriority() {
57 return DEFAULT_PRIORITY;
64 * @see Comparable#compareTo(Object)
67 default int compareTo( RepositoryValidator o ) {
72 return this.getPriority( ) - o.getPriority( );
77 * Sets the repository registry to the given instance.
78 * @param repositoryRegistry the repository registry
80 void setRepositoryRegistry( RepositoryRegistry repositoryRegistry );
82 Class<R> getFlavour();
84 boolean isFlavour(Class<?> clazz);