View Javadoc
1   package org.eclipse.aether.spi.connector.filter;
2   
3   /*
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
11   *
12   *  http://www.apache.org/licenses/LICENSE-2.0
13   *
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
19   * under the License.
20   */
21  
22  import org.eclipse.aether.artifact.Artifact;
23  import org.eclipse.aether.metadata.Metadata;
24  import org.eclipse.aether.repository.RemoteRepository;
25  
26  /**
27   * Remote repository filter that decides should the given artifact or metadata be accepted (for further processing)
28   * from remote repository or not.
29   *
30   * @since 1.9.0
31   */
32  public interface RemoteRepositoryFilter
33  {
34      /**
35       * The check result, is immutable.
36       */
37      interface Result
38      {
39          /**
40           * Returns {@code true} if accepted.
41           */
42          boolean isAccepted();
43  
44          /**
45           * Returns string "reasoning" for {@link #isAccepted()} result, meant for human consumption, never {@code null}.
46           */
47          String reasoning();
48      }
49  
50      /**
51       * Decides should artifact be accepted from given remote repository.
52       *
53       * @param remoteRepository The remote repository, not {@code null}.
54       * @param artifact         The artifact, not {@code null}.
55       * @return the result, never {@code null}.
56       */
57      Result acceptArtifact( RemoteRepository remoteRepository, Artifact artifact );
58  
59      /**
60       * Decides should metadata be accepted from given remote repository.
61       *
62       * @param remoteRepository The remote repository, not {@code null}.
63       * @param metadata         The artifact, not {@code null}.
64       * @return the result, never {@code null}.
65       */
66      Result acceptMetadata( RemoteRepository remoteRepository, Metadata metadata );
67  }