Madan Jampani | 12390c1 | 2014-11-12 00:35:56 -0800 | [diff] [blame^] | 1 | package org.onlab.onos.store.service.impl; |
| 2 | |
| 3 | public class TableModificationEvent { |
| 4 | |
| 5 | public enum Type { |
| 6 | ROW_ADDED, |
| 7 | ROW_DELETED, |
| 8 | ROW_UPDATED |
| 9 | } |
| 10 | |
| 11 | private final String tableName; |
| 12 | private final String key; |
| 13 | private final Type type; |
| 14 | |
| 15 | public static TableModificationEvent rowDeleted(String tableName, String key) { |
| 16 | return new TableModificationEvent(tableName, key, Type.ROW_DELETED); |
| 17 | } |
| 18 | |
| 19 | public static TableModificationEvent rowAdded(String tableName, String key) { |
| 20 | return new TableModificationEvent(tableName, key, Type.ROW_ADDED); |
| 21 | } |
| 22 | |
| 23 | public static TableModificationEvent rowUpdated(String tableName, String key) { |
| 24 | return new TableModificationEvent(tableName, key, Type.ROW_UPDATED); |
| 25 | } |
| 26 | |
| 27 | private TableModificationEvent(String tableName, String key, Type type) { |
| 28 | this.tableName = tableName; |
| 29 | this.key = key; |
| 30 | this.type = type; |
| 31 | } |
| 32 | |
| 33 | public String tableName() { |
| 34 | return tableName; |
| 35 | } |
| 36 | |
| 37 | public String key() { |
| 38 | return key; |
| 39 | } |
| 40 | |
| 41 | public Type type() { |
| 42 | return type; |
| 43 | } |
| 44 | } |