1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.model.building;
20
21 import java.io.File;
22 import java.net.URI;
23
24 import org.apache.maven.building.FileSource;
25
26
27
28
29
30
31 @Deprecated(since = "4.0.0")
32 public class FileModelSource extends FileSource implements ModelSource2 {
33
34
35
36
37
38
39 public FileModelSource(File pomFile) {
40 super(pomFile);
41 }
42
43
44
45
46
47
48
49 @Deprecated
50 public File getPomFile() {
51 return getFile();
52 }
53
54 @Override
55 public ModelSource2 getRelatedSource(String relPath) {
56 relPath = relPath.replace('\\', File.separatorChar).replace('/', File.separatorChar);
57
58 File relatedPom = new File(getFile().getParentFile(), relPath);
59
60 if (relatedPom.isDirectory()) {
61
62 relatedPom = new File(relatedPom, "pom.xml");
63 }
64
65 if (relatedPom.isFile() && relatedPom.canRead()) {
66 return new FileModelSource(new File(relatedPom.toURI().normalize()));
67 }
68
69 return null;
70 }
71
72 @Override
73 public URI getLocationURI() {
74 return getFile().toURI();
75 }
76
77 @Override
78 public boolean equals(Object obj) {
79 if (this == obj) {
80 return true;
81 }
82
83 if (!(obj instanceof FileModelSource)) {
84 return false;
85 }
86 FileModelSource other = (FileModelSource) obj;
87 return getFile().equals(other.getFile());
88 }
89
90 @Override
91 public int hashCode() {
92 return getFile().hashCode();
93 }
94 }