2 |
|
|
3 |
import java.util.logging.Logger; |
import java.util.logging.Logger; |
4 |
|
|
|
import javax.servlet.ServletContext; |
|
|
|
|
5 |
import dk.thoerup.circuitbreaker.config.BreakerConfig; |
import dk.thoerup.circuitbreaker.config.BreakerConfig; |
6 |
import dk.thoerup.webconfig.ConfigVariable; |
import dk.thoerup.webconfig.ConfigVariable; |
|
import dk.thoerup.webconfig.ContextConfigLoader; |
|
|
import dk.thoerup.webconfig.ReloadConfig; |
|
7 |
|
|
8 |
|
|
9 |
public class TraininfoSettings implements BreakerConfig{ |
public class TraininfoSettings implements BreakerConfig{ |
10 |
|
public enum Backend { |
11 |
|
Azure, |
12 |
|
Mobile |
13 |
|
} |
14 |
|
|
15 |
Logger logger = Logger.getLogger(TraininfoSettings.class.getName() ); |
Logger logger = Logger.getLogger(TraininfoSettings.class.getName() ); |
16 |
|
|
|
ServletContext cxt; |
|
|
public TraininfoSettings(ServletContext cxt) { |
|
|
this.cxt = cxt; |
|
|
} |
|
|
|
|
17 |
@ConfigVariable |
@ConfigVariable |
18 |
boolean useazuresite; |
Backend backend; |
19 |
|
|
20 |
@ConfigVariable(description = "Circuitbreaker", readonly = true) |
@ConfigVariable(description = "Circuitbreaker", readonly = true) |
21 |
int banedk_threshold; |
int banedk_threshold; |
31 |
|
|
32 |
@ConfigVariable |
@ConfigVariable |
33 |
int reply_timeout; |
int reply_timeout; |
34 |
|
|
35 |
@ReloadConfig |
@ConfigVariable(readonly = true) |
36 |
public void reloadConfig() { |
String mail_recipient; |
37 |
logger.info("Reloading config"); |
|
38 |
new ContextConfigLoader(cxt).loadConfig(this); |
@ConfigVariable |
39 |
} |
boolean tritinfo_enabled; |
40 |
|
|
41 |
|
|
42 |
public boolean getUseAzureSite() { |
public Backend getBackend() { |
43 |
return useazuresite; |
return backend; |
44 |
} |
} |
45 |
|
|
46 |
|
|
55 |
public int getReplyTimeout() { |
public int getReplyTimeout() { |
56 |
return reply_timeout; |
return reply_timeout; |
57 |
} |
} |
|
|
|
58 |
|
|
59 |
@Override |
@Override |
60 |
public int getTreshold() { |
public int getTreshold() { |
65 |
public int getTimeout() { |
public int getTimeout() { |
66 |
return banedk_timeout; |
return banedk_timeout; |
67 |
} |
} |
68 |
|
|
69 |
|
public String getMailRecipient() { |
70 |
|
return mail_recipient; |
71 |
|
} |
72 |
|
|
73 |
|
|
74 |
|
public boolean isTritinfoEnabled() { |
75 |
|
return tritinfo_enabled; |
76 |
|
} |
77 |
|
|
78 |
|
|
79 |
} |
} |