1 4 package com.tc.config.schema.test; 5 6 10 public class L2ConfigBuilder extends BaseConfigBuilder { 11 12 private String name; 13 14 public L2ConfigBuilder() { 15 super(3, ALL_PROPERTIES); 16 } 17 18 public void setName(String data) { 19 this.name = data; 20 } 21 22 String getName() { 23 return this.name; 24 } 25 26 public void setData(String data) { 27 setProperty("data", data); 28 } 29 30 public void setLogs(String logs) { 31 setProperty("logs", logs); 32 } 33 34 public void setDSOPort(int data) { 35 setProperty("dso-port", data); 36 } 37 38 public void setJMXPort(int data) { 39 setProperty("jmx-port", data); 40 } 41 42 public void setJMXPort(String data) { 43 setProperty("jmx-port", data); 44 } 45 46 public static final String PERSISTENCE_MODE_TEMPORARY_SWAP_ONLY = "temporary-swap-only"; 47 public static final String PERSISTENCE_MODE_PERMANENT_STORE = "permanent-store"; 48 49 public void setPersistenceMode(String data) { 50 setProperty("mode", data); 51 } 52 53 public void setGCEnabled(boolean data) { 54 setProperty("enabled", data); 55 } 56 57 public void setGCEnabled(String data) { 58 setProperty("enabled", data); 59 } 60 61 public void setGCVerbose(boolean data) { 62 setProperty("verbose", data); 63 } 64 65 public void setGCVerbose(String data) { 66 setProperty("verbose", data); 67 } 68 69 public void setGCInterval(int data) { 70 setProperty("interval", data); 71 } 72 73 public void setGCInterval(String data) { 74 setProperty("interval", data); 75 } 76 77 private static final String [] L2 = new String [] { "data", "logs", "dso-port", "jmx-port" }; 78 79 private static final String [] DSO_PERSISTENCE = new String [] { "mode" }; 80 private static final String [] DSO_GC = new String [] { "enabled", "verbose", "interval" }; 81 private static final String [] DSO = concat(new Object [] { DSO_PERSISTENCE, DSO_GC, }); 82 83 private static final String [] ALL_PROPERTIES = concat(new Object [] { L2, DSO }); 84 85 public String toString() { 86 String out = ""; 87 88 out += indent() + "<server" + (this.name != null ? " name=\"" + this.name + "\"" : "") + ">\n"; 89 90 out += elements(L2) + openElement("dso", DSO) + elementGroup("persistence", DSO_PERSISTENCE) 91 + elementGroup("garbage-collection", DSO_GC) + closeElement("dso", DSO); 92 93 out += closeElement("server"); 94 95 return out; 96 } 97 98 public static L2ConfigBuilder newMinimalInstance() { 99 return new L2ConfigBuilder(); 100 } 101 102 } 103 | Popular Tags |