26
26
import org .slf4j .LoggerFactory ;
27
27
28
28
/** The generic DAO that is used to scan ScalarDB data */
29
- public class ScalarDBDao {
29
+ public class ScalarDbDao {
30
30
31
31
/* Class logger */
32
- private static final Logger logger = LoggerFactory .getLogger (ScalarDBDao .class );
32
+ private static final Logger logger = LoggerFactory .getLogger (ScalarDbDao .class );
33
33
private static final String GET_COMPLETED_MSG = "GET completed for %s" ;
34
34
private static final String PUT_COMPLETED_MSG = "PUT completed for %s" ;
35
35
private static final String SCAN_START_MSG = "SCAN started..." ;
@@ -44,15 +44,15 @@ public class ScalarDBDao {
44
44
* @param clusteringKey Optional clustering key for get
45
45
* @param storage Distributed storage for ScalarDB connection that is running in storage mode.
46
46
* @return Optional get result
47
- * @throws ScalarDBDaoException if something goes wrong while reading the data
47
+ * @throws ScalarDbDaoException if something goes wrong while reading the data
48
48
*/
49
49
public Optional <Result > get (
50
50
String namespace ,
51
51
String table ,
52
52
Key partitionKey ,
53
53
Key clusteringKey ,
54
54
DistributedStorage storage )
55
- throws ScalarDBDaoException {
55
+ throws ScalarDbDaoException {
56
56
57
57
// Retrieving the key data for logging
58
58
String loggingKey = keysToString (partitionKey , clusteringKey );
@@ -63,7 +63,7 @@ public Optional<Result> get(
63
63
logger .info (String .format (GET_COMPLETED_MSG , loggingKey ));
64
64
return result ;
65
65
} catch (ExecutionException e ) {
66
- throw new ScalarDBDaoException ("error GET " + loggingKey , e );
66
+ throw new ScalarDbDaoException ("error GET " + loggingKey , e );
67
67
}
68
68
}
69
69
@@ -76,15 +76,15 @@ public Optional<Result> get(
76
76
* @param clusteringKey Optional clustering key for get
77
77
* @param transaction ScalarDB transaction instance
78
78
* @return Optional get result
79
- * @throws ScalarDBDaoException if something goes wrong while reading the data
79
+ * @throws ScalarDbDaoException if something goes wrong while reading the data
80
80
*/
81
81
public Optional <Result > get (
82
82
String namespace ,
83
83
String table ,
84
84
Key partitionKey ,
85
85
Key clusteringKey ,
86
86
DistributedTransaction transaction )
87
- throws ScalarDBDaoException {
87
+ throws ScalarDbDaoException {
88
88
89
89
Get get = createGetWith (namespace , table , partitionKey , clusteringKey );
90
90
// Retrieving the key data for logging
@@ -94,7 +94,7 @@ public Optional<Result> get(
94
94
logger .info (String .format (GET_COMPLETED_MSG , loggingKey ));
95
95
return result ;
96
96
} catch (CrudException e ) {
97
- throw new ScalarDBDaoException ("error GET " + loggingKey , e .getCause ());
97
+ throw new ScalarDbDaoException ("error GET " + loggingKey , e .getCause ());
98
98
}
99
99
}
100
100
@@ -107,7 +107,7 @@ public Optional<Result> get(
107
107
* @param clusteringKey Optional clustering key
108
108
* @param columns List of column values to be inserted or updated
109
109
* @param transaction ScalarDB transaction instance
110
- * @throws ScalarDBDaoException if something goes wrong while executing the transaction
110
+ * @throws ScalarDbDaoException if something goes wrong while executing the transaction
111
111
*/
112
112
public void put (
113
113
String namespace ,
@@ -116,13 +116,13 @@ public void put(
116
116
Key clusteringKey ,
117
117
List <Column <?>> columns ,
118
118
DistributedTransaction transaction )
119
- throws ScalarDBDaoException {
119
+ throws ScalarDbDaoException {
120
120
121
121
Put put = createPutWith (namespace , table , partitionKey , clusteringKey , columns );
122
122
try {
123
123
transaction .put (put );
124
124
} catch (CrudException e ) {
125
- throw new ScalarDBDaoException (
125
+ throw new ScalarDbDaoException (
126
126
CoreError .DATA_LOADER_ERROR_CRUD_EXCEPTION .buildMessage (e .getMessage ()), e );
127
127
}
128
128
logger .info (String .format (PUT_COMPLETED_MSG , keysToString (partitionKey , clusteringKey )));
@@ -137,7 +137,7 @@ public void put(
137
137
* @param clusteringKey Optional clustering key
138
138
* @param columns List of column values to be inserted or updated
139
139
* @param storage Distributed storage for ScalarDB connection that is running in storage mode
140
- * @throws ScalarDBDaoException if something goes wrong while executing the transaction
140
+ * @throws ScalarDbDaoException if something goes wrong while executing the transaction
141
141
*/
142
142
public void put (
143
143
String namespace ,
@@ -146,12 +146,12 @@ public void put(
146
146
Key clusteringKey ,
147
147
List <Column <?>> columns ,
148
148
DistributedStorage storage )
149
- throws ScalarDBDaoException {
149
+ throws ScalarDbDaoException {
150
150
Put put = createPutWith (namespace , table , partitionKey , clusteringKey , columns );
151
151
try {
152
152
storage .put (put );
153
153
} catch (ExecutionException e ) {
154
- throw new ScalarDBDaoException (
154
+ throw new ScalarDbDaoException (
155
155
CoreError .DATA_LOADER_ERROR_CRUD_EXCEPTION .buildMessage (e .getMessage ()), e );
156
156
}
157
157
logger .info (String .format (PUT_COMPLETED_MSG , keysToString (partitionKey , clusteringKey )));
@@ -169,7 +169,7 @@ public void put(
169
169
* @param limit Scan limit value
170
170
* @param storage Distributed storage for ScalarDB connection that is running in storage mode
171
171
* @return List of ScalarDB scan results
172
- * @throws ScalarDBDaoException if scan fails
172
+ * @throws ScalarDbDaoException if scan fails
173
173
*/
174
174
public List <Result > scan (
175
175
String namespace ,
@@ -180,7 +180,7 @@ public List<Result> scan(
180
180
List <String > projections ,
181
181
int limit ,
182
182
DistributedStorage storage )
183
- throws ScalarDBDaoException {
183
+ throws ScalarDbDaoException {
184
184
// Create scan
185
185
Scan scan = createScan (namespace , table , partitionKey , range , sorts , projections , limit );
186
186
@@ -193,7 +193,7 @@ public List<Result> scan(
193
193
return allResults ;
194
194
}
195
195
} catch (ExecutionException | IOException e ) {
196
- throw new ScalarDBDaoException (
196
+ throw new ScalarDbDaoException (
197
197
CoreError .DATA_LOADER_ERROR_SCAN .buildMessage (e .getMessage ()), e );
198
198
}
199
199
}
@@ -211,7 +211,7 @@ public List<Result> scan(
211
211
* @param transaction Distributed Transaction manager for ScalarDB connection that is * running in
212
212
* transaction mode
213
213
* @return List of ScalarDB scan results
214
- * @throws ScalarDBDaoException if scan fails
214
+ * @throws ScalarDbDaoException if scan fails
215
215
*/
216
216
public List <Result > scan (
217
217
String namespace ,
@@ -222,7 +222,7 @@ public List<Result> scan(
222
222
List <String > projections ,
223
223
int limit ,
224
224
DistributedTransaction transaction )
225
- throws ScalarDBDaoException {
225
+ throws ScalarDbDaoException {
226
226
227
227
// Create scan
228
228
Scan scan = createScan (namespace , table , partitionKey , range , sorts , projections , limit );
@@ -236,7 +236,7 @@ public List<Result> scan(
236
236
} catch (CrudException | NoSuchElementException e ) {
237
237
// No such element Exception is thrown when the scan is done in transaction mode but
238
238
// ScalarDB is running in storage mode
239
- throw new ScalarDBDaoException (
239
+ throw new ScalarDbDaoException (
240
240
CoreError .DATA_LOADER_ERROR_SCAN .buildMessage (e .getMessage ()), e );
241
241
}
242
242
}
@@ -250,21 +250,21 @@ public List<Result> scan(
250
250
* @param limit Scan limit value
251
251
* @param storage Distributed storage for ScalarDB connection that is running in storage mode
252
252
* @return ScalarDB Scanner object
253
- * @throws ScalarDBDaoException if scan fails
253
+ * @throws ScalarDbDaoException if scan fails
254
254
*/
255
255
public Scanner createScanner (
256
256
String namespace ,
257
257
String table ,
258
258
List <String > projectionColumns ,
259
259
int limit ,
260
260
DistributedStorage storage )
261
- throws ScalarDBDaoException {
261
+ throws ScalarDbDaoException {
262
262
Scan scan =
263
263
createScan (namespace , table , null , null , new ArrayList <>(), projectionColumns , limit );
264
264
try {
265
265
return storage .scan (scan );
266
266
} catch (ExecutionException e ) {
267
- throw new ScalarDBDaoException (
267
+ throw new ScalarDbDaoException (
268
268
CoreError .DATA_LOADER_ERROR_SCAN .buildMessage (e .getMessage ()), e );
269
269
}
270
270
}
@@ -281,7 +281,7 @@ public Scanner createScanner(
281
281
* @param limit Scan limit value
282
282
* @param storage Distributed storage for ScalarDB connection that is running in storage mode
283
283
* @return ScalarDB Scanner object
284
- * @throws ScalarDBDaoException if scan fails
284
+ * @throws ScalarDbDaoException if scan fails
285
285
*/
286
286
public Scanner createScanner (
287
287
String namespace ,
@@ -292,13 +292,13 @@ public Scanner createScanner(
292
292
@ Nullable List <String > projectionColumns ,
293
293
int limit ,
294
294
DistributedStorage storage )
295
- throws ScalarDBDaoException {
295
+ throws ScalarDbDaoException {
296
296
Scan scan =
297
297
createScan (namespace , table , partitionKey , scanRange , sortOrders , projectionColumns , limit );
298
298
try {
299
299
return storage .scan (scan );
300
300
} catch (ExecutionException e ) {
301
- throw new ScalarDBDaoException (
301
+ throw new ScalarDbDaoException (
302
302
CoreError .DATA_LOADER_ERROR_SCAN .buildMessage (e .getMessage ()), e );
303
303
}
304
304
}
0 commit comments