blob: 0f6a87020dae13c8b3745e4dac1e81cbb982a13c (
plain) (
blame)
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
|
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.config.provision;
import java.util.EnumSet;
import java.util.Set;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* Systems in hosted Vespa
*
* @author mpolden
*/
public enum SystemName {
/** Continuous deployment system */
cd(false, true),
/** Production system */
main(false, false),
/** System accessible to the public */
Public(true, false),
/** Continuous deployment system for testing the Public system */
PublicCd(true, true),
/** Local development system */
dev(false, false);
private final boolean isPublic;
private final boolean isCd;
SystemName(boolean isPublic, boolean isCd) {
this.isPublic = isPublic;
this.isCd = isCd;
}
public static SystemName defaultSystem() {
return main;
}
public static SystemName from(String value) {
switch (value.toLowerCase()) {
case "dev": return dev;
case "cd": return cd;
case "main": return main;
case "public": return Public;
case "publiccd": return PublicCd;
default: throw new IllegalArgumentException(String.format("'%s' is not a valid system", value));
}
}
public String value() {
switch (this) {
case dev: return "dev";
case cd: return "cd";
case main: return "main";
case Public: return "public";
case PublicCd: return "publiccd";
default : throw new IllegalStateException();
}
}
/** Whether the system is similar to Public, e.g. PublicCd. */
public boolean isPublic() { return isPublic; }
/** Whether the system is used for continuous deployment. */
public boolean isCd() { return isCd; }
public static Set<SystemName> all() { return EnumSet.allOf(SystemName.class); }
public static Set<SystemName> allOf(Predicate<SystemName> predicate) {
return Stream.of(values()).filter(predicate::test).collect(Collectors.toSet());
}
}
|