blob: 03cb05641a20cf24c5fdcff800f1651dc555d369 [file] [log] [blame]
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2014-present Open Networking Laboratory
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07003 *
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'Connorabafb502014-12-02 22:26:20 -080016package org.onosproject.store.device.impl;
Madan Jampani5009cfb2014-10-08 11:21:07 -070017
Brian O'Connorabafb502014-12-02 22:26:20 -080018import org.onosproject.net.DeviceId;
19import org.onosproject.store.Timestamp;
Madan Jampani5009cfb2014-10-08 11:21:07 -070020
Yuta HIGUCHI9ee60f62014-10-09 10:00:01 -070021import com.google.common.base.MoreObjects;
22
Madan Jampani5009cfb2014-10-08 11:21:07 -070023/**
24 * Information published by GossipDeviceStore to notify peers of a device
25 * going offline.
26 */
27public class InternalDeviceOfflineEvent {
28
29 private final DeviceId deviceId;
30 private final Timestamp timestamp;
31
32 /**
33 * Creates a InternalDeviceOfflineEvent.
34 * @param deviceId identifier of device going offline.
35 * @param timestamp timestamp of when the device went offline.
36 */
37 public InternalDeviceOfflineEvent(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 HIGUCHI9ee60f62014-10-09 10:00:01 -070050 @Override
51 public String toString() {
52 return MoreObjects.toStringHelper(getClass())
53 .add("deviceId", deviceId)
54 .add("timestamp", timestamp)
55 .toString();
56 }
57
Madan Jampani5009cfb2014-10-08 11:21:07 -070058 // for serializer
59 @SuppressWarnings("unused")
60 private InternalDeviceOfflineEvent() {
61 deviceId = null;
62 timestamp = null;
63 }
64}