Source Code Cross Referenced for L1ConfigBuilder.java in  » Net » Terracotta » com » tc » config » schema » test » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Net » Terracotta » com.tc.config.schema.test 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright
003:         * notice. All rights reserved.
004:         */
005:        package com.tc.config.schema.test;
006:
007:        import java.util.ArrayList;
008:        import java.util.HashMap;
009:        import java.util.Iterator;
010:        import java.util.List;
011:        import java.util.Map;
012:
013:        /**
014:         * Allows you to build valid config for the L1. This class <strong>MUST NOT</strong> invoke the actual XML beans to do
015:         * its work; one of its purposes is, in fact, to test that those beans are set up correctly.
016:         */
017:        public class L1ConfigBuilder extends BaseConfigBuilder {
018:
019:            private List modules = new ArrayList();
020:            private List repos = new ArrayList();
021:
022:            public L1ConfigBuilder() {
023:                super (1, ALL_PROPERTIES);
024:            }
025:
026:            public void setILClass(boolean use) {
027:                setProperty("class", use);
028:            }
029:
030:            public void setILClass(String use) {
031:                setProperty("class", use);
032:            }
033:
034:            public void setILHierarchy(boolean use) {
035:                setProperty("hierarchy", use);
036:            }
037:
038:            public void setILHierarchy(String use) {
039:                setProperty("hierarchy", use);
040:            }
041:
042:            public void setILLocks(boolean use) {
043:                setProperty("locks", use);
044:            }
045:
046:            public void setILLocks(String use) {
047:                setProperty("locks", use);
048:            }
049:
050:            public void setILTransientRoot(boolean use) {
051:                setProperty("transient-root", use);
052:            }
053:
054:            public void setILTransientRoot(String use) {
055:                setProperty("transient-root", use);
056:            }
057:
058:            public void setILRoots(boolean use) {
059:                setProperty("roots", use);
060:            }
061:
062:            public void setILRoots(String use) {
063:                setProperty("roots", use);
064:            }
065:
066:            public void setILDistributedMethods(boolean use) {
067:                setProperty("distributed-methods", use);
068:            }
069:
070:            public void setILDistributedMethods(String use) {
071:                setProperty("distributed-methods", use);
072:            }
073:
074:            public void setRLLockDebug(boolean use) {
075:                setProperty("lock-debug", use);
076:            }
077:
078:            public void setRLLockDebug(String use) {
079:                setProperty("lock-debug", use);
080:            }
081:
082:            public void setRLPartialInstrumentation(boolean use) {
083:                setProperty("partial-instrumentation", use);
084:            }
085:
086:            public void setRLPartialInstrumentation(String use) {
087:                setProperty("partial-instrumentation", use);
088:            }
089:
090:            public void setRLNonPortableWarning(boolean use) {
091:                setProperty("non-portable-warning", use);
092:            }
093:
094:            public void setRLNonPortableWarning(String use) {
095:                setProperty("non-portable-warning", use);
096:            }
097:
098:            public void setRLWaitNotifyDebug(boolean use) {
099:                setProperty("wait-notify-debug", use);
100:            }
101:
102:            public void setRLWaitNotifyDebug(String use) {
103:                setProperty("wait-notify-debug", use);
104:            }
105:
106:            public void setRLDistributedMethodDebug(boolean use) {
107:                setProperty("distributed-method-debug", use);
108:            }
109:
110:            public void setRLDistributedMethodDebug(String use) {
111:                setProperty("distributed-method-debug", use);
112:            }
113:
114:            public void setRLNewObjectDebug(boolean use) {
115:                setProperty("new-object-debug", use);
116:            }
117:
118:            public void setRLNewObjectDebug(String use) {
119:                setProperty("new-object-debug", use);
120:            }
121:
122:            public void setROOAutoLockDetails(boolean use) {
123:                setProperty("auto-lock-details", use);
124:            }
125:
126:            public void setROOAutoLockDetails(String use) {
127:                setProperty("auto-lock-details", use);
128:            }
129:
130:            public void setROOCaller(boolean use) {
131:                setProperty("caller", use);
132:            }
133:
134:            public void setROOCaller(String use) {
135:                setProperty("caller", use);
136:            }
137:
138:            public void setROOFullStack(boolean use) {
139:                setProperty("full-stack", use);
140:            }
141:
142:            public void setROOFullStack(String use) {
143:                setProperty("full-stack", use);
144:            }
145:
146:            public void setMaxInMemoryObjectCount(int value) {
147:                setProperty("max-in-memory-object-count", value);
148:            }
149:
150:            public void setMaxInMemoryObjectCount(String value) {
151:                setProperty("max-in-memory-object-count", value);
152:            }
153:
154:            public void setLogs(String value) {
155:                setProperty("logs", value);
156:            }
157:
158:            public void addRepository(String location) {
159:                repos.add(location);
160:            }
161:
162:            public void addModule(String name, String version) {
163:                addModule(name, "org.terracotta.modules", version);
164:            }
165:
166:            public void addModule(String name, String groupId, String version) {
167:                modules.add(new Module(name, groupId, version));
168:            }
169:
170:            private String addModuleElement() {
171:                StringBuffer moduleElement = new StringBuffer();
172:
173:                if (modules.size() > 0 || repos.size() > 0) {
174:                    moduleElement.append(openElement("modules"));
175:
176:                    for (Iterator it = repos.iterator(); it.hasNext();) {
177:                        String loc = (String) it.next();
178:                        moduleElement.append(openElement("repository"));
179:                        moduleElement.append(loc);
180:                        moduleElement.append(closeElement("repository"));
181:                    }
182:
183:                    for (Iterator it = modules.iterator(); it.hasNext();) {
184:                        Module m = (Module) it.next();
185:                        moduleElement.append(selfCloseElement("module", m
186:                                .asAttribute()));
187:                    }
188:
189:                    moduleElement.append(closeElement("modules"));
190:                }
191:
192:                return moduleElement.toString();
193:            }
194:
195:            private static final String[] DSO_INSTRUMENTATION_LOGGING = new String[] {
196:                    "class", "hierarchy", "locks", "transient-root", "roots",
197:                    "distributed-methods" };
198:            private static final String[] DSO_RUNTIME_LOGGING = new String[] {
199:                    "lock-debug", "partial-instrumentation",
200:                    "non-portable-warning", "wait-notify-debug",
201:                    "distributed-method-debug", "new-object-debug" };
202:            private static final String[] DSO_RUNTIME_OUTPUT_OPTIONS = new String[] {
203:                    "auto-lock-details", "caller", "full-stack" };
204:
205:            private static final String[] DSO_DEBUGGING = concat(new Object[] {
206:                    DSO_INSTRUMENTATION_LOGGING, DSO_RUNTIME_LOGGING,
207:                    DSO_RUNTIME_OUTPUT_OPTIONS });
208:            private static final String[] DSO = concat(new Object[] {
209:                    "max-in-memory-object-count", DSO_DEBUGGING });
210:            private static final String[] MODULE_ATTRIBUTES = new String[] {
211:                    "name", "group-id", "version" };
212:            private static final String[] ALL_PROPERTIES = concat(new Object[] {
213:                    "modules", "logs", DSO });
214:
215:            public String toString() {
216:                return addModuleElement()
217:                        + element("logs")
218:                        + openElement("dso", DSO)
219:                        + element("max-in-memory-object-count")
220:                        + openElement("debugging", DSO_DEBUGGING)
221:                        + elementGroup("instrumentation-logging",
222:                                DSO_INSTRUMENTATION_LOGGING)
223:                        + elementGroup("runtime-logging", DSO_RUNTIME_LOGGING)
224:                        + elementGroup("runtime-output-options",
225:                                DSO_RUNTIME_OUTPUT_OPTIONS)
226:                        + closeElement("debugging", DSO_DEBUGGING)
227:                        + closeElement("dso", DSO);
228:            }
229:
230:            public static L1ConfigBuilder newMinimalInstance() {
231:                return new L1ConfigBuilder();
232:            }
233:
234:            private static class Module {
235:                private String name;
236:                private String groupId;
237:                private String version;
238:
239:                public Module(String name, String groupId, String version) {
240:                    this .name = name;
241:                    this .groupId = groupId;
242:                    this .version = version;
243:                }
244:
245:                public Map asAttribute() {
246:                    Map attr = new HashMap();
247:                    attr.put(MODULE_ATTRIBUTES[0], name);
248:                    attr.put(MODULE_ATTRIBUTES[1], groupId);
249:                    attr.put(MODULE_ATTRIBUTES[2], version);
250:                    return attr;
251:                }
252:            }
253:
254:            public static void main(String[] args) {
255:                L1ConfigBuilder builder = new L1ConfigBuilder();
256:                System.err.println(builder);
257:
258:                builder.setROOCaller(true);
259:                builder.setROOFullStack(false);
260:                builder.setLogs("funk");
261:                builder.addModule("testmo", "org.mycompany.modules", "1.2");
262:                System.err.println(builder);
263:            }
264:
265:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.