01: /*
02: * All content copyright (c) 2003-2007 Terracotta, Inc., except as may otherwise be noted in a separate copyright
03: * notice. All rights reserved.
04: */
05: package com.tc.config.schema;
06:
07: import com.tc.config.schema.context.ConfigContext;
08: import com.tc.config.schema.dynamic.IntConfigItem;
09: import com.tc.config.schema.dynamic.StringConfigItem;
10: import com.terracottatech.config.Ha;
11: import com.terracottatech.config.HaMode;
12:
13: public class NewHaConfigObject extends BaseNewConfigObject implements
14: NewHaConfig {
15: private final StringConfigItem haMode;
16: private final IntConfigItem electionTime;
17:
18: public NewHaConfigObject(ConfigContext context) {
19: super (context);
20:
21: context.ensureRepositoryProvides(Ha.class);
22:
23: haMode = context.stringItem("mode");
24: electionTime = context
25: .intItem("networked-active-passive/election-time");
26: }
27:
28: public StringConfigItem haMode() {
29: return haMode;
30: }
31:
32: public IntConfigItem electionTime() {
33: return electionTime;
34: }
35:
36: public boolean isNetworkedActivePassive() {
37: return haMode.getString().equals(
38: HaMode.NETWORKED_ACTIVE_PASSIVE.toString());
39: }
40: }
|