18
18
*/
19
19
package org .eclipse .aether .repository ;
20
20
21
+ import java .nio .file .Path ;
22
+
21
23
import org .eclipse .aether .RepositorySystemSession ;
22
24
import org .eclipse .aether .artifact .Artifact ;
23
25
import org .eclipse .aether .metadata .Metadata ;
@@ -37,16 +39,44 @@ public interface LocalRepositoryManager {
37
39
*/
38
40
LocalRepository getRepository ();
39
41
42
+ /**
43
+ * Gets the absolute path for a locally installed artifact. Note that the artifact need not actually exist yet at
44
+ * the returned location, the path merely indicates where the artifact would eventually be stored.
45
+ *
46
+ * @param artifact The artifact for which to determine the path, must not be {@code null}.
47
+ * @return The path, relative to the local repository's base directory.
48
+ * @since 2.0.5
49
+ */
50
+ default Path getAbsolutePathForLocalArtifact (Artifact artifact ) {
51
+ return getRepository ().getBasePath ().resolve (getPathForLocalArtifact (artifact ));
52
+ }
53
+
40
54
/**
41
55
* Gets the relative path for a locally installed artifact. Note that the artifact need not actually exist yet at
42
56
* the returned location, the path merely indicates where the artifact would eventually be stored. The path uses the
43
57
* forward slash as directory separator regardless of the underlying file system.
44
58
*
45
59
* @param artifact The artifact for which to determine the path, must not be {@code null}.
46
60
* @return The path, relative to the local repository's base directory.
61
+ * @deprecated See {@link #getAbsolutePathForLocalArtifact(Artifact)}
47
62
*/
63
+ @ Deprecated
48
64
String getPathForLocalArtifact (Artifact artifact );
49
65
66
+ /**
67
+ * Gets the absolute path for an artifact cached from a remote repository. Note that the artifact need not actually
68
+ * exist yet at the returned location, the path merely indicates where the artifact would eventually be stored.
69
+ *
70
+ * @param artifact The artifact for which to determine the path, must not be {@code null}.
71
+ * @param repository The source repository of the artifact, must not be {@code null}.
72
+ * @param context The resolution context in which the artifact is being requested, may be {@code null}.
73
+ * @return The path, relative to the local repository's base directory.
74
+ * @since 2.0.5
75
+ */
76
+ default Path getAbsolutePathForRemoteArtifact (Artifact artifact , RemoteRepository repository , String context ) {
77
+ return getRepository ().getBasePath ().resolve (getPathForRemoteArtifact (artifact , repository , context ));
78
+ }
79
+
50
80
/**
51
81
* Gets the relative path for an artifact cached from a remote repository. Note that the artifact need not actually
52
82
* exist yet at the returned location, the path merely indicates where the artifact would eventually be stored. The
@@ -56,19 +86,49 @@ public interface LocalRepositoryManager {
56
86
* @param repository The source repository of the artifact, must not be {@code null}.
57
87
* @param context The resolution context in which the artifact is being requested, may be {@code null}.
58
88
* @return The path, relative to the local repository's base directory.
89
+ * @deprecated See {@link #getAbsolutePathForRemoteArtifact(Artifact, RemoteRepository, String)}
59
90
*/
91
+ @ Deprecated
60
92
String getPathForRemoteArtifact (Artifact artifact , RemoteRepository repository , String context );
61
93
94
+ /**
95
+ * Gets the absolute path for locally installed metadata. Note that the metadata need not actually exist yet at the
96
+ * returned location, the path merely indicates where the metadata would eventually be stored.
97
+ *
98
+ * @param metadata The metadata for which to determine the path, must not be {@code null}.
99
+ * @return The path, relative to the local repository's base directory.
100
+ * @since 2.0.5
101
+ */
102
+ default Path getAbsolutePathForLocalMetadata (Metadata metadata ) {
103
+ return getRepository ().getBasePath ().resolve (getPathForLocalMetadata (metadata ));
104
+ }
105
+
62
106
/**
63
107
* Gets the relative path for locally installed metadata. Note that the metadata need not actually exist yet at the
64
108
* returned location, the path merely indicates where the metadata would eventually be stored. The path uses the
65
109
* forward slash as directory separator regardless of the underlying file system.
66
110
*
67
111
* @param metadata The metadata for which to determine the path, must not be {@code null}.
68
112
* @return The path, relative to the local repository's base directory.
113
+ * @deprecated See {@link #getAbsolutePathForLocalMetadata(Metadata)}
69
114
*/
115
+ @ Deprecated
70
116
String getPathForLocalMetadata (Metadata metadata );
71
117
118
+ /**
119
+ * Gets the absolute path for metadata cached from a remote repository. Note that the metadata need not actually
120
+ * exist yet at the returned location, the path merely indicates where the metadata would eventually be stored.
121
+ *
122
+ * @param metadata The metadata for which to determine the path, must not be {@code null}.
123
+ * @param repository The source repository of the metadata, must not be {@code null}.
124
+ * @param context The resolution context in which the metadata is being requested, may be {@code null}.
125
+ * @return The path, relative to the local repository's base directory.
126
+ * @since 2.0.5
127
+ */
128
+ default Path getAbsolutePathForRemoteMetadata (Metadata metadata , RemoteRepository repository , String context ) {
129
+ return getRepository ().getBasePath ().resolve (getPathForRemoteMetadata (metadata , repository , context ));
130
+ }
131
+
72
132
/**
73
133
* Gets the relative path for metadata cached from a remote repository. Note that the metadata need not actually
74
134
* exist yet at the returned location, the path merely indicates where the metadata would eventually be stored. The
@@ -78,7 +138,9 @@ public interface LocalRepositoryManager {
78
138
* @param repository The source repository of the metadata, must not be {@code null}.
79
139
* @param context The resolution context in which the metadata is being requested, may be {@code null}.
80
140
* @return The path, relative to the local repository's base directory.
141
+ * @deprecated See {@link #getAbsolutePathForRemoteMetadata(Metadata, RemoteRepository, String)}
81
142
*/
143
+ @ Deprecated
82
144
String getPathForRemoteMetadata (Metadata metadata , RemoteRepository repository , String context );
83
145
84
146
/**
0 commit comments