1 /*******************************************************************************
2 * Copyright (c) 2010, 2013 Sonatype, Inc.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
9 * Sonatype, Inc. - initial API and implementation
10 *******************************************************************************/
11 package org
.eclipse
.aether
.repository
;
13 import org
.eclipse
.aether
.RepositorySystemSession
;
14 import org
.eclipse
.aether
.artifact
.Artifact
;
15 import org
.eclipse
.aether
.metadata
.Metadata
;
18 * Manages access to a local repository.
20 * @see RepositorySystemSession#getLocalRepositoryManager()
21 * @see org.eclipse.aether.RepositorySystem#newLocalRepositoryManager(RepositorySystemSession, LocalRepository)
23 public interface LocalRepositoryManager
27 * Gets the description of the local repository being managed.
29 * @return The description of the local repository, never {@code null}.
31 LocalRepository
getRepository();
34 * Gets the relative path for a locally installed artifact. Note that the artifact need not actually exist yet at
35 * the returned location, the path merely indicates where the artifact would eventually be stored. The path uses the
36 * forward slash as directory separator regardless of the underlying file system.
38 * @param artifact The artifact for which to determine the path, must not be {@code null}.
39 * @return The path, relative to the local repository's base directory.
41 String
getPathForLocalArtifact( Artifact artifact
);
44 * Gets the relative path for an artifact cached from a remote repository. Note that the artifact need not actually
45 * exist yet at the returned location, the path merely indicates where the artifact would eventually be stored. The
46 * path uses the forward slash as directory separator regardless of the underlying file system.
48 * @param artifact The artifact for which to determine the path, must not be {@code null}.
49 * @param repository The source repository of the artifact, must not be {@code null}.
50 * @param context The resolution context in which the artifact is being requested, may be {@code null}.
51 * @return The path, relative to the local repository's base directory.
53 String
getPathForRemoteArtifact( Artifact artifact
, RemoteRepository repository
, String context
);
56 * Gets the relative path for locally installed metadata. Note that the metadata need not actually exist yet at the
57 * returned location, the path merely indicates where the metadata would eventually be stored. The path uses the
58 * forward slash as directory separator regardless of the underlying file system.
60 * @param metadata The metadata for which to determine the path, must not be {@code null}.
61 * @return The path, relative to the local repository's base directory.
63 String
getPathForLocalMetadata( Metadata metadata
);
66 * Gets the relative path for metadata cached from a remote repository. Note that the metadata need not actually
67 * exist yet at the returned location, the path merely indicates where the metadata would eventually be stored. The
68 * path uses the forward slash as directory separator regardless of the underlying file system.
70 * @param metadata The metadata for which to determine the path, must not be {@code null}.
71 * @param repository The source repository of the metadata, must not be {@code null}.
72 * @param context The resolution context in which the metadata is being requested, may be {@code null}.
73 * @return The path, relative to the local repository's base directory.
75 String
getPathForRemoteMetadata( Metadata metadata
, RemoteRepository repository
, String context
);
78 * Queries for the existence of an artifact in the local repository. The request could be satisfied by a locally
79 * installed artifact or a previously downloaded artifact.
81 * @param session The repository system session during which the request is made, must not be {@code null}.
82 * @param request The artifact request, must not be {@code null}.
83 * @return The result of the request, never {@code null}.
85 LocalArtifactResult
find( RepositorySystemSession session
, LocalArtifactRequest request
);
88 * Registers an installed or resolved artifact with the local repository. Note that artifact registration is merely
89 * concerned about updating the local repository's internal state, not about actually installing the artifact or its
90 * accompanying metadata.
92 * @param session The repository system session during which the registration is made, must not be {@code null}.
93 * @param request The registration request, must not be {@code null}.
95 void add( RepositorySystemSession session
, LocalArtifactRegistration request
);
98 * Queries for the existence of metadata in the local repository. The request could be satisfied by locally
99 * installed or previously downloaded metadata.
101 * @param session The repository system session during which the request is made, must not be {@code null}.
102 * @param request The metadata request, must not be {@code null}.
103 * @return The result of the request, never {@code null}.
105 LocalMetadataResult
find( RepositorySystemSession session
, LocalMetadataRequest request
);
108 * Registers installed or resolved metadata with the local repository. Note that metadata registration is merely
109 * concerned about updating the local repository's internal state, not about actually installing the metadata.
110 * However, this method MUST be called after the actual install to give the repository manager the opportunity to
111 * inspect the added metadata.
113 * @param session The repository system session during which the registration is made, must not be {@code null}.
114 * @param request The registration request, must not be {@code null}.
116 void add( RepositorySystemSession session
, LocalMetadataRegistration request
);