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;
05:
06: import org.apache.commons.lang.builder.EqualsBuilder;
07: import org.apache.commons.lang.builder.HashCodeBuilder;
08:
09: import com.tc.config.schema.dynamic.ObjectArrayConfigItem;
10: import com.tc.util.Assert;
11: import com.tc.util.stringification.OurStringBuilder;
12:
13: /**
14: * Contains the information from the L2s that L1 needs.
15: */
16: public interface L2ConfigForL1 {
17:
18: public static class L2Data {
19: private final String host;
20: private final int dsoPort;
21:
22: public L2Data(String host, int dsoPort) {
23: Assert.assertNotBlank(host);
24: this .host = host;
25: this .dsoPort = dsoPort;
26: }
27:
28: public String host() {
29: return this .host;
30: }
31:
32: public int dsoPort() {
33: return this .dsoPort;
34: }
35:
36: public boolean equals(Object that) {
37: if (!(that instanceof L2Data))
38: return false;
39: L2Data thatData = (L2Data) that;
40: return new EqualsBuilder().append(this .host, thatData.host)
41: .append(this .dsoPort, thatData.dsoPort).isEquals();
42: }
43:
44: public int hashCode() {
45: return new HashCodeBuilder().append(this .host).append(
46: this .dsoPort).toHashCode();
47: }
48:
49: public String toString() {
50: return new OurStringBuilder(this ).append("host", this .host)
51: .append("DSO port", this .dsoPort).toString();
52: }
53: }
54:
55: ObjectArrayConfigItem l2Data();
56:
57: }
|