diff options
author | Ashlee Young <ashlee@wildernessvoice.com> | 2015-11-22 10:02:05 -0800 |
---|---|---|
committer | Ashlee Young <ashlee@wildernessvoice.com> | 2015-11-22 10:02:05 -0800 |
commit | 77ce3be7567bd01c66d8ee88a93b485666723501 (patch) | |
tree | 283e7f39a501750bbd705fbb91645b20198900f1 /framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostEvent.java | |
parent | 00e6500d0813dcbccaaa741ef38cc1eae6d11e07 (diff) |
Removed patch path since changes have been merged upstream to a different path. Updated README with directions.
Change-Id: Ie419abd2d3d3ef7315de9f607dcd757a78190995
Signed-off-by: Ashlee Young <ashlee@wildernessvoice.com>
Diffstat (limited to 'framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostEvent.java')
-rw-r--r-- | framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostEvent.java | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostEvent.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostEvent.java index 58ac0bb8..92824cf8 100644 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostEvent.java +++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostEvent.java @@ -18,7 +18,6 @@ package org.onosproject.net.host; import org.joda.time.LocalDateTime; import org.onosproject.event.AbstractEvent; import org.onosproject.net.Host; -import org.onosproject.net.HostLocation; import static com.google.common.base.MoreObjects.toStringHelper; @@ -52,7 +51,7 @@ public class HostEvent extends AbstractEvent<HostEvent.Type, Host> { HOST_MOVED } - private HostLocation prevLocation; + private Host prevSubject; /** * Creates an event of a given type and for the specified host and the @@ -77,25 +76,29 @@ public class HostEvent extends AbstractEvent<HostEvent.Type, Host> { } /** - * Creates an event with HOST_MOVED type along with the previous location - * of the host. + * Creates an event with previous subject. * + * The previous subject is ignored if the type is not moved or updated + * + * @param type host event type * @param host event host subject - * @param prevLocation previous location of the host + * @param prevSubject previous host subject */ - public HostEvent(Host host, HostLocation prevLocation) { - super(Type.HOST_MOVED, host); - this.prevLocation = prevLocation; + public HostEvent(Type type, Host host, Host prevSubject) { + super(type, host); + if (type == Type.HOST_MOVED || type == Type.HOST_UPDATED) { + this.prevSubject = prevSubject; + } } /** - * Gets the previous location information in this host event. + * Gets the previous subject in this host event. * - * @return the previous location, or null if previous location is not + * @return the previous subject, or null if previous subject is not * specified. */ - public HostLocation prevLocation() { - return this.prevLocation; + public Host prevSubject() { + return this.prevSubject; } @Override @@ -104,7 +107,7 @@ public class HostEvent extends AbstractEvent<HostEvent.Type, Host> { .add("time", new LocalDateTime(time())) .add("type", type()) .add("subject", subject()) - .add("prevLocation", prevLocation()) + .add("prevSubject", prevSubject()) .toString(); } } |