View Javadoc
1   package org.eclipse.aether.spi.localrepo;
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.RepositorySystemSession;
23  import org.eclipse.aether.repository.LocalRepository;
24  import org.eclipse.aether.repository.LocalRepositoryManager;
25  import org.eclipse.aether.repository.NoLocalRepositoryManagerException;
26  
27  /**
28   * A factory to create managers for the local repository. A local repository manager needs to keep track of artifacts
29   * and metadata and manage access. When the repository system needs a repository manager for a given local repository,
30   * it iterates the registered factories in descending order of their priority and calls
31   * {@link #newInstance(RepositorySystemSession, LocalRepository)} on them. The first manager returned by a factory will
32   * then be used for the local repository.
33   */
34  public interface LocalRepositoryManagerFactory
35  {
36  
37      /**
38       * Tries to create a repository manager for the specified local repository. The distinguishing property of a local
39       * repository is its {@link LocalRepository#getContentType() type}, which may for example denote the used directory
40       * structure.
41       * 
42       * @param session The repository system session from which to configure the manager, must not be {@code null}.
43       * @param repository The local repository to create a manager for, must not be {@code null}.
44       * @return The manager for the given repository, never {@code null}.
45       * @throws NoLocalRepositoryManagerException If the factory cannot create a manager for the specified local
46       *             repository.
47       */
48      LocalRepositoryManager newInstance( RepositorySystemSession session, LocalRepository repository )
49          throws NoLocalRepositoryManagerException;
50  
51      /**
52       * The priority of this factory. Factories with higher priority are preferred over those with lower priority.
53       * 
54       * @return The priority of this factory.
55       */
56      float getPriority();
57  
58  }