001package org.eclipse.aether.spi.localrepo;
002
003/*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements.  See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership.  The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License.  You may obtain a copy of the License at
011 * 
012 *  http://www.apache.org/licenses/LICENSE-2.0
013 * 
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied.  See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021
022import org.eclipse.aether.RepositorySystemSession;
023import org.eclipse.aether.repository.LocalRepository;
024import org.eclipse.aether.repository.LocalRepositoryManager;
025import org.eclipse.aether.repository.NoLocalRepositoryManagerException;
026
027/**
028 * A factory to create managers for the local repository. A local repository manager needs to keep track of artifacts
029 * and metadata and manage access. When the repository system needs a repository manager for a given local repository,
030 * it iterates the registered factories in descending order of their priority and calls
031 * {@link #newInstance(RepositorySystemSession, LocalRepository)} on them. The first manager returned by a factory will
032 * then be used for the local repository.
033 */
034public interface LocalRepositoryManagerFactory
035{
036
037    /**
038     * Tries to create a repository manager for the specified local repository. The distinguishing property of a local
039     * repository is its {@link LocalRepository#getContentType() type}, which may for example denote the used directory
040     * structure.
041     * 
042     * @param session The repository system session from which to configure the manager, must not be {@code null}.
043     * @param repository The local repository to create a manager for, must not be {@code null}.
044     * @return The manager for the given repository, never {@code null}.
045     * @throws NoLocalRepositoryManagerException If the factory cannot create a manager for the specified local
046     *             repository.
047     */
048    LocalRepositoryManager newInstance( RepositorySystemSession session, LocalRepository repository )
049        throws NoLocalRepositoryManagerException;
050
051    /**
052     * The priority of this factory. Factories with higher priority are preferred over those with lower priority.
053     * 
054     * @return The priority of this factory.
055     */
056    float getPriority();
057
058}