1 package com.eyeq.pivot4j.analytics.datasource;
2
3 import java.io.Serializable;
4
5 import org.apache.commons.configuration.HierarchicalConfiguration;
6 import org.apache.commons.lang.builder.ToStringBuilder;
7
8 import com.eyeq.pivot4j.state.Configurable;
9
10 public class ConnectionInfo implements Configurable, Serializable {
11
12 private static final long serialVersionUID = 1613489385973603487L;
13
14 private String catalogName;
15
16 private String cubeName;
17
18 public ConnectionInfo() {
19 }
20
21
22
23
24
25 public ConnectionInfo(String catalogName, String cubeName) {
26 this.catalogName = catalogName;
27 this.cubeName = cubeName;
28 }
29
30
31
32
33 public String getCubeName() {
34 return cubeName;
35 }
36
37
38
39
40
41 public void setCubeName(String cubeName) {
42 this.cubeName = cubeName;
43 }
44
45
46
47
48 public String getCatalogName() {
49 return catalogName;
50 }
51
52
53
54
55
56 public void setCatalogName(String catalogName) {
57 this.catalogName = catalogName;
58 }
59
60
61
62
63 @Override
64 public void saveSettings(HierarchicalConfiguration configuration) {
65 if (configuration == null) {
66 throw new IllegalArgumentException(
67 "Configuration object cannot be null.");
68 }
69
70 configuration.addProperty("catalog", catalogName);
71 configuration.addProperty("cube", cubeName);
72 }
73
74
75
76
77 @Override
78 public void restoreSettings(HierarchicalConfiguration configuration) {
79 if (configuration == null) {
80 throw new IllegalArgumentException(
81 "Configuration object cannot be null.");
82 }
83
84 this.catalogName = configuration.getString("catalog");
85 this.cubeName = configuration.getString("cube");
86 }
87
88
89
90
91 @Override
92 public String toString() {
93 return new ToStringBuilder(this).append("cubeName", cubeName)
94 .append("catalogName", catalogName).toString();
95 }
96 }