1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 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 17 * under the License. 18 */ 19 package org.eclipse.aether.spi.validator; 20 21 import org.eclipse.aether.artifact.Artifact; 22 import org.eclipse.aether.graph.Dependency; 23 import org.eclipse.aether.metadata.Metadata; 24 import org.eclipse.aether.repository.LocalRepository; 25 import org.eclipse.aether.repository.RemoteRepository; 26 27 /** 28 * A repository system main input validator; this validator is used in repository system "main entry methods". 29 * 30 * @since 2.0.8 31 */ 32 public interface Validator { 33 /** 34 * Validates artifact. 35 * 36 * @param artifact The artifact to validate, never {@code null}. 37 * @throws IllegalArgumentException if artifact is invalid. 38 */ 39 default void validateArtifact(Artifact artifact) throws IllegalArgumentException {} 40 41 /** 42 * Validates metadata. 43 * 44 * @param metadata The metadata to validate, never {@code null}. 45 * @throws IllegalArgumentException if artifact is invalid. 46 */ 47 default void validateMetadata(Metadata metadata) throws IllegalArgumentException {} 48 49 /** 50 * Validates dependency. 51 * 52 * @param dependency The dependency to validate, never {@code null}. 53 * @throws IllegalArgumentException if dependency is invalid. 54 */ 55 default void validateDependency(Dependency dependency) throws IllegalArgumentException {} 56 57 /** 58 * Validates local repository. 59 * 60 * @param localRepository The local repository to validate, never {@code null}. 61 * @throws IllegalArgumentException if local repository is invalid. 62 */ 63 default void validateLocalRepository(LocalRepository localRepository) throws IllegalArgumentException {} 64 65 /** 66 * Validates remote repository. 67 * 68 * @param remoteRepository The remote repository to validate, never {@code null}. 69 * @throws IllegalArgumentException if remote repository is invalid. 70 */ 71 default void validateRemoteRepository(RemoteRepository remoteRepository) throws IllegalArgumentException {} 72 }