KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > config > schema > test > L1ConfigBuilder


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.config.schema.test;
5
6 /**
7  * Allows you to build valid config for the L1. This class <strong>MUST NOT</strong> invoke the actual XML beans to do
8  * its work; one of its purposes is, in fact, to test that those beans are set up correctly.
9  */

10 public class L1ConfigBuilder extends BaseConfigBuilder {
11
12   public L1ConfigBuilder() {
13     super(1, ALL_PROPERTIES);
14   }
15
16   public void setILClass(boolean use) {
17     setProperty("class", use);
18   }
19
20   public void setILClass(String JavaDoc use) {
21     setProperty("class", use);
22   }
23
24   public void setILHierarchy(boolean use) {
25     setProperty("hierarchy", use);
26   }
27
28   public void setILHierarchy(String JavaDoc use) {
29     setProperty("hierarchy", use);
30   }
31
32   public void setILLocks(boolean use) {
33     setProperty("locks", use);
34   }
35
36   public void setILLocks(String JavaDoc use) {
37     setProperty("locks", use);
38   }
39
40   public void setILTransientRoot(boolean use) {
41     setProperty("transient-root", use);
42   }
43
44   public void setILTransientRoot(String JavaDoc use) {
45     setProperty("transient-root", use);
46   }
47
48   public void setILRoots(boolean use) {
49     setProperty("roots", use);
50   }
51
52   public void setILRoots(String JavaDoc use) {
53     setProperty("roots", use);
54   }
55
56   public void setILDistributedMethods(boolean use) {
57     setProperty("distributed-methods", use);
58   }
59
60   public void setILDistributedMethods(String JavaDoc use) {
61     setProperty("distributed-methods", use);
62   }
63
64   public void setRLLockDebug(boolean use) {
65     setProperty("lock-debug", use);
66   }
67
68   public void setRLLockDebug(String JavaDoc use) {
69     setProperty("lock-debug", use);
70   }
71
72   public void setRLPartialInstrumentation(boolean use) {
73     setProperty("partial-instrumentation", use);
74   }
75
76   public void setRLPartialInstrumentation(String JavaDoc use) {
77     setProperty("partial-instrumentation", use);
78   }
79
80   public void setRLNonPortableWarning(boolean use) {
81     setProperty("non-portable-warning", use);
82   }
83
84   public void setRLNonPortableWarning(String JavaDoc use) {
85     setProperty("non-portable-warning", use);
86   }
87
88   public void setRLWaitNotifyDebug(boolean use) {
89     setProperty("wait-notify-debug", use);
90   }
91
92   public void setRLWaitNotifyDebug(String JavaDoc use) {
93     setProperty("wait-notify-debug", use);
94   }
95
96   public void setRLDistributedMethodDebug(boolean use) {
97     setProperty("distributed-method-debug", use);
98   }
99
100   public void setRLDistributedMethodDebug(String JavaDoc use) {
101     setProperty("distributed-method-debug", use);
102   }
103
104   public void setRLNewObjectDebug(boolean use) {
105     setProperty("new-object-debug", use);
106   }
107
108   public void setRLNewObjectDebug(String JavaDoc use) {
109     setProperty("new-object-debug", use);
110   }
111
112   public void setROOAutoLockDetails(boolean use) {
113     setProperty("auto-lock-details", use);
114   }
115
116   public void setROOAutoLockDetails(String JavaDoc use) {
117     setProperty("auto-lock-details", use);
118   }
119
120   public void setROOCaller(boolean use) {
121     setProperty("caller", use);
122   }
123
124   public void setROOCaller(String JavaDoc use) {
125     setProperty("caller", use);
126   }
127
128   public void setROOFullStack(boolean use) {
129     setProperty("full-stack", use);
130   }
131
132   public void setROOFullStack(String JavaDoc use) {
133     setProperty("full-stack", use);
134   }
135
136   public void setMaxInMemoryObjectCount(int value) {
137     setProperty("max-in-memory-object-count", value);
138   }
139
140   public void setMaxInMemoryObjectCount(String JavaDoc value) {
141     setProperty("max-in-memory-object-count", value);
142   }
143
144   public void setLogs(String JavaDoc value) {
145     setProperty("logs", value);
146   }
147
148   private static final String JavaDoc[] DSO_INSTRUMENTATION_LOGGING = new String JavaDoc[] { "class", "hierarchy", "locks",
149       "transient-root", "roots", "distributed-methods" };
150   private static final String JavaDoc[] DSO_RUNTIME_LOGGING = new String JavaDoc[] { "lock-debug", "partial-instrumentation",
151       "non-portable-warning", "wait-notify-debug", "distributed-method-debug", "new-object-debug" };
152   private static final String JavaDoc[] DSO_RUNTIME_OUTPUT_OPTIONS = new String JavaDoc[] { "auto-lock-details", "caller",
153       "full-stack" };
154
155   private static final String JavaDoc[] DSO_DEBUGGING = concat(new Object JavaDoc[] { DSO_INSTRUMENTATION_LOGGING,
156       DSO_RUNTIME_LOGGING, DSO_RUNTIME_OUTPUT_OPTIONS });
157   private static final String JavaDoc[] DSO = concat(new Object JavaDoc[] { "max-in-memory-object-count",
158       DSO_DEBUGGING });
159
160   private static final String JavaDoc[] ALL_PROPERTIES = concat(new Object JavaDoc[] { "logs", DSO });
161
162   public String JavaDoc toString() {
163     return element("logs") + openElement("dso", DSO) + element("max-in-memory-object-count")
164            + openElement("debugging", DSO_DEBUGGING)
165            + elementGroup("instrumentation-logging", DSO_INSTRUMENTATION_LOGGING)
166            + elementGroup("runtime-logging", DSO_RUNTIME_LOGGING)
167            + elementGroup("runtime-output-options", DSO_RUNTIME_OUTPUT_OPTIONS)
168            + closeElement("debugging", DSO_DEBUGGING) + closeElement("dso", DSO);
169   }
170
171   public static L1ConfigBuilder newMinimalInstance() {
172     return new L1ConfigBuilder();
173   }
174
175   public static void main(String JavaDoc[] args) {
176     L1ConfigBuilder builder = new L1ConfigBuilder();
177     System.err.println(builder);
178
179     builder.setROOCaller(true);
180     builder.setROOFullStack(false);
181     builder.setLogs("funk");
182     System.err.println(builder);
183   }
184
185 }
186
Popular Tags