-
Notifications
You must be signed in to change notification settings - Fork 31
/
ISettings.java
117 lines (98 loc) · 3.34 KB
/
ISettings.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/*************************************************************************
* Copyright (c) 2019,2021 The Eclipse Foundation and others.
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
* distribution, and is available at https://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*************************************************************************/
package org.eclipse.dash.licenses;
import java.io.File;
public interface ISettings {
public static final String DEFAULT_GITLAB_URL = "https://gitlab.eclipse.org";
public static final String DEFAULT_IPLAB_PATH = "eclipsefdn/iplab/iplab";
public static final String DEFAULT_APPROVED_LICENSES_URL = "https://www.eclipse.org/legal/licenses.json";
public static final String DEFAULT_CLEARLYDEFINED_URL = "https://api.clearlydefined.io/definitions";
public static final String DEFAULT_IPZILLA_URL = "https://www.eclipse.org/projects/services/license_check.php";
public static final int DEFAULT_THRESHOLD = 60;
public static final int DEFAULT_BATCH = 1000;
default int getBatchSize() {
String value = System.getProperty("org.eclipse.dash.batch");
if (value == null)
return DEFAULT_BATCH;
int threshold = Integer.valueOf(value);
if (threshold < 1)
return 1;
return threshold;
};
/**
* The license check URL is the address of the Eclipse Foundation license data
* service.
*
* @return the URL (String)
*/
default String getLicenseCheckUrl() {
return System.getProperty("org.eclipse.dash.ipzilla", DEFAULT_IPZILLA_URL);
};
default String getClearlyDefinedDefinitionsUrl() {
return System.getProperty("org.eclipse.dash.clearlydefined", DEFAULT_CLEARLYDEFINED_URL);
};
default String getApprovedLicensesUrl() {
return System.getProperty("org.eclipse.dash.licenses", DEFAULT_APPROVED_LICENSES_URL);
};
default int getConfidenceThreshold() {
String value = System.getProperty("org.eclipse.dash.threshold");
if (value == null)
return DEFAULT_THRESHOLD;
int threshold = Integer.valueOf(value);
if (threshold < 0)
return 0;
if (threshold > 100)
return 100;
return threshold;
};
default String getProjectId() {
return System.getProperty("org.eclipse.dash.project");
}
/**
* How long do we wait for a response from a license data provider?
*
* @return the timeout in seconds (int).
*/
default int getTimeout() {
return 60;
}
/**
* The GitLab authentication token that we need to connect to GitLab to create
* requests for review.
*
* @return the token or <code>null</code> if no value is available.
*/
default String getIpLabToken() {
return System.getProperty("org.eclipse.dash.token");
}
/**
* The URL of the GitLab host of the "IP Lab" repository.
*
* @return A valid URL.
*/
default String getIpLabHostUrl() {
return System.getProperty("org.eclipse.dash.iplab-host", DEFAULT_GITLAB_URL);
}
/**
* The path (relative to the GitLab host) of the path of the "IP Lab"
* repository.
*
* @return A valid path.
*/
default String getIpLabRepositoryPath() {
return System.getProperty("org.eclipse.dash.iplab-path", DEFAULT_IPLAB_PATH);
}
default String getSummaryFilePath() {
return System.getProperty("org.eclipse.dash.summary");
};
default File getSummaryFile() {
return new File(getSummaryFilePath());
}
}