Jian Li | 95edb59 | 2017-01-29 08:42:07 +0900 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017-present Open Networking Laboratory |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | package org.onosproject.mapping; |
| 17 | |
| 18 | import org.onosproject.event.AbstractEvent; |
| 19 | |
| 20 | /** |
| 21 | * Describes mapping event. |
| 22 | */ |
| 23 | public class MappingEvent extends AbstractEvent<MappingEvent.Type, Mapping> { |
| 24 | |
Jian Li | 9876310 | 2017-02-19 23:48:46 +0900 | [diff] [blame] | 25 | /** |
| 26 | * Type of mapping events. |
| 27 | */ |
Jian Li | 95edb59 | 2017-01-29 08:42:07 +0900 | [diff] [blame] | 28 | public enum Type { |
| 29 | |
| 30 | /** |
| 31 | * Signifies that a new mapping has been detected. |
| 32 | */ |
| 33 | MAPPING_ADDED, |
| 34 | |
| 35 | /** |
| 36 | * Signifies that a new mapping has been removed. |
| 37 | */ |
| 38 | MAPPING_REMOVED, |
| 39 | |
| 40 | /** |
| 41 | * Signifies that a mapping has been updated. |
| 42 | */ |
| 43 | MAPPING_UPDATED, |
| 44 | |
| 45 | // internal event between Manager <-> Store |
| 46 | |
| 47 | /** |
| 48 | * Signifies that a request to add mapping has been added to the store. |
| 49 | */ |
| 50 | MAPPING_ADD_REQUESTED, |
| 51 | |
| 52 | /** |
| 53 | * Signifies that a request to update mapping has been added to the store. |
| 54 | */ |
| 55 | MAPPING_UPDATE_REQUESTED, |
| 56 | |
| 57 | /** |
| 58 | * Signifies that a request to remove flow rule has been added to the store. |
| 59 | */ |
Jian Li | 9876310 | 2017-02-19 23:48:46 +0900 | [diff] [blame] | 60 | MAPPING_REMOVE_REQUESTED |
Jian Li | 95edb59 | 2017-01-29 08:42:07 +0900 | [diff] [blame] | 61 | } |
| 62 | |
Jian Li | 9876310 | 2017-02-19 23:48:46 +0900 | [diff] [blame] | 63 | /** |
| 64 | * Creates an event of a given type and for the specified mapping and the |
| 65 | * current time. |
| 66 | * |
| 67 | * @param type mapping event type |
| 68 | * @param mapping event mapping subject |
| 69 | */ |
Jian Li | 95edb59 | 2017-01-29 08:42:07 +0900 | [diff] [blame] | 70 | public MappingEvent(Type type, Mapping mapping) { |
| 71 | super(type, mapping); |
| 72 | } |
Jian Li | 9876310 | 2017-02-19 23:48:46 +0900 | [diff] [blame] | 73 | |
| 74 | /** |
| 75 | * Creates an event of a given type and for the specified mapping and time. |
| 76 | * |
| 77 | * @param type mapping event type |
| 78 | * @param mapping event mapping subject |
| 79 | * @param time occurrence time |
| 80 | */ |
| 81 | public MappingEvent(Type type, Mapping mapping, long time) { |
| 82 | super(type, mapping, time); |
| 83 | } |
Jian Li | 95edb59 | 2017-01-29 08:42:07 +0900 | [diff] [blame] | 84 | } |