]> git.argeo.org Git - gpl/argeo-slc.git/blob - LocalRepositoryManager.java
d9d8777e6dc56abb83fe8bd8984d48853e57ac46
[gpl/argeo-slc.git] / LocalRepositoryManager.java
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
7 *
8 * Contributors:
9 * Sonatype, Inc. - initial API and implementation
10 *******************************************************************************/
11 package org.eclipse.aether.repository;
12
13 import org.eclipse.aether.RepositorySystemSession;
14 import org.eclipse.aether.artifact.Artifact;
15 import org.eclipse.aether.metadata.Metadata;
16
17 /**
18 * Manages access to a local repository.
19 *
20 * @see RepositorySystemSession#getLocalRepositoryManager()
21 * @see org.eclipse.aether.RepositorySystem#newLocalRepositoryManager(RepositorySystemSession, LocalRepository)
22 */
23 public interface LocalRepositoryManager
24 {
25
26 /**
27 * Gets the description of the local repository being managed.
28 *
29 * @return The description of the local repository, never {@code null}.
30 */
31 LocalRepository getRepository();
32
33 /**
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.
37 *
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.
40 */
41 String getPathForLocalArtifact( Artifact artifact );
42
43 /**
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.
47 *
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.
52 */
53 String getPathForRemoteArtifact( Artifact artifact, RemoteRepository repository, String context );
54
55 /**
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.
59 *
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.
62 */
63 String getPathForLocalMetadata( Metadata metadata );
64
65 /**
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.
69 *
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.
74 */
75 String getPathForRemoteMetadata( Metadata metadata, RemoteRepository repository, String context );
76
77 /**
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.
80 *
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}.
84 */
85 LocalArtifactResult find( RepositorySystemSession session, LocalArtifactRequest request );
86
87 /**
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.
91 *
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}.
94 */
95 void add( RepositorySystemSession session, LocalArtifactRegistration request );
96
97 /**
98 * Queries for the existence of metadata in the local repository. The request could be satisfied by locally
99 * installed or previously downloaded metadata.
100 *
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}.
104 */
105 LocalMetadataResult find( RepositorySystemSession session, LocalMetadataRequest request );
106
107 /**
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.
112 *
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}.
115 */
116 void add( RepositorySystemSession session, LocalMetadataRegistration request );
117
118 }