com.yahoo.container.QrConfig Maven / Gradle / Ivy
/**
* This file is generated from a config definition file.
* ------------ D O N O T E D I T ! ------------
*/
package com.yahoo.container;
import java.util.*;
import java.io.File;
import java.nio.file.Path;
import com.yahoo.config.*;
/**
* This class represents the root node of qr
*
* Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
*/
public final class QrConfig extends ConfigInstance {
public final static String CONFIG_DEF_MD5 = "f26ba59028f4055e7e67e904ec360f6a";
public final static String CONFIG_DEF_NAME = "qr";
public final static String CONFIG_DEF_NAMESPACE = "container";
public final static String CONFIG_DEF_VERSION = "";
public final static String[] CONFIG_DEF_SCHEMA = {
"namespace=container",
"filedistributor.configid reference default=\"\" restart",
"rpc.enabled bool default=false restart",
"rpc.port int default=8086 restart",
"rpc.host string default=\"\" restart",
"rpc.slobrokId string default=\"\" restart",
"discriminator string default=\"qrserver.0\" restart",
"restartOnDeploy bool default=false restart"
};
public static String getDefMd5() { return CONFIG_DEF_MD5; }
public static String getDefName() { return CONFIG_DEF_NAME; }
public static String getDefNamespace() { return CONFIG_DEF_NAMESPACE; }
public static String getDefVersion() { return CONFIG_DEF_VERSION; }
public interface Producer extends ConfigInstance.Producer {
void getConfig(Builder builder);
}
public static class Builder implements ConfigInstance.Builder {
private Set __uninitialized = new HashSet();
public Filedistributor.Builder filedistributor = new Filedistributor.Builder();
public Rpc.Builder rpc = new Rpc.Builder();
private String discriminator = null;
private Boolean restartOnDeploy = null;
public Builder() { }
public Builder(QrConfig config) {
filedistributor(new Filedistributor.Builder(config.filedistributor()));
rpc(new Rpc.Builder(config.rpc()));
discriminator(config.discriminator());
restartOnDeploy(config.restartOnDeploy());
}
private Builder override(Builder __superior) {
filedistributor(filedistributor.override(__superior.filedistributor));
rpc(rpc.override(__superior.rpc));
if (__superior.discriminator != null)
discriminator(__superior.discriminator);
if (__superior.restartOnDeploy != null)
restartOnDeploy(__superior.restartOnDeploy);
return this;
}
public Builder filedistributor(Filedistributor.Builder __builder) {
filedistributor = __builder;
return this;
}
public Builder rpc(Rpc.Builder __builder) {
rpc = __builder;
return this;
}
public Builder discriminator(String __value) {
if (__value == null) throw new IllegalArgumentException("Null value is not allowed.");
discriminator = __value;
return this;
}
public Builder restartOnDeploy(boolean __value) {
restartOnDeploy = __value;
return this;
}
private Builder restartOnDeploy(String __value) {
return restartOnDeploy(Boolean.valueOf(__value));
}
private boolean _applyOnRestart = false;
@java.lang.Override
public final boolean dispatchGetConfig(ConfigInstance.Producer producer) {
if (producer instanceof Producer) {
((Producer)producer).getConfig(this);
return true;
}
return false;
}
@java.lang.Override
public final String getDefMd5() { return CONFIG_DEF_MD5; }
@java.lang.Override
public final String getDefName() { return CONFIG_DEF_NAME; }
@java.lang.Override
public final String getDefNamespace() { return CONFIG_DEF_NAMESPACE; }
@java.lang.Override
public final boolean getApplyOnRestart() { return _applyOnRestart; }
@java.lang.Override
public final void setApplyOnRestart(boolean applyOnRestart) { _applyOnRestart = applyOnRestart; }
public QrConfig build() {
return new QrConfig(this);
}
}
private final Filedistributor filedistributor;
private final Rpc rpc;
// A unique identifier string for this QRS. The only guarantee given is
// this string will be unique for every QRS in a Vespa application.
private final StringNode discriminator;
// Force restart of container on deploy, and defer any changes until restart
private final BooleanNode restartOnDeploy;
public QrConfig(Builder builder) {
this(builder, true);
}
private QrConfig(Builder builder, boolean throwIfUninitialized) {
if (throwIfUninitialized && ! builder.__uninitialized.isEmpty())
throw new IllegalArgumentException("The following builder parameters for " +
"qr must be initialized: " + builder.__uninitialized);
filedistributor = new Filedistributor(builder.filedistributor, throwIfUninitialized);
rpc = new Rpc(builder.rpc, throwIfUninitialized);
discriminator = (builder.discriminator == null) ?
new StringNode("qrserver.0") : new StringNode(builder.discriminator);
restartOnDeploy = (builder.restartOnDeploy == null) ?
new BooleanNode(false) : new BooleanNode(builder.restartOnDeploy);
}
/**
* @return qr.filedistributor
*/
public Filedistributor filedistributor() {
return filedistributor;
}
/**
* @return qr.rpc
*/
public Rpc rpc() {
return rpc;
}
/**
* @return qr.discriminator
*/
public String discriminator() {
return discriminator.value();
}
/**
* @return qr.restartOnDeploy
*/
public boolean restartOnDeploy() {
return restartOnDeploy.value();
}
private ChangesRequiringRestart getChangesRequiringRestart(QrConfig newConfig) {
ChangesRequiringRestart changes = new ChangesRequiringRestart("qr");
changes.mergeChanges("filedistributor", this.filedistributor.getChangesRequiringRestart(newConfig.filedistributor));
changes.mergeChanges("rpc", this.rpc.getChangesRequiringRestart(newConfig.rpc));
changes.compare(this.discriminator, newConfig.discriminator, "discriminator", "A unique identifier string for this QRS. The only guarantee given is\nthis string will be unique for every QRS in a Vespa application.");
changes.compare(this.restartOnDeploy, newConfig.restartOnDeploy, "restartOnDeploy", "Force restart of container on deploy, and defer any changes until restart");
return changes;
}
private static boolean containsFieldsFlaggedWithRestart() {
return true;
}
/**
* This class represents qr.filedistributor
*/
public final static class Filedistributor extends InnerNode {
public static class Builder implements ConfigBuilder {
private Set __uninitialized = new HashSet();
private String configid = null;
public Builder() { }
public Builder(Filedistributor config) {
configid(config.configid());
}
private Builder override(Builder __superior) {
if (__superior.configid != null)
configid(__superior.configid);
return this;
}
public Builder configid(String __value) {
if (__value == null) throw new IllegalArgumentException("Null value is not allowed.");
configid = __value;
return this;
}
public Filedistributor build() {
return new Filedistributor(this);
}
}
// All params must be flagged as 'restart' because this config is manually
// retrieved by ConfiguredApplication.start to init the rpc server
// filedistributor rpc configuration
private final ReferenceNode configid;
public Filedistributor(Builder builder) {
this(builder, true);
}
private Filedistributor(Builder builder, boolean throwIfUninitialized) {
if (throwIfUninitialized && ! builder.__uninitialized.isEmpty())
throw new IllegalArgumentException("The following builder parameters for " +
"qr.filedistributor must be initialized: " + builder.__uninitialized);
configid = (builder.configid == null) ?
new ReferenceNode("") : new ReferenceNode(builder.configid);
}
/**
* @return qr.filedistributor.configid
*/
public String configid() {
return configid.value();
}
private ChangesRequiringRestart getChangesRequiringRestart(Filedistributor newConfig) {
ChangesRequiringRestart changes = new ChangesRequiringRestart("filedistributor");
changes.compare(this.configid, newConfig.configid, "configid", "All params must be flagged as 'restart' because this config is manually\nretrieved by ConfiguredApplication.start to init the rpc server\n\nfiledistributor rpc configuration");
return changes;
}
}
/**
* This class represents qr.rpc
*/
public final static class Rpc extends InnerNode {
public static class Builder implements ConfigBuilder {
private Set __uninitialized = new HashSet();
private Boolean enabled = null;
private Integer port = null;
private String host = null;
private String slobrokId = null;
public Builder() { }
public Builder(Rpc config) {
enabled(config.enabled());
port(config.port());
host(config.host());
slobrokId(config.slobrokId());
}
private Builder override(Builder __superior) {
if (__superior.enabled != null)
enabled(__superior.enabled);
if (__superior.port != null)
port(__superior.port);
if (__superior.host != null)
host(__superior.host);
if (__superior.slobrokId != null)
slobrokId(__superior.slobrokId);
return this;
}
public Builder enabled(boolean __value) {
enabled = __value;
return this;
}
private Builder enabled(String __value) {
return enabled(Boolean.valueOf(__value));
}
public Builder port(int __value) {
port = __value;
return this;
}
private Builder port(String __value) {
return port(Integer.valueOf(__value));
}
public Builder host(String __value) {
if (__value == null) throw new IllegalArgumentException("Null value is not allowed.");
host = __value;
return this;
}
public Builder slobrokId(String __value) {
if (__value == null) throw new IllegalArgumentException("Null value is not allowed.");
slobrokId = __value;
return this;
}
public Rpc build() {
return new Rpc(this);
}
}
// Is RPC server enabled?
private final BooleanNode enabled;
// RPC server listen port
private final IntegerNode port;
// Which interface to bind to.
private final StringNode host;
// The id this service should register itself with in slobrok
private final StringNode slobrokId;
public Rpc(Builder builder) {
this(builder, true);
}
private Rpc(Builder builder, boolean throwIfUninitialized) {
if (throwIfUninitialized && ! builder.__uninitialized.isEmpty())
throw new IllegalArgumentException("The following builder parameters for " +
"qr.rpc must be initialized: " + builder.__uninitialized);
enabled = (builder.enabled == null) ?
new BooleanNode(false) : new BooleanNode(builder.enabled);
port = (builder.port == null) ?
new IntegerNode(8086) : new IntegerNode(builder.port);
host = (builder.host == null) ?
new StringNode("") : new StringNode(builder.host);
slobrokId = (builder.slobrokId == null) ?
new StringNode("") : new StringNode(builder.slobrokId);
}
/**
* @return qr.rpc.enabled
*/
public boolean enabled() {
return enabled.value();
}
/**
* @return qr.rpc.port
*/
public int port() {
return port.value();
}
/**
* @return qr.rpc.host
*/
public String host() {
return host.value();
}
/**
* @return qr.rpc.slobrokId
*/
public String slobrokId() {
return slobrokId.value();
}
private ChangesRequiringRestart getChangesRequiringRestart(Rpc newConfig) {
ChangesRequiringRestart changes = new ChangesRequiringRestart("rpc");
changes.compare(this.enabled, newConfig.enabled, "enabled", "Is RPC server enabled?");
changes.compare(this.port, newConfig.port, "port", "RPC server listen port");
changes.compare(this.host, newConfig.host, "host", "Which interface to bind to.");
changes.compare(this.slobrokId, newConfig.slobrokId, "slobrokId", "The id this service should register itself with in slobrok");
return changes;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy