summaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorMorten Tokle <mortent@oath.com>2017-10-26 09:27:00 +0200
committerMorten Tokle <mortent@oath.com>2017-10-26 09:27:00 +0200
commit53f55c1ad067b077e7487c7a691f4b73dd8e872a (patch)
treed7bb4697de229f872fe791cdb659a193e48195b4 /config-model
parent7df6c74f23d330a75c5a3f5f68bc363cc3853a2e (diff)
Refactor identity as config producer
Diffstat (limited to 'config-model')
-rwxr-xr-xconfig-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java28
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/container/Identity.java16
2 files changed, 20 insertions, 24 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java
index 412baf6b270..b7482a3646d 100755
--- a/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java
@@ -842,23 +842,6 @@ public final class ContainerCluster
*/
public Optional<Integer> getMemoryPercentage() { return memoryPercentage; }
- private Optional<Identity> getIdentity() {
- return Optional.ofNullable(identity);
- }
-
- public void setIdentity(Identity identity) {
- this.identity = identity;
- addSimpleComponent("com.yahoo.container.jdisc.athenz.impl.AthenzIdentityProviderImpl");
- }
-
- @Override
- public void getConfig(IdentityConfig.Builder builder) {
- getIdentity().ifPresent(id -> {
- builder.service(id.getService());
- builder.domain(id.getDomain());
- });
- }
-
@Override
public String toString() {
return "container cluster '" + getName() + "'";
@@ -881,4 +864,15 @@ public final class ContainerCluster
}
}
+ public void setIdentity(Identity identity) {
+ this.identity = identity;
+ addComponent(identity);
+ }
+
+ @Override
+ public void getConfig(IdentityConfig.Builder builder) {
+ if (identity != null) {
+ identity.getConfig(builder);
+ }
+ }
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/Identity.java b/config-model/src/main/java/com/yahoo/vespa/model/container/Identity.java
index 9f784482510..665da9ec426 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/container/Identity.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/container/Identity.java
@@ -1,23 +1,25 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.container;
+import com.yahoo.container.core.identity.IdentityConfig;
+import com.yahoo.vespa.model.container.component.SimpleComponent;
+
/**
* @author mortent
*/
-public class Identity {
+public class Identity extends SimpleComponent implements IdentityConfig.Producer {
private final String domain;
private final String service;
public Identity(String domain, String service) {
+ super("com.yahoo.container.jdisc.athenz.impl.AthenzIdentityProviderImpl");
this.domain = domain;
this.service = service;
}
- public String getDomain() {
- return domain;
- }
-
- public String getService() {
- return service;
+ @Override
+ public void getConfig(IdentityConfig.Builder builder) {
+ builder.domain(domain);
+ builder.service(service);
}
}