001: package com.bostechcorp.cbesb.runtime.component.jdbc;
002:
003: public enum JdbcPropertiesEnumeration {
004:
005: DRIVER {
006: String getValue(JdbcEndpoint endpoint) {
007: return endpoint.getDriver();
008: }
009:
010: void setValue(JdbcEndpoint endpoint, Object value) {
011: if (isSetable())
012: endpoint.setDriver((String) value);
013: }
014:
015: boolean isSetable() {
016: return true;
017: }
018: },
019: URL {
020: String getValue(JdbcEndpoint endpoint) {
021: return endpoint.getUrl();
022: }
023:
024: void setValue(JdbcEndpoint endpoint, Object value) {
025: if (isSetable())
026: endpoint.setUrl((String) value);
027: }
028:
029: boolean isSetable() {
030: return true;
031: }
032: },
033: USER {
034: String getValue(JdbcEndpoint endpoint) {
035: return endpoint.getUser();
036: }
037:
038: void setValue(JdbcEndpoint endpoint, Object value) {
039: if (isSetable())
040: endpoint.setUser((String) value);
041: }
042:
043: boolean isSetable() {
044: return true;
045: }
046: },
047: PASSWORD {
048: String getValue(JdbcEndpoint endpoint) {
049: return endpoint.getPassword();
050: }
051:
052: void setValue(JdbcEndpoint endpoint, Object value) {
053: if (isSetable())
054: endpoint.setPassword((String) value);
055: }
056:
057: boolean isSetable() {
058: return true;
059: }
060: },
061: REQUEST_HANDLER {
062: String getValue(JdbcEndpoint endpoint) {
063: return endpoint.getRequestHandler();
064: }
065:
066: void setValue(JdbcEndpoint endpoint, Object value) {
067: if (isSetable())
068: endpoint.setRequestHandler((String) value);
069: }
070:
071: boolean isSetable() {
072: return true;
073: }
074: },
075: EXEC_HANDLER {
076: String getValue(JdbcEndpoint endpoint) {
077: return endpoint.getExecHandler();
078: }
079:
080: void setValue(JdbcEndpoint endpoint, Object value) {
081: if (isSetable())
082: endpoint.setExecHandler((String) value);
083: }
084:
085: boolean isSetable() {
086: return true;
087: }
088: },
089: AUTO_COMMIT {
090: String getValue(JdbcEndpoint endpoint) {
091: return Boolean.toString(endpoint.isAutoCommit());
092: }
093:
094: void setValue(JdbcEndpoint endpoint, Object value) {
095: if (isSetable())
096: endpoint.setAutoCommit(new Boolean((String) value));
097: }
098:
099: boolean isSetable() {
100: return true;
101: }
102: },
103: CONNECTION_RETRIES {
104: String getValue(JdbcEndpoint endpoint) {
105: return Integer.toString(endpoint.getConnectionRetries());
106: }
107:
108: void setValue(JdbcEndpoint endpoint, Object value) {
109: if (isSetable())
110: endpoint.setConnectionRetries(Integer
111: .parseInt((String) value));
112: }
113:
114: boolean isSetable() {
115: return true;
116: }
117: },
118: CONNECTION_INTERVAL {
119: String getValue(JdbcEndpoint endpoint) {
120: return Integer.toString(endpoint.getConnectionInterval());
121: }
122:
123: void setValue(JdbcEndpoint endpoint, Object value) {
124: if (isSetable())
125: endpoint.setConnectionInterval(Integer
126: .parseInt((String) value));
127: }
128:
129: boolean isSetable() {
130: return true;
131: }
132: },
133: TRANSACTION_TIMEOUT {
134: String getValue(JdbcEndpoint endpoint) {
135: return Integer.toString(endpoint.getTransactionTimeout());
136: }
137:
138: void setValue(JdbcEndpoint endpoint, Object value) {
139: if (isSetable())
140: endpoint.setTransactionTimeout(Integer
141: .parseInt((String) value));
142: }
143:
144: boolean isSetable() {
145: return true;
146: }
147: },
148: DEFAULT_PAGESIZE {
149: String getValue(JdbcEndpoint endpoint) {
150: return Integer.toString(endpoint.getDefaultPageSize());
151: }
152:
153: void setValue(JdbcEndpoint endpoint, Object value) {
154: if (isSetable())
155: endpoint.setDefaultPageSize(Integer
156: .parseInt((String) value));
157: }
158:
159: boolean isSetable() {
160: return true;
161: }
162: };
163: /**
164: *
165: * @param endpoint --
166: * endpoint in use
167: * @return - attribute value according to enumeration item
168: */
169: abstract String getValue(JdbcEndpoint endpoint);
170:
171: /**
172: *
173: * @param endpoint--
174: * endpoint in use
175: * @param value -
176: * sets attribute value according to enumeration item
177: */
178: abstract void setValue(JdbcEndpoint endpoint, Object value);
179:
180: /**
181: * tells either is possible or not to set the value false if the attribute
182: * is read only
183: *
184: * @return
185: */
186: abstract boolean isSetable();
187:
188: }
|