1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 package fr.ens.transcriptome.doelan.data;
24
25 import java.io.File;
26 import java.net.MalformedURLException;
27 import java.net.URL;
28
29 import org.apache.log4j.Logger;
30
31 import fr.ens.transcriptome.nividic.platform.PlatformRegistery;
32
33 /***
34 * This class define a location to a qualtity test suite.
35 * @author Laurent Jourdren
36 */
37 public class QualityTestSuiteURL {
38
39
40 private static Logger log = Logger.getLogger(QualityTestSuiteURL.class);
41
42 private String name;
43
44 private URL url;
45
46
47
48
49
50 /***
51 * Get the name of the TestSuiteURL
52 * @return The name of the TestSuiteURL
53 */
54 public String getName() {
55 return name;
56 }
57
58 /***
59 * Get the URL of the test TestSuiteURL
60 * @return the URL of the test suite
61 */
62 public URL getURL() {
63 return url;
64 }
65
66
67
68
69
70 /***
71 * Set the name of the TestSuiteURL
72 * @param name Name to set
73 */
74 public void setName(final String name) {
75 this.name = name;
76 }
77
78 /***
79 * Set the url of the TestSuite
80 * @param url URL to set
81 */
82 public void setURL(final URL url) {
83 this.url = url;
84 }
85
86 /***
87 * Set the url of the TestSuite
88 * @param url URL to set
89 */
90 public void setUrl(final String url) {
91
92 if (url == null)
93 return;
94
95 try {
96 if (url.startsWith("file:") || url.startsWith("ftp:")
97 || url.startsWith("http:"))
98 this.url = new URL(url);
99 else {
100 File f = new File(url);
101 if (!f.isAbsolute())
102 f = new File(PlatformRegistery.getConfDirectory() + File.separator + url);
103 if (f.exists() && !f.isDirectory()) {
104
105
106 this.url = f.toURL();
107 }
108
109 }
110 } catch (MalformedURLException e) {
111 log.error("Malformed URL: " + e);
112 return;
113 }
114 }
115
116 }