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