Thomas Vachuska | 96d55b1 | 2015-05-11 08:52:03 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 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 | */ |
Ray Milkey | a412236 | 2015-08-18 15:19:08 -0700 | [diff] [blame] | 16 | package org.onosproject.net.config; |
Thomas Vachuska | 96d55b1 | 2015-05-11 08:52:03 -0700 | [diff] [blame] | 17 | |
| 18 | import org.onosproject.event.AbstractEvent; |
| 19 | |
| 20 | /** |
| 21 | * Describes network configuration event. |
| 22 | */ |
| 23 | public class NetworkConfigEvent extends AbstractEvent<NetworkConfigEvent.Type, Object> { |
| 24 | |
| 25 | private final Class configClass; |
| 26 | |
| 27 | /** |
| 28 | * Type of network configuration events. |
| 29 | */ |
| 30 | public enum Type { |
| 31 | /** |
Thomas Vachuska | e636022 | 2015-07-21 10:10:36 -0700 | [diff] [blame] | 32 | * Signifies that a network configuration was registered. |
| 33 | */ |
| 34 | CONFIG_REGISTERED, |
| 35 | |
| 36 | /** |
| 37 | * Signifies that a network configuration was unregistered. |
| 38 | */ |
| 39 | CONFIG_UNREGISTERED, |
| 40 | |
| 41 | /** |
Thomas Vachuska | 96d55b1 | 2015-05-11 08:52:03 -0700 | [diff] [blame] | 42 | * Signifies that network configuration was added. |
| 43 | */ |
Thomas Vachuska | 96d55b1 | 2015-05-11 08:52:03 -0700 | [diff] [blame] | 44 | CONFIG_ADDED, |
Thomas Vachuska | e636022 | 2015-07-21 10:10:36 -0700 | [diff] [blame] | 45 | |
Thomas Vachuska | 96d55b1 | 2015-05-11 08:52:03 -0700 | [diff] [blame] | 46 | /** |
| 47 | * Signifies that network configuration was updated. |
| 48 | */ |
| 49 | CONFIG_UPDATED, |
| 50 | |
| 51 | /** |
| 52 | * Signifies that network configuration was removed. |
| 53 | */ |
| 54 | CONFIG_REMOVED |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * Creates an event of a given type and for the specified subject and the |
| 59 | * current time. |
| 60 | * |
| 61 | * @param type event type |
| 62 | * @param subject event subject |
| 63 | * @param configClass configuration class |
| 64 | */ |
| 65 | public NetworkConfigEvent(Type type, Object subject, Class configClass) { |
| 66 | super(type, subject); |
| 67 | this.configClass = configClass; |
| 68 | } |
| 69 | |
| 70 | /** |
| 71 | * Creates an event of a given type and for the specified subject and time. |
| 72 | * |
| 73 | * @param type device event type |
| 74 | * @param subject event subject |
| 75 | * @param configClass configuration class |
| 76 | * @param time occurrence time |
| 77 | */ |
| 78 | public NetworkConfigEvent(Type type, Object subject, Class configClass, long time) { |
| 79 | super(type, subject, time); |
| 80 | this.configClass = configClass; |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * Returns the class of configuration that has been changed. |
| 85 | * |
| 86 | * @return configuration class |
| 87 | */ |
| 88 | public Class configClass() { |
| 89 | return configClass; |
| 90 | } |
| 91 | |
| 92 | } |