kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | f8d7c8f27f4594258a05fee9dfcd4909d151fe1ff2b2b0563ee11dd04c5c1ca5 |
|---|---|
| Author | Olivier Michallat <olim7t@users.noreply.github.com> · 2016-01-04 17:50 +01:00 |
| Committer | Olivier Michallat <olim7t@users.noreply.github.com> · 2016-01-04 17:50 +01:00 |
| Parents | e85d9dc25858, c2df6e94606c |
36 files changed
modified driver-core/src/main/java/com/datastax/driver/core/AbstractAddressableByIndexData.java +20 −0
| @@ -38,40 +38,48 @@ | ||
| 38 | 38 | return (T) this; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | + @Override | |
| 41 | 42 | protected ByteBuffer getValue(int i) { |
| 42 | 43 | return values[i]; |
| 43 | 44 | } |
| 44 | 45 | |
| 46 | + @Override | |
| 45 | 47 | public T setBool(int i, boolean v) { |
| 46 | 48 | checkType(i, DataType.Name.BOOLEAN); |
| 47 | 49 | return setValue(i, TypeCodec.booleanCodec.serializeNoBoxing(v)); |
| 48 | 50 | } |
| 49 | 51 | |
| 52 | + @Override | |
| 50 | 53 | public T setInt(int i, int v) { |
| 51 | 54 | checkType(i, DataType.Name.INT); |
| 52 | 55 | return setValue(i, TypeCodec.intCodec.serializeNoBoxing(v)); |
| 53 | 56 | } |
| 54 | 57 | |
| 58 | + @Override | |
| 55 | 59 | public T setLong(int i, long v) { |
| 56 | 60 | checkType(i, DataType.Name.BIGINT, DataType.Name.COUNTER); |
| 57 | 61 | return setValue(i, TypeCodec.longCodec.serializeNoBoxing(v)); |
| 58 | 62 | } |
| 59 | 63 | |
| 64 | + @Override | |
| 60 | 65 | public T setDate(int i, Date v) { |
| 61 | 66 | checkType(i, DataType.Name.TIMESTAMP); |
| 62 | 67 | return setValue(i, v == null ? null : TypeCodec.dateCodec.serialize(v)); |
| 63 | 68 | } |
| 64 | 69 | |
| 70 | + @Override | |
| 65 | 71 | public T setFloat(int i, float v) { |
| 66 | 72 | checkType(i, DataType.Name.FLOAT); |
| 67 | 73 | return setValue(i, TypeCodec.floatCodec.serializeNoBoxing(v)); |
| 68 | 74 | } |
| 69 | 75 | |
| 76 | + @Override | |
| 70 | 77 | public T setDouble(int i, double v) { |
| 71 | 78 | checkType(i, DataType.Name.DOUBLE); |
| 72 | 79 | return setValue(i, TypeCodec.doubleCodec.serializeNoBoxing(v)); |
| 73 | 80 | } |
| 74 | 81 | |
| 82 | + @Override | |
| 75 | 83 | public T setString(int i, String v) { |
| 76 | 84 | DataType.Name type = checkType(i, DataType.Name.VARCHAR, DataType.Name.TEXT, DataType.Name.ASCII); |
| 77 | 85 | switch (type) { |
| @@ -85,25 +93,30 @@ | ||
| 85 | 93 | } |
| 86 | 94 | } |
| 87 | 95 | |
| 96 | + @Override | |
| 88 | 97 | public T setBytes(int i, ByteBuffer v) { |
| 89 | 98 | checkType(i, DataType.Name.BLOB); |
| 90 | 99 | return setBytesUnsafe(i, v); |
| 91 | 100 | } |
| 92 | 101 | |
| 102 | + @Override | |
| 93 | 103 | public T setBytesUnsafe(int i, ByteBuffer v) { |
| 94 | 104 | return setValue(i, v == null ? null : v.duplicate()); |
| 95 | 105 | } |
| 96 | 106 | |
| 107 | + @Override | |
| 97 | 108 | public T setVarint(int i, BigInteger v) { |
| 98 | 109 | checkType(i, DataType.Name.VARINT); |
| 99 | 110 | return setValue(i, v == null ? null : TypeCodec.bigIntegerCodec.serialize(v)); |
| 100 | 111 | } |
| 101 | 112 | |
| 113 | + @Override | |
| 102 | 114 | public T setDecimal(int i, BigDecimal v) { |
| 103 | 115 | checkType(i, DataType.Name.DECIMAL); |
| 104 | 116 | return setValue(i, v == null ? null : TypeCodec.decimalCodec.serialize(v)); |
| 105 | 117 | } |
| 106 | 118 | |
| 119 | + @Override | |
| 107 | 120 | public T setUUID(int i, UUID v) { |
| 108 | 121 | DataType.Name type = checkType(i, DataType.Name.UUID, DataType.Name.TIMEUUID); |
| 109 | 122 | |
| @@ -118,11 +131,13 @@ | ||
| 118 | 131 | : setValue(i, TypeCodec.timeUuidCodec.serialize(v)); |
| 119 | 132 | } |
| 120 | 133 | |
| 134 | + @Override | |
| 121 | 135 | public T setInet(int i, InetAddress v) { |
| 122 | 136 | checkType(i, DataType.Name.INET); |
| 123 | 137 | return setValue(i, v == null ? null : TypeCodec.inetCodec.serialize(v)); |
| 124 | 138 | } |
| 125 | 139 | |
| 140 | + @Override | |
| 126 | 141 | public <E> T setList(int i, List<E> v) { |
| 127 | 142 | DataType type = getType(i); |
| 128 | 143 | if (type.getName() != DataType.Name.LIST) |
| @@ -143,6 +158,7 @@ | ||
| 143 | 158 | return setValue(i, type.codec(protocolVersion).serialize(v)); |
| 144 | 159 | } |
| 145 | 160 | |
| 161 | + @Override | |
| 146 | 162 | public <K, V> T setMap(int i, Map<K, V> v) { |
| 147 | 163 | DataType type = getType(i); |
| 148 | 164 | if (type.getName() != DataType.Name.MAP) |
| @@ -165,6 +181,7 @@ | ||
| 165 | 181 | return setValue(i, type.codec(protocolVersion).serialize(v)); |
| 166 | 182 | } |
| 167 | 183 | |
| 184 | + @Override | |
| 168 | 185 | public <E> T setSet(int i, Set<E> v) { |
| 169 | 186 | DataType type = getType(i); |
| 170 | 187 | if (type.getName() != DataType.Name.SET) |
| @@ -184,6 +201,7 @@ | ||
| 184 | 201 | return setValue(i, type.codec(protocolVersion).serialize(v)); |
| 185 | 202 | } |
| 186 | 203 | |
| 204 | + @Override | |
| 187 | 205 | public T setUDTValue(int i, UDTValue v) { |
| 188 | 206 | DataType type = getType(i); |
| 189 | 207 | if (type.getName() != DataType.Name.UDT) |
| @@ -196,6 +214,7 @@ | ||
| 196 | 214 | return setValue(i, type.codec(ProtocolVersion.V3).serialize(v)); |
| 197 | 215 | } |
| 198 | 216 | |
| 217 | + @Override | |
| 199 | 218 | public T setTupleValue(int i, TupleValue v) { |
| 200 | 219 | DataType type = getType(i); |
| 201 | 220 | if (type.getName() != DataType.Name.TUPLE) |
| @@ -208,6 +227,7 @@ | ||
| 208 | 227 | return setValue(i, type.codec(ProtocolVersion.V3).serialize(v)); |
| 209 | 228 | } |
| 210 | 229 | |
| 230 | + @Override | |
| 211 | 231 | public T setToNull(int i) { |
| 212 | 232 | return setValue(i, null); |
| 213 | 233 | } |
modified driver-core/src/main/java/com/datastax/driver/core/AbstractData.java +38 −0
| @@ -55,19 +55,23 @@ | ||
| 55 | 55 | return wrapped; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | + @Override | |
| 58 | 59 | protected ByteBuffer getValue(int i) { |
| 59 | 60 | return values[i]; |
| 60 | 61 | } |
| 61 | 62 | |
| 63 | + @Override | |
| 62 | 64 | protected int getIndexOf(String name) { |
| 63 | 65 | return getAllIndexesOf(name)[0]; |
| 64 | 66 | } |
| 65 | 67 | |
| 68 | + @Override | |
| 66 | 69 | public T setBool(int i, boolean v) { |
| 67 | 70 | checkType(i, DataType.Name.BOOLEAN); |
| 68 | 71 | return setValue(i, TypeCodec.booleanCodec.serializeNoBoxing(v)); |
| 69 | 72 | } |
| 70 | 73 | |
| 74 | + @Override | |
| 71 | 75 | public T setBool(String name, boolean v) { |
| 72 | 76 | int[] indexes = getAllIndexesOf(name); |
| 73 | 77 | ByteBuffer value = TypeCodec.booleanCodec.serializeNoBoxing(v); |
| @@ -78,11 +82,13 @@ | ||
| 78 | 82 | return wrapped; |
| 79 | 83 | } |
| 80 | 84 | |
| 85 | + @Override | |
| 81 | 86 | public T setInt(int i, int v) { |
| 82 | 87 | checkType(i, DataType.Name.INT); |
| 83 | 88 | return setValue(i, TypeCodec.intCodec.serializeNoBoxing(v)); |
| 84 | 89 | } |
| 85 | 90 | |
| 91 | + @Override | |
| 86 | 92 | public T setInt(String name, int v) { |
| 87 | 93 | int[] indexes = getAllIndexesOf(name); |
| 88 | 94 | ByteBuffer value = TypeCodec.intCodec.serializeNoBoxing(v); |
| @@ -93,11 +99,13 @@ | ||
| 93 | 99 | return wrapped; |
| 94 | 100 | } |
| 95 | 101 | |
| 102 | + @Override | |
| 96 | 103 | public T setLong(int i, long v) { |
| 97 | 104 | checkType(i, DataType.Name.BIGINT, DataType.Name.COUNTER); |
| 98 | 105 | return setValue(i, TypeCodec.longCodec.serializeNoBoxing(v)); |
| 99 | 106 | } |
| 100 | 107 | |
| 108 | + @Override | |
| 101 | 109 | public T setLong(String name, long v) { |
| 102 | 110 | int[] indexes = getAllIndexesOf(name); |
| 103 | 111 | ByteBuffer value = TypeCodec.longCodec.serializeNoBoxing(v); |
| @@ -108,11 +116,13 @@ | ||
| 108 | 116 | return wrapped; |
| 109 | 117 | } |
| 110 | 118 | |
| 119 | + @Override | |
| 111 | 120 | public T setDate(int i, Date v) { |
| 112 | 121 | checkType(i, DataType.Name.TIMESTAMP); |
| 113 | 122 | return setValue(i, v == null ? null : TypeCodec.dateCodec.serialize(v)); |
| 114 | 123 | } |
| 115 | 124 | |
| 125 | + @Override | |
| 116 | 126 | public T setDate(String name, Date v) { |
| 117 | 127 | int[] indexes = getAllIndexesOf(name); |
| 118 | 128 | ByteBuffer value = v == null ? null : TypeCodec.dateCodec.serialize(v); |
| @@ -123,11 +133,13 @@ | ||
| 123 | 133 | return wrapped; |
| 124 | 134 | } |
| 125 | 135 | |
| 136 | + @Override | |
| 126 | 137 | public T setFloat(int i, float v) { |
| 127 | 138 | checkType(i, DataType.Name.FLOAT); |
| 128 | 139 | return setValue(i, TypeCodec.floatCodec.serializeNoBoxing(v)); |
| 129 | 140 | } |
| 130 | 141 | |
| 142 | + @Override | |
| 131 | 143 | public T setFloat(String name, float v) { |
| 132 | 144 | int[] indexes = getAllIndexesOf(name); |
| 133 | 145 | ByteBuffer value = TypeCodec.floatCodec.serializeNoBoxing(v); |
| @@ -138,11 +150,13 @@ | ||
| 138 | 150 | return wrapped; |
| 139 | 151 | } |
| 140 | 152 | |
| 153 | + @Override | |
| 141 | 154 | public T setDouble(int i, double v) { |
| 142 | 155 | checkType(i, DataType.Name.DOUBLE); |
| 143 | 156 | return setValue(i, TypeCodec.doubleCodec.serializeNoBoxing(v)); |
| 144 | 157 | } |
| 145 | 158 | |
| 159 | + @Override | |
| 146 | 160 | public T setDouble(String name, double v) { |
| 147 | 161 | int[] indexes = getAllIndexesOf(name); |
| 148 | 162 | ByteBuffer value = TypeCodec.doubleCodec.serializeNoBoxing(v); |
| @@ -153,6 +167,7 @@ | ||
| 153 | 167 | return wrapped; |
| 154 | 168 | } |
| 155 | 169 | |
| 170 | + @Override | |
| 156 | 171 | public T setString(int i, String v) { |
| 157 | 172 | DataType.Name type = checkType(i, DataType.Name.VARCHAR, DataType.Name.TEXT, DataType.Name.ASCII); |
| 158 | 173 | switch (type) { |
| @@ -166,6 +181,7 @@ | ||
| 166 | 181 | } |
| 167 | 182 | } |
| 168 | 183 | |
| 184 | + @Override | |
| 169 | 185 | public T setString(String name, String v) { |
| 170 | 186 | int[] indexes = getAllIndexesOf(name); |
| 171 | 187 | for (int i = 0; i < indexes.length; i++) |
| @@ -173,11 +189,13 @@ | ||
| 173 | 189 | return wrapped; |
| 174 | 190 | } |
| 175 | 191 | |
| 192 | + @Override | |
| 176 | 193 | public T setBytes(int i, ByteBuffer v) { |
| 177 | 194 | checkType(i, DataType.Name.BLOB); |
| 178 | 195 | return setBytesUnsafe(i, v); |
| 179 | 196 | } |
| 180 | 197 | |
| 198 | + @Override | |
| 181 | 199 | public T setBytes(String name, ByteBuffer v) { |
| 182 | 200 | int[] indexes = getAllIndexesOf(name); |
| 183 | 201 | ByteBuffer value = v == null ? null : v.duplicate(); |
| @@ -188,10 +206,12 @@ | ||
| 188 | 206 | return wrapped; |
| 189 | 207 | } |
| 190 | 208 | |
| 209 | + @Override | |
| 191 | 210 | public T setBytesUnsafe(int i, ByteBuffer v) { |
| 192 | 211 | return setValue(i, v == null ? null : v.duplicate()); |
| 193 | 212 | } |
| 194 | 213 | |
| 214 | + @Override | |
| 195 | 215 | public T setBytesUnsafe(String name, ByteBuffer v) { |
| 196 | 216 | int[] indexes = getAllIndexesOf(name); |
| 197 | 217 | ByteBuffer value = v == null ? null : v.duplicate(); |
| @@ -200,11 +220,13 @@ | ||
| 200 | 220 | return wrapped; |
| 201 | 221 | } |
| 202 | 222 | |
| 223 | + @Override | |
| 203 | 224 | public T setVarint(int i, BigInteger v) { |
| 204 | 225 | checkType(i, DataType.Name.VARINT); |
| 205 | 226 | return setValue(i, v == null ? null : TypeCodec.bigIntegerCodec.serialize(v)); |
| 206 | 227 | } |
| 207 | 228 | |
| 229 | + @Override | |
| 208 | 230 | public T setVarint(String name, BigInteger v) { |
| 209 | 231 | int[] indexes = getAllIndexesOf(name); |
| 210 | 232 | ByteBuffer value = v == null ? null : TypeCodec.bigIntegerCodec.serialize(v); |
| @@ -215,11 +237,13 @@ | ||
| 215 | 237 | return wrapped; |
| 216 | 238 | } |
| 217 | 239 | |
| 240 | + @Override | |
| 218 | 241 | public T setDecimal(int i, BigDecimal v) { |
| 219 | 242 | checkType(i, DataType.Name.DECIMAL); |
| 220 | 243 | return setValue(i, v == null ? null : TypeCodec.decimalCodec.serialize(v)); |
| 221 | 244 | } |
| 222 | 245 | |
| 246 | + @Override | |
| 223 | 247 | public T setDecimal(String name, BigDecimal v) { |
| 224 | 248 | int[] indexes = getAllIndexesOf(name); |
| 225 | 249 | ByteBuffer value = v == null ? null : TypeCodec.decimalCodec.serialize(v); |
| @@ -230,6 +254,7 @@ | ||
| 230 | 254 | return wrapped; |
| 231 | 255 | } |
| 232 | 256 | |
| 257 | + @Override | |
| 233 | 258 | public T setUUID(int i, UUID v) { |
| 234 | 259 | DataType.Name type = checkType(i, DataType.Name.UUID, DataType.Name.TIMEUUID); |
| 235 | 260 | |
| @@ -244,6 +269,7 @@ | ||
| 244 | 269 | : setValue(i, TypeCodec.timeUuidCodec.serialize(v)); |
| 245 | 270 | } |
| 246 | 271 | |
| 272 | + @Override | |
| 247 | 273 | public T setUUID(String name, UUID v) { |
| 248 | 274 | int[] indexes = getAllIndexesOf(name); |
| 249 | 275 | ByteBuffer value = v == null ? null : TypeCodec.uuidCodec.serialize(v); |
| @@ -256,11 +282,13 @@ | ||
| 256 | 282 | return wrapped; |
| 257 | 283 | } |
| 258 | 284 | |
| 285 | + @Override | |
| 259 | 286 | public T setInet(int i, InetAddress v) { |
| 260 | 287 | checkType(i, DataType.Name.INET); |
| 261 | 288 | return setValue(i, v == null ? null : TypeCodec.inetCodec.serialize(v)); |
| 262 | 289 | } |
| 263 | 290 | |
| 291 | + @Override | |
| 264 | 292 | public T setInet(String name, InetAddress v) { |
| 265 | 293 | int[] indexes = getAllIndexesOf(name); |
| 266 | 294 | ByteBuffer value = v == null ? null : TypeCodec.inetCodec.serialize(v); |
| @@ -286,6 +314,7 @@ | ||
| 286 | 314 | return wrapped; |
| 287 | 315 | } |
| 288 | 316 | |
| 317 | + @Override | |
| 289 | 318 | public <E> T setList(int i, List<E> v) { |
| 290 | 319 | DataType type = getType(i); |
| 291 | 320 | if (type.getName() != DataType.Name.LIST) |
| @@ -306,6 +335,7 @@ | ||
| 306 | 335 | return setValue(i, type.codec(protocolVersion).serialize(v)); |
| 307 | 336 | } |
| 308 | 337 | |
| 338 | + @Override | |
| 309 | 339 | public <E> T setList(String name, List<E> v) { |
| 310 | 340 | int[] indexes = getAllIndexesOf(name); |
| 311 | 341 | for (int i = 0; i < indexes.length; i++) |
| @@ -313,6 +343,7 @@ | ||
| 313 | 343 | return wrapped; |
| 314 | 344 | } |
| 315 | 345 | |
| 346 | + @Override | |
| 316 | 347 | public <K, V> T setMap(int i, Map<K, V> v) { |
| 317 | 348 | DataType type = getType(i); |
| 318 | 349 | if (type.getName() != DataType.Name.MAP) |
| @@ -335,6 +366,7 @@ | ||
| 335 | 366 | return setValue(i, type.codec(protocolVersion).serialize(v)); |
| 336 | 367 | } |
| 337 | 368 | |
| 369 | + @Override | |
| 338 | 370 | public <K, V> T setMap(String name, Map<K, V> v) { |
| 339 | 371 | int[] indexes = getAllIndexesOf(name); |
| 340 | 372 | for (int i = 0; i < indexes.length; i++) |
| @@ -342,6 +374,7 @@ | ||
| 342 | 374 | return wrapped; |
| 343 | 375 | } |
| 344 | 376 | |
| 377 | + @Override | |
| 345 | 378 | public <E> T setSet(int i, Set<E> v) { |
| 346 | 379 | DataType type = getType(i); |
| 347 | 380 | if (type.getName() != DataType.Name.SET) |
| @@ -361,6 +394,7 @@ | ||
| 361 | 394 | return setValue(i, type.codec(protocolVersion).serialize(v)); |
| 362 | 395 | } |
| 363 | 396 | |
| 397 | + @Override | |
| 364 | 398 | public <E> T setSet(String name, Set<E> v) { |
| 365 | 399 | int[] indexes = getAllIndexesOf(name); |
| 366 | 400 | for (int i = 0; i < indexes.length; i++) |
| @@ -368,6 +402,7 @@ | ||
| 368 | 402 | return wrapped; |
| 369 | 403 | } |
| 370 | 404 | |
| 405 | + @Override | |
| 371 | 406 | public T setUDTValue(int i, UDTValue v) { |
| 372 | 407 | DataType type = getType(i); |
| 373 | 408 | if (type.getName() != DataType.Name.UDT) |
| @@ -381,6 +416,7 @@ | ||
| 381 | 416 | return wrapped; |
| 382 | 417 | } |
| 383 | 418 | |
| 419 | + @Override | |
| 384 | 420 | public T setUDTValue(String name, UDTValue v) { |
| 385 | 421 | int[] indexes = getAllIndexesOf(name); |
| 386 | 422 | for (int i = 0; i < indexes.length; i++) |
| @@ -388,6 +424,7 @@ | ||
| 388 | 424 | return wrapped; |
| 389 | 425 | } |
| 390 | 426 | |
| 427 | + @Override | |
| 391 | 428 | public T setTupleValue(int i, TupleValue v) { |
| 392 | 429 | DataType type = getType(i); |
| 393 | 430 | if (type.getName() != DataType.Name.TUPLE) |
| @@ -401,6 +438,7 @@ | ||
| 401 | 438 | return wrapped; |
| 402 | 439 | } |
| 403 | 440 | |
| 441 | + @Override | |
| 404 | 442 | public T setTupleValue(String name, TupleValue v) { |
| 405 | 443 | int[] indexes = getAllIndexesOf(name); |
| 406 | 444 | for (int i = 0; i < indexes.length; i++) |
modified driver-core/src/main/java/com/datastax/driver/core/ArrayBackedResultSet.java +16 −0
| @@ -100,10 +100,12 @@ | ||
| 100 | 100 | return new SinglePage(ColumnDefinitions.EMPTY, null, null, EMPTY_QUEUE, info); |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | + @Override | |
| 103 | 104 | public ColumnDefinitions getColumnDefinitions() { |
| 104 | 105 | return metadata; |
| 105 | 106 | } |
| 106 | 107 | |
| 108 | + @Override | |
| 107 | 109 | public List<Row> all() { |
| 108 | 110 | if (isExhausted()) |
| 109 | 111 | return Collections.emptyList(); |
| @@ -165,30 +167,37 @@ | ||
| 165 | 167 | this.rows = rows; |
| 166 | 168 | } |
| 167 | 169 | |
| 170 | + @Override | |
| 168 | 171 | public boolean isExhausted() { |
| 169 | 172 | return rows.isEmpty(); |
| 170 | 173 | } |
| 171 | 174 | |
| 175 | + @Override | |
| 172 | 176 | public Row one() { |
| 173 | 177 | return ArrayBackedRow.fromData(metadata, tokenFactory, protocolVersion, rows.poll()); |
| 174 | 178 | } |
| 175 | 179 | |
| 180 | + @Override | |
| 176 | 181 | public int getAvailableWithoutFetching() { |
| 177 | 182 | return rows.size(); |
| 178 | 183 | } |
| 179 | 184 | |
| 185 | + @Override | |
| 180 | 186 | public boolean isFullyFetched() { |
| 181 | 187 | return true; |
| 182 | 188 | } |
| 183 | 189 | |
| 190 | + @Override | |
| 184 | 191 | public ListenableFuture<Void> fetchMoreResults() { |
| 185 | 192 | return MoreFutures.VOID_SUCCESS; |
| 186 | 193 | } |
| 187 | 194 | |
| 195 | + @Override | |
| 188 | 196 | public ExecutionInfo getExecutionInfo() { |
| 189 | 197 | return info; |
| 190 | 198 | } |
| 191 | 199 | |
| 200 | + @Override | |
| 192 | 201 | public List<ExecutionInfo> getAllExecutionInfo() { |
| 193 | 202 | return Collections.singletonList(info); |
| 194 | 203 | } |
| @@ -240,16 +249,19 @@ | ||
| 240 | 249 | this.statement = statement; |
| 241 | 250 | } |
| 242 | 251 | |
| 252 | + @Override | |
| 243 | 253 | public boolean isExhausted() { |
| 244 | 254 | prepareNextRow(); |
| 245 | 255 | return currentPage.isEmpty(); |
| 246 | 256 | } |
| 247 | 257 | |
| 258 | + @Override | |
| 248 | 259 | public Row one() { |
| 249 | 260 | prepareNextRow(); |
| 250 | 261 | return ArrayBackedRow.fromData(metadata, tokenFactory, protocolVersion, currentPage.poll()); |
| 251 | 262 | } |
| 252 | 263 | |
| 264 | + @Override | |
| 253 | 265 | public int getAvailableWithoutFetching() { |
| 254 | 266 | int available = currentPage.size(); |
| 255 | 267 | for (Queue<List<ByteBuffer>> page : nextPages) |
| @@ -257,6 +269,7 @@ | ||
| 257 | 269 | return available; |
| 258 | 270 | } |
| 259 | 271 | |
| 272 | + @Override | |
| 260 | 273 | public boolean isFullyFetched() { |
| 261 | 274 | return fetchState == null; |
| 262 | 275 | } |
| @@ -286,6 +299,7 @@ | ||
| 286 | 299 | } |
| 287 | 300 | } |
| 288 | 301 | |
| 302 | + @Override | |
| 289 | 303 | public ListenableFuture<Void> fetchMoreResults() { |
| 290 | 304 | return fetchMoreResults(this.fetchState); |
| 291 | 305 | } |
| @@ -390,10 +404,12 @@ | ||
| 390 | 404 | return future; |
| 391 | 405 | } |
| 392 | 406 | |
| 407 | + @Override | |
| 393 | 408 | public ExecutionInfo getExecutionInfo() { |
| 394 | 409 | return infos.getLast(); |
| 395 | 410 | } |
| 396 | 411 | |
| 412 | + @Override | |
| 397 | 413 | public List<ExecutionInfo> getAllExecutionInfo() { |
| 398 | 414 | return new ArrayList<ExecutionInfo>(infos); |
| 399 | 415 | } |
modified driver-core/src/main/java/com/datastax/driver/core/ArrayBackedRow.java +1 −0
| @@ -87,6 +87,7 @@ | ||
| 87 | 87 | return getToken(metadata.getFirstIdx(name)); |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | + @Override | |
| 90 | 91 | public Token getPartitionKeyToken() { |
| 91 | 92 | int i = 0; |
| 92 | 93 | for (ColumnDefinitions.Definition column : metadata) { |
modified driver-core/src/main/java/com/datastax/driver/core/AuthProvider.java +1 −0
| @@ -34,6 +34,7 @@ | ||
| 34 | 34 | * This is only useful as a placeholder when no authentication is to be used. |
| 35 | 35 | */ |
| 36 | 36 | public static final AuthProvider NONE = new AuthProvider() { |
| 37 | + @Override | |
| 37 | 38 | public Authenticator newAuthenticator(InetSocketAddress host) { |
| 38 | 39 | throw new AuthenticationException(host, |
| 39 | 40 | String.format("Host %s requires authentication, but no authenticator found in Cluster configuration", host)); |
modified driver-core/src/main/java/com/datastax/driver/core/BoundStatement.java +83 −0
| @@ -304,6 +304,7 @@ | ||
| 304 | 304 | * @throws IndexOutOfBoundsException if {@code i < 0 || i >= this.preparedStatement().variables().size()}. |
| 305 | 305 | * @throws InvalidTypeException if column {@code i} is not of type BOOLEAN. |
| 306 | 306 | */ |
| 307 | + @Override | |
| 307 | 308 | public BoundStatement setBool(int i, boolean v) { |
| 308 | 309 | return wrapper.setBool(i, v); |
| 309 | 310 | } |
| @@ -320,6 +321,7 @@ | ||
| 320 | 321 | * variable, that is, if {@code !this.preparedStatement().variables().names().contains(name)}. |
| 321 | 322 | * @throws InvalidTypeException if (any one occurrence of) {@code name} is not of type BOOLEAN. |
| 322 | 323 | */ |
| 324 | + @Override | |
| 323 | 325 | public BoundStatement setBool(String name, boolean v) { |
| 324 | 326 | return wrapper.setBool(name, v); |
| 325 | 327 | } |
| @@ -333,6 +335,7 @@ | ||
| 333 | 335 | * @throws IndexOutOfBoundsException if {@code i < 0 || i >= this.preparedStatement().variables().size()}. |
| 334 | 336 | * @throws InvalidTypeException if column {@code i} is not of type INT. |
| 335 | 337 | */ |
| 338 | + @Override | |
| 336 | 339 | public BoundStatement setInt(int i, int v) { |
| 337 | 340 | return wrapper.setInt(i, v); |
| 338 | 341 | } |
| @@ -349,6 +352,7 @@ | ||
| 349 | 352 | * variable, that is, if {@code !this.preparedStatement().variables().names().contains(name)}. |
| 350 | 353 | * @throws InvalidTypeException if (any one occurrence of) {@code name} is not of type INT. |
| 351 | 354 | */ |
| 355 | + @Override | |
| 352 | 356 | public BoundStatement setInt(String name, int v) { |
| 353 | 357 | return wrapper.setInt(name, v); |
| 354 | 358 | } |
| @@ -362,6 +366,7 @@ | ||
| 362 | 366 | * @throws IndexOutOfBoundsException if {@code i < 0 || i >= this.preparedStatement().variables().size()}. |
| 363 | 367 | * @throws InvalidTypeException if column {@code i} is not of type BIGINT or COUNTER. |
| 364 | 368 | */ |
| 369 | + @Override | |
| 365 | 370 | public BoundStatement setLong(int i, long v) { |
| 366 | 371 | return wrapper.setLong(i, v); |
| 367 | 372 | } |
| @@ -379,6 +384,7 @@ | ||
| 379 | 384 | * @throws InvalidTypeException if (any occurrence of) {@code name} is |
| 380 | 385 | * not of type BIGINT or COUNTER. |
| 381 | 386 | */ |
| 387 | + @Override | |
| 382 | 388 | public BoundStatement setLong(String name, long v) { |
| 383 | 389 | return wrapper.setLong(name, v); |
| 384 | 390 | } |
| @@ -392,6 +398,7 @@ | ||
| 392 | 398 | * @throws IndexOutOfBoundsException if {@code i < 0 || i >= this.preparedStatement().variables().size()}. |
| 393 | 399 | * @throws InvalidTypeException if column {@code i} is not of type TIMESTAMP. |
| 394 | 400 | */ |
| 401 | + @Override | |
| 395 | 402 | public BoundStatement setDate(int i, Date v) { |
| 396 | 403 | return wrapper.setDate(i, v); |
| 397 | 404 | } |
| @@ -409,6 +416,7 @@ | ||
| 409 | 416 | * @throws InvalidTypeException if (any occurrence of) {@code name} is |
| 410 | 417 | * not of type TIMESTAMP. |
| 411 | 418 | */ |
| 419 | + @Override | |
| 412 | 420 | public BoundStatement setDate(String name, Date v) { |
| 413 | 421 | return wrapper.setDate(name, v); |
| 414 | 422 | } |
| @@ -422,6 +430,7 @@ | ||
| 422 | 430 | * @throws IndexOutOfBoundsException if {@code i < 0 || i >= this.preparedStatement().variables().size()}. |
| 423 | 431 | * @throws InvalidTypeException if column {@code i} is not of type FLOAT. |
| 424 | 432 | */ |
| 433 | + @Override | |
| 425 | 434 | public BoundStatement setFloat(int i, float v) { |
| 426 | 435 | return wrapper.setFloat(i, v); |
| 427 | 436 | } |
| @@ -439,6 +448,7 @@ | ||
| 439 | 448 | * @throws InvalidTypeException if (any occurrence of) {@code name} is |
| 440 | 449 | * not of type FLOAT. |
| 441 | 450 | */ |
| 451 | + @Override | |
| 442 | 452 | public BoundStatement setFloat(String name, float v) { |
| 443 | 453 | return wrapper.setFloat(name, v); |
| 444 | 454 | } |
| @@ -452,6 +462,7 @@ | ||
| 452 | 462 | * @throws IndexOutOfBoundsException if {@code i < 0 || i >= this.preparedStatement().variables().size()}. |
| 453 | 463 | * @throws InvalidTypeException if column {@code i} is not of type DOUBLE. |
| 454 | 464 | */ |
| 465 | + @Override | |
| 455 | 466 | public BoundStatement setDouble(int i, double v) { |
| 456 | 467 | return wrapper.setDouble(i, v); |
| 457 | 468 | } |
| @@ -469,6 +480,7 @@ | ||
| 469 | 480 | * @throws InvalidTypeException if (any occurrence of) {@code name} is |
| 470 | 481 | * not of type DOUBLE. |
| 471 | 482 | */ |
| 483 | + @Override | |
| 472 | 484 | public BoundStatement setDouble(String name, double v) { |
| 473 | 485 | return wrapper.setDouble(name, v); |
| 474 | 486 | } |
| @@ -483,6 +495,7 @@ | ||
| 483 | 495 | * @throws InvalidTypeException if column {@code i} is of neither of the |
| 484 | 496 | * following types: VARCHAR, TEXT or ASCII. |
| 485 | 497 | */ |
| 498 | + @Override | |
| 486 | 499 | public BoundStatement setString(int i, String v) { |
| 487 | 500 | return wrapper.setString(i, v); |
| 488 | 501 | } |
| @@ -500,6 +513,7 @@ | ||
| 500 | 513 | * @throws InvalidTypeException if (any occurrence of) {@code name} is |
| 501 | 514 | * of neither of the following types: VARCHAR, TEXT or ASCII. |
| 502 | 515 | */ |
| 516 | + @Override | |
| 503 | 517 | public BoundStatement setString(String name, String v) { |
| 504 | 518 | return wrapper.setString(name, v); |
| 505 | 519 | } |
| @@ -517,6 +531,7 @@ | ||
| 517 | 531 | * @throws IndexOutOfBoundsException if {@code i < 0 || i >= this.preparedStatement().variables().size()}. |
| 518 | 532 | * @throws InvalidTypeException if column {@code i} is not of type BLOB. |
| 519 | 533 | */ |
| 534 | + @Override | |
| 520 | 535 | public BoundStatement setBytes(int i, ByteBuffer v) { |
| 521 | 536 | return wrapper.setBytes(i, v); |
| 522 | 537 | } |
| @@ -537,6 +552,7 @@ | ||
| 537 | 552 | * variable, that is if {@code !this.preparedStatement().variables().names().contains(name)}. |
| 538 | 553 | * @throws InvalidTypeException if (any occurrence of) {@code name} is not of type BLOB. |
| 539 | 554 | */ |
| 555 | + @Override | |
| 540 | 556 | public BoundStatement setBytes(String name, ByteBuffer v) { |
| 541 | 557 | return wrapper.setBytes(name, v); |
| 542 | 558 | } |
| @@ -554,6 +570,7 @@ | ||
| 554 | 570 | * @return this BoundStatement. |
| 555 | 571 | * @throws IndexOutOfBoundsException if {@code i < 0 || i >= this.preparedStatement().variables().size()}. |
| 556 | 572 | */ |
| 573 | + @Override | |
| 557 | 574 | public BoundStatement setBytesUnsafe(int i, ByteBuffer v) { |
| 558 | 575 | return wrapper.setBytesUnsafe(i, v); |
| 559 | 576 | } |
| @@ -574,6 +591,7 @@ | ||
| 574 | 591 | * @throws IllegalArgumentException if {@code name} is not a prepared |
| 575 | 592 | * variable, that is if {@code !this.preparedStatement().variables().names().contains(name)}. |
| 576 | 593 | */ |
| 594 | + @Override | |
| 577 | 595 | public BoundStatement setBytesUnsafe(String name, ByteBuffer v) { |
| 578 | 596 | return wrapper.setBytesUnsafe(name, v); |
| 579 | 597 | } |
| @@ -587,6 +605,7 @@ | ||
| 587 | 605 | * @throws IndexOutOfBoundsException if {@code i < 0 || i >= this.preparedStatement().variables().size()}. |
| 588 | 606 | * @throws InvalidTypeException if column {@code i} is not of type VARINT. |
| 589 | 607 | */ |
| 608 | + @Override | |
| 590 | 609 | public BoundStatement setVarint(int i, BigInteger v) { |
| 591 | 610 | return wrapper.setVarint(i, v); |
| 592 | 611 | } |
| @@ -604,6 +623,7 @@ | ||
| 604 | 623 | * @throws InvalidTypeException if (any occurrence of) {@code name} is |
| 605 | 624 | * not of type VARINT. |
| 606 | 625 | */ |
| 626 | + @Override | |
| 607 | 627 | public BoundStatement setVarint(String name, BigInteger v) { |
| 608 | 628 | return wrapper.setVarint(name, v); |
| 609 | 629 | } |
| @@ -617,6 +637,7 @@ | ||
| 617 | 637 | * @throws IndexOutOfBoundsException if {@code i < 0 || i >= this.preparedStatement().variables().size()}. |
| 618 | 638 | * @throws InvalidTypeException if column {@code i} is not of type DECIMAL. |
| 619 | 639 | */ |
| 640 | + @Override | |
| 620 | 641 | public BoundStatement setDecimal(int i, BigDecimal v) { |
| 621 | 642 | return wrapper.setDecimal(i, v); |
| 622 | 643 | } |
| @@ -634,6 +655,7 @@ | ||
| 634 | 655 | * @throws InvalidTypeException if (any occurrence of) {@code name} is |
| 635 | 656 | * not of type DECIMAL. |
| 636 | 657 | */ |
| 658 | + @Override | |
| 637 | 659 | public BoundStatement setDecimal(String name, BigDecimal v) { |
| 638 | 660 | return wrapper.setDecimal(name, v); |
| 639 | 661 | } |
| @@ -649,6 +671,7 @@ | ||
| 649 | 671 | * TIMEUUID, or if column {@code i} is of type TIMEUUID but {@code v} is |
| 650 | 672 | * not a type 1 UUID. |
| 651 | 673 | */ |
| 674 | + @Override | |
| 652 | 675 | public BoundStatement setUUID(int i, UUID v) { |
| 653 | 676 | return wrapper.setUUID(i, v); |
| 654 | 677 | } |
| @@ -667,6 +690,7 @@ | ||
| 667 | 690 | * not of type UUID or TIMEUUID, or if column {@code name} is of type |
| 668 | 691 | * TIMEUUID but {@code v} is not a type 1 UUID. |
| 669 | 692 | */ |
| 693 | + @Override | |
| 670 | 694 | public BoundStatement setUUID(String name, UUID v) { |
| 671 | 695 | return wrapper.setUUID(name, v); |
| 672 | 696 | } |
| @@ -680,6 +704,7 @@ | ||
| 680 | 704 | * @throws IndexOutOfBoundsException if {@code i < 0 || i >= this.preparedStatement().variables().size()}. |
| 681 | 705 | * @throws InvalidTypeException if column {@code i} is not of type INET. |
| 682 | 706 | */ |
| 707 | + @Override | |
| 683 | 708 | public BoundStatement setInet(int i, InetAddress v) { |
| 684 | 709 | return wrapper.setInet(i, v); |
| 685 | 710 | } |
| @@ -697,6 +722,7 @@ | ||
| 697 | 722 | * @throws InvalidTypeException if (any occurrence of) {@code name} is |
| 698 | 723 | * not of type INET. |
| 699 | 724 | */ |
| 725 | + @Override | |
| 700 | 726 | public BoundStatement setInet(String name, InetAddress v) { |
| 701 | 727 | return wrapper.setInet(name, v); |
| 702 | 728 | } |
| @@ -795,6 +821,7 @@ | ||
| 795 | 821 | * @throws NullPointerException if {@code v} contains null values. Nulls are not supported in collections |
| 796 | 822 | * by CQL. |
| 797 | 823 | */ |
| 824 | + @Override | |
| 798 | 825 | public <T> BoundStatement setList(int i, List<T> v) { |
| 799 | 826 | return wrapper.setList(i, v); |
| 800 | 827 | } |
| @@ -818,6 +845,7 @@ | ||
| 818 | 845 | * @throws NullPointerException if {@code v} contains null values. Nulls are not supported in collections |
| 819 | 846 | * by CQL. |
| 820 | 847 | */ |
| 848 | + @Override | |
| 821 | 849 | public <T> BoundStatement setList(String name, List<T> v) { |
| 822 | 850 | return wrapper.setList(name, v); |
| 823 | 851 | } |
| @@ -839,6 +867,7 @@ | ||
| 839 | 867 | * @throws NullPointerException if {@code v} contains null values. Nulls are not supported in collections |
| 840 | 868 | * by CQL. |
| 841 | 869 | */ |
| 870 | + @Override | |
| 842 | 871 | public <K, V> BoundStatement setMap(int i, Map<K, V> v) { |
| 843 | 872 | return wrapper.setMap(i, v); |
| 844 | 873 | } |
| @@ -863,6 +892,7 @@ | ||
| 863 | 892 | * @throws NullPointerException if {@code v} contains null values. Nulls are not supported in collections |
| 864 | 893 | * by CQL. |
| 865 | 894 | */ |
| 895 | + @Override | |
| 866 | 896 | public <K, V> BoundStatement setMap(String name, Map<K, V> v) { |
| 867 | 897 | return wrapper.setMap(name, v); |
| 868 | 898 | } |
| @@ -883,6 +913,7 @@ | ||
| 883 | 913 | * @throws NullPointerException if {@code v} contains null values. Nulls are not supported in collections |
| 884 | 914 | * by CQL. |
| 885 | 915 | */ |
| 916 | + @Override | |
| 886 | 917 | public <T> BoundStatement setSet(int i, Set<T> v) { |
| 887 | 918 | return wrapper.setSet(i, v); |
| 888 | 919 | } |
| @@ -906,6 +937,7 @@ | ||
| 906 | 937 | * @throws NullPointerException if {@code v} contains null values. Nulls are not supported in collections |
| 907 | 938 | * by CQL. |
| 908 | 939 | */ |
| 940 | + @Override | |
| 909 | 941 | public <T> BoundStatement setSet(String name, Set<T> v) { |
| 910 | 942 | return wrapper.setSet(name, v); |
| 911 | 943 | } |
| @@ -920,6 +952,7 @@ | ||
| 920 | 952 | * @throws InvalidTypeException if value {@code i} is not a UDT value or if its definition |
| 921 | 953 | * does not correspond to the one of {@code v}. |
| 922 | 954 | */ |
| 955 | + @Override | |
| 923 | 956 | public BoundStatement setUDTValue(int i, UDTValue v) { |
| 924 | 957 | return wrapper.setUDTValue(i, v); |
| 925 | 958 | } |
| @@ -937,6 +970,7 @@ | ||
| 937 | 970 | * not a UDT value or if the definition of column {@code name} does not correspond to |
| 938 | 971 | * the one of {@code v}. |
| 939 | 972 | */ |
| 973 | + @Override | |
| 940 | 974 | public BoundStatement setUDTValue(String name, UDTValue v) { |
| 941 | 975 | return wrapper.setUDTValue(name, v); |
| 942 | 976 | } |
| @@ -951,6 +985,7 @@ | ||
| 951 | 985 | * @throws InvalidTypeException if value {@code i} is not a tuple value or if its types |
| 952 | 986 | * do not correspond to the ones of {@code v}. |
| 953 | 987 | */ |
| 988 | + @Override | |
| 954 | 989 | public BoundStatement setTupleValue(int i, TupleValue v) { |
| 955 | 990 | return wrapper.setTupleValue(i, v); |
| 956 | 991 | } |
| @@ -968,6 +1003,7 @@ | ||
| 968 | 1003 | * not a tuple value or if the types of column {@code name} do not correspond to |
| 969 | 1004 | * the ones of {@code v}. |
| 970 | 1005 | */ |
| 1006 | + @Override | |
| 971 | 1007 | public BoundStatement setTupleValue(String name, TupleValue v) { |
| 972 | 1008 | return wrapper.setTupleValue(name, v); |
| 973 | 1009 | } |
| @@ -981,6 +1017,7 @@ | ||
| 981 | 1017 | * @return this object. |
| 982 | 1018 | * @throws IndexOutOfBoundsException if {@code i} is not a valid index for this object. |
| 983 | 1019 | */ |
| 1020 | + @Override | |
| 984 | 1021 | public BoundStatement setToNull(int i) { |
| 985 | 1022 | return wrapper.setToNull(i); |
| 986 | 1023 | } |
| @@ -995,6 +1032,7 @@ | ||
| 995 | 1032 | * @return this object. |
| 996 | 1033 | * @throws IllegalArgumentException if {@code name} is not a valid name for this object. |
| 997 | 1034 | */ |
| 1035 | + @Override | |
| 998 | 1036 | public BoundStatement setToNull(String name) { |
| 999 | 1037 | return wrapper.setToNull(name); |
| 1000 | 1038 | } |
| @@ -1002,6 +1040,7 @@ | ||
| 1002 | 1040 | /** |
| 1003 | 1041 | * {@inheritDoc} |
| 1004 | 1042 | */ |
| 1043 | + @Override | |
| 1005 | 1044 | public boolean isNull(int i) { |
| 1006 | 1045 | return wrapper.isNull(i); |
| 1007 | 1046 | } |
| @@ -1009,6 +1048,7 @@ | ||
| 1009 | 1048 | /** |
| 1010 | 1049 | * {@inheritDoc} |
| 1011 | 1050 | */ |
| 1051 | + @Override | |
| 1012 | 1052 | public boolean isNull(String name) { |
| 1013 | 1053 | return wrapper.isNull(name); |
| 1014 | 1054 | } |
| @@ -1023,6 +1063,7 @@ | ||
| 1023 | 1063 | /** |
| 1024 | 1064 | * {@inheritDoc} |
| 1025 | 1065 | */ |
| 1066 | + @Override | |
| 1026 | 1067 | public boolean getBool(String name) { |
| 1027 | 1068 | return wrapper.getBool(name); |
| 1028 | 1069 | } |
| @@ -1030,6 +1071,7 @@ | ||
| 1030 | 1071 | /** |
| 1031 | 1072 | * {@inheritDoc} |
| 1032 | 1073 | */ |
| 1074 | + @Override | |
| 1033 | 1075 | public int getInt(int i) { |
| 1034 | 1076 | return wrapper.getInt(i); |
| 1035 | 1077 | } |
| @@ -1037,6 +1079,7 @@ | ||
| 1037 | 1079 | /** |
| 1038 | 1080 | * {@inheritDoc} |
| 1039 | 1081 | */ |
| 1082 | + @Override | |
| 1040 | 1083 | public int getInt(String name) { |
| 1041 | 1084 | return wrapper.getInt(name); |
| 1042 | 1085 | } |
| @@ -1044,6 +1087,7 @@ | ||
| 1044 | 1087 | /** |
| 1045 | 1088 | * {@inheritDoc} |
| 1046 | 1089 | */ |
| 1090 | + @Override | |
| 1047 | 1091 | public long getLong(int i) { |
| 1048 | 1092 | return wrapper.getLong(i); |
| 1049 | 1093 | } |
| @@ -1051,6 +1095,7 @@ | ||
| 1051 | 1095 | /** |
| 1052 | 1096 | * {@inheritDoc} |
| 1053 | 1097 | */ |
| 1098 | + @Override | |
| 1054 | 1099 | public long getLong(String name) { |
| 1055 | 1100 | return wrapper.getLong(name); |
| 1056 | 1101 | } |
| @@ -1058,6 +1103,7 @@ | ||
| 1058 | 1103 | /** |
| 1059 | 1104 | * {@inheritDoc} |
| 1060 | 1105 | */ |
| 1106 | + @Override | |
| 1061 | 1107 | public Date getDate(int i) { |
| 1062 | 1108 | return wrapper.getDate(i); |
| 1063 | 1109 | } |
| @@ -1065,6 +1111,7 @@ | ||
| 1065 | 1111 | /** |
| 1066 | 1112 | * {@inheritDoc} |
| 1067 | 1113 | */ |
| 1114 | + @Override | |
| 1068 | 1115 | public Date getDate(String name) { |
| 1069 | 1116 | return wrapper.getDate(name); |
| 1070 | 1117 | } |
| @@ -1072,6 +1119,7 @@ | ||
| 1072 | 1119 | /** |
| 1073 | 1120 | * {@inheritDoc} |
| 1074 | 1121 | */ |
| 1122 | + @Override | |
| 1075 | 1123 | public float getFloat(int i) { |
| 1076 | 1124 | return wrapper.getFloat(i); |
| 1077 | 1125 | } |
| @@ -1079,6 +1127,7 @@ | ||
| 1079 | 1127 | /** |
| 1080 | 1128 | * {@inheritDoc} |
| 1081 | 1129 | */ |
| 1130 | + @Override | |
| 1082 | 1131 | public float getFloat(String name) { |
| 1083 | 1132 | return wrapper.getFloat(name); |
| 1084 | 1133 | } |
| @@ -1086,6 +1135,7 @@ | ||
| 1086 | 1135 | /** |
| 1087 | 1136 | * {@inheritDoc} |
| 1088 | 1137 | */ |
| 1138 | + @Override | |
| 1089 | 1139 | public double getDouble(int i) { |
| 1090 | 1140 | return wrapper.getDouble(i); |
| 1091 | 1141 | } |
| @@ -1093,6 +1143,7 @@ | ||
| 1093 | 1143 | /** |
| 1094 | 1144 | * {@inheritDoc} |
| 1095 | 1145 | */ |
| 1146 | + @Override | |
| 1096 | 1147 | public double getDouble(String name) { |
| 1097 | 1148 | return wrapper.getDouble(name); |
| 1098 | 1149 | } |
| @@ -1100,6 +1151,7 @@ | ||
| 1100 | 1151 | /** |
| 1101 | 1152 | * {@inheritDoc} |
| 1102 | 1153 | */ |
| 1154 | + @Override | |
| 1103 | 1155 | public ByteBuffer getBytesUnsafe(int i) { |
| 1104 | 1156 | return wrapper.getBytesUnsafe(i); |
| 1105 | 1157 | } |
| @@ -1107,6 +1159,7 @@ | ||
| 1107 | 1159 | /** |
| 1108 | 1160 | * {@inheritDoc} |
| 1109 | 1161 | */ |
| 1162 | + @Override | |
| 1110 | 1163 | public ByteBuffer getBytesUnsafe(String name) { |
| 1111 | 1164 | return wrapper.getBytesUnsafe(name); |
| 1112 | 1165 | } |
| @@ -1114,6 +1167,7 @@ | ||
| 1114 | 1167 | /** |
| 1115 | 1168 | * {@inheritDoc} |
| 1116 | 1169 | */ |
| 1170 | + @Override | |
| 1117 | 1171 | public ByteBuffer getBytes(int i) { |
| 1118 | 1172 | return wrapper.getBytes(i); |
| 1119 | 1173 | } |
| @@ -1121,6 +1175,7 @@ | ||
| 1121 | 1175 | /** |
| 1122 | 1176 | * {@inheritDoc} |
| 1123 | 1177 | */ |
| 1178 | + @Override | |
| 1124 | 1179 | public ByteBuffer getBytes(String name) { |
| 1125 | 1180 | return wrapper.getBytes(name); |
| 1126 | 1181 | } |
| @@ -1128,6 +1183,7 @@ | ||
| 1128 | 1183 | /** |
| 1129 | 1184 | * {@inheritDoc} |
| 1130 | 1185 | */ |
| 1186 | + @Override | |
| 1131 | 1187 | public String getString(int i) { |
| 1132 | 1188 | return wrapper.getString(i); |
| 1133 | 1189 | } |
| @@ -1135,6 +1191,7 @@ | ||
| 1135 | 1191 | /** |
| 1136 | 1192 | * {@inheritDoc} |
| 1137 | 1193 | */ |
| 1194 | + @Override | |
| 1138 | 1195 | public String getString(String name) { |
| 1139 | 1196 | return wrapper.getString(name); |
| 1140 | 1197 | } |
| @@ -1142,6 +1199,7 @@ | ||
| 1142 | 1199 | /** |
| 1143 | 1200 | * {@inheritDoc} |
| 1144 | 1201 | */ |
| 1202 | + @Override | |
| 1145 | 1203 | public BigInteger getVarint(int i) { |
| 1146 | 1204 | return wrapper.getVarint(i); |
| 1147 | 1205 | } |
| @@ -1149,6 +1207,7 @@ | ||
| 1149 | 1207 | /** |
| 1150 | 1208 | * {@inheritDoc} |
| 1151 | 1209 | */ |
| 1210 | + @Override | |
| 1152 | 1211 | public BigInteger getVarint(String name) { |
| 1153 | 1212 | return wrapper.getVarint(name); |
| 1154 | 1213 | } |
| @@ -1156,6 +1215,7 @@ | ||
| 1156 | 1215 | /** |
| 1157 | 1216 | * {@inheritDoc} |
| 1158 | 1217 | */ |
| 1218 | + @Override | |
| 1159 | 1219 | public BigDecimal getDecimal(int i) { |
| 1160 | 1220 | return wrapper.getDecimal(i); |
| 1161 | 1221 | } |
| @@ -1163,6 +1223,7 @@ | ||
| 1163 | 1223 | /** |
| 1164 | 1224 | * {@inheritDoc} |
| 1165 | 1225 | */ |
| 1226 | + @Override | |
| 1166 | 1227 | public BigDecimal getDecimal(String name) { |
| 1167 | 1228 | return wrapper.getDecimal(name); |
| 1168 | 1229 | } |
| @@ -1170,6 +1231,7 @@ | ||
| 1170 | 1231 | /** |
| 1171 | 1232 | * {@inheritDoc} |
| 1172 | 1233 | */ |
| 1234 | + @Override | |
| 1173 | 1235 | public UUID getUUID(int i) { |
| 1174 | 1236 | return wrapper.getUUID(i); |
| 1175 | 1237 | } |
| @@ -1177,6 +1239,7 @@ | ||
| 1177 | 1239 | /** |
| 1178 | 1240 | * {@inheritDoc} |
| 1179 | 1241 | */ |
| 1242 | + @Override | |
| 1180 | 1243 | public UUID getUUID(String name) { |
| 1181 | 1244 | return wrapper.getUUID(name); |
| 1182 | 1245 | } |
| @@ -1184,6 +1247,7 @@ | ||
| 1184 | 1247 | /** |
| 1185 | 1248 | * {@inheritDoc} |
| 1186 | 1249 | */ |
| 1250 | + @Override | |
| 1187 | 1251 | public InetAddress getInet(int i) { |
| 1188 | 1252 | return wrapper.getInet(i); |
| 1189 | 1253 | } |
| @@ -1191,6 +1255,7 @@ | ||
| 1191 | 1255 | /** |
| 1192 | 1256 | * {@inheritDoc} |
| 1193 | 1257 | */ |
| 1258 | + @Override | |
| 1194 | 1259 | public InetAddress getInet(String name) { |
| 1195 | 1260 | return wrapper.getInet(name); |
| 1196 | 1261 | } |
| @@ -1198,6 +1263,7 @@ | ||
| 1198 | 1263 | /** |
| 1199 | 1264 | * {@inheritDoc} |
| 1200 | 1265 | */ |
| 1266 | + @Override | |
| 1201 | 1267 | public <T> List<T> getList(int i, Class<T> elementsClass) { |
| 1202 | 1268 | return wrapper.getList(i, elementsClass); |
| 1203 | 1269 | } |
| @@ -1205,6 +1271,7 @@ | ||
| 1205 | 1271 | /** |
| 1206 | 1272 | * {@inheritDoc} |
| 1207 | 1273 | */ |
| 1274 | + @Override | |
| 1208 | 1275 | public <T> List<T> getList(int i, TypeToken<T> elementsType) { |
| 1209 | 1276 | return wrapper.getList(i, elementsType); |
| 1210 | 1277 | } |
| @@ -1212,6 +1279,7 @@ | ||
| 1212 | 1279 | /** |
| 1213 | 1280 | * {@inheritDoc} |
| 1214 | 1281 | */ |
| 1282 | + @Override | |
| 1215 | 1283 | public <T> List<T> getList(String name, Class<T> elementsClass) { |
| 1216 | 1284 | return wrapper.getList(name, elementsClass); |
| 1217 | 1285 | } |
| @@ -1219,6 +1287,7 @@ | ||
| 1219 | 1287 | /** |
| 1220 | 1288 | * {@inheritDoc} |
| 1221 | 1289 | */ |
| 1290 | + @Override | |
| 1222 | 1291 | public <T> List<T> getList(String name, TypeToken<T> elementsType) { |
| 1223 | 1292 | return wrapper.getList(name, elementsType); |
| 1224 | 1293 | } |
| @@ -1226,6 +1295,7 @@ | ||
| 1226 | 1295 | /** |
| 1227 | 1296 | * {@inheritDoc} |
| 1228 | 1297 | */ |
| 1298 | + @Override | |
| 1229 | 1299 | public <T> Set<T> getSet(int i, Class<T> elementsClass) { |
| 1230 | 1300 | return wrapper.getSet(i, elementsClass); |
| 1231 | 1301 | } |
| @@ -1233,6 +1303,7 @@ | ||
| 1233 | 1303 | /** |
| 1234 | 1304 | * {@inheritDoc} |
| 1235 | 1305 | */ |
| 1306 | + @Override | |
| 1236 | 1307 | public <T> Set<T> getSet(int i, TypeToken<T> elementsType) { |
| 1237 | 1308 | return wrapper.getSet(i, elementsType); |
| 1238 | 1309 | } |
| @@ -1240,6 +1311,7 @@ | ||
| 1240 | 1311 | /** |
| 1241 | 1312 | * {@inheritDoc} |
| 1242 | 1313 | */ |
| 1314 | + @Override | |
| 1243 | 1315 | public <T> Set<T> getSet(String name, Class<T> elementsClass) { |
| 1244 | 1316 | return wrapper.getSet(name, elementsClass); |
| 1245 | 1317 | } |
| @@ -1247,6 +1319,7 @@ | ||
| 1247 | 1319 | /** |
| 1248 | 1320 | * {@inheritDoc} |
| 1249 | 1321 | */ |
| 1322 | + @Override | |
| 1250 | 1323 | public <T> Set<T> getSet(String name, TypeToken<T> elementsType) { |
| 1251 | 1324 | return wrapper.getSet(name, elementsType); |
| 1252 | 1325 | } |
| @@ -1254,6 +1327,7 @@ | ||
| 1254 | 1327 | /** |
| 1255 | 1328 | * {@inheritDoc} |
| 1256 | 1329 | */ |
| 1330 | + @Override | |
| 1257 | 1331 | public <K, V> Map<K, V> getMap(int i, Class<K> keysClass, Class<V> valuesClass) { |
| 1258 | 1332 | return wrapper.getMap(i, keysClass, valuesClass); |
| 1259 | 1333 | } |
| @@ -1261,6 +1335,7 @@ | ||
| 1261 | 1335 | /** |
| 1262 | 1336 | * {@inheritDoc} |
| 1263 | 1337 | */ |
| 1338 | + @Override | |
| 1264 | 1339 | public <K, V> Map<K, V> getMap(int i, TypeToken<K> keysType, TypeToken<V> valuesType) { |
| 1265 | 1340 | return wrapper.getMap(i, keysType, valuesType); |
| 1266 | 1341 | } |
| @@ -1268,6 +1343,7 @@ | ||
| 1268 | 1343 | /** |
| 1269 | 1344 | * {@inheritDoc} |
| 1270 | 1345 | */ |
| 1346 | + @Override | |
| 1271 | 1347 | public <K, V> Map<K, V> getMap(String name, Class<K> keysClass, Class<V> valuesClass) { |
| 1272 | 1348 | return wrapper.getMap(name, keysClass, valuesClass); |
| 1273 | 1349 | } |
| @@ -1275,6 +1351,7 @@ | ||
| 1275 | 1351 | /** |
| 1276 | 1352 | * {@inheritDoc} |
| 1277 | 1353 | */ |
| 1354 | + @Override | |
| 1278 | 1355 | public <K, V> Map<K, V> getMap(String name, TypeToken<K> keysType, TypeToken<V> valuesType) { |
| 1279 | 1356 | return wrapper.getMap(name, keysType, valuesType); |
| 1280 | 1357 | } |
| @@ -1282,6 +1359,7 @@ | ||
| 1282 | 1359 | /** |
| 1283 | 1360 | * {@inheritDoc} |
| 1284 | 1361 | */ |
| 1362 | + @Override | |
| 1285 | 1363 | public UDTValue getUDTValue(int i) { |
| 1286 | 1364 | return wrapper.getUDTValue(i); |
| 1287 | 1365 | } |
| @@ -1289,6 +1367,7 @@ | ||
| 1289 | 1367 | /** |
| 1290 | 1368 | * {@inheritDoc} |
| 1291 | 1369 | */ |
| 1370 | + @Override | |
| 1292 | 1371 | public UDTValue getUDTValue(String name) { |
| 1293 | 1372 | return wrapper.getUDTValue(name); |
| 1294 | 1373 | } |
| @@ -1296,6 +1375,7 @@ | ||
| 1296 | 1375 | /** |
| 1297 | 1376 | * {@inheritDoc} |
| 1298 | 1377 | */ |
| 1378 | + @Override | |
| 1299 | 1379 | public TupleValue getTupleValue(int i) { |
| 1300 | 1380 | return wrapper.getTupleValue(i); |
| 1301 | 1381 | } |
| @@ -1303,6 +1383,7 @@ | ||
| 1303 | 1383 | /** |
| 1304 | 1384 | * {@inheritDoc} |
| 1305 | 1385 | */ |
| 1386 | + @Override | |
| 1306 | 1387 | public TupleValue getTupleValue(String name) { |
| 1307 | 1388 | return wrapper.getTupleValue(name); |
| 1308 | 1389 | } |
| @@ -1310,6 +1391,7 @@ | ||
| 1310 | 1391 | /** |
| 1311 | 1392 | * {@inheritDoc} |
| 1312 | 1393 | */ |
| 1394 | + @Override | |
| 1313 | 1395 | public Object getObject(int i) { |
| 1314 | 1396 | return wrapper.getObject(i); |
| 1315 | 1397 | } |
| @@ -1317,6 +1399,7 @@ | ||
| 1317 | 1399 | /** |
| 1318 | 1400 | * {@inheritDoc} |
| 1319 | 1401 | */ |
| 1402 | + @Override | |
| 1320 | 1403 | public Object getObject(String name) { |
| 1321 | 1404 | return wrapper.getObject(name); |
| 1322 | 1405 | } |
modified driver-core/src/main/java/com/datastax/driver/core/CloseFuture.java +2 −0
| @@ -72,10 +72,12 @@ | ||
| 72 | 72 | this.futures = futures; |
| 73 | 73 | |
| 74 | 74 | Futures.addCallback(Futures.allAsList(futures), new FutureCallback<List<Void>>() { |
| 75 | + @Override | |
| 75 | 76 | public void onFailure(Throwable t) { |
| 76 | 77 | Forwarding.this.setException(t); |
| 77 | 78 | } |
| 78 | 79 | |
| 80 | + @Override | |
| 79 | 81 | public void onSuccess(List<Void> v) { |
| 80 | 82 | Forwarding.this.onFuturesDone(); |
| 81 | 83 | } |
modified driver-core/src/main/java/com/datastax/driver/core/Cluster.java +13 −0
| @@ -548,6 +548,7 @@ | ||
| 548 | 548 | * <p/> |
| 549 | 549 | * This method is a shortcut for {@code closeAsync().get()}. |
| 550 | 550 | */ |
| 551 | + @Override | |
| 551 | 552 | public void close() { |
| 552 | 553 | try { |
| 553 | 554 | closeAsync().get(); |
| @@ -1814,10 +1815,12 @@ | ||
| 1814 | 1815 | void startPeriodicReconnectionAttempt(final Host host, final boolean isHostAddition) { |
| 1815 | 1816 | new AbstractReconnectionHandler(host.toString(), reconnectionExecutor, reconnectionPolicy().newSchedule(), host.reconnectionAttempt) { |
| 1816 | 1817 | |
| 1818 | + @Override | |
| 1817 | 1819 | protected Connection tryReconnect() throws ConnectionException, InterruptedException, UnsupportedProtocolVersionException, ClusterNameMismatchException { |
| 1818 | 1820 | return connectionFactory.open(host); |
| 1819 | 1821 | } |
| 1820 | 1822 | |
| 1823 | + @Override | |
| 1821 | 1824 | protected void onReconnection(Connection connection) { |
| 1822 | 1825 | // Make sure we have up-to-date infos on that host before adding it (so we typically |
| 1823 | 1826 | // catch that an upgraded node uses a new cassandra version). |
| @@ -1839,17 +1842,20 @@ | ||
| 1839 | 1842 | } |
| 1840 | 1843 | } |
| 1841 | 1844 | |
| 1845 | + @Override | |
| 1842 | 1846 | protected boolean onConnectionException(ConnectionException e, long nextDelayMs) { |
| 1843 | 1847 | if (logger.isDebugEnabled()) |
| 1844 | 1848 | logger.debug("Failed reconnection to {} ({}), scheduling retry in {} milliseconds", host, e.getMessage(), nextDelayMs); |
| 1845 | 1849 | return true; |
| 1846 | 1850 | } |
| 1847 | 1851 | |
| 1852 | + @Override | |
| 1848 | 1853 | protected boolean onUnknownException(Exception e, long nextDelayMs) { |
| 1849 | 1854 | logger.error(String.format("Unknown error during reconnection to %s, scheduling retry in %d milliseconds", host, nextDelayMs), e); |
| 1850 | 1855 | return true; |
| 1851 | 1856 | } |
| 1852 | 1857 | |
| 1858 | + @Override | |
| 1853 | 1859 | protected boolean onAuthenticationException(AuthenticationException e, long nextDelayMs) { |
| 1854 | 1860 | logger.error(String.format("Authentication error during reconnection to %s, scheduling retry in %d milliseconds", host, nextDelayMs), e); |
| 1855 | 1861 | return true; |
| @@ -1867,10 +1873,12 @@ | ||
| 1867 | 1873 | // Setting an initial delay of 0 to start immediately, and all the exception handlers return false to prevent further attempts |
| 1868 | 1874 | new AbstractReconnectionHandler(host.toString(), reconnectionExecutor, reconnectionPolicy().newSchedule(), host.reconnectionAttempt, 0) { |
| 1869 | 1875 | |
| 1876 | + @Override | |
| 1870 | 1877 | protected Connection tryReconnect() throws ConnectionException, InterruptedException, UnsupportedProtocolVersionException, ClusterNameMismatchException { |
| 1871 | 1878 | return connectionFactory.open(host); |
| 1872 | 1879 | } |
| 1873 | 1880 | |
| 1881 | + @Override | |
| 1874 | 1882 | protected void onReconnection(Connection connection) { |
| 1875 | 1883 | // Make sure we have up-to-date infos on that host before adding it (so we typically |
| 1876 | 1884 | // catch that an upgraded node uses a new cassandra version). |
| @@ -1889,17 +1897,20 @@ | ||
| 1889 | 1897 | } |
| 1890 | 1898 | } |
| 1891 | 1899 | |
| 1900 | + @Override | |
| 1892 | 1901 | protected boolean onConnectionException(ConnectionException e, long nextDelayMs) { |
| 1893 | 1902 | if (logger.isDebugEnabled()) |
| 1894 | 1903 | logger.debug("Failed one-time reconnection to {} ({})", host, e.getMessage()); |
| 1895 | 1904 | return false; |
| 1896 | 1905 | } |
| 1897 | 1906 | |
| 1907 | + @Override | |
| 1898 | 1908 | protected boolean onUnknownException(Exception e, long nextDelayMs) { |
| 1899 | 1909 | logger.error(String.format("Unknown error during one-time reconnection to %s", host), e); |
| 1900 | 1910 | return false; |
| 1901 | 1911 | } |
| 1902 | 1912 | |
| 1913 | + @Override | |
| 1903 | 1914 | protected boolean onAuthenticationException(AuthenticationException e, long nextDelayMs) { |
| 1904 | 1915 | logger.error(String.format("Authentication error during one-time reconnection to %s", host), e); |
| 1905 | 1916 | return false; |
| @@ -2414,6 +2425,7 @@ | ||
| 2414 | 2425 | * a netty worker, which we're going to shutdown. So creates some thread for that. |
| 2415 | 2426 | */ |
| 2416 | 2427 | (new Thread("Shutdown-checker") { |
| 2428 | + @Override | |
| 2417 | 2429 | public void run() { |
| 2418 | 2430 | // Just wait indefinitely on the the completion of the thread pools. Provided the user |
| 2419 | 2431 | // call force(), we'll never really block forever. |
| @@ -2605,6 +2617,7 @@ | ||
| 2605 | 2617 | // probably should be fixed C* side, after which we'll be able to remove this. |
| 2606 | 2618 | final SettableFuture<?> future = SettableFuture.create(); |
| 2607 | 2619 | scheduledTasksExecutor.schedule(new ExceptionCatchingRunnable() { |
| 2620 | + @Override | |
| 2608 | 2621 | public void runMayThrow() throws Exception { |
| 2609 | 2622 | ListenableFuture<?> f = execute(task); |
| 2610 | 2623 | Futures.addCallback(f, new FutureCallback<Object>() { |
modified driver-core/src/main/java/com/datastax/driver/core/DefaultPreparedStatement.java +20 −0
| @@ -95,42 +95,51 @@ | ||
| 95 | 95 | return true; |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | + @Override | |
| 98 | 99 | public ColumnDefinitions getVariables() { |
| 99 | 100 | return preparedId.metadata; |
| 100 | 101 | } |
| 101 | 102 | |
| 103 | + @Override | |
| 102 | 104 | public BoundStatement bind(Object... values) { |
| 103 | 105 | BoundStatement bs = new BoundStatement(this); |
| 104 | 106 | return bs.bind(values); |
| 105 | 107 | } |
| 106 | 108 | |
| 109 | + @Override | |
| 107 | 110 | public BoundStatement bind() { |
| 108 | 111 | return new BoundStatement(this); |
| 109 | 112 | } |
| 110 | 113 | |
| 114 | + @Override | |
| 111 | 115 | public PreparedStatement setRoutingKey(ByteBuffer routingKey) { |
| 112 | 116 | this.routingKey = routingKey; |
| 113 | 117 | return this; |
| 114 | 118 | } |
| 115 | 119 | |
| 120 | + @Override | |
| 116 | 121 | public PreparedStatement setRoutingKey(ByteBuffer... routingKeyComponents) { |
| 117 | 122 | this.routingKey = SimpleStatement.compose(routingKeyComponents); |
| 118 | 123 | return this; |
| 119 | 124 | } |
| 120 | 125 | |
| 126 | + @Override | |
| 121 | 127 | public ByteBuffer getRoutingKey() { |
| 122 | 128 | return routingKey; |
| 123 | 129 | } |
| 124 | 130 | |
| 131 | + @Override | |
| 125 | 132 | public PreparedStatement setConsistencyLevel(ConsistencyLevel consistency) { |
| 126 | 133 | this.consistency = consistency; |
| 127 | 134 | return this; |
| 128 | 135 | } |
| 129 | 136 | |
| 137 | + @Override | |
| 130 | 138 | public ConsistencyLevel getConsistencyLevel() { |
| 131 | 139 | return consistency; |
| 132 | 140 | } |
| 133 | 141 | |
| 142 | + @Override | |
| 134 | 143 | public PreparedStatement setSerialConsistencyLevel(ConsistencyLevel serialConsistency) { |
| 135 | 144 | if (serialConsistency != ConsistencyLevel.SERIAL && serialConsistency != ConsistencyLevel.LOCAL_SERIAL) |
| 136 | 145 | throw new IllegalArgumentException(); |
| @@ -138,50 +147,61 @@ | ||
| 138 | 147 | return this; |
| 139 | 148 | } |
| 140 | 149 | |
| 150 | + @Override | |
| 141 | 151 | public ConsistencyLevel getSerialConsistencyLevel() { |
| 142 | 152 | return serialConsistency; |
| 143 | 153 | } |
| 144 | 154 | |
| 155 | + @Override | |
| 145 | 156 | public String getQueryString() { |
| 146 | 157 | return query; |
| 147 | 158 | } |
| 148 | 159 | |
| 160 | + @Override | |
| 149 | 161 | public String getQueryKeyspace() { |
| 150 | 162 | return queryKeyspace; |
| 151 | 163 | } |
| 152 | 164 | |
| 165 | + @Override | |
| 153 | 166 | public PreparedStatement enableTracing() { |
| 154 | 167 | this.traceQuery = true; |
| 155 | 168 | return this; |
| 156 | 169 | } |
| 157 | 170 | |
| 171 | + @Override | |
| 158 | 172 | public PreparedStatement disableTracing() { |
| 159 | 173 | this.traceQuery = false; |
| 160 | 174 | return this; |
| 161 | 175 | } |
| 162 | 176 | |
| 177 | + @Override | |
| 163 | 178 | public boolean isTracing() { |
| 164 | 179 | return traceQuery; |
| 165 | 180 | } |
| 166 | 181 | |
| 182 | + @Override | |
| 167 | 183 | public PreparedStatement setRetryPolicy(RetryPolicy policy) { |
| 168 | 184 | this.retryPolicy = policy; |
| 169 | 185 | return this; |
| 170 | 186 | } |
| 171 | 187 | |
| 188 | + @Override | |
| 172 | 189 | public RetryPolicy getRetryPolicy() { |
| 173 | 190 | return retryPolicy; |
| 174 | 191 | } |
| 175 | 192 | |
| 193 | + @Override | |
| 176 | 194 | public PreparedId getPreparedId() { |
| 177 | 195 | return preparedId; |
| 178 | 196 | } |
| 179 | 197 | |
| 198 | + @Override | |
| 180 | 199 | public PreparedStatement setIdempotent(Boolean idempotent) { |
| 181 | 200 | this.idempotent = idempotent; |
| 182 | 201 | return this; |
| 183 | 202 | } |
| 184 | 203 | |
| 204 | + @Override | |
| 185 | 205 | public Boolean isIdempotent() { |
| 186 | 206 | return this.idempotent; |
| 187 | 207 | } |
modified driver-core/src/main/java/com/datastax/driver/core/DefaultResultSetFuture.java +2 −0
| @@ -209,6 +209,7 @@ | ||
| 209 | 209 | * @throws QueryValidationException if the query is invalid (syntax error, |
| 210 | 210 | * unauthorized or any other validation problem). |
| 211 | 211 | */ |
| 212 | + @Override | |
| 212 | 213 | public ResultSet getUninterruptibly() { |
| 213 | 214 | try { |
| 214 | 215 | return Uninterruptibles.getUninterruptibly(this); |
| @@ -241,6 +242,7 @@ | ||
| 241 | 242 | * different from a Cassandra timeout, which is a {@code |
| 242 | 243 | * QueryExecutionException}). |
| 243 | 244 | */ |
| 245 | + @Override | |
| 244 | 246 | public ResultSet getUninterruptibly(long timeout, TimeUnit unit) throws TimeoutException { |
| 245 | 247 | try { |
| 246 | 248 | return Uninterruptibles.getUninterruptibly(this, timeout, unit); |
modified driver-core/src/main/java/com/datastax/driver/core/FrameCompressor.java +4 −0
| @@ -56,6 +56,7 @@ | ||
| 56 | 56 | Snappy.getNativeLibraryVersion(); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | + @Override | |
| 59 | 60 | public Frame compress(Frame frame) throws IOException { |
| 60 | 61 | byte[] input = CBUtil.readRawBytes(frame.body); |
| 61 | 62 | byte[] output = new byte[Snappy.maxCompressedLength(input.length)]; |
| @@ -64,6 +65,7 @@ | ||
| 64 | 65 | return frame.with(Unpooled.wrappedBuffer(output, 0, written)); |
| 65 | 66 | } |
| 66 | 67 | |
| 68 | + @Override | |
| 67 | 69 | public Frame decompress(Frame frame) throws IOException { |
| 68 | 70 | byte[] input = CBUtil.readRawBytes(frame.body); |
| 69 | 71 | |
| @@ -105,6 +107,7 @@ | ||
| 105 | 107 | decompressor = lz4Factory.fastDecompressor(); |
| 106 | 108 | } |
| 107 | 109 | |
| 110 | + @Override | |
| 108 | 111 | public Frame compress(Frame frame) throws IOException { |
| 109 | 112 | byte[] input = CBUtil.readRawBytes(frame.body); |
| 110 | 113 | |
| @@ -124,6 +127,7 @@ | ||
| 124 | 127 | } |
| 125 | 128 | } |
| 126 | 129 | |
| 130 | + @Override | |
| 127 | 131 | public Frame decompress(Frame frame) throws IOException { |
| 128 | 132 | byte[] input = CBUtil.readRawBytes(frame.body); |
| 129 | 133 |
modified driver-core/src/main/java/com/datastax/driver/core/HostConnectionPool.java +1 −0
| @@ -637,6 +637,7 @@ | ||
| 637 | 637 | for (final Connection connection : connections) { |
| 638 | 638 | CloseFuture future = connection.closeAsync(); |
| 639 | 639 | future.addListener(new Runnable() { |
| 640 | + @Override | |
| 640 | 641 | public void run() { |
| 641 | 642 | if (connection.state.compareAndSet(OPEN, GONE)) |
| 642 | 643 | open.decrementAndGet(); |
modified driver-core/src/main/java/com/datastax/driver/core/PlainTextAuthProvider.java +2 −0
| @@ -77,6 +77,7 @@ | ||
| 77 | 77 | * @return an Authenticator instance which can be used to perform |
| 78 | 78 | * authentication negotiations on behalf of the client |
| 79 | 79 | */ |
| 80 | + @Override | |
| 80 | 81 | public Authenticator newAuthenticator(InetSocketAddress host) { |
| 81 | 82 | return new PlainTextAuthenticator(username, password); |
| 82 | 83 | } |
| @@ -116,6 +117,7 @@ | ||
| 116 | 117 | // no-op, the server should send nothing anyway |
| 117 | 118 | } |
| 118 | 119 | |
| 120 | + @Override | |
| 119 | 121 | Map<String, String> getCredentials() { |
| 120 | 122 | return ImmutableMap.of("username", new String(username, Charsets.UTF_8), |
| 121 | 123 | "password", new String(password, Charsets.UTF_8)); |
modified driver-core/src/main/java/com/datastax/driver/core/ReplicationStategy.java +3 −1
| @@ -73,6 +73,7 @@ | ||
| 73 | 73 | this.replicationFactor = replicationFactor; |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | + @Override | |
| 76 | 77 | Map<Token, Set<Host>> computeTokenToReplicaMap(String keyspaceName, Map<Token, Host> tokenToPrimary, List<Token> ring) { |
| 77 | 78 | |
| 78 | 79 | int rf = Math.min(replicationFactor, ring.size()); |
| @@ -116,7 +117,8 @@ | ||
| 116 | 117 | this.replicationFactors = replicationFactors; |
| 117 | 118 | } |
| 118 | 119 | |
| 119 | - Map<Token, Set<Host>> computeTokenToReplicaMap(String keyspaceName, Map<Token, Host> tokenToPrimary, List<Token> ring) { | |
| 120 | + @Override | |
| 121 | + Map<Token, Set<Host>> computeTokenToReplicaMap(String keyspaceName, Map<Token, Host> tokenToPrimary, List<Token> ring) { | |
| 120 | 122 | |
| 121 | 123 | // This is essentially a copy of org.apache.cassandra.locator.NetworkTopologyStrategy |
| 122 | 124 | Map<String, Set<String>> racks = getRacksInDcs(tokenToPrimary.values()); |
modified driver-core/src/main/java/com/datastax/driver/core/Requests.java +18 −0
| @@ -36,10 +36,12 @@ | ||
| 36 | 36 | public static final String COMPRESSION_OPTION = "COMPRESSION"; |
| 37 | 37 | |
| 38 | 38 | public static final Message.Coder<Startup> coder = new Message.Coder<Startup>() { |
| 39 | + @Override | |
| 39 | 40 | public void encode(Startup msg, ByteBuf dest, ProtocolVersion version) { |
| 40 | 41 | CBUtil.writeStringMap(msg.options, dest); |
| 41 | 42 | } |
| 42 | 43 | |
| 44 | + @Override | |
| 43 | 45 | public int encodedSize(Startup msg, ProtocolVersion version) { |
| 44 | 46 | return CBUtil.sizeOfStringMap(msg.options); |
| 45 | 47 | } |
| @@ -68,11 +70,13 @@ | ||
| 68 | 70 | |
| 69 | 71 | public static final Message.Coder<Credentials> coder = new Message.Coder<Credentials>() { |
| 70 | 72 | |
| 73 | + @Override | |
| 71 | 74 | public void encode(Credentials msg, ByteBuf dest, ProtocolVersion version) { |
| 72 | 75 | assert version == ProtocolVersion.V1; |
| 73 | 76 | CBUtil.writeStringMap(msg.credentials, dest); |
| 74 | 77 | } |
| 75 | 78 | |
| 79 | + @Override | |
| 76 | 80 | public int encodedSize(Credentials msg, ProtocolVersion version) { |
| 77 | 81 | assert version == ProtocolVersion.V1; |
| 78 | 82 | return CBUtil.sizeOfStringMap(msg.credentials); |
| @@ -90,9 +94,11 @@ | ||
| 90 | 94 | public static class Options extends Message.Request { |
| 91 | 95 | |
| 92 | 96 | public static final Message.Coder<Options> coder = new Message.Coder<Options>() { |
| 97 | + @Override | |
| 93 | 98 | public void encode(Options msg, ByteBuf dest, ProtocolVersion version) { |
| 94 | 99 | } |
| 95 | 100 | |
| 101 | + @Override | |
| 96 | 102 | public int encodedSize(Options msg, ProtocolVersion version) { |
| 97 | 103 | return 0; |
| 98 | 104 | } |
| @@ -111,11 +117,13 @@ | ||
| 111 | 117 | public static class Query extends Message.Request { |
| 112 | 118 | |
| 113 | 119 | public static final Message.Coder<Query> coder = new Message.Coder<Query>() { |
| 120 | + @Override | |
| 114 | 121 | public void encode(Query msg, ByteBuf dest, ProtocolVersion version) { |
| 115 | 122 | CBUtil.writeLongString(msg.query, dest); |
| 116 | 123 | msg.options.encode(dest, version); |
| 117 | 124 | } |
| 118 | 125 | |
| 126 | + @Override | |
| 119 | 127 | public int encodedSize(Query msg, ProtocolVersion version) { |
| 120 | 128 | return CBUtil.sizeOfLongString(msg.query) |
| 121 | 129 | + msg.options.encodedSize(version); |
| @@ -154,11 +162,13 @@ | ||
| 154 | 162 | public static class Execute extends Message.Request { |
| 155 | 163 | |
| 156 | 164 | public static final Message.Coder<Execute> coder = new Message.Coder<Execute>() { |
| 165 | + @Override | |
| 157 | 166 | public void encode(Execute msg, ByteBuf dest, ProtocolVersion version) { |
| 158 | 167 | CBUtil.writeBytes(msg.statementId.bytes, dest); |
| 159 | 168 | msg.options.encode(dest, version); |
| 160 | 169 | } |
| 161 | 170 | |
| 171 | + @Override | |
| 162 | 172 | public int encodedSize(Execute msg, ProtocolVersion version) { |
| 163 | 173 | return CBUtil.sizeOfBytes(msg.statementId.bytes) |
| 164 | 174 | + msg.options.encodedSize(version); |
| @@ -334,6 +344,7 @@ | ||
| 334 | 344 | public static class Batch extends Message.Request { |
| 335 | 345 | |
| 336 | 346 | public static final Message.Coder<Batch> coder = new Message.Coder<Batch>() { |
| 347 | + @Override | |
| 337 | 348 | public void encode(Batch msg, ByteBuf dest, ProtocolVersion version) { |
| 338 | 349 | int queries = msg.queryOrIdList.size(); |
| 339 | 350 | assert queries <= 0xFFFF; |
| @@ -355,6 +366,7 @@ | ||
| 355 | 366 | msg.options.encode(dest, version); |
| 356 | 367 | } |
| 357 | 368 | |
| 369 | + @Override | |
| 358 | 370 | public int encodedSize(Batch msg, ProtocolVersion version) { |
| 359 | 371 | int size = 3; // type + nb queries |
| 360 | 372 | for (int i = 0; i < msg.queryOrIdList.size(); i++) { |
| @@ -487,10 +499,12 @@ | ||
| 487 | 499 | |
| 488 | 500 | public static final Message.Coder<Prepare> coder = new Message.Coder<Prepare>() { |
| 489 | 501 | |
| 502 | + @Override | |
| 490 | 503 | public void encode(Prepare msg, ByteBuf dest, ProtocolVersion version) { |
| 491 | 504 | CBUtil.writeLongString(msg.query, dest); |
| 492 | 505 | } |
| 493 | 506 | |
| 507 | + @Override | |
| 494 | 508 | public int encodedSize(Prepare msg, ProtocolVersion version) { |
| 495 | 509 | return CBUtil.sizeOfLongString(msg.query); |
| 496 | 510 | } |
| @@ -512,12 +526,14 @@ | ||
| 512 | 526 | public static class Register extends Message.Request { |
| 513 | 527 | |
| 514 | 528 | public static final Message.Coder<Register> coder = new Message.Coder<Register>() { |
| 529 | + @Override | |
| 515 | 530 | public void encode(Register msg, ByteBuf dest, ProtocolVersion version) { |
| 516 | 531 | dest.writeShort(msg.eventTypes.size()); |
| 517 | 532 | for (ProtocolEvent.Type type : msg.eventTypes) |
| 518 | 533 | CBUtil.writeEnumValue(type, dest); |
| 519 | 534 | } |
| 520 | 535 | |
| 536 | + @Override | |
| 521 | 537 | public int encodedSize(Register msg, ProtocolVersion version) { |
| 522 | 538 | int size = 2; |
| 523 | 539 | for (ProtocolEvent.Type type : msg.eventTypes) |
| @@ -543,10 +559,12 @@ | ||
| 543 | 559 | |
| 544 | 560 | public static final Message.Coder<AuthResponse> coder = new Message.Coder<AuthResponse>() { |
| 545 | 561 | |
| 562 | + @Override | |
| 546 | 563 | public void encode(AuthResponse response, ByteBuf dest, ProtocolVersion version) { |
| 547 | 564 | CBUtil.writeValue(response.token, dest); |
| 548 | 565 | } |
| 549 | 566 | |
| 567 | + @Override | |
| 550 | 568 | public int encodedSize(AuthResponse response, ProtocolVersion version) { |
| 551 | 569 | return CBUtil.sizeOfValue(response.token); |
| 552 | 570 | } |
modified driver-core/src/main/java/com/datastax/driver/core/Responses.java +12 −0
| @@ -132,6 +132,7 @@ | ||
| 132 | 132 | public static class Ready extends Message.Response { |
| 133 | 133 | |
| 134 | 134 | public static final Message.Decoder<Ready> decoder = new Message.Decoder<Ready>() { |
| 135 | + @Override | |
| 135 | 136 | public Ready decode(ByteBuf body, ProtocolVersion version) { |
| 136 | 137 | // TODO: Would it be cool to return a singleton? Check we don't need to |
| 137 | 138 | // set the streamId or something |
| @@ -152,6 +153,7 @@ | ||
| 152 | 153 | public static class Authenticate extends Message.Response { |
| 153 | 154 | |
| 154 | 155 | public static final Message.Decoder<Authenticate> decoder = new Message.Decoder<Authenticate>() { |
| 156 | + @Override | |
| 155 | 157 | public Authenticate decode(ByteBuf body, ProtocolVersion version) { |
| 156 | 158 | String authenticator = CBUtil.readString(body); |
| 157 | 159 | return new Authenticate(authenticator); |
| @@ -174,6 +176,7 @@ | ||
| 174 | 176 | public static class Supported extends Message.Response { |
| 175 | 177 | |
| 176 | 178 | public static final Message.Decoder<Supported> decoder = new Message.Decoder<Supported>() { |
| 179 | + @Override | |
| 177 | 180 | public Supported decode(ByteBuf body, ProtocolVersion version) { |
| 178 | 181 | return new Supported(CBUtil.readStringToStringListMap(body)); |
| 179 | 182 | } |
| @@ -210,6 +213,7 @@ | ||
| 210 | 213 | public static abstract class Result extends Message.Response { |
| 211 | 214 | |
| 212 | 215 | public static final Message.Decoder<Result> decoder = new Message.Decoder<Result>() { |
| 216 | + @Override | |
| 213 | 217 | public Result decode(ByteBuf body, ProtocolVersion version) { |
| 214 | 218 | Kind kind = Kind.fromId(body.readInt()); |
| 215 | 219 | return kind.subDecoder.decode(body, version); |
| @@ -268,6 +272,7 @@ | ||
| 268 | 272 | } |
| 269 | 273 | |
| 270 | 274 | public static final Message.Decoder<Result> subcodec = new Message.Decoder<Result>() { |
| 275 | + @Override | |
| 271 | 276 | public Result decode(ByteBuf body, ProtocolVersion version) { |
| 272 | 277 | return new Void(); |
| 273 | 278 | } |
| @@ -288,6 +293,7 @@ | ||
| 288 | 293 | } |
| 289 | 294 | |
| 290 | 295 | public static final Message.Decoder<Result> subcodec = new Message.Decoder<Result>() { |
| 296 | + @Override | |
| 291 | 297 | public Result decode(ByteBuf body, ProtocolVersion version) { |
| 292 | 298 | return new SetKeyspace(CBUtil.readString(body)); |
| 293 | 299 | } |
| @@ -393,6 +399,7 @@ | ||
| 393 | 399 | } |
| 394 | 400 | |
| 395 | 401 | public static final Message.Decoder<Result> subcodec = new Message.Decoder<Result>() { |
| 402 | + @Override | |
| 396 | 403 | public Result decode(ByteBuf body, ProtocolVersion version) { |
| 397 | 404 | |
| 398 | 405 | Metadata metadata = Metadata.decode(body); |
| @@ -451,6 +458,7 @@ | ||
| 451 | 458 | public static class Prepared extends Result { |
| 452 | 459 | |
| 453 | 460 | public static final Message.Decoder<Result> subcodec = new Message.Decoder<Result>() { |
| 461 | + @Override | |
| 454 | 462 | public Result decode(ByteBuf body, ProtocolVersion version) { |
| 455 | 463 | MD5Digest id = MD5Digest.wrap(CBUtil.readBytes(body)); |
| 456 | 464 | Rows.Metadata metadata = Rows.Metadata.decode(body); |
| @@ -498,6 +506,7 @@ | ||
| 498 | 506 | public final String targetName; |
| 499 | 507 | |
| 500 | 508 | public static final Message.Decoder<Result> subcodec = new Message.Decoder<Result>() { |
| 509 | + @Override | |
| 501 | 510 | public Result decode(ByteBuf body, ProtocolVersion version) { |
| 502 | 511 | // Note: the CREATE KEYSPACE/TABLE/TYPE SCHEMA_CHANGE response is different from the SCHEMA_CHANGE EVENT type |
| 503 | 512 | Change change; |
| @@ -541,6 +550,7 @@ | ||
| 541 | 550 | public static class Event extends Message.Response { |
| 542 | 551 | |
| 543 | 552 | public static final Message.Decoder<Event> decoder = new Message.Decoder<Event>() { |
| 553 | + @Override | |
| 544 | 554 | public Event decode(ByteBuf body, ProtocolVersion version) { |
| 545 | 555 | return new Event(ProtocolEvent.deserialize(body, version)); |
| 546 | 556 | } |
| @@ -562,6 +572,7 @@ | ||
| 562 | 572 | public static class AuthChallenge extends Message.Response { |
| 563 | 573 | |
| 564 | 574 | public static final Message.Decoder<AuthChallenge> decoder = new Message.Decoder<AuthChallenge>() { |
| 575 | + @Override | |
| 565 | 576 | public AuthChallenge decode(ByteBuf body, ProtocolVersion version) { |
| 566 | 577 | ByteBuffer b = CBUtil.readValue(body); |
| 567 | 578 | if (b == null) |
| @@ -584,6 +595,7 @@ | ||
| 584 | 595 | public static class AuthSuccess extends Message.Response { |
| 585 | 596 | |
| 586 | 597 | public static final Message.Decoder<AuthSuccess> decoder = new Message.Decoder<AuthSuccess>() { |
| 598 | + @Override | |
| 587 | 599 | public AuthSuccess decode(ByteBuf body, ProtocolVersion version) { |
| 588 | 600 | ByteBuffer b = CBUtil.readValue(body); |
| 589 | 601 | if (b == null) |
modified driver-core/src/main/java/com/datastax/driver/core/Session.java +1 −0
| @@ -309,6 +309,7 @@ | ||
| 309 | 309 | * If you want to do so, use {@link Cluster#close}, but note that it will |
| 310 | 310 | * close all sessions created from that cluster. |
| 311 | 311 | */ |
| 312 | + @Override | |
| 312 | 313 | public void close(); |
| 313 | 314 | |
| 314 | 315 | /** |
modified driver-core/src/main/java/com/datastax/driver/core/SessionManager.java +15 −0
| @@ -62,6 +62,7 @@ | ||
| 62 | 62 | this.poolsState = new HostConnectionPool.PoolState(); |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | + @Override | |
| 65 | 66 | public Session init() { |
| 66 | 67 | try { |
| 67 | 68 | return Uninterruptibles.getUninterruptibly(initAsync()); |
| @@ -70,6 +71,7 @@ | ||
| 70 | 71 | } |
| 71 | 72 | } |
| 72 | 73 | |
| 74 | + @Override | |
| 73 | 75 | public ListenableFuture<Session> initAsync() { |
| 74 | 76 | // If we haven't initialized the cluster, do it now |
| 75 | 77 | cluster.init(); |
| @@ -117,10 +119,12 @@ | ||
| 117 | 119 | return Futures.allAsList(futures); |
| 118 | 120 | } |
| 119 | 121 | |
| 122 | + @Override | |
| 120 | 123 | public String getLoggedKeyspace() { |
| 121 | 124 | return poolsState.keyspace; |
| 122 | 125 | } |
| 123 | 126 | |
| 127 | + @Override | |
| 124 | 128 | public ResultSetFuture executeAsync(final Statement statement) { |
| 125 | 129 | if (isInit) { |
| 126 | 130 | DefaultResultSetFuture future = new DefaultResultSetFuture(this, cluster.manager.protocolVersion(), makeRequestMessage(statement, null)); |
| @@ -143,12 +147,14 @@ | ||
| 143 | 147 | } |
| 144 | 148 | } |
| 145 | 149 | |
| 150 | + @Override | |
| 146 | 151 | public ListenableFuture<PreparedStatement> prepareAsync(String query) { |
| 147 | 152 | Connection.Future future = new Connection.Future(new Requests.Prepare(query)); |
| 148 | 153 | execute(future, Statement.DEFAULT); |
| 149 | 154 | return toPreparedStatement(query, future); |
| 150 | 155 | } |
| 151 | 156 | |
| 157 | + @Override | |
| 152 | 158 | public CloseFuture closeAsync() { |
| 153 | 159 | CloseFuture future = closeFuture.get(); |
| 154 | 160 | if (future != null) |
| @@ -168,20 +174,24 @@ | ||
| 168 | 174 | : closeFuture.get(); // We raced, it's ok, return the future that was actually set |
| 169 | 175 | } |
| 170 | 176 | |
| 177 | + @Override | |
| 171 | 178 | public boolean isClosed() { |
| 172 | 179 | return closeFuture.get() != null; |
| 173 | 180 | } |
| 174 | 181 | |
| 182 | + @Override | |
| 175 | 183 | public Cluster getCluster() { |
| 176 | 184 | return cluster; |
| 177 | 185 | } |
| 178 | 186 | |
| 187 | + @Override | |
| 179 | 188 | public Session.State getState() { |
| 180 | 189 | return new State(this); |
| 181 | 190 | } |
| 182 | 191 | |
| 183 | 192 | private ListenableFuture<PreparedStatement> toPreparedStatement(final String query, final Connection.Future future) { |
| 184 | 193 | return Futures.transform(future, new AsyncFunction<Response, PreparedStatement>() { |
| 194 | + @Override | |
| 185 | 195 | public ListenableFuture<PreparedStatement> apply(Response response) { |
| 186 | 196 | switch (response.type) { |
| 187 | 197 | case RESULT: |
| @@ -679,24 +689,29 @@ | ||
| 679 | 689 | return -1; |
| 680 | 690 | } |
| 681 | 691 | |
| 692 | + @Override | |
| 682 | 693 | public Session getSession() { |
| 683 | 694 | return session; |
| 684 | 695 | } |
| 685 | 696 | |
| 697 | + @Override | |
| 686 | 698 | public Collection<Host> getConnectedHosts() { |
| 687 | 699 | return connectedHosts; |
| 688 | 700 | } |
| 689 | 701 | |
| 702 | + @Override | |
| 690 | 703 | public int getOpenConnections(Host host) { |
| 691 | 704 | int i = getIdx(host); |
| 692 | 705 | return i < 0 ? 0 : openConnections[i]; |
| 693 | 706 | } |
| 694 | 707 | |
| 708 | + @Override | |
| 695 | 709 | public int getTrashedConnections(Host host) { |
| 696 | 710 | int i = getIdx(host); |
| 697 | 711 | return i < 0 ? 0 : trashedConnections[i]; |
| 698 | 712 | } |
| 699 | 713 | |
| 714 | + @Override | |
| 700 | 715 | public int getInFlightQueries(Host host) { |
| 701 | 716 | int i = getIdx(host); |
| 702 | 717 | return i < 0 ? 0 : inFlightQueries[i]; |
modified driver-core/src/main/java/com/datastax/driver/core/TableMetadata.java +2 −0
| @@ -46,6 +46,7 @@ | ||
| 46 | 46 | private static final String DEFAULT_VALUE_ALIAS = "value"; |
| 47 | 47 | |
| 48 | 48 | private static final Comparator<ColumnMetadata> columnMetadataComparator = new Comparator<ColumnMetadata>() { |
| 49 | + @Override | |
| 49 | 50 | public int compare(ColumnMetadata c1, ColumnMetadata c2) { |
| 50 | 51 | return c1.getName().compareTo(c2.getName()); |
| 51 | 52 | } |
| @@ -72,6 +73,7 @@ | ||
| 72 | 73 | ASC, DESC; |
| 73 | 74 | |
| 74 | 75 | static final Predicate<Order> isAscending = new Predicate<Order>() { |
| 76 | + @Override | |
| 75 | 77 | public boolean apply(Order o) { |
| 76 | 78 | return o == ASC; |
| 77 | 79 | } |
modified driver-core/src/main/java/com/datastax/driver/core/UDTValue.java +3 −0
| @@ -28,14 +28,17 @@ | ||
| 28 | 28 | this.definition = definition; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | + @Override | |
| 31 | 32 | protected DataType getType(int i) { |
| 32 | 33 | return definition.byIdx[i].getType(); |
| 33 | 34 | } |
| 34 | 35 | |
| 36 | + @Override | |
| 35 | 37 | protected String getName(int i) { |
| 36 | 38 | return definition.byIdx[i].getName(); |
| 37 | 39 | } |
| 38 | 40 | |
| 41 | + @Override | |
| 39 | 42 | protected int[] getAllIndexesOf(String name) { |
| 40 | 43 | int[] indexes = definition.byName.get(Metadata.handleId(name)); |
| 41 | 44 | if (indexes == null) |
modified driver-core/src/main/java/com/datastax/driver/core/VersionNumber.java +1 −0
| @@ -171,6 +171,7 @@ | ||
| 171 | 171 | return new VersionNumber(major, minor, patch, dsePatch, null, null); |
| 172 | 172 | } |
| 173 | 173 | |
| 174 | + @Override | |
| 174 | 175 | public int compareTo(VersionNumber other) { |
| 175 | 176 | if (major < other.major) |
| 176 | 177 | return -1; |
modified driver-core/src/main/java/com/datastax/driver/core/policies/EC2MultiRegionAddressTranslater.java +1 −0
| @@ -101,6 +101,7 @@ | ||
| 101 | 101 | return null; |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | + @Override | |
| 104 | 105 | public void close() { |
| 105 | 106 | try { |
| 106 | 107 | ctx.close(); |
modified driver-core/src/main/java/com/datastax/driver/core/policies/IdentityTranslater.java +1 −0
| @@ -32,6 +32,7 @@ | ||
| 32 | 32 | * @param address the address of a node as returned by Cassandra. |
| 33 | 33 | * @return {@code address} unmodified. |
| 34 | 34 | */ |
| 35 | + @Override | |
| 35 | 36 | public InetSocketAddress translate(InetSocketAddress address) { |
| 36 | 37 | return address; |
| 37 | 38 | } |
modified driver-core/src/main/java/com/datastax/driver/core/policies/LatencyAwarePolicy.java +1 −0
| @@ -392,6 +392,7 @@ | ||
| 392 | 392 | private final ConcurrentMap<Host, HostLatencyTracker> latencies = new ConcurrentHashMap<Host, HostLatencyTracker>(); |
| 393 | 393 | private volatile long cachedMin = -1L; |
| 394 | 394 | |
| 395 | + @Override | |
| 395 | 396 | public void update(Host host, Statement statement, Exception exception, long newLatencyNanos) { |
| 396 | 397 | if (shouldConsiderNewLatency(statement, exception)) { |
| 397 | 398 | HostLatencyTracker hostTracker = latencies.get(host); |
modified driver-core/src/main/java/com/datastax/driver/core/querybuilder/Select.java +7 −0
| @@ -310,6 +310,7 @@ | ||
| 310 | 310 | * |
| 311 | 311 | * @return this in-build SELECT statement. |
| 312 | 312 | */ |
| 313 | + @Override | |
| 313 | 314 | public Selection distinct() { |
| 314 | 315 | this.isDistinct = true; |
| 315 | 316 | return this; |
| @@ -426,6 +427,7 @@ | ||
| 426 | 427 | * @return an in-build SELECT statement. |
| 427 | 428 | * @throws IllegalStateException if some columns had already been selected for this builder. |
| 428 | 429 | */ |
| 430 | + @Override | |
| 429 | 431 | public Builder all() { |
| 430 | 432 | if (columnNames != null) |
| 431 | 433 | throw new IllegalStateException(String.format("Some columns (%s) have already been selected.", columnNames)); |
| @@ -441,6 +443,7 @@ | ||
| 441 | 443 | * @return an in-build SELECT statement. |
| 442 | 444 | * @throws IllegalStateException if some columns had already been selected for this builder. |
| 443 | 445 | */ |
| 446 | + @Override | |
| 444 | 447 | public Builder countAll() { |
| 445 | 448 | if (columnNames != null) |
| 446 | 449 | throw new IllegalStateException(String.format("Some columns (%s) have already been selected.", columnNames)); |
| @@ -457,6 +460,7 @@ | ||
| 457 | 460 | * @param name the new column name to add. |
| 458 | 461 | * @return this in-build SELECT statement |
| 459 | 462 | */ |
| 463 | + @Override | |
| 460 | 464 | public SelectionOrAlias column(String name) { |
| 461 | 465 | return queueName(name); |
| 462 | 466 | } |
| @@ -484,6 +488,7 @@ | ||
| 484 | 488 | * @param name the name of the column to select the write time of. |
| 485 | 489 | * @return this in-build SELECT statement |
| 486 | 490 | */ |
| 491 | + @Override | |
| 487 | 492 | public SelectionOrAlias writeTime(String name) { |
| 488 | 493 | return queueName(new Utils.FCall("writetime", new Utils.CName(name))); |
| 489 | 494 | } |
| @@ -496,6 +501,7 @@ | ||
| 496 | 501 | * @param name the name of the column to select the ttl of. |
| 497 | 502 | * @return this in-build SELECT statement |
| 498 | 503 | */ |
| 504 | + @Override | |
| 499 | 505 | public SelectionOrAlias ttl(String name) { |
| 500 | 506 | return queueName(new Utils.FCall("ttl", new Utils.CName(name))); |
| 501 | 507 | } |
| @@ -511,6 +517,7 @@ | ||
| 511 | 517 | * {@link QueryBuilder#column} method, and so |
| 512 | 518 | * {@code fcall("textToBlob", QueryBuilder.column(foo)}. |
| 513 | 519 | */ |
| 520 | + @Override | |
| 514 | 521 | public SelectionOrAlias fcall(String name, Object... parameters) { |
| 515 | 522 | return queueName(new Utils.FCall(name, parameters)); |
| 516 | 523 | } |
modified driver-core/src/main/java/com/datastax/driver/core/schemabuilder/TableOptions.java +2 −0
| @@ -1038,10 +1038,12 @@ | ||
| 1038 | 1038 | super(Algorithm.NONE); |
| 1039 | 1039 | } |
| 1040 | 1040 | |
| 1041 | + @Override | |
| 1041 | 1042 | public CompressionOptions withChunkLengthInKb(Integer chunkLengthInKb) { |
| 1042 | 1043 | return this; |
| 1043 | 1044 | } |
| 1044 | 1045 | |
| 1046 | + @Override | |
| 1045 | 1047 | public CompressionOptions withCRCCheckChance(Double crcCheckChance) { |
| 1046 | 1048 | return this; |
| 1047 | 1049 | } |
modified driver-core/src/test/java/com/datastax/driver/core/CCMBridge.java +1 −0
| @@ -532,6 +532,7 @@ | ||
| 532 | 532 | } |
| 533 | 533 | |
| 534 | 534 | public static class terminationHook extends Thread { |
| 535 | + @Override | |
| 535 | 536 | public void run() { |
| 536 | 537 | logger.debug("shut down hook task.."); |
| 537 | 538 |
modified driver-examples/stress/src/main/java/com/datastax/driver/stress/BlockingConsumer.java +1 −0
| @@ -52,6 +52,7 @@ | ||
| 52 | 52 | super("Consumer Threads"); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | + @Override | |
| 55 | 56 | public void run() { |
| 56 | 57 | try { |
| 57 | 58 | while (requests.hasNext()) |
modified driver-examples/stress/src/main/java/com/datastax/driver/stress/Generators.java +9 −0
| @@ -26,6 +26,7 @@ | ||
| 26 | 26 | |
| 27 | 27 | public class Generators { |
| 28 | 28 | private static ThreadLocal<Random> random = new ThreadLocal<Random>() { |
| 29 | + @Override | |
| 29 | 30 | protected Random initialValue() { |
| 30 | 31 | return new Random(); |
| 31 | 32 | } |
| @@ -62,10 +63,12 @@ | ||
| 62 | 63 | |
| 63 | 64 | public static final QueryGenerator.Builder INSERTER = new QueryGenerator.Builder() { |
| 64 | 65 | |
| 66 | + @Override | |
| 65 | 67 | public String name() { |
| 66 | 68 | return "insert"; |
| 67 | 69 | } |
| 68 | 70 | |
| 71 | + @Override | |
| 69 | 72 | public OptionParser addOptions(OptionParser parser) { |
| 70 | 73 | String msg = "Simple insertion of CQL3 rows (using prepared statements unless the --no-prepare option is used). " |
| 71 | 74 | + "The inserted rows have a fixed set of columns but no clustering columns."; |
| @@ -78,6 +81,7 @@ | ||
| 78 | 81 | return parser; |
| 79 | 82 | } |
| 80 | 83 | |
| 84 | + @Override | |
| 81 | 85 | public void prepare(OptionSet options, Session session) { |
| 82 | 86 | |
| 83 | 87 | try { |
| @@ -100,6 +104,7 @@ | ||
| 100 | 104 | session.execute(sb.toString()); |
| 101 | 105 | } |
| 102 | 106 | |
| 107 | + @Override | |
| 103 | 108 | public QueryGenerator create(int id, int iterations, OptionSet options, Session session) { |
| 104 | 109 | |
| 105 | 110 | return options.has("no-prepare") |
| @@ -159,10 +164,12 @@ | ||
| 159 | 164 | |
| 160 | 165 | public static final QueryGenerator.Builder READER = new QueryGenerator.Builder() { |
| 161 | 166 | |
| 167 | + @Override | |
| 162 | 168 | public String name() { |
| 163 | 169 | return "read"; |
| 164 | 170 | } |
| 165 | 171 | |
| 172 | + @Override | |
| 166 | 173 | public OptionParser addOptions(OptionParser parser) { |
| 167 | 174 | String msg = "Read the rows inserted with the insert generator. Use prepared statements unless the --no-prepare option is used."; |
| 168 | 175 | parser.formatHelpWith(Stress.Help.formatFor(name(), msg)); |
| @@ -171,6 +178,7 @@ | ||
| 171 | 178 | return parser; |
| 172 | 179 | } |
| 173 | 180 | |
| 181 | + @Override | |
| 174 | 182 | public void prepare(OptionSet options, Session session) { |
| 175 | 183 | KeyspaceMetadata ks = session.getCluster().getMetadata().getKeyspace("stress"); |
| 176 | 184 | if (ks == null || ks.getTable("standard1") == null) { |
| @@ -181,6 +189,7 @@ | ||
| 181 | 189 | session.execute("USE stress"); |
| 182 | 190 | } |
| 183 | 191 | |
| 192 | + @Override | |
| 184 | 193 | public QueryGenerator create(int id, int iterations, OptionSet options, Session session) { |
| 185 | 194 | return options.has("no-prepare") |
| 186 | 195 | ? createRegular(id, iterations) |
modified driver-examples/stress/src/main/java/com/datastax/driver/stress/QueryGenerator.java +4 −0
| @@ -59,10 +59,12 @@ | ||
| 59 | 59 | this.statement = statement; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | + @Override | |
| 62 | 63 | public ResultSet execute(Session session) { |
| 63 | 64 | return session.execute(statement); |
| 64 | 65 | } |
| 65 | 66 | |
| 67 | + @Override | |
| 66 | 68 | public ResultSetFuture executeAsync(Session session) { |
| 67 | 69 | return session.executeAsync(statement); |
| 68 | 70 | } |
| @@ -76,10 +78,12 @@ | ||
| 76 | 78 | this.query = query; |
| 77 | 79 | } |
| 78 | 80 | |
| 81 | + @Override | |
| 79 | 82 | public ResultSet execute(Session session) { |
| 80 | 83 | return session.execute(query); |
| 81 | 84 | } |
| 82 | 85 | |
| 86 | + @Override | |
| 83 | 87 | public ResultSetFuture executeAsync(Session session) { |
| 84 | 88 | return session.executeAsync(query); |
| 85 | 89 | } |
modified driver-mapping/src/main/java/com/datastax/driver/mapping/AccessorInvocationHandler.java +1 −0
| @@ -49,6 +49,7 @@ | ||
| 49 | 49 | methodMap.put(method.method, method); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | + @Override | |
| 52 | 53 | public Object invoke(Object proxy, Method m, Object[] args) throws Throwable { |
| 53 | 54 | if (m.equals(TO_STRING)) |
| 54 | 55 | return mapper.daoClass.getSimpleName() + " implementation generated by the Cassandra driver mapper"; |
modified driver-mapping/src/main/java/com/datastax/driver/mapping/AccessorReflectionMapper.java +1 −0
| @@ -47,6 +47,7 @@ | ||
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | private static class AccessorReflectionFactory implements Factory { |
| 50 | + @Override | |
| 50 | 51 | public <T> AccessorMapper<T> create(Class<T> daoClass, List<MethodMapper> methods) { |
| 51 | 52 | return new AccessorReflectionMapper<T>(daoClass, methods); |
| 52 | 53 | } |
modified driver-mapping/src/main/java/com/datastax/driver/mapping/AnnotationParser.java +1 −0
| @@ -38,6 +38,7 @@ | ||
| 38 | 38 | class AnnotationParser { |
| 39 | 39 | |
| 40 | 40 | private static final Comparator<Field> fieldComparator = new Comparator<Field>() { |
| 41 | + @Override | |
| 41 | 42 | public int compare(Field f1, Field f2) { |
| 42 | 43 | return position(f1) - position(f2); |
| 43 | 44 | } |
modified driver-mapping/src/main/java/com/datastax/driver/mapping/Mapper.java +5 −0
| @@ -77,16 +77,19 @@ | ||
| 77 | 77 | |
| 78 | 78 | this.protocolVersion = manager.getSession().getCluster().getConfiguration().getProtocolOptions().getProtocolVersionEnum(); |
| 79 | 79 | this.mapOneFunction = new Function<ResultSet, T>() { |
| 80 | + @Override | |
| 80 | 81 | public T apply(ResultSet rs) { |
| 81 | 82 | return Mapper.this.mapAliased(rs).one(); |
| 82 | 83 | } |
| 83 | 84 | }; |
| 84 | 85 | this.mapOneFunctionWithoutAliases = new Function<ResultSet, T>() { |
| 86 | + @Override | |
| 85 | 87 | public T apply(ResultSet rs) { |
| 86 | 88 | return Mapper.this.map(rs).one(); |
| 87 | 89 | } |
| 88 | 90 | }; |
| 89 | 91 | this.mapAllFunctionWithoutAliases = new Function<ResultSet, Result<T>>() { |
| 92 | + @Override | |
| 90 | 93 | public Result<T> apply(ResultSet rs) { |
| 91 | 94 | return Mapper.this.map(rs); |
| 92 | 95 | } |
| @@ -822,6 +825,7 @@ | ||
| 822 | 825 | this.ttlValue = value; |
| 823 | 826 | } |
| 824 | 827 | |
| 828 | + @Override | |
| 825 | 829 | void appendTo(Insert.Options usings) { |
| 826 | 830 | usings.and(QueryBuilder.ttl(QueryBuilder.bindMarker())); |
| 827 | 831 | } |
| @@ -1025,6 +1029,7 @@ | ||
| 1025 | 1029 | return false; |
| 1026 | 1030 | } |
| 1027 | 1031 | |
| 1032 | + @Override | |
| 1028 | 1033 | public int hashCode() { |
| 1029 | 1034 | return Objects.hashCode(queryType, optionTypes, columns); |
| 1030 | 1035 | } |
modified driver-mapping/src/main/java/com/datastax/driver/mapping/ReflectionMapper.java +2 −0
| @@ -198,11 +198,13 @@ | ||
| 198 | 198 | |
| 199 | 199 | private static class ReflectionFactory implements Factory { |
| 200 | 200 | |
| 201 | + @Override | |
| 201 | 202 | public <T> EntityMapper<T> create(Class<T> entityClass, String keyspace, String table, ConsistencyLevel writeConsistency, ConsistencyLevel readConsistency) { |
| 202 | 203 | return new ReflectionMapper<T>(entityClass, keyspace, table, writeConsistency, readConsistency); |
| 203 | 204 | } |
| 204 | 205 | |
| 205 | 206 | @SuppressWarnings({"unchecked", "rawtypes"}) |
| 207 | + @Override | |
| 206 | 208 | public <T> ColumnMapper<T> createColumnMapper(Class<T> entityClass, Field field, int position, MappingManager mappingManager, AtomicInteger columnCounter) { |
| 207 | 209 | String fieldName = field.getName(); |
| 208 | 210 | try { |
modified driver-mapping/src/main/java/com/datastax/driver/mapping/Result.java +5 −1
| @@ -107,18 +107,22 @@ | ||
| 107 | 107 | * @return an iterator that will consume and return the remaining rows of |
| 108 | 108 | * this mapped result set. |
| 109 | 109 | */ |
| 110 | - public Iterator<T> iterator() { | |
| 110 | + @Override | |
| 111 | + public Iterator<T> iterator() { | |
| 111 | 112 | return new Iterator<T>() { |
| 112 | 113 | private final Iterator<Row> rowIterator = rs.iterator(); |
| 113 | 114 | |
| 115 | + @Override | |
| 114 | 116 | public boolean hasNext() { |
| 115 | 117 | return rowIterator.hasNext(); |
| 116 | 118 | } |
| 117 | 119 | |
| 120 | + @Override | |
| 118 | 121 | public T next() { |
| 119 | 122 | return map(rowIterator.next()); |
| 120 | 123 | } |
| 121 | 124 | |
| 125 | + @Override | |
| 122 | 126 | public void remove() { |
| 123 | 127 | throw new UnsupportedOperationException(); |
| 124 | 128 | } |