KickJava   Java API By Example, From Geeks To Geeks.

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


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 L2s. 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 L2SConfigBuilder extends BaseConfigBuilder {
11
12   public L2SConfigBuilder() {
13     super(1, new String JavaDoc[] { "servers" });
14   }
15
16   public void setL2s(String JavaDoc l2s) {
17     setProperty("servers", l2s);
18   }
19
20   public void setL2s(L2ConfigBuilder[] l2s) {
21     setProperty("servers", selfTaggingArray(l2s));
22   }
23   
24   public L2ConfigBuilder[] getL2s() {
25     if (isSet("servers")) return (L2ConfigBuilder[]) ((SelfTaggingArray) getRawProperty("servers")).values();
26     else return null;
27   }
28
29   public String JavaDoc toString() {
30     if (!isSet("servers")) return "";
31     else return getProperty("servers").toString();
32   }
33
34   public static L2SConfigBuilder newMinimalInstance() {
35     L2ConfigBuilder l2 = new L2ConfigBuilder();
36     l2.setName("localhost");
37     l2.setDSOPort(9510);
38
39     L2SConfigBuilder out = new L2SConfigBuilder();
40     out.setL2s(new L2ConfigBuilder[] { l2 });
41
42     return out;
43   }
44
45 }
46
Popular Tags