Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2014-present Open Networking Laboratory |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [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 | */ |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 16 | package org.onosproject.store.device.impl; |
Madan Jampani | 3fc72ed | 2014-10-08 12:50:27 -0700 | [diff] [blame] | 17 | |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 18 | import org.onosproject.net.DeviceId; |
| 19 | import org.onosproject.store.Timestamp; |
Madan Jampani | 3fc72ed | 2014-10-08 12:50:27 -0700 | [diff] [blame] | 20 | |
Yuta HIGUCHI | 9ee60f6 | 2014-10-09 10:00:01 -0700 | [diff] [blame] | 21 | import com.google.common.base.MoreObjects; |
| 22 | |
Madan Jampani | 3fc72ed | 2014-10-08 12:50:27 -0700 | [diff] [blame] | 23 | /** |
| 24 | * Information published by GossipDeviceStore to notify peers of a device |
| 25 | * being administratively removed. |
| 26 | */ |
| 27 | public class InternalDeviceRemovedEvent { |
| 28 | |
| 29 | private final DeviceId deviceId; |
| 30 | private final Timestamp timestamp; |
| 31 | |
| 32 | /** |
| 33 | * Creates a InternalDeviceRemovedEvent. |
| 34 | * @param deviceId identifier of the removed device. |
| 35 | * @param timestamp timestamp of when the device was administratively removed. |
| 36 | */ |
| 37 | public InternalDeviceRemovedEvent(DeviceId deviceId, Timestamp timestamp) { |
| 38 | this.deviceId = deviceId; |
| 39 | this.timestamp = timestamp; |
| 40 | } |
| 41 | |
| 42 | public DeviceId deviceId() { |
| 43 | return deviceId; |
| 44 | } |
| 45 | |
| 46 | public Timestamp timestamp() { |
| 47 | return timestamp; |
| 48 | } |
| 49 | |
Yuta HIGUCHI | 9ee60f6 | 2014-10-09 10:00:01 -0700 | [diff] [blame] | 50 | @Override |
| 51 | public String toString() { |
| 52 | return MoreObjects.toStringHelper(getClass()) |
| 53 | .add("deviceId", deviceId) |
| 54 | .add("timestamp", timestamp) |
| 55 | .toString(); |
| 56 | } |
| 57 | |
Madan Jampani | 3fc72ed | 2014-10-08 12:50:27 -0700 | [diff] [blame] | 58 | // for serializer |
| 59 | @SuppressWarnings("unused") |
| 60 | private InternalDeviceRemovedEvent() { |
| 61 | deviceId = null; |
| 62 | timestamp = null; |
| 63 | } |
| 64 | } |