001: /*
002: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
003: */
004: package com.tc.config.schema.test;
005:
006: import com.tc.config.schema.builder.DSOApplicationConfigBuilder;
007: import com.tc.config.schema.builder.InstrumentedClassConfigBuilder;
008: import com.tc.config.schema.builder.LockConfigBuilder;
009: import com.tc.config.schema.builder.RootConfigBuilder;
010: import com.tc.config.schema.builder.SpringConfigBuilder;
011: import com.tc.config.schema.builder.WebApplicationConfigBuilder;
012:
013: /**
014: * Allows you to build valid config for the DSO part of an application. This class <strong>MUST NOT</strong> invoke the
015: * actual XML beans to do its work; one of its purposes is, in fact, to test that those beans are set up correctly.
016: */
017: public class DSOApplicationConfigBuilderImpl extends BaseConfigBuilder
018: implements DSOApplicationConfigBuilder {
019:
020: public DSOApplicationConfigBuilderImpl() {
021: super (4, ALL_PROPERTIES);
022:
023: setArrayPropertyTagName("transient-fields", "transient-field");
024: setArrayPropertyTagName("roots", "root");
025: setArrayPropertyTagName("distributed-methods",
026: "distributed-method");
027: setArrayPropertyTagName("additional-boot-jar-classes",
028: "include");
029:
030: setProperty("instrumented-classes", "");
031: }
032:
033: public void setInstrumentedClasses(String value) {
034: setProperty("instrumented-classes", value);
035: }
036:
037: public void setInstrumentedClasses(
038: InstrumentedClassConfigBuilder[] value) {
039: setProperty("instrumented-classes", value);
040: }
041:
042: public void setDistributedMethods(String value) {
043: setProperty("distributed-methods", value);
044: }
045:
046: public void setDistributedMethods(String[] value) {
047: setProperty("distributed-methods", value);
048: }
049:
050: public void setAdditionalBootJarClasses(String value) {
051: setProperty("additional-boot-jar-classes", value);
052: }
053:
054: public void setAdditionalBootJarClasses(String[] value) {
055: setProperty("additional-boot-jar-classes", value);
056: }
057:
058: public void setRoots(String value) {
059: setProperty("roots", value);
060: }
061:
062: public void setRoots(RootConfigBuilder[] value) {
063: setProperty("roots", value);
064: }
065:
066: public void setTransientFields(String value) {
067: setProperty("transient-fields", value);
068: }
069:
070: public void setTransientFields(String[] value) {
071: setProperty("transient-fields", value);
072: }
073:
074: public void setLocks(String value) {
075: setProperty("locks", value);
076: }
077:
078: public void setLocks(LockConfigBuilder[] value) {
079: setProperty("locks", selfTaggingArray(value));
080: }
081:
082: public void setWebApplications(WebApplicationConfigBuilder[] value) {
083: setProperty("web-applications", selfTaggingArray(value));
084: }
085:
086: private static final String[] ALL_PROPERTIES = new String[] {
087: "instrumented-classes", "transient-fields", "locks",
088: "roots", "distributed-methods",
089: "additional-boot-jar-classes", "web-applications", "spring" };
090:
091: public String toString() {
092: String out = "";
093:
094: out += indent() + elements(ALL_PROPERTIES);
095:
096: return out;
097: }
098:
099: public static DSOApplicationConfigBuilder newMinimalInstance() {
100: return new DSOApplicationConfigBuilderImpl();
101: }
102:
103: public SpringConfigBuilder getSpring() {
104: if (!isSet("spring"))
105: setSpring(SpringConfigBuilderImpl.newMinimalInstance());
106: return (SpringConfigBuilder) getRawProperty("spring");
107: }
108:
109: private void setSpring(SpringConfigBuilder builder) {
110: setProperty("spring", builder);
111:
112: }
113:
114: }
|