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.apache.maven.api.services;
20  
21  import org.apache.maven.api.RemoteRepository;
22  import org.apache.maven.api.Service;
23  import org.apache.maven.api.Session;
24  import org.apache.maven.api.annotations.Consumer;
25  import org.apache.maven.api.annotations.Experimental;
26  import org.apache.maven.api.annotations.Nonnull;
27  
28  /**
29   * Transporter provider is a service that provides somewhat trivial transport capabilities backed by Maven internals.
30   * This API does not try to cover all the requirements out there, just the basic ones, and is intentionally simple.
31   * If plugin or extension needs anything more complex feature wise (i.e. HTTP range support or alike) it should
32   * probably roll its own.
33   * <p>
34   * This implementation is backed by Maven Resolver API, supported protocols and transport selection depends on it. If
35   * resolver preference regarding transport is altered, it will affect this service as well.
36   *
37   * @since 4.0.0
38   */
39  @Experimental
40  @Consumer
41  public interface TransportProvider extends Service {
42      /**
43       * Provides new {@link Transport} instance for given {@link RemoteRepository}, if possible.
44       *
45       * @throws TransportProviderException if passed in remote repository has invalid remote URL or unsupported protocol.
46       */
47      @Nonnull
48      Transport transport(@Nonnull Session session, @Nonnull RemoteRepository repository);
49  }