View Javadoc
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.connector;
20  
21  import org.eclipse.aether.RepositorySystemSession;
22  import org.eclipse.aether.repository.RemoteRepository;
23  
24  /**
25   * A pipeline factory to create piped repository connectors.
26   *
27   * @since 2.0.8
28   */
29  public interface PipelineRepositoryConnectorFactory {
30  
31      /**
32       * Create a piped repository connector for the specified remote repository. Typically, a factory will inspect
33       * {@link RemoteRepository#getProtocol()} and {@link RemoteRepository#getContentType()} to determine whether it can
34       * handle a repository. This method never throws or returns {@code null}, least can do is to return the passed in
35       * delegate connector instance.
36       *
37       * @param session The repository system session from which to configure the connector, must not be {@code null}. In
38       *            particular, a connector must notify any {@link RepositorySystemSession#getTransferListener()} set for
39       *            the session and should obey the timeouts configured for the session.
40       * @param repository The remote repository to create a connector for, must not be {@code null}.
41       * @param delegate The delegate connector, never {@code null}. The delegate is "right hand" connector in connector
42       *                 pipeline.
43       * @return The connector for the given repository, never {@code null}. If pipeline wants to step aside, it must
44       * return the passed in delegate connector instance.
45       */
46      RepositoryConnector newInstance(
47              RepositorySystemSession session, RemoteRepository repository, RepositoryConnector delegate);
48  
49      /**
50       * The priority of this pipeline factory. Higher priority makes connector closer to right end (tail) of pipeline
51       * (closest to delegate), while lower priority makes it closer to left hand (head) of the pipeline.
52       */
53      float getPriority();
54  }