01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.config.schema.test;
05:
06: import com.tc.config.schema.builder.SpringApplicationConfigBuilder;
07: import com.tc.config.schema.builder.SpringApplicationContextConfigBuilder;
08:
09: import java.util.Collections;
10:
11: public class SpringApplicationConfigBuilderImpl extends
12: BaseConfigBuilder implements SpringApplicationConfigBuilder {
13:
14: private String name;
15:
16: protected SpringApplicationConfigBuilderImpl() {
17: super (4, new String[] { "application-contexts" });
18: }
19:
20: public static SpringApplicationConfigBuilderImpl newMinimalInstance() {
21: SpringApplicationConfigBuilderImpl result = new SpringApplicationConfigBuilderImpl();
22:
23: result
24: .setApplicationContexts(new SpringApplicationContextConfigBuilder[] { SpringApplicationContextConfigBuilderImpl
25: .newMinimalInstance() });
26: return result;
27: }
28:
29: public String toString() {
30: return openElement("jee-application", Collections.singletonMap(
31: "name", name))
32: + openElement("application-contexts")
33: + propertyAsString("application-contexts")
34: + closeElement("application-contexts")
35: + closeElement("jee-application");
36: }
37:
38: public SpringApplicationContextConfigBuilder[] getApplicationContexts() {
39: if (isSet("application-contexts"))
40: return (SpringApplicationContextConfigBuilder[]) ((SelfTaggingArray) getRawProperty("application-contexts"))
41: .values();
42: else
43: return null;
44: }
45:
46: public void setApplicationContexts(
47: SpringApplicationContextConfigBuilder[] applications) {
48: setProperty("application-contexts",
49: selfTaggingArray(applications));
50: }
51:
52: public void setName(String name) {
53: this.name = name;
54: }
55: }
|