1 |
package dk.thoerup.traininfoservice; |
package dk.thoerup.traininfoservice; |
2 |
|
|
3 |
|
import java.util.logging.Logger; |
4 |
|
|
5 |
public class TraininfoSettings { |
import javax.servlet.ServletContext; |
6 |
|
|
7 |
|
import dk.thoerup.circuitbreaker.config.BreakerConfig; |
8 |
|
import dk.thoerup.webconfig.ConfigVariable; |
9 |
|
import dk.thoerup.webconfig.ContextConfigLoader; |
10 |
|
import dk.thoerup.webconfig.ReloadConfigMethod; |
11 |
|
|
12 |
|
|
13 |
|
public class TraininfoSettings implements BreakerConfig{ |
14 |
|
public enum Backend { |
15 |
|
Azure, |
16 |
|
Mobile |
17 |
|
} |
18 |
|
|
19 |
|
Logger logger = Logger.getLogger(TraininfoSettings.class.getName() ); |
20 |
|
|
21 |
boolean useazuresite; |
@ConfigVariable |
22 |
|
Backend backend; |
23 |
|
|
24 |
|
@ConfigVariable(description = "Circuitbreaker", readonly = true) |
25 |
int banedk_threshold; |
int banedk_threshold; |
26 |
|
|
27 |
|
@ConfigVariable(readonly = true) |
28 |
int banedk_timeout; |
int banedk_timeout; |
29 |
|
|
30 |
|
@ConfigVariable(readonly = true) |
31 |
int cache_timeout; |
int cache_timeout; |
32 |
|
|
33 |
|
@ConfigVariable(readonly = true) |
34 |
int stats_interval; |
int stats_interval; |
35 |
|
|
36 |
|
@ConfigVariable |
37 |
int reply_timeout; |
int reply_timeout; |
38 |
|
|
39 |
|
|
40 |
|
public Backend getBackend() { |
41 |
public boolean getUseAzureSite() { |
return backend; |
|
return useazuresite; |
|
|
} |
|
|
|
|
|
/* public int getBanedkThreshold() { |
|
|
return banedk_threshold; |
|
42 |
} |
} |
43 |
|
|
|
public int getBanedkTimeout() { |
|
|
return banedk_timeout; |
|
|
}*/ |
|
44 |
|
|
45 |
public int getCacheTimeout() { |
public int getCacheTimeout() { |
46 |
return cache_timeout; |
return cache_timeout; |
47 |
} |
} |
48 |
/* |
|
49 |
public int getStatsInterval() { |
public int getStatsInterval() { |
50 |
return stats_interval; |
return stats_interval; |
51 |
}*/ |
} |
52 |
|
|
53 |
public int getReplyTimeout() { |
public int getReplyTimeout() { |
54 |
return reply_timeout; |
return reply_timeout; |
55 |
} |
} |
56 |
|
|
57 |
|
@Override |
58 |
|
public int getTreshold() { |
59 |
|
return banedk_threshold; |
60 |
|
} |
61 |
|
|
62 |
|
@Override |
63 |
|
public int getTimeout() { |
64 |
|
return banedk_timeout; |
65 |
|
} |
66 |
} |
} |