Sho SHIMIZU | fa62b47 | 2015-11-02 17:35:46 -0800 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Foundation |
Sho SHIMIZU | fa62b47 | 2015-11-02 17:35:46 -0800 | [diff] [blame] | 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 | */ |
Sho SHIMIZU | e18cb12 | 2016-02-22 21:04:56 -0800 | [diff] [blame] | 16 | package org.onosproject.net.resource; |
Sho SHIMIZU | fa62b47 | 2015-11-02 17:35:46 -0800 | [diff] [blame] | 17 | |
| 18 | import com.google.common.annotations.Beta; |
| 19 | import org.onosproject.event.AbstractEvent; |
| 20 | |
| 21 | import static com.google.common.base.Preconditions.checkNotNull; |
| 22 | |
| 23 | /** |
| 24 | * Describes an event related to a resource. |
| 25 | */ |
| 26 | @Beta |
Sho SHIMIZU | 8fa670a | 2016-01-14 11:17:18 -0800 | [diff] [blame] | 27 | public final class ResourceEvent extends AbstractEvent<ResourceEvent.Type, Resource> { |
Sho SHIMIZU | fa62b47 | 2015-11-02 17:35:46 -0800 | [diff] [blame] | 28 | |
| 29 | /** |
| 30 | * Type of resource events. |
| 31 | */ |
| 32 | @Beta |
| 33 | public enum Type { |
| 34 | /** |
| 35 | * Signifies that a new resource has been detected. |
| 36 | */ |
| 37 | RESOURCE_ADDED, |
| 38 | |
| 39 | /** |
| 40 | * Signifies that a resource has been removed. |
| 41 | */ |
| 42 | RESOURCE_REMOVED |
| 43 | } |
| 44 | |
| 45 | /** |
| 46 | * Create a resource event. |
| 47 | * |
| 48 | * @param type type of resource event |
| 49 | * @param subject subject of resource event |
| 50 | */ |
Sho SHIMIZU | 8fa670a | 2016-01-14 11:17:18 -0800 | [diff] [blame] | 51 | public ResourceEvent(Type type, Resource subject) { |
Sho SHIMIZU | fa62b47 | 2015-11-02 17:35:46 -0800 | [diff] [blame] | 52 | super(checkNotNull(type), checkNotNull(subject)); |
| 53 | } |
| 54 | } |