KickJava   Java API By Example, From Geeks To Geeks.

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


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 a query route. This class <strong>MUST NOT</strong> invoke the actual XML beans
8  * to do its work; one of its purposes is, in fact, to test that those beans are set up correctly.
9  */

10 public class QueryRouteConfigBuilder extends BaseConfigBuilder {
11
12   private final String JavaDoc matchType;
13   private final String JavaDoc route;
14   private final String JavaDoc query;
15
16   public static final String JavaDoc MATCH_TYPE_EXACT = "exact";
17   public static final String JavaDoc MATCH_TYPE_REGEX = "regex";
18
19   public static final String JavaDoc ROUTE_TERRACOTTA = "terracotta";
20   public static final String JavaDoc ROUTE_NATIVE = "native";
21
22   public QueryRouteConfigBuilder(String JavaDoc matchType, String JavaDoc route, String JavaDoc query) {
23     super(5, new String JavaDoc[0]);
24
25     this.matchType = matchType;
26     this.route = route;
27     this.query = query;
28   }
29
30   public String JavaDoc toString() {
31     String JavaDoc out = indent() + "<query-route";
32     if (this.matchType != null) out += " match-type=\"" + this.matchType + "\"";
33     if (this.route != null) out += " route=\"" + this.route + "\"";
34     out += ">";
35     if (this.query != null) out += this.query;
36     out += "</query-route>\n";
37
38     return out;
39   }
40
41 }
42
Popular Tags