Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/**
* 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 statistics
*
* Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
*/
public final class StatisticsConfig extends ConfigInstance {
public final static String CONFIG_DEF_MD5 = "e028a9c7c31c188cc1650fba5a57036f";
public final static String CONFIG_DEF_NAME = "statistics";
public final static String CONFIG_DEF_NAMESPACE = "container";
public final static String CONFIG_DEF_VERSION = "";
public final static String[] CONFIG_DEF_SCHEMA = {
"namespace=container",
"collectionintervalsec double default=300.0",
"loggingintervalsec double default=300.0",
"values[].name string",
"values[].operations[].name enum { RAW, MEAN, MIN, MAX, REGULAR, CUMULATIVE, REVERSE_CUMULATIVE, SUM, INSERTIONS } default=RAW",
"values[].operations[].arguments[].key string",
"values[].operations[].arguments[].value string",
"counterresets[].name string"
};
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();
private Double collectionintervalsec = null;
private Double loggingintervalsec = null;
public List values = new ArrayList<>();
public List counterresets = new ArrayList<>();
public Builder() { }
public Builder(StatisticsConfig config) {
collectionintervalsec(config.collectionintervalsec());
loggingintervalsec(config.loggingintervalsec());
for (Values v : config.values()) {
values(new Values.Builder(v));
}
for (Counterresets c : config.counterresets()) {
counterresets(new Counterresets.Builder(c));
}
}
private Builder override(Builder __superior) {
if (__superior.collectionintervalsec != null)
collectionintervalsec(__superior.collectionintervalsec);
if (__superior.loggingintervalsec != null)
loggingintervalsec(__superior.loggingintervalsec);
if (!__superior.values.isEmpty())
values.addAll(__superior.values);
if (!__superior.counterresets.isEmpty())
counterresets.addAll(__superior.counterresets);
return this;
}
public Builder collectionintervalsec(double __value) {
collectionintervalsec = __value;
return this;
}
private Builder collectionintervalsec(String __value) {
return collectionintervalsec(Double.valueOf(__value));
}
public Builder loggingintervalsec(double __value) {
loggingintervalsec = __value;
return this;
}
private Builder loggingintervalsec(String __value) {
return loggingintervalsec(Double.valueOf(__value));
}
/**
* Add the given builder to this builder's list of Values builders
* @param __builder a builder
* @return this builder
*/
public Builder values(Values.Builder __builder) {
values.add(__builder);
return this;
}
/**
* Make a new builder and run the supplied function on it before adding it to the list
* @param __func lambda that modifies the given builder
* @return this builder
*/
public Builder values(java.util.function.Consumer __func) {
Values.Builder __inner = new Values.Builder();
__func.accept(__inner);
values.add(__inner);
return this;
}
/**
* Set the given list as this builder's list of Values builders
* @param __builders a list of builders
* @return this builder
*/
public Builder values(List __builders) {
values = __builders;
return this;
}
/**
* Add the given builder to this builder's list of Counterresets builders
* @param __builder a builder
* @return this builder
*/
public Builder counterresets(Counterresets.Builder __builder) {
counterresets.add(__builder);
return this;
}
/**
* Make a new builder and run the supplied function on it before adding it to the list
* @param __func lambda that modifies the given builder
* @return this builder
*/
public Builder counterresets(java.util.function.Consumer __func) {
Counterresets.Builder __inner = new Counterresets.Builder();
__func.accept(__inner);
counterresets.add(__inner);
return this;
}
/**
* Set the given list as this builder's list of Counterresets builders
* @param __builders a list of builders
* @return this builder
*/
public Builder counterresets(List __builders) {
counterresets = __builders;
return this;
}
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 StatisticsConfig build() {
return new StatisticsConfig(this);
}
}
// Interval between internal sample points measured in seconds
private final DoubleNode collectionintervalsec;
// Interval between each dump to log measured in seconds
private final DoubleNode loggingintervalsec;
private final InnerNodeVector values;
private final InnerNodeVector counterresets;
public StatisticsConfig(Builder builder) {
this(builder, true);
}
private StatisticsConfig(Builder builder, boolean throwIfUninitialized) {
if (throwIfUninitialized && ! builder.__uninitialized.isEmpty())
throw new IllegalArgumentException("The following builder parameters for " +
"statistics must be initialized: " + builder.__uninitialized);
collectionintervalsec = (builder.collectionintervalsec == null) ?
new DoubleNode(300.0D) : new DoubleNode(builder.collectionintervalsec);
loggingintervalsec = (builder.loggingintervalsec == null) ?
new DoubleNode(300.0D) : new DoubleNode(builder.loggingintervalsec);
values = Values.createVector(builder.values);
counterresets = Counterresets.createVector(builder.counterresets);
}
/**
* @return statistics.collectionintervalsec
*/
public double collectionintervalsec() {
return collectionintervalsec.value();
}
/**
* @return statistics.loggingintervalsec
*/
public double loggingintervalsec() {
return loggingintervalsec.value();
}
/**
* @return statistics.values[]
*/
public List values() {
return values;
}
/**
* @param i the index of the value to return
* @return statistics.values[]
*/
public Values values(int i) {
return values.get(i);
}
/**
* @return statistics.counterresets[]
*/
public List counterresets() {
return counterresets;
}
/**
* @param i the index of the value to return
* @return statistics.counterresets[]
*/
public Counterresets counterresets(int i) {
return counterresets.get(i);
}
private ChangesRequiringRestart getChangesRequiringRestart(StatisticsConfig newConfig) {
ChangesRequiringRestart changes = new ChangesRequiringRestart("statistics");
return changes;
}
private static boolean containsFieldsFlaggedWithRestart() {
return false;
}
/**
* This class represents statistics.values[]
*/
public final static class Values extends InnerNode {
public static class Builder implements ConfigBuilder {
private Set __uninitialized = new HashSet(Arrays.asList(
"name"
));
private String name = null;
public List operations = new ArrayList<>();
public Builder() { }
public Builder(Values config) {
name(config.name());
for (Operations o : config.operations()) {
operations(new Operations.Builder(o));
}
}
private Builder override(Builder __superior) {
if (__superior.name != null)
name(__superior.name);
if (!__superior.operations.isEmpty())
operations.addAll(__superior.operations);
return this;
}
public Builder name(String __value) {
if (__value == null) throw new IllegalArgumentException("Null value is not allowed.");
name = __value;
__uninitialized.remove("name");
return this;
}
/**
* Add the given builder to this builder's list of Operations builders
* @param __builder a builder
* @return this builder
*/
public Builder operations(Operations.Builder __builder) {
operations.add(__builder);
return this;
}
/**
* Make a new builder and run the supplied function on it before adding it to the list
* @param __func lambda that modifies the given builder
* @return this builder
*/
public Builder operations(java.util.function.Consumer __func) {
Operations.Builder __inner = new Operations.Builder();
__func.accept(__inner);
operations.add(__inner);
return this;
}
/**
* Set the given list as this builder's list of Operations builders
* @param __builders a list of builders
* @return this builder
*/
public Builder operations(List __builders) {
operations = __builders;
return this;
}
public Values build() {
return new Values(this);
}
}
// Configuration for measured values
private final StringNode name;
private final InnerNodeVector operations;
public Values(Builder builder) {
this(builder, true);
}
private Values(Builder builder, boolean throwIfUninitialized) {
if (throwIfUninitialized && ! builder.__uninitialized.isEmpty())
throw new IllegalArgumentException("The following builder parameters for " +
"statistics.values[] must be initialized: " + builder.__uninitialized);
name = (builder.name == null) ?
new StringNode() : new StringNode(builder.name);
operations = Operations.createVector(builder.operations);
}
/**
* @return statistics.values[].name
*/
public String name() {
return name.value();
}
/**
* @return statistics.values[].operations[]
*/
public List operations() {
return operations;
}
/**
* @param i the index of the value to return
* @return statistics.values[].operations[]
*/
public Operations operations(int i) {
return operations.get(i);
}
private ChangesRequiringRestart getChangesRequiringRestart(Values newConfig) {
ChangesRequiringRestart changes = new ChangesRequiringRestart("values");
return changes;
}
private static InnerNodeVector createVector(List builders) {
List elems = new ArrayList<>();
for (Builder b : builders) {
elems.add(new Values(b));
}
return new InnerNodeVector(elems);
}
/**
* This class represents statistics.values[].operations[]
*/
public final static class Operations extends InnerNode {
public static class Builder implements ConfigBuilder {
private Set __uninitialized = new HashSet();
private Name.Enum name = null;
public List arguments = new ArrayList<>();
public Builder() { }
public Builder(Operations config) {
name(config.name());
for (Arguments a : config.arguments()) {
arguments(new Arguments.Builder(a));
}
}
private Builder override(Builder __superior) {
if (__superior.name != null)
name(__superior.name);
if (!__superior.arguments.isEmpty())
arguments.addAll(__superior.arguments);
return this;
}
public Builder name(Name.Enum __value) {
if (__value == null) throw new IllegalArgumentException("Null value is not allowed.");
name = __value;
return this;
}
private Builder name(String __value) {
return name(Name.Enum.valueOf(__value));
}
/**
* Add the given builder to this builder's list of Arguments builders
* @param __builder a builder
* @return this builder
*/
public Builder arguments(Arguments.Builder __builder) {
arguments.add(__builder);
return this;
}
/**
* Make a new builder and run the supplied function on it before adding it to the list
* @param __func lambda that modifies the given builder
* @return this builder
*/
public Builder arguments(java.util.function.Consumer __func) {
Arguments.Builder __inner = new Arguments.Builder();
__func.accept(__inner);
arguments.add(__inner);
return this;
}
/**
* Set the given list as this builder's list of Arguments builders
* @param __builders a list of builders
* @return this builder
*/
public Builder arguments(List __builders) {
arguments = __builders;
return this;
}
public Operations build() {
return new Operations(this);
}
}
// An array of what operations should be performed on gathered data
private final Name name;
private final InnerNodeVector arguments;
public Operations(Builder builder) {
this(builder, true);
}
private Operations(Builder builder, boolean throwIfUninitialized) {
if (throwIfUninitialized && ! builder.__uninitialized.isEmpty())
throw new IllegalArgumentException("The following builder parameters for " +
"statistics.values[].operations[] must be initialized: " + builder.__uninitialized);
name = (builder.name == null) ?
new Name(Name.RAW) : new Name(builder.name);
arguments = Arguments.createVector(builder.arguments);
}
/**
* @return statistics.values[].operations[].name
*/
public Name.Enum name() {
return name.value();
}
/**
* @return statistics.values[].operations[].arguments[]
*/
public List arguments() {
return arguments;
}
/**
* @param i the index of the value to return
* @return statistics.values[].operations[].arguments[]
*/
public Arguments arguments(int i) {
return arguments.get(i);
}
private ChangesRequiringRestart getChangesRequiringRestart(Operations newConfig) {
ChangesRequiringRestart changes = new ChangesRequiringRestart("operations");
return changes;
}
private static InnerNodeVector createVector(List builders) {
List elems = new ArrayList<>();
for (Builder b : builders) {
elems.add(new Operations(b));
}
return new InnerNodeVector(elems);
}
/**
* This class represents statistics.values[].operations[].name
*
* An array of what operations should be performed on gathered data
*/
public final static class Name extends EnumNode {
public Name(){
this.value = null;
}
public Name(Enum enumValue) {
super(enumValue != null);
this.value = enumValue;
}
public enum Enum {RAW, MEAN, MIN, MAX, REGULAR, CUMULATIVE, REVERSE_CUMULATIVE, SUM, INSERTIONS}
public final static Enum RAW = Enum.RAW;
public final static Enum MEAN = Enum.MEAN;
public final static Enum MIN = Enum.MIN;
public final static Enum MAX = Enum.MAX;
public final static Enum REGULAR = Enum.REGULAR;
public final static Enum CUMULATIVE = Enum.CUMULATIVE;
public final static Enum REVERSE_CUMULATIVE = Enum.REVERSE_CUMULATIVE;
public final static Enum SUM = Enum.SUM;
public final static Enum INSERTIONS = Enum.INSERTIONS;
@Override
protected boolean doSetValue(String name) {
try {
value = Enum.valueOf(name);
return true;
} catch (IllegalArgumentException e) {
}
return false;
}
}
/**
* This class represents statistics.values[].operations[].arguments[]
*/
public final static class Arguments extends InnerNode {
public static class Builder implements ConfigBuilder {
private Set __uninitialized = new HashSet(Arrays.asList(
"key",
"value"
));
private String key = null;
private String value = null;
public Builder() { }
public Builder(Arguments config) {
key(config.key());
value(config.value());
}
private Builder override(Builder __superior) {
if (__superior.key != null)
key(__superior.key);
if (__superior.value != null)
value(__superior.value);
return this;
}
public Builder key(String __value) {
if (__value == null) throw new IllegalArgumentException("Null value is not allowed.");
key = __value;
__uninitialized.remove("key");
return this;
}
public Builder value(String __value) {
if (__value == null) throw new IllegalArgumentException("Null value is not allowed.");
value = __value;
__uninitialized.remove("value");
return this;
}
public Arguments build() {
return new Arguments(this);
}
}
// Arguments for the operations, typically limits for arrays.
private final StringNode key;
private final StringNode value;
public Arguments(Builder builder) {
this(builder, true);
}
private Arguments(Builder builder, boolean throwIfUninitialized) {
if (throwIfUninitialized && ! builder.__uninitialized.isEmpty())
throw new IllegalArgumentException("The following builder parameters for " +
"statistics.values[].operations[].arguments[] must be initialized: " + builder.__uninitialized);
key = (builder.key == null) ?
new StringNode() : new StringNode(builder.key);
value = (builder.value == null) ?
new StringNode() : new StringNode(builder.value);
}
/**
* @return statistics.values[].operations[].arguments[].key
*/
public String key() {
return key.value();
}
/**
* @return statistics.values[].operations[].arguments[].value
*/
public String value() {
return value.value();
}
private ChangesRequiringRestart getChangesRequiringRestart(Arguments newConfig) {
ChangesRequiringRestart changes = new ChangesRequiringRestart("arguments");
return changes;
}
private static InnerNodeVector createVector(List builders) {
List elems = new ArrayList<>();
for (Builder b : builders) {
elems.add(new Arguments(b));
}
return new InnerNodeVector(elems);
}
}
}
}
/**
* This class represents statistics.counterresets[]
*/
public final static class Counterresets extends InnerNode {
public static class Builder implements ConfigBuilder {
private Set __uninitialized = new HashSet(Arrays.asList(
"name"
));
private String name = null;
public Builder() { }
public Builder(Counterresets config) {
name(config.name());
}
private Builder override(Builder __superior) {
if (__superior.name != null)
name(__superior.name);
return this;
}
public Builder name(String __value) {
if (__value == null) throw new IllegalArgumentException("Null value is not allowed.");
name = __value;
__uninitialized.remove("name");
return this;
}
public Counterresets build() {
return new Counterresets(this);
}
}
// The counters which should be reset between each collection interval,
// and therefore be logged as values.
private final StringNode name;
public Counterresets(Builder builder) {
this(builder, true);
}
private Counterresets(Builder builder, boolean throwIfUninitialized) {
if (throwIfUninitialized && ! builder.__uninitialized.isEmpty())
throw new IllegalArgumentException("The following builder parameters for " +
"statistics.counterresets[] must be initialized: " + builder.__uninitialized);
name = (builder.name == null) ?
new StringNode() : new StringNode(builder.name);
}
/**
* @return statistics.counterresets[].name
*/
public String name() {
return name.value();
}
private ChangesRequiringRestart getChangesRequiringRestart(Counterresets newConfig) {
ChangesRequiringRestart changes = new ChangesRequiringRestart("counterresets");
return changes;
}
private static InnerNodeVector createVector(List builders) {
List elems = new ArrayList<>();
for (Builder b : builders) {
elems.add(new Counterresets(b));
}
return new InnerNodeVector(elems);
}
}
}