diff options
Diffstat (limited to 'framework/src/onos/core/api')
2 files changed, 41 insertions, 4 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 98329df0..58ac0bb8 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 @@ -15,8 +15,12 @@ */ 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; /** * Describes end-station host event. @@ -48,6 +52,8 @@ public class HostEvent extends AbstractEvent<HostEvent.Type, Host> { HOST_MOVED } + private HostLocation prevLocation; + /** * Creates an event of a given type and for the specified host and the * current time. @@ -70,4 +76,35 @@ public class HostEvent extends AbstractEvent<HostEvent.Type, Host> { super(type, host, time); } + /** + * Creates an event with HOST_MOVED type along with the previous location + * of the host. + * + * @param host event host subject + * @param prevLocation previous location of the host + */ + public HostEvent(Host host, HostLocation prevLocation) { + super(Type.HOST_MOVED, host); + this.prevLocation = prevLocation; + } + + /** + * Gets the previous location information in this host event. + * + * @return the previous location, or null if previous location is not + * specified. + */ + public HostLocation prevLocation() { + return this.prevLocation; + } + + @Override + public String toString() { + return toStringHelper(this) + .add("time", new LocalDateTime(time())) + .add("type", type()) + .add("subject", subject()) + .add("prevLocation", prevLocation()) + .toString(); + } } diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/newresource/ResourceAdminService.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/newresource/ResourceAdminService.java index e94ee452..cdcd4072 100644 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/newresource/ResourceAdminService.java +++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/newresource/ResourceAdminService.java @@ -26,7 +26,7 @@ import java.util.List; @Beta public interface ResourceAdminService { /** - * Register resources as the children of the parent resource path. + * Registers resources as the children of the parent resource path. * * @param parent parent resource path under which the resource are registered * @param children resources to be registered as the children of the parent @@ -39,7 +39,7 @@ public interface ResourceAdminService { } /** - * Register resources as the children of the parent resource path. + * Registers resources as the children of the parent resource path. * * @param parent parent resource path under which the resource are registered * @param children resources to be registered as the children of the parent @@ -50,7 +50,7 @@ public interface ResourceAdminService { <T> boolean registerResources(ResourcePath parent, List<T> children); /** - * Unregister resources as the children of the parent resource path. + * Unregisters resources as the children of the parent resource path. * * @param parent parent resource path under which the resource are unregistered * @param children resources to be unregistered as the children of the parent @@ -63,7 +63,7 @@ public interface ResourceAdminService { } /** - * Unregister resources as the children of the parent resource path. + * Unregisters resources as the children of the parent resource path. * * @param parent parent resource path under which the resource are unregistered * @param children resources to be unregistered as the children of the parent |