KickJava   Java API By Example, From Geeks To Geeks.

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


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 import com.tc.config.schema.builder.DSOApplicationConfigBuilder;
7 import com.tc.config.schema.builder.InstrumentedClassConfigBuilder;
8 import com.tc.config.schema.builder.LockConfigBuilder;
9 import com.tc.config.schema.builder.RootConfigBuilder;
10 import com.tc.config.schema.builder.SpringConfigBuilder;
11 import com.tc.config.schema.builder.WebApplicationConfigBuilder;
12
13
14 /**
15  * Allows you to build valid config for the DSO part of an application. This class <strong>MUST NOT</strong> invoke the
16  * actual XML beans to do its work; one of its purposes is, in fact, to test that those beans are set up correctly.
17  */

18 public class DSOApplicationConfigBuilderImpl extends BaseConfigBuilder implements DSOApplicationConfigBuilder {
19
20   public DSOApplicationConfigBuilderImpl() {
21     super(4, ALL_PROPERTIES);
22
23     setArrayPropertyTagName("transient-fields", "transient-field");
24     setArrayPropertyTagName("roots", "root");
25     setArrayPropertyTagName("distributed-methods", "distributed-method");
26     setArrayPropertyTagName("additional-boot-jar-classes", "include");
27     
28     setProperty("instrumented-classes", "");
29   }
30
31   public void setInstrumentedClasses(String JavaDoc value) {
32     setProperty("instrumented-classes", value);
33   }
34
35   public void setInstrumentedClasses(InstrumentedClassConfigBuilder[] value) {
36     setProperty("instrumented-classes", value);
37   }
38
39   public void setDistributedMethods(String JavaDoc value) {
40     setProperty("distributed-methods", value);
41   }
42
43   public void setDistributedMethods(String JavaDoc[] value) {
44     setProperty("distributed-methods", value);
45   }
46
47   public void setAdditionalBootJarClasses(String JavaDoc value) {
48     setProperty("additional-boot-jar-classes", value);
49   }
50
51   public void setAdditionalBootJarClasses(String JavaDoc[] value) {
52     setProperty("additional-boot-jar-classes", value);
53   }
54
55   public void setRoots(String JavaDoc value) {
56     setProperty("roots", value);
57   }
58
59   public void setRoots(RootConfigBuilder[] value) {
60     setProperty("roots", value);
61   }
62
63   public void setTransientFields(String JavaDoc value) {
64     setProperty("transient-fields", value);
65   }
66
67   public void setTransientFields(String JavaDoc[] value) {
68     setProperty("transient-fields", value);
69   }
70
71   public void setLocks(String JavaDoc value) {
72     setProperty("locks", value);
73   }
74
75   public void setLocks(LockConfigBuilder[] value) {
76     setProperty("locks", selfTaggingArray(value));
77   }
78   
79   public void setWebApplications(WebApplicationConfigBuilder[] value) {
80     setProperty("web-applications", selfTaggingArray(value));
81   }
82
83   private static final String JavaDoc[] ALL_PROPERTIES = new String JavaDoc[] { "instrumented-classes", "transient-fields", "locks",
84       "roots", "distributed-methods", "additional-boot-jar-classes", "web-applications", "spring" };
85
86   public String JavaDoc toString() {
87     String JavaDoc out = "";
88
89     out += indent() + elements(ALL_PROPERTIES);
90
91     return out;
92   }
93
94   public static DSOApplicationConfigBuilder newMinimalInstance() {
95     return new DSOApplicationConfigBuilderImpl();
96   }
97
98   public SpringConfigBuilder getSpring() {
99     if (!isSet("spring")) setSpring(SpringConfigBuilderImpl.newMinimalInstance());
100     return (SpringConfigBuilder) getRawProperty("spring");
101   }
102
103   private void setSpring(SpringConfigBuilder builder) {
104     setProperty("spring", builder);
105     
106   }
107
108 }
109
Popular Tags