yoonseon | fe72197 | 2017-01-10 17:18:49 -0800 | [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 | |
| 17 | package org.onosproject.incubator.net.virtual.event; |
| 18 | |
| 19 | import org.onosproject.event.AbstractEvent; |
| 20 | import org.onosproject.event.Event; |
| 21 | import org.onosproject.incubator.net.virtual.NetworkId; |
| 22 | |
| 23 | /** |
| 24 | * Base class for virtual network event that encapsulates a normal event. |
| 25 | */ |
| 26 | public class VirtualEvent<E extends Event> |
| 27 | extends AbstractEvent<VirtualEvent.Type, E> { |
| 28 | |
| 29 | private NetworkId networkId; |
| 30 | |
| 31 | /** |
| 32 | * Type of virtual network events. |
| 33 | */ |
| 34 | public enum Type { |
| 35 | /** |
| 36 | * A new virtual event has been posted. |
| 37 | */ |
| 38 | POSTED |
| 39 | } |
| 40 | |
| 41 | protected VirtualEvent(NetworkId networkId, Type type, E subject) { |
| 42 | super(type, subject); |
| 43 | this.networkId = networkId; |
| 44 | } |
| 45 | |
| 46 | protected VirtualEvent(NetworkId networkId, Type type, E subject, long time) { |
| 47 | super(type, subject, time); |
| 48 | this.networkId = networkId; |
| 49 | } |
| 50 | |
| 51 | public NetworkId networkId() { |
| 52 | return networkId; |
| 53 | } |
| 54 | } |