|
15 | 15 | */ |
16 | 16 | package com.datastax.oss.driver.api.core.metadata.schema; |
17 | 17 |
|
18 | | -import com.datastax.oss.driver.api.core.session.Session; |
19 | 18 | import com.datastax.oss.driver.api.core.type.UserDefinedType; |
20 | 19 |
|
21 | 20 | /** |
22 | | - * Convenience schema change listener implementation that defines all methods as no-ops. |
23 | | - * |
24 | | - * <p>Implementors that are only interested in a subset of events can extend this class and override |
25 | | - * the relevant methods. |
| 21 | + * Convenience class for listener implementations that that don't need to override all methods (all |
| 22 | + * methods in this class are empty). |
26 | 23 | */ |
27 | 24 | public class SchemaChangeListenerBase implements SchemaChangeListener { |
28 | 25 |
|
29 | 26 | @Override |
30 | | - public void onKeyspaceCreated(KeyspaceMetadata keyspace) {} |
31 | | - |
32 | | - @Override |
33 | | - public void onKeyspaceDropped(KeyspaceMetadata keyspace) {} |
| 27 | + public void onKeyspaceCreated(KeyspaceMetadata keyspace) { |
| 28 | + // nothing to do |
| 29 | + } |
34 | 30 |
|
35 | 31 | @Override |
36 | | - public void onKeyspaceUpdated(KeyspaceMetadata current, KeyspaceMetadata previous) {} |
| 32 | + public void onKeyspaceDropped(KeyspaceMetadata keyspace) { |
| 33 | + // nothing to do |
| 34 | + } |
37 | 35 |
|
38 | 36 | @Override |
39 | | - public void onTableCreated(TableMetadata table) {} |
| 37 | + public void onKeyspaceUpdated(KeyspaceMetadata current, KeyspaceMetadata previous) { |
| 38 | + // nothing to do |
| 39 | + } |
40 | 40 |
|
41 | 41 | @Override |
42 | | - public void onTableDropped(TableMetadata table) {} |
| 42 | + public void onTableCreated(TableMetadata table) { |
| 43 | + // nothing to do |
| 44 | + } |
43 | 45 |
|
44 | 46 | @Override |
45 | | - public void onTableUpdated(TableMetadata current, TableMetadata previous) {} |
| 47 | + public void onTableDropped(TableMetadata table) { |
| 48 | + // nothing to do |
| 49 | + } |
46 | 50 |
|
47 | 51 | @Override |
48 | | - public void onUserDefinedTypeCreated(UserDefinedType type) {} |
| 52 | + public void onTableUpdated(TableMetadata current, TableMetadata previous) { |
| 53 | + // nothing to do |
| 54 | + } |
49 | 55 |
|
50 | 56 | @Override |
51 | | - public void onUserDefinedTypeDropped(UserDefinedType type) {} |
| 57 | + public void onUserDefinedTypeCreated(UserDefinedType type) { |
| 58 | + // nothing to do |
| 59 | + } |
52 | 60 |
|
53 | 61 | @Override |
54 | | - public void onUserDefinedTypeUpdated(UserDefinedType current, UserDefinedType previous) {} |
| 62 | + public void onUserDefinedTypeDropped(UserDefinedType type) { |
| 63 | + // nothing to do |
| 64 | + } |
55 | 65 |
|
56 | 66 | @Override |
57 | | - public void onFunctionCreated(FunctionMetadata function) {} |
| 67 | + public void onUserDefinedTypeUpdated(UserDefinedType current, UserDefinedType previous) { |
| 68 | + // nothing to do |
| 69 | + } |
58 | 70 |
|
59 | 71 | @Override |
60 | | - public void onFunctionDropped(FunctionMetadata function) {} |
| 72 | + public void onFunctionCreated(FunctionMetadata function) { |
| 73 | + // nothing to do |
| 74 | + } |
61 | 75 |
|
62 | 76 | @Override |
63 | | - public void onFunctionUpdated(FunctionMetadata current, FunctionMetadata previous) {} |
| 77 | + public void onFunctionDropped(FunctionMetadata function) { |
| 78 | + // nothing to do |
| 79 | + } |
64 | 80 |
|
65 | 81 | @Override |
66 | | - public void onAggregateCreated(AggregateMetadata aggregate) {} |
| 82 | + public void onFunctionUpdated(FunctionMetadata current, FunctionMetadata previous) { |
| 83 | + // nothing to do |
| 84 | + } |
67 | 85 |
|
68 | 86 | @Override |
69 | | - public void onAggregateDropped(AggregateMetadata aggregate) {} |
| 87 | + public void onAggregateCreated(AggregateMetadata aggregate) { |
| 88 | + // nothing to do |
| 89 | + } |
70 | 90 |
|
71 | 91 | @Override |
72 | | - public void onAggregateUpdated(AggregateMetadata current, AggregateMetadata previous) {} |
| 92 | + public void onAggregateDropped(AggregateMetadata aggregate) { |
| 93 | + // nothing to do |
| 94 | + } |
73 | 95 |
|
74 | 96 | @Override |
75 | | - public void onViewCreated(ViewMetadata view) {} |
| 97 | + public void onAggregateUpdated(AggregateMetadata current, AggregateMetadata previous) { |
| 98 | + // nothing to do |
| 99 | + } |
76 | 100 |
|
77 | 101 | @Override |
78 | | - public void onViewDropped(ViewMetadata view) {} |
| 102 | + public void onViewCreated(ViewMetadata view) { |
| 103 | + // nothing to do |
| 104 | + } |
79 | 105 |
|
80 | 106 | @Override |
81 | | - public void onViewUpdated(ViewMetadata current, ViewMetadata previous) {} |
| 107 | + public void onViewDropped(ViewMetadata view) { |
| 108 | + // nothing to do |
| 109 | + } |
82 | 110 |
|
83 | 111 | @Override |
84 | | - public void onRegister(Session session) {} |
| 112 | + public void onViewUpdated(ViewMetadata current, ViewMetadata previous) { |
| 113 | + // nothing to do |
| 114 | + } |
85 | 115 |
|
86 | 116 | @Override |
87 | | - public void onUnregister(Session session) {} |
| 117 | + public void close() throws Exception { |
| 118 | + // nothing to do |
| 119 | + } |
88 | 120 | } |
0 commit comments