diff options
author | Håkon Hallingstad <hakon@oath.com> | 2017-10-25 17:36:20 +0200 |
---|---|---|
committer | Håkon Hallingstad <hakon@oath.com> | 2017-10-25 17:36:20 +0200 |
commit | 37ce355370e8483c05bd9a7ce9f4f248e19ad4fb (patch) | |
tree | a8f0ec831ee667ecd909fad6b5206fdae5307821 /application-model/src/main | |
parent | 9606e88b7ca082f36eb38b0e197a0513f76ef6eb (diff) |
Provide more info in host Orchestrator REST API
Diffstat (limited to 'application-model/src/main')
-rw-r--r-- | application-model/src/main/java/com/yahoo/vespa/applicationmodel/ServiceCluster.java | 22 | ||||
-rw-r--r-- | application-model/src/main/java/com/yahoo/vespa/applicationmodel/ServiceInstance.java | 20 |
2 files changed, 36 insertions, 6 deletions
diff --git a/application-model/src/main/java/com/yahoo/vespa/applicationmodel/ServiceCluster.java b/application-model/src/main/java/com/yahoo/vespa/applicationmodel/ServiceCluster.java index d18ced478f1..e53058f40e3 100644 --- a/application-model/src/main/java/com/yahoo/vespa/applicationmodel/ServiceCluster.java +++ b/application-model/src/main/java/com/yahoo/vespa/applicationmodel/ServiceCluster.java @@ -1,9 +1,11 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.applicationmodel; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Objects; +import java.util.Optional; import java.util.Set; /** @@ -16,6 +18,7 @@ public class ServiceCluster { private final ClusterId clusterId; private final ServiceType serviceType; private final Set<ServiceInstance> serviceInstances; + private Optional<ApplicationInstance> applicationInstance = Optional.empty(); public ServiceCluster(ClusterId clusterId, ServiceType serviceType, Set<ServiceInstance> serviceInstances) { this.clusterId = clusterId; @@ -38,12 +41,25 @@ public class ServiceCluster { return serviceInstances; } + @JsonIgnore + public void setApplicationInstance(ApplicationInstance applicationInstance) { + this.applicationInstance = Optional.of(applicationInstance); + } + + @JsonIgnore + public ApplicationInstance getApplicationInstance() { + return applicationInstance.get(); + } + @Override public String toString() { return "ServiceCluster{" + "clusterId=" + clusterId + ", serviceType=" + serviceType + ", serviceInstances=" + serviceInstances + + (applicationInstance.isPresent() ? + ", applicationInstance=" + applicationInstance.get() : + "") + '}'; } @@ -54,12 +70,12 @@ public class ServiceCluster { ServiceCluster that = (ServiceCluster) o; return Objects.equals(clusterId, that.clusterId) && Objects.equals(serviceType, that.serviceType) && - Objects.equals(serviceInstances, that.serviceInstances); + Objects.equals(serviceInstances, that.serviceInstances) && + Objects.equals(applicationInstance, that.applicationInstance); } @Override public int hashCode() { - return Objects.hash(clusterId, serviceType, serviceInstances); + return Objects.hash(clusterId, serviceType, serviceInstances, applicationInstance); } - } diff --git a/application-model/src/main/java/com/yahoo/vespa/applicationmodel/ServiceInstance.java b/application-model/src/main/java/com/yahoo/vespa/applicationmodel/ServiceInstance.java index 2b31bb11ff7..4c802218b22 100644 --- a/application-model/src/main/java/com/yahoo/vespa/applicationmodel/ServiceInstance.java +++ b/application-model/src/main/java/com/yahoo/vespa/applicationmodel/ServiceInstance.java @@ -1,9 +1,11 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.applicationmodel; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Objects; +import java.util.Optional; /** * @author bjorncs @@ -13,6 +15,7 @@ public class ServiceInstance { private final ConfigId configId; private final HostName hostName; private final ServiceStatus serviceStatus; + private Optional<ServiceCluster> serviceCluster = Optional.empty(); public ServiceInstance(ConfigId configId, HostName hostName, ServiceStatus serviceStatus) { this.configId = configId; @@ -35,12 +38,23 @@ public class ServiceInstance { return serviceStatus; } + @JsonIgnore + public void setServiceCluster(ServiceCluster serviceCluster) { + this.serviceCluster = Optional.of(serviceCluster); + } + + @JsonIgnore + public ServiceCluster getServiceCluster() { + return serviceCluster.get(); + } + @Override public String toString() { return "ServiceInstance{" + "configId=" + configId + ", hostName=" + hostName + ", serviceStatus=" + serviceStatus + + (serviceCluster.isPresent() ? ", serviceCluster=" + serviceCluster.get() : "") + '}'; } @@ -51,12 +65,12 @@ public class ServiceInstance { ServiceInstance that = (ServiceInstance) o; return Objects.equals(configId, that.configId) && Objects.equals(hostName, that.hostName) && - Objects.equals(serviceStatus, that.serviceStatus); + serviceStatus == that.serviceStatus && + Objects.equals(serviceCluster, that.serviceCluster); } @Override public int hashCode() { - return Objects.hash(configId, hostName, serviceStatus); + return Objects.hash(configId, hostName, serviceStatus, serviceCluster); } - } |