-
Notifications
You must be signed in to change notification settings - Fork 171
/
Config.java
69 lines (49 loc) · 1.65 KB
/
Config.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
#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
package ${package}.config;
import org.apache.streampipes.config.SpConfig;
import org.apache.streampipes.container.model.PeConfig;
import static ${package}.config.ConfigKeys.*;
public enum Config implements PeConfig {
INSTANCE;
private SpConfig config;
public final static String serverUrl;
public final static String iconBaseUrl;
private final static String SERVICE_ID= "pe/${package}";
Config() {
config = SpConfig.getSpConfig("pe/${package}");
config.register(HOST, "${artifactId}", "Hostname for the pe sinks");
config.register(PORT, 8090, "Port for the pe sinks");
config.register(ICON_HOST, "backend", "Hostname for the icon host");
config.register(ICON_PORT, 80, "Port for the icons in nginx");
config.register(SERVICE_NAME, "${packageName}", "The name of the service");
}
static {
serverUrl = Config.INSTANCE.getHost() + ":" + Config.INSTANCE.getPort();
iconBaseUrl = "http://" + Config.INSTANCE.getIconHost() + ":" + Config.INSTANCE.getIconPort() + "/assets/img/pe_icons";
}
public static final String getIconUrl(String pictureName) {
return iconBaseUrl + "/" + pictureName + ".png";
}
public String getHost() {
return config.getString(HOST);
}
public int getPort() {
return config.getInteger(PORT);
}
public String getIconHost() {
return config.getString(ICON_HOST);
}
public int getIconPort() {
return config.getInteger(ICON_PORT);
}
@Override
public String getId() {
return SERVICE_ID;
}
@Override
public String getName() {
return config.getString(SERVICE_NAME);
}
}