001package org.eclipse.aether.repository; 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.artifact.Artifact; 024import org.eclipse.aether.metadata.Metadata; 025 026/** 027 * Manages access to a local repository. 028 * 029 * @see RepositorySystemSession#getLocalRepositoryManager() 030 * @see org.eclipse.aether.RepositorySystem#newLocalRepositoryManager(RepositorySystemSession, LocalRepository) 031 */ 032public interface LocalRepositoryManager 033{ 034 035 /** 036 * Gets the description of the local repository being managed. 037 * 038 * @return The description of the local repository, never {@code null}. 039 */ 040 LocalRepository getRepository(); 041 042 /** 043 * Gets the relative path for a locally installed artifact. Note that the artifact need not actually exist yet at 044 * the returned location, the path merely indicates where the artifact would eventually be stored. The path uses the 045 * forward slash as directory separator regardless of the underlying file system. 046 * 047 * @param artifact The artifact for which to determine the path, must not be {@code null}. 048 * @return The path, relative to the local repository's base directory. 049 */ 050 String getPathForLocalArtifact( Artifact artifact ); 051 052 /** 053 * Gets the relative path for an artifact cached from a remote repository. Note that the artifact need not actually 054 * exist yet at the returned location, the path merely indicates where the artifact would eventually be stored. The 055 * path uses the forward slash as directory separator regardless of the underlying file system. 056 * 057 * @param artifact The artifact for which to determine the path, must not be {@code null}. 058 * @param repository The source repository of the artifact, must not be {@code null}. 059 * @param context The resolution context in which the artifact is being requested, may be {@code null}. 060 * @return The path, relative to the local repository's base directory. 061 */ 062 String getPathForRemoteArtifact( Artifact artifact, RemoteRepository repository, String context ); 063 064 /** 065 * Gets the relative path for locally installed metadata. Note that the metadata need not actually exist yet at the 066 * returned location, the path merely indicates where the metadata would eventually be stored. The path uses the 067 * forward slash as directory separator regardless of the underlying file system. 068 * 069 * @param metadata The metadata for which to determine the path, must not be {@code null}. 070 * @return The path, relative to the local repository's base directory. 071 */ 072 String getPathForLocalMetadata( Metadata metadata ); 073 074 /** 075 * Gets the relative path for metadata cached from a remote repository. Note that the metadata need not actually 076 * exist yet at the returned location, the path merely indicates where the metadata would eventually be stored. The 077 * path uses the forward slash as directory separator regardless of the underlying file system. 078 * 079 * @param metadata The metadata for which to determine the path, must not be {@code null}. 080 * @param repository The source repository of the metadata, must not be {@code null}. 081 * @param context The resolution context in which the metadata is being requested, may be {@code null}. 082 * @return The path, relative to the local repository's base directory. 083 */ 084 String getPathForRemoteMetadata( Metadata metadata, RemoteRepository repository, String context ); 085 086 /** 087 * Queries for the existence of an artifact in the local repository. The request could be satisfied by a locally 088 * installed artifact or a previously downloaded artifact. 089 * 090 * @param session The repository system session during which the request is made, must not be {@code null}. 091 * @param request The artifact request, must not be {@code null}. 092 * @return The result of the request, never {@code null}. 093 */ 094 LocalArtifactResult find( RepositorySystemSession session, LocalArtifactRequest request ); 095 096 /** 097 * Registers an installed or resolved artifact with the local repository. Note that artifact registration is merely 098 * concerned about updating the local repository's internal state, not about actually installing the artifact or its 099 * accompanying metadata. 100 * 101 * @param session The repository system session during which the registration is made, must not be {@code null}. 102 * @param request The registration request, must not be {@code null}. 103 */ 104 void add( RepositorySystemSession session, LocalArtifactRegistration request ); 105 106 /** 107 * Queries for the existence of metadata in the local repository. The request could be satisfied by locally 108 * installed or previously downloaded metadata. 109 * 110 * @param session The repository system session during which the request is made, must not be {@code null}. 111 * @param request The metadata request, must not be {@code null}. 112 * @return The result of the request, never {@code null}. 113 */ 114 LocalMetadataResult find( RepositorySystemSession session, LocalMetadataRequest request ); 115 116 /** 117 * Registers installed or resolved metadata with the local repository. Note that metadata registration is merely 118 * concerned about updating the local repository's internal state, not about actually installing the metadata. 119 * However, this method MUST be called after the actual install to give the repository manager the opportunity to 120 * inspect the added metadata. 121 * 122 * @param session The repository system session during which the registration is made, must not be {@code null}. 123 * @param request The registration request, must not be {@code null}. 124 */ 125 void add( RepositorySystemSession session, LocalMetadataRegistration request ); 126 127}