1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.eclipse.aether.internal.impl.synccontext.named;
20
21 import java.util.Collection;
22 import java.util.Collections;
23
24 import org.eclipse.aether.RepositorySystemSession;
25 import org.eclipse.aether.artifact.Artifact;
26 import org.eclipse.aether.metadata.Metadata;
27 import org.eclipse.aether.named.NamedLockKey;
28
29
30
31
32
33 public class StaticNameMapper implements NameMapper {
34 @Override
35 public boolean isFileSystemFriendly() {
36 return true;
37 }
38
39 @Override
40 public Collection<NamedLockKey> nameLocks(
41 final RepositorySystemSession session,
42 final Collection<? extends Artifact> artifacts,
43 final Collection<? extends Metadata> metadatas) {
44 if (artifacts != null && !artifacts.isEmpty()) {
45 return Collections.singletonList(NamedLockKey.of("static-artifact"));
46 } else if (metadatas != null && !metadatas.isEmpty()) {
47 return Collections.singletonList(NamedLockKey.of("static-metadata"));
48 } else {
49 return Collections.emptyList();
50 }
51 }
52 }