aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java/com/yahoo
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@verizonmedia.com>2019-05-02 21:29:29 +0200
committerJon Bratseth <bratseth@verizonmedia.com>2019-05-02 21:29:29 +0200
commit8457cd74f0ac3d876d1f7fd6cd7ea7b503cae491 (patch)
tree4a2eb5ed891f5da85397797fc4c943c33ade8b65 /config-model/src/main/java/com/yahoo
parent75e2698805c454d54afb4b5a8bc62b046c4e3246 (diff)
Allow continuous node resource specs
Diffstat (limited to 'config-model/src/main/java/com/yahoo')
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomAdminBuilderBase.java11
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomAdminV2Builder.java5
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomAdminV4Builder.java6
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/ModelElement.java126
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/NodesSpecification.java42
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/content/BucketSplitting.java11
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/content/ClusterControllerConfig.java4
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/content/ContentSearchCluster.java14
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/content/Distributor.java4
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/content/DistributorCluster.java8
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/content/StorageGroup.java14
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/content/StorageNode.java2
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/content/cluster/ContentCluster.java24
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/content/cluster/DocumentSelectionBuilder.java6
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/content/cluster/DomContentSearchBuilder.java2
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/content/cluster/DomDispatchBuilder.java4
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/content/cluster/DomResourceLimitsBuilder.java6
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/content/cluster/DomSearchCoverageBuilder.java4
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/content/cluster/DomTuningDispatchBuilder.java4
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/content/cluster/EngineFactoryBuilder.java8
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/content/cluster/GlobalDistributionBuilder.java4
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/content/cluster/RedundancyBuilder.java4
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/content/cluster/SearchDefinitionBuilder.java2
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/content/storagecluster/FileStorProducer.java8
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/content/storagecluster/PersistenceProducer.java2
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/content/storagecluster/StorServerProducer.java8
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/content/storagecluster/StorVisitorProducer.java8
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/search/SearchDefinitionXMLHandler.java5
28 files changed, 162 insertions, 184 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomAdminBuilderBase.java b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomAdminBuilderBase.java
index 3a9a5d59b1a..bae9c52b06e 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomAdminBuilderBase.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomAdminBuilderBase.java
@@ -14,7 +14,6 @@ import com.yahoo.vespa.model.admin.Admin;
import com.yahoo.vespa.model.admin.Configserver;
import com.yahoo.vespa.model.admin.LogForwarder;
import com.yahoo.vespa.model.admin.ModelConfigProvider;
-import com.yahoo.vespa.model.admin.monitoring.MetricsConsumer;
import com.yahoo.vespa.model.admin.monitoring.DefaultMonitoring;
import com.yahoo.vespa.model.admin.monitoring.Monitoring;
import com.yahoo.vespa.model.admin.monitoring.builder.Metrics;
@@ -26,10 +25,8 @@ import org.w3c.dom.Element;
import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
import static com.yahoo.vespa.model.admin.monitoring.builder.PredefinedMetricSets.predefinedMetricSets;
-import static java.util.logging.Level.WARNING;
/**
* A base class for admin model builders, to support common functionality across versions.
@@ -116,11 +113,11 @@ public abstract class DomAdminBuilderBase extends VespaDomBuilder.DomConfigProdu
void addLogForwarders(ModelElement logForwardingElement, Admin admin) {
if (logForwardingElement == null) return;
- for (ModelElement e : logForwardingElement.getChildren("splunk")) {
+ for (ModelElement e : logForwardingElement.children("splunk")) {
LogForwarder.Config cfg = LogForwarder.cfg()
- .withSplunkHome(e.getStringAttribute("splunk-home"))
- .withDeploymentServer(e.getStringAttribute("deployment-server"))
- .withClientName(e.getStringAttribute("client-name"));
+ .withSplunkHome(e.stringAttribute("splunk-home"))
+ .withDeploymentServer(e.stringAttribute("deployment-server"))
+ .withClientName(e.stringAttribute("client-name"));
admin.setLogForwarderConfig(cfg);
}
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomAdminV2Builder.java b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomAdminV2Builder.java
index 3a16264b148..1b0e04b50a8 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomAdminV2Builder.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomAdminV2Builder.java
@@ -17,7 +17,6 @@ import com.yahoo.vespa.model.admin.clustercontroller.ClusterControllerCluster;
import com.yahoo.vespa.model.admin.clustercontroller.ClusterControllerContainer;
import com.yahoo.vespa.model.admin.clustercontroller.ClusterControllerContainerCluster;
import com.yahoo.vespa.model.builder.xml.dom.VespaDomBuilder.DomConfigProducerBuilder;
-import com.yahoo.vespa.model.container.xml.ContainerModelBuilder;
import org.w3c.dom.Element;
import java.util.List;
@@ -51,9 +50,9 @@ public class DomAdminV2Builder extends DomAdminBuilderBase {
admin.setClusterControllers(addConfiguredClusterControllers(deployState, admin, adminE));
ModelElement adminElement = new ModelElement(adminE);
- addLogForwarders(adminElement.getChild("logforwarding"), admin);
+ addLogForwarders(adminElement.child("logforwarding"), admin);
- if (adminElement.getChild("filedistribution") != null) {
+ if (adminElement.child("filedistribution") != null) {
deployState.getDeployLogger().log(LogLevel.WARNING, "'filedistribution' element is deprecated and ignored");
}
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomAdminV4Builder.java b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomAdminV4Builder.java
index 8980c7db93d..71ce6492b09 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomAdminV4Builder.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomAdminV4Builder.java
@@ -54,14 +54,14 @@ public class DomAdminV4Builder extends DomAdminBuilderBase {
// Note: These two elements only exists in admin version 4.0
// This build handles admin version 3.0 by ignoring its content (as the content is not useful)
Optional<NodesSpecification> requestedSlobroks =
- NodesSpecification.optionalDedicatedFromParent(adminElement.getChild("slobroks"), context);
+ NodesSpecification.optionalDedicatedFromParent(adminElement.child("slobroks"), context);
Optional<NodesSpecification> requestedLogservers =
- NodesSpecification.optionalDedicatedFromParent(adminElement.getChild("logservers"), context);
+ NodesSpecification.optionalDedicatedFromParent(adminElement.child("logservers"), context);
assignSlobroks(deployState.getDeployLogger(), requestedSlobroks.orElse(NodesSpecification.nonDedicated(3, context)), admin);
assignLogserver(deployState, requestedLogservers.orElse(createNodesSpecificationForLogserver()), admin);
- addLogForwarders(adminElement.getChild("logforwarding"), admin);
+ addLogForwarders(adminElement.child("logforwarding"), admin);
}
private void assignSlobroks(DeployLogger deployLogger, NodesSpecification nodesSpecification, Admin admin) {
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/ModelElement.java b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/ModelElement.java
index 1fc70e343f3..1f649b122fa 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/ModelElement.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/ModelElement.java
@@ -20,54 +20,38 @@ public class ModelElement {
private final Element xml;
public ModelElement(Element xml) {
+ if (xml == null) throw new NullPointerException("Can not create ModelElement with null element");
+ if (xml.getNodeName() == null) throw new NullPointerException("Can not create ModelElement with unnamed element");
this.xml = xml;
- if (xml == null) {
- throw new NullPointerException("Can not create ModelElement with null element");
- }
- if (xml.getNodeName() == null) {
- throw new NullPointerException("Can not create ModelElement with unnamed element");
- }
}
- public Element getXml() {
- return xml;
- }
+ public Element getXml() { return xml; }
- /**
- * If not found, return null.
- */
- public ModelElement getChild(String name) {
+ /** Returns the child with the given name, or null if none. */
+ public ModelElement child(String name) {
Element e = XML.getChild(xml, name);
-
- if (e != null) {
- return new ModelElement(e);
- }
-
- return null;
+ if (e == null) return null;
+ return new ModelElement(e);
}
- /**
- * If not found, return empty list
- */
- public List<ModelElement> getChildren(String name) {
+ /** If not found, return empty list. */
+ public List<ModelElement> children(String name) {
List<Element> e = XML.getChildren(xml, name);
List<ModelElement> list = new ArrayList<>();
e.forEach(element -> list.add(new ModelElement(element)));
-
return list;
}
- public ModelElement getChildByPath(String path) {
+ public ModelElement childByPath(String path) {
StringTokenizer tokenizer = new StringTokenizer(path, ".");
ModelElement curElem = this;
while (tokenizer.hasMoreTokens() && curElem != null) {
String pathElem = tokenizer.nextToken();
- ModelElement child = curElem.getChild(pathElem);
+ ModelElement child = curElem.child(pathElem);
if (!tokenizer.hasMoreTokens()) {
- if (child != null) {
+ if (child != null)
return child;
- }
}
curElem = child;
}
@@ -79,9 +63,9 @@ public class ModelElement {
ModelElement curElem = this;
while (tokenizer.hasMoreTokens() && curElem != null) {
String pathElem = tokenizer.nextToken();
- ModelElement child = curElem.getChild(pathElem);
+ ModelElement child = curElem.child(pathElem);
if (!tokenizer.hasMoreTokens()) {
- String attr = curElem.getStringAttribute(pathElem);
+ String attr = curElem.stringAttribute(pathElem);
if (attr != null) {
return attr;
} else if (child != null) {
@@ -111,97 +95,84 @@ public class ModelElement {
public Long childAsLong(String path) {
String child = childAsString(path);
- if (child == null) {
- return null;
- }
+ if (child == null) return null;
return Long.parseLong(child.trim());
}
public Integer childAsInteger(String path) {
String child = childAsString(path);
- if (child == null) {
- return null;
- }
+ if (child == null) return null;
return Integer.parseInt(child.trim());
}
public Double childAsDouble(String path) {
String child = childAsString(path);
- if (child == null) {
- return null;
- }
+ if (child == null) return null;
return Double.parseDouble(child.trim());
}
public Boolean childAsBoolean(String path) {
String child = childAsString(path);
- if (child == null) {
- return null;
- }
+ if (child == null) return null;
return Boolean.parseBoolean(child.trim());
}
public Duration childAsDuration(String path) {
String child = childAsString(path);
- if (child == null) {
- return null;
- }
+ if (child == null) return null;
return new Duration(child);
}
/** Returns the given attribute or throws IllegalArgumentException if not present */
public int requiredIntegerAttribute(String name) {
- if (getStringAttribute(name) == null)
+ if (stringAttribute(name) == null)
throw new IllegalArgumentException("Required attribute '" + name + "' is missing");
- return getIntegerAttribute(name, null);
+ return integerAttribute(name, null);
}
/** Returns the value of this attribute or null if not present */
- public Integer getIntegerAttribute(String name) {
- return getIntegerAttribute(name, null);
+ public Integer integerAttribute(String name) {
+ return integerAttribute(name, null);
}
- public Integer getIntegerAttribute(String name, Integer defaultValue) {
- String value = getStringAttribute(name);
- if (value == null) {
- return defaultValue;
- }
+ public Integer integerAttribute(String name, Integer defaultValue) {
+ String value = stringAttribute(name);
+ if (value == null) return defaultValue;
return (int) BinaryUnit.valueOf(value);
}
- public boolean getBooleanAttribute(String name) {
- return getBooleanAttribute(name, false);
+ public boolean booleanAttribute(String name) {
+ return booleanAttribute(name, false);
}
- public boolean getBooleanAttribute(String name, boolean defaultValue) {
- String value = getStringAttribute(name);
- if (value == null) {
- return defaultValue;
- }
+ public boolean booleanAttribute(String name, boolean defaultValue) {
+ String value = stringAttribute(name);
+ if (value == null) return defaultValue;
return Boolean.parseBoolean(value);
}
- public Long getLongAttribute(String name) {
- String value = getStringAttribute(name);
- if (value == null) {
- return null;
- }
+ public Long longAttribute(String name) {
+ String value = stringAttribute(name);
+ if (value == null) return null;
return (long) BinaryUnit.valueOf(value);
}
- public Double getDoubleAttribute(String name) {
- String value = getStringAttribute(name);
- if (value == null) {
- return null;
- }
+ public Double doubleAttribute(String name) {
+ String value = stringAttribute(name);
+ if (value == null) return null;
return Double.parseDouble(value);
}
- public String getStringAttribute(String name) {
- if (!xml.hasAttribute(name)) {
- return null;
- }
+ /** Returns the given attribute or throws IllegalArgumentException if not present */
+ public double requiredDoubleAttribute(String name) {
+ if (stringAttribute(name) == null)
+ throw new IllegalArgumentException("Required attribute '" + name + "' is missing");
+ return doubleAttribute(name);
+ }
+ /** Returns the content of the attribute with the given name, or null if none */
+ public String stringAttribute(String name) {
+ if ( ! xml.hasAttribute(name)) return null;
return xml.getAttribute(name);
}
@@ -209,10 +180,8 @@ public class ModelElement {
List<Element> elements = XML.getChildren(xml, name);
List<ModelElement> helpers = new ArrayList<>();
- for (Element e : elements) {
+ for (Element e : elements)
helpers.add(new ModelElement(e));
- }
-
return helpers;
}
@@ -220,4 +189,5 @@ public class ModelElement {
public String toString() {
return xml.getNodeName();
}
+
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/NodesSpecification.java b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/NodesSpecification.java
index 84fdbf0a75c..1031ae7b787 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/NodesSpecification.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/NodesSpecification.java
@@ -7,6 +7,7 @@ import com.yahoo.config.model.ConfigModelContext;
import com.yahoo.config.provision.Capacity;
import com.yahoo.config.provision.ClusterMembership;
import com.yahoo.config.provision.ClusterSpec;
+import com.yahoo.config.provision.FlavorSpec;
import com.yahoo.config.provision.RotationName;
import com.yahoo.vespa.model.HostResource;
import com.yahoo.vespa.model.HostSystem;
@@ -44,14 +45,14 @@ public class NodesSpecification {
private final boolean exclusive;
/** The flavor the nodes should have, or empty to use the default */
- private final Optional<String> flavor;
+ private final Optional<FlavorSpec> flavor;
/** The identifier of the custom docker image layer to use (not supported yet) */
private final Optional<String> dockerImage;
private NodesSpecification(boolean dedicated, int count, int groups, Version version,
boolean required, boolean canFail, boolean exclusive,
- Optional<String> flavor, Optional<String> dockerImage) {
+ Optional<FlavorSpec> flavor, Optional<String> dockerImage) {
this.dedicated = dedicated;
this.count = count;
this.groups = groups;
@@ -66,18 +67,16 @@ public class NodesSpecification {
private NodesSpecification(boolean dedicated, boolean canFail, Version version, ModelElement nodesElement) {
this(dedicated,
nodesElement.requiredIntegerAttribute("count"),
- nodesElement.getIntegerAttribute("groups", 1),
+ nodesElement.integerAttribute("groups", 1),
version,
- nodesElement.getBooleanAttribute("required", false),
+ nodesElement.booleanAttribute("required", false),
canFail,
- nodesElement.getBooleanAttribute("exclusive", false),
- Optional.ofNullable(nodesElement.getStringAttribute("flavor")),
- Optional.ofNullable(nodesElement.getStringAttribute("docker-image")));
+ nodesElement.booleanAttribute("exclusive", false),
+ getFlavor(nodesElement),
+ Optional.ofNullable(nodesElement.stringAttribute("docker-image")));
}
- /**
- * Returns a requirement for dedicated nodes taken from the given <code>nodes</code> element
- */
+ /** Returns a requirement for dedicated nodes taken from the given <code>nodes</code> element */
public static NodesSpecification from(ModelElement nodesElement, ConfigModelContext context) {
return new NodesSpecification(true,
! context.getDeployState().getProperties().isBootstrap(),
@@ -92,7 +91,7 @@ public class NodesSpecification {
*/
public static Optional<NodesSpecification> fromParent(ModelElement parentElement, ConfigModelContext context) {
if (parentElement == null) return Optional.empty();
- ModelElement nodesElement = parentElement.getChild("nodes");
+ ModelElement nodesElement = parentElement.child("nodes");
if (nodesElement == null) return Optional.empty();
return Optional.of(from(nodesElement, context));
}
@@ -105,9 +104,9 @@ public class NodesSpecification {
public static Optional<NodesSpecification> optionalDedicatedFromParent(ModelElement parentElement,
ConfigModelContext context) {
if (parentElement == null) return Optional.empty();
- ModelElement nodesElement = parentElement.getChild("nodes");
+ ModelElement nodesElement = parentElement.child("nodes");
if (nodesElement == null) return Optional.empty();
- return Optional.of(new NodesSpecification(nodesElement.getBooleanAttribute("dedicated", false),
+ return Optional.of(new NodesSpecification(nodesElement.booleanAttribute("dedicated", false),
! context.getDeployState().getProperties().isBootstrap(),
context.getDeployState().getWantedNodeVespaVersion(),
nodesElement));
@@ -171,7 +170,22 @@ public class NodesSpecification {
DeployLogger logger,
Set<RotationName> rotations) {
ClusterSpec cluster = ClusterSpec.request(clusterType, clusterId, version, exclusive, rotations);
- return hostSystem.allocateHosts(cluster, Capacity.fromNodeCount(count, flavor, required, canFail), groups, logger);
+ return hostSystem.allocateHosts(cluster, Capacity.fromCount(count, flavor, required, canFail), groups, logger);
+ }
+
+ private static Optional<FlavorSpec> getFlavor(ModelElement nodesElement) {
+ ModelElement flavor = nodesElement.child("flavor");
+ if (flavor != null) {
+ return Optional.of(new FlavorSpec(flavor.requiredDoubleAttribute("cpus"),
+ flavor.requiredDoubleAttribute("memory"),
+ flavor.requiredDoubleAttribute("disk")));
+ }
+ else if (nodesElement.stringAttribute("flavor") != null) { // legacy fallback
+ return Optional.of(FlavorSpec.fromLegacyFlavorName(nodesElement.stringAttribute("flavor")));
+ }
+ else { // Get the default
+ return Optional.empty();
+ }
}
@Override
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/BucketSplitting.java b/config-model/src/main/java/com/yahoo/vespa/model/content/BucketSplitting.java
index 9f7494f470d..cb588f20f0e 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/content/BucketSplitting.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/content/BucketSplitting.java
@@ -3,7 +3,6 @@ package com.yahoo.vespa.model.content;
import com.yahoo.vespa.config.content.core.StorDistributormanagerConfig;
import com.yahoo.vespa.model.builder.xml.dom.ModelElement;
-import com.yahoo.vespa.model.content.cluster.ContentCluster;
/**
* Represents configuration for bucket splitting.
@@ -15,16 +14,16 @@ public class BucketSplitting implements StorDistributormanagerConfig.Producer {
public static class Builder {
public BucketSplitting build(ModelElement clusterElem) {
- ModelElement tuning = clusterElem.getChild("tuning");
+ ModelElement tuning = clusterElem.child("tuning");
if (tuning == null) {
return new BucketSplitting(null, null, null);
}
- ModelElement bucketSplitting = tuning.getChild("bucket-splitting");
+ ModelElement bucketSplitting = tuning.child("bucket-splitting");
if (bucketSplitting != null) {
- Integer maxDocuments = bucketSplitting.getIntegerAttribute("max-documents");
- Integer splitSize = bucketSplitting.getIntegerAttribute("max-size");
- Integer minSplitCount = bucketSplitting.getIntegerAttribute("minimum-bits");
+ Integer maxDocuments = bucketSplitting.integerAttribute("max-documents");
+ Integer splitSize = bucketSplitting.integerAttribute("max-size");
+ Integer minSplitCount = bucketSplitting.integerAttribute("minimum-bits");
return new BucketSplitting(maxDocuments, splitSize, minSplitCount);
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/ClusterControllerConfig.java b/config-model/src/main/java/com/yahoo/vespa/model/content/ClusterControllerConfig.java
index 176ba31857b..1b0af3e9046 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/content/ClusterControllerConfig.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/content/ClusterControllerConfig.java
@@ -31,11 +31,11 @@ public class ClusterControllerConfig extends AbstractConfigProducer implements F
protected ClusterControllerConfig doBuild(DeployState deployState, AbstractConfigProducer ancestor, Element producerSpec) {
ModelElement tuning = null;
- ModelElement clusterTuning = clusterElement.getChild("tuning");
+ ModelElement clusterTuning = clusterElement.child("tuning");
Integer bucketSplittingMinimumBits = null;
Double minNodeRatioPerGroup = null;
if (clusterTuning != null) {
- tuning = clusterTuning.getChild("cluster-controller");
+ tuning = clusterTuning.child("cluster-controller");
minNodeRatioPerGroup = clusterTuning.childAsDouble("min-node-ratio-per-group");
bucketSplittingMinimumBits = clusterTuning.childAsInteger("bucket-splitting.minimum-bits");
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/ContentSearchCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/content/ContentSearchCluster.java
index 219c8a01afe..db7b4a88721 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/content/ContentSearchCluster.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/content/ContentSearchCluster.java
@@ -86,11 +86,11 @@ public class ContentSearchCluster extends AbstractConfigProducer implements Prot
ContentSearchCluster search = new ContentSearchCluster(ancestor, clusterName, documentDefinitions, globallyDistributedDocuments,
getFlushOnShutdown(flushOnShutdownElem, deployState));
- ModelElement tuning = clusterElem.getChildByPath("engine.proton.tuning");
+ ModelElement tuning = clusterElem.childByPath("engine.proton.tuning");
if (tuning != null) {
search.setTuning(new DomSearchTuningBuilder().build(deployState, search, tuning.getXml()));
}
- ModelElement protonElem = clusterElem.getChildByPath("engine.proton");
+ ModelElement protonElem = clusterElem.childByPath("engine.proton");
if (protonElem != null) {
search.setResourceLimits(DomResourceLimitsBuilder.build(protonElem));
}
@@ -112,14 +112,14 @@ public class ContentSearchCluster extends AbstractConfigProducer implements Prot
}
private void buildAllStreamingSearchClusters(DeployState deployState, ModelElement clusterElem, String clusterName, ContentSearchCluster search) {
- ModelElement docElem = clusterElem.getChild("documents");
+ ModelElement docElem = clusterElem.child("documents");
if (docElem == null) {
return;
}
for (ModelElement docType : docElem.subElements("document")) {
- String mode = docType.getStringAttribute("mode");
+ String mode = docType.stringAttribute("mode");
if ("streaming".equals(mode)) {
buildStreamingSearchCluster(deployState, clusterElem, clusterName, search, docType);
}
@@ -128,7 +128,7 @@ public class ContentSearchCluster extends AbstractConfigProducer implements Prot
private void buildStreamingSearchCluster(DeployState deployState, ModelElement clusterElem, String clusterName,
ContentSearchCluster search, ModelElement docType) {
- String docTypeName = docType.getStringAttribute("type");
+ String docTypeName = docType.stringAttribute("type");
StreamingSearchCluster cluster = new StreamingSearchCluster(search, clusterName + "." + docTypeName, 0, docTypeName, clusterName);
search.addSearchCluster(deployState, cluster, getQueryTimeout(clusterElem), Arrays.asList(docType));
}
@@ -151,13 +151,13 @@ public class ContentSearchCluster extends AbstractConfigProducer implements Prot
private List<ModelElement> getIndexedSearchDefinitions(ModelElement clusterElem) {
List<ModelElement> indexedDefs = new ArrayList<>();
- ModelElement docElem = clusterElem.getChild("documents");
+ ModelElement docElem = clusterElem.child("documents");
if (docElem == null) {
return indexedDefs;
}
for (ModelElement docType : docElem.subElements("document")) {
- String mode = docType.getStringAttribute("mode");
+ String mode = docType.stringAttribute("mode");
if ("index".equals(mode)) {
indexedDefs.add(docType);
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/Distributor.java b/config-model/src/main/java/com/yahoo/vespa/model/content/Distributor.java
index ddc816d2c17..c55548cfd2b 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/content/Distributor.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/content/Distributor.java
@@ -27,8 +27,8 @@ public class Distributor extends ContentNode {
@Override
protected Distributor doBuild(DeployState deployState, AbstractConfigProducer ancestor, Element producerSpec) {
- return new Distributor((DistributorCluster)ancestor, new ModelElement(producerSpec).getIntegerAttribute("distribution-key"),
- clusterXml.getIntegerAttribute("distributor-base-port"), persistenceProvider);
+ return new Distributor((DistributorCluster)ancestor, new ModelElement(producerSpec).integerAttribute("distribution-key"),
+ clusterXml.integerAttribute("distributor-base-port"), persistenceProvider);
}
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/DistributorCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/content/DistributorCluster.java
index ad067d6faed..cd790a67742 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/content/DistributorCluster.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/content/DistributorCluster.java
@@ -52,7 +52,7 @@ public class DistributorCluster extends AbstractConfigProducer<Distributor> impl
DocumentSelector s = new DocumentSelector(selStr);
boolean enableGC = false;
if (documentNode != null) {
- enableGC = documentNode.getBooleanAttribute("garbage-collection", false);
+ enableGC = documentNode.booleanAttribute("garbage-collection", false);
}
if (!enableGC) {
return null;
@@ -64,7 +64,7 @@ public class DistributorCluster extends AbstractConfigProducer<Distributor> impl
private int getGCInterval(ModelElement documentNode) {
int gcInterval = 3600;
if (documentNode != null) {
- gcInterval = documentNode.getIntegerAttribute("garbage-collection-interval", gcInterval);
+ gcInterval = documentNode.integerAttribute("garbage-collection-interval", gcInterval);
}
return gcInterval;
}
@@ -90,13 +90,13 @@ public class DistributorCluster extends AbstractConfigProducer<Distributor> impl
private boolean clusterContainsIndexedDocumentType(ModelElement documentsNode) {
return documentsNode != null
&& documentsNode.subElements("document").stream()
- .anyMatch(node -> documentModeImpliesIndexing(node.getStringAttribute("mode")));
+ .anyMatch(node -> documentModeImpliesIndexing(node.stringAttribute("mode")));
}
@Override
protected DistributorCluster doBuild(DeployState deployState, AbstractConfigProducer ancestor, Element producerSpec) {
final ModelElement clusterElement = new ModelElement(producerSpec);
- final ModelElement documentsNode = clusterElement.getChild("documents");
+ final ModelElement documentsNode = clusterElement.child("documents");
final GcOptions gc = parseGcOptions(documentsNode);
final boolean hasIndexedDocumentType = clusterContainsIndexedDocumentType(documentsNode);
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/StorageGroup.java b/config-model/src/main/java/com/yahoo/vespa/model/content/StorageGroup.java
index 17ff15d3a77..84132427427 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/content/StorageGroup.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/content/StorageGroup.java
@@ -204,12 +204,12 @@ public class StorageGroup {
}
public StorageGroup buildRootGroup(DeployState deployState) {
- Optional<ModelElement> group = Optional.ofNullable(clusterElement.getChild("group"));
+ Optional<ModelElement> group = Optional.ofNullable(clusterElement.child("group"));
Optional<ModelElement> nodes = getNodes(clusterElement);
if (group.isPresent() && nodes.isPresent())
throw new IllegalStateException("Both group and nodes exists, only one of these tags is legal");
- if (group.isPresent() && (group.get().getStringAttribute("name") != null || group.get().getIntegerAttribute("distribution-key") != null))
+ if (group.isPresent() && (group.get().stringAttribute("name") != null || group.get().integerAttribute("distribution-key") != null))
deployState.getDeployLogger().log(LogLevel.INFO, "'distribution-key' attribute on a content cluster's root group is ignored");
GroupBuilder groupBuilder = collectGroup(group, nodes, null, null);
@@ -409,7 +409,7 @@ public class StorageGroup {
throw new IllegalArgumentException("A group can contain either explicit subgroups or a nodes specification, but not both.");
Optional<NodesSpecification> nodeRequirement;
- if (nodesElement.isPresent() && nodesElement.get().getStringAttribute("count") != null ) // request these nodes
+ if (nodesElement.isPresent() && nodesElement.get().stringAttribute("count") != null ) // request these nodes
nodeRequirement = Optional.of(NodesSpecification.from(nodesElement.get(), context));
else if (! nodesElement.isPresent() && subGroups.isEmpty() && context.getDeployState().isHosted()) // request one node
nodeRequirement = Optional.of(NodesSpecification.nonDedicated(1, context));
@@ -434,12 +434,12 @@ public class StorageGroup {
private boolean booleanAttributeOr(Optional<ModelElement> element, String attributeName, boolean defaultValue) {
if ( ! element.isPresent()) return defaultValue;
- return element.get().getBooleanAttribute(attributeName, defaultValue);
+ return element.get().booleanAttribute(attributeName, defaultValue);
}
private Optional<ModelElement> getNodes(ModelElement groupOrNodesElement) {
if (groupOrNodesElement.getXml().getTagName().equals("nodes")) return Optional.of(groupOrNodesElement);
- return Optional.ofNullable(groupOrNodesElement.getChild("nodes"));
+ return Optional.ofNullable(groupOrNodesElement.child("nodes"));
}
private List<XmlNodeBuilder> collectExplicitNodes(Optional<ModelElement> groupOrNodesElement) {
@@ -461,8 +461,8 @@ public class StorageGroup {
indexPrefix = parentGroup.index + ".";
}
for (ModelElement g : subGroupElements) {
- subGroups.add(collectGroup(Optional.of(g), Optional.ofNullable(g.getChild("nodes")), g.getStringAttribute("name"),
- indexPrefix + g.getIntegerAttribute("distribution-key")));
+ subGroups.add(collectGroup(Optional.of(g), Optional.ofNullable(g.child("nodes")), g.stringAttribute("name"),
+ indexPrefix + g.integerAttribute("distribution-key")));
}
return subGroups;
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/StorageNode.java b/config-model/src/main/java/com/yahoo/vespa/model/content/StorageNode.java
index 9ea92048f3b..c8220071373 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/content/StorageNode.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/content/StorageNode.java
@@ -32,7 +32,7 @@ public class StorageNode extends ContentNode implements StorServerConfig.Produce
@Override
protected StorageNode doBuild(DeployState deployState, AbstractConfigProducer ancestor, Element producerSpec) {
ModelElement e = new ModelElement(producerSpec);
- return new StorageNode((StorageCluster)ancestor, e.getDoubleAttribute("capacity"), e.getIntegerAttribute("distribution-key"), false);
+ return new StorageNode((StorageCluster)ancestor, e.doubleAttribute("capacity"), e.integerAttribute("distribution-key"), false);
}
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/ContentCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/ContentCluster.java
index 79675febe2f..833afb67f58 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/ContentCluster.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/ContentCluster.java
@@ -119,7 +119,7 @@ public class ContentCluster extends AbstractConfigProducer implements
ModelElement contentElement = new ModelElement(w3cContentElement);
DeployState deployState = context.getDeployState();
- ModelElement documentsElement = contentElement.getChild("documents");
+ ModelElement documentsElement = contentElement.child("documents");
Map<String, NewDocumentType> documentDefinitions =
new SearchDefinitionBuilder().build(deployState.getDocumentModel().getDocumentManager(), documentsElement);
@@ -150,7 +150,7 @@ public class ContentCluster extends AbstractConfigProducer implements
}
if (documentsElement != null) {
- ModelElement e = documentsElement.getChild("document-processing");
+ ModelElement e = documentsElement.child("document-processing");
if (e != null) {
setupDocumentProcessing(c, e);
}
@@ -158,11 +158,11 @@ public class ContentCluster extends AbstractConfigProducer implements
throw new IllegalArgumentException("The specified content engine requires the <documents> element to be specified.");
}
- ModelElement tuning = contentElement.getChild("tuning");
+ ModelElement tuning = contentElement.child("tuning");
if (tuning != null) {
setupTuning(c, tuning);
}
- ModelElement experimental = contentElement.getChild("experimental");
+ ModelElement experimental = contentElement.child("experimental");
if (experimental != null) {
setupExperimental(c, experimental);
}
@@ -217,7 +217,7 @@ public class ContentCluster extends AbstractConfigProducer implements
}
private void setupDocumentProcessing(ContentCluster c, ModelElement e) {
- String docprocCluster = e.getStringAttribute("cluster");
+ String docprocCluster = e.stringAttribute("cluster");
if (docprocCluster != null) {
docprocCluster = docprocCluster.trim();
}
@@ -227,7 +227,7 @@ public class ContentCluster extends AbstractConfigProducer implements
}
}
- String docprocChain = e.getStringAttribute("chain");
+ String docprocChain = e.stringAttribute("chain");
if (docprocChain != null) {
docprocChain = docprocChain.trim();
}
@@ -239,9 +239,9 @@ public class ContentCluster extends AbstractConfigProducer implements
}
private void setupTuning(ContentCluster c, ModelElement tuning) {
- ModelElement distribution = tuning.getChild("distribution");
+ ModelElement distribution = tuning.child("distribution");
if (distribution != null) {
- String attr = distribution.getStringAttribute("type");
+ String attr = distribution.stringAttribute("type");
if (attr != null) {
if (attr.toLowerCase().equals("strict")) {
c.distributionMode = DistributionMode.STRICT;
@@ -254,9 +254,9 @@ public class ContentCluster extends AbstractConfigProducer implements
}
}
}
- ModelElement merges = tuning.getChild("merges");
+ ModelElement merges = tuning.child("merges");
if (merges != null) {
- Integer attr = merges.getIntegerAttribute("max-nodes-per-merge");
+ Integer attr = merges.integerAttribute("max-nodes-per-merge");
if (attr != null) {
c.maxNodesPerMerge = attr;
}
@@ -307,7 +307,7 @@ public class ContentCluster extends AbstractConfigProducer implements
else if (admin.multitenant()) {
String clusterName = contentClusterName + "-controllers";
NodesSpecification nodesSpecification =
- NodesSpecification.optionalDedicatedFromParent(contentElement.getChild("controllers"), context)
+ NodesSpecification.optionalDedicatedFromParent(contentElement.child("controllers"), context)
.orElse(NodesSpecification.nonDedicated(3, context));
Collection<HostResource> hosts = nodesSpecification.isDedicated() ?
getControllerHosts(nodesSpecification, admin, clusterName, context) :
@@ -520,7 +520,7 @@ public class ContentCluster extends AbstractConfigProducer implements
}
public static String getClusterName(ModelElement clusterElem) {
- String clusterName = clusterElem.getStringAttribute("id");
+ String clusterName = clusterElem.stringAttribute("id");
if (clusterName == null) {
clusterName = "content";
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/DocumentSelectionBuilder.java b/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/DocumentSelectionBuilder.java
index c6008ef4084..07b87a41b2f 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/DocumentSelectionBuilder.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/DocumentSelectionBuilder.java
@@ -54,9 +54,9 @@ public class DocumentSelectionBuilder {
sb.append(" OR ");
}
sb.append('(');
- String type = e.getStringAttribute("type");
+ String type = e.stringAttribute("type");
sb.append(type);
- String selection = e.getStringAttribute("selection");
+ String selection = e.stringAttribute("selection");
if (selection != null) {
validateSelectionExpression(selection, type);
sb.append(" AND (");
@@ -66,7 +66,7 @@ public class DocumentSelectionBuilder {
sb.append(')');
}
- String globalSelection = elem.getStringAttribute("selection");
+ String globalSelection = elem.stringAttribute("selection");
if (globalSelection != null) {
validateSelectionExpression(globalSelection, null);
StringBuilder global = new StringBuilder();
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/DomContentSearchBuilder.java b/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/DomContentSearchBuilder.java
index 9ef64e0b288..40bfa3241e2 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/DomContentSearchBuilder.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/DomContentSearchBuilder.java
@@ -11,7 +11,7 @@ public class DomContentSearchBuilder {
public static ContentSearch build(ModelElement contentXml) {
ContentSearch.Builder builder = new ContentSearch.Builder();
- ModelElement searchElement = contentXml.getChild("search");
+ ModelElement searchElement = contentXml.child("search");
if (searchElement == null) {
return builder.build();
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/DomDispatchBuilder.java b/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/DomDispatchBuilder.java
index 3d06d120b09..ffe07a00775 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/DomDispatchBuilder.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/DomDispatchBuilder.java
@@ -17,7 +17,7 @@ public class DomDispatchBuilder {
public static DispatchSpec build(ModelElement contentXml) {
DispatchSpec.Builder builder = new DispatchSpec.Builder();
- ModelElement dispatchElement = contentXml.getChild("dispatch");
+ ModelElement dispatchElement = contentXml.child("dispatch");
if (dispatchElement == null) {
return builder.build();
}
@@ -48,6 +48,6 @@ public class DomDispatchBuilder {
}
private static DispatchSpec.Node buildNode(ModelElement nodeElement) {
- return new DispatchSpec.Node(nodeElement.getIntegerAttribute("distribution-key"));
+ return new DispatchSpec.Node(nodeElement.integerAttribute("distribution-key"));
}
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/DomResourceLimitsBuilder.java b/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/DomResourceLimitsBuilder.java
index 87412ad3596..61bf42af379 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/DomResourceLimitsBuilder.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/DomResourceLimitsBuilder.java
@@ -13,14 +13,14 @@ public class DomResourceLimitsBuilder {
public static ResourceLimits build(ModelElement contentXml) {
ResourceLimits.Builder builder = new ResourceLimits.Builder();
- ModelElement resourceLimits = contentXml.getChild("resource-limits");
+ ModelElement resourceLimits = contentXml.child("resource-limits");
if (resourceLimits == null) {
return builder.build();
}
- if (resourceLimits.getChild("disk") != null) {
+ if (resourceLimits.child("disk") != null) {
builder.setDiskLimit(resourceLimits.childAsDouble("disk"));
}
- if (resourceLimits.getChild("memory") != null) {
+ if (resourceLimits.child("memory") != null) {
builder.setMemoryLimit(resourceLimits.childAsDouble("memory"));
}
return builder.build();
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/DomSearchCoverageBuilder.java b/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/DomSearchCoverageBuilder.java
index cfc110d7a13..64953deb36e 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/DomSearchCoverageBuilder.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/DomSearchCoverageBuilder.java
@@ -11,11 +11,11 @@ public class DomSearchCoverageBuilder {
public static SearchCoverage build(ModelElement contentXml) {
SearchCoverage.Builder builder = new SearchCoverage.Builder();
- ModelElement searchElement = contentXml.getChild("search");
+ ModelElement searchElement = contentXml.child("search");
if (searchElement == null) {
return builder.build();
}
- ModelElement coverageElement = searchElement.getChild("coverage");
+ ModelElement coverageElement = searchElement.child("coverage");
if (coverageElement == null) {
return builder.build();
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/DomTuningDispatchBuilder.java b/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/DomTuningDispatchBuilder.java
index f470e75abf0..5f26b0628c2 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/DomTuningDispatchBuilder.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/DomTuningDispatchBuilder.java
@@ -11,11 +11,11 @@ public class DomTuningDispatchBuilder {
public static TuningDispatch build(ModelElement contentXml) {
TuningDispatch.Builder builder = new TuningDispatch.Builder();
- ModelElement tuningElement = contentXml.getChild("tuning");
+ ModelElement tuningElement = contentXml.child("tuning");
if (tuningElement == null) {
return builder.build();
}
- ModelElement dispatchElement = tuningElement.getChild("dispatch");
+ ModelElement dispatchElement = tuningElement.child("dispatch");
if (dispatchElement == null) {
return builder.build();
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/EngineFactoryBuilder.java b/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/EngineFactoryBuilder.java
index 83e9553ebd5..e31e9703f11 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/EngineFactoryBuilder.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/EngineFactoryBuilder.java
@@ -9,15 +9,15 @@ import com.yahoo.vespa.model.content.engines.*;
*/
public class EngineFactoryBuilder {
public PersistenceEngine.PersistenceFactory build(ModelElement clusterElem, ContentCluster c) {
- ModelElement persistence = clusterElem.getChild("engine");
+ ModelElement persistence = clusterElem.child("engine");
if (persistence != null) {
- if (c.getSearch().hasIndexedCluster() && persistence.getChild("proton") == null) {
+ if (c.getSearch().hasIndexedCluster() && persistence.child("proton") == null) {
throw new IllegalArgumentException("Persistence engine does not allow for indexed search. Please use <proton> as your engine.");
}
- if (persistence.getChild("proton") != null) {
+ if (persistence.child("proton") != null) {
return new ProtonEngine.Factory(c.getSearch());
- } else if (persistence.getChild("dummy") != null) {
+ } else if (persistence.child("dummy") != null) {
return new com.yahoo.vespa.model.content.engines.DummyPersistence.Factory();
}
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/GlobalDistributionBuilder.java b/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/GlobalDistributionBuilder.java
index bdc15074258..1adb5d6d2d5 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/GlobalDistributionBuilder.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/GlobalDistributionBuilder.java
@@ -36,11 +36,11 @@ public class GlobalDistributionBuilder {
}
private static boolean isGloballyDistributed(ModelElement e) {
- return e.getBooleanAttribute("global", false);
+ return e.booleanAttribute("global", false);
}
private static String getDocumentName(ModelElement e) {
- return e.getStringAttribute("type");
+ return e.stringAttribute("type");
}
private NewDocumentType getDocumentType(String name) {
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/RedundancyBuilder.java b/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/RedundancyBuilder.java
index e1675007bbc..fe73fcc904b 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/RedundancyBuilder.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/RedundancyBuilder.java
@@ -14,9 +14,9 @@ public class RedundancyBuilder {
Integer finalRedundancy = 3;
Integer readyCopies = 2;
- ModelElement redundancyElement = clusterXml.getChild("redundancy");
+ ModelElement redundancyElement = clusterXml.child("redundancy");
if (redundancyElement != null) {
- initialRedundancy = redundancyElement.getIntegerAttribute("reply-after");
+ initialRedundancy = redundancyElement.integerAttribute("reply-after");
finalRedundancy = (int)redundancyElement.asLong();
if (initialRedundancy == null) {
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/SearchDefinitionBuilder.java b/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/SearchDefinitionBuilder.java
index 53220268bf8..44cb9cb96dd 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/SearchDefinitionBuilder.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/SearchDefinitionBuilder.java
@@ -21,7 +21,7 @@ public class SearchDefinitionBuilder {
if (elem != null) {
for (ModelElement e : elem.subElements("document")) {
- String name = e.getStringAttribute("type"); // Schema-guaranteed presence
+ String name = e.stringAttribute("type"); // Schema-guaranteed presence
NewDocumentType documentType = repo.getDocumentType(name);
if (documentType != null) {
docTypes.put(documentType.getName(), documentType);
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/storagecluster/FileStorProducer.java b/config-model/src/main/java/com/yahoo/vespa/model/content/storagecluster/FileStorProducer.java
index 0cc62fb6680..785088e96fc 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/content/storagecluster/FileStorProducer.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/content/storagecluster/FileStorProducer.java
@@ -16,16 +16,16 @@ public class FileStorProducer implements StorFilestorConfig.Producer {
}
private Integer getThreads(ModelElement clusterElem) {
- ModelElement tuning = clusterElem.getChild("tuning");
+ ModelElement tuning = clusterElem.child("tuning");
if (tuning == null) {
return null;
}
- ModelElement threads = tuning.getChild("persistence-threads");
+ ModelElement threads = tuning.child("persistence-threads");
if (threads == null) {
return null;
}
- Integer count = threads.getIntegerAttribute("count");
+ Integer count = threads.integerAttribute("count");
if (count != null) {
return count;
}
@@ -33,7 +33,7 @@ public class FileStorProducer implements StorFilestorConfig.Producer {
// Backward compatible fallback
int numThreads = 0;
for (ModelElement thread : threads.subElements("thread")) {
- count = thread.getIntegerAttribute("count");
+ count = thread.integerAttribute("count");
numThreads += (count == null) ? 1 : count;
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/storagecluster/PersistenceProducer.java b/config-model/src/main/java/com/yahoo/vespa/model/content/storagecluster/PersistenceProducer.java
index dabfbd4f75d..749cf8f374e 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/content/storagecluster/PersistenceProducer.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/content/storagecluster/PersistenceProducer.java
@@ -12,7 +12,7 @@ public class PersistenceProducer implements PersistenceConfig.Producer {
public static class Builder {
public PersistenceProducer build(ModelElement element) {
- ModelElement persistence = element.getChild("engine");
+ ModelElement persistence = element.child("engine");
if (persistence == null) {
return new PersistenceProducer();
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/storagecluster/StorServerProducer.java b/config-model/src/main/java/com/yahoo/vespa/model/content/storagecluster/StorServerProducer.java
index baebbcd3f65..51fc610bf28 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/content/storagecluster/StorServerProducer.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/content/storagecluster/StorServerProducer.java
@@ -11,20 +11,20 @@ import com.yahoo.vespa.model.builder.xml.dom.ModelElement;
public class StorServerProducer implements StorServerConfig.Producer {
public static class Builder {
StorServerProducer build(ModelElement element) {
- ModelElement tuning = element.getChild("tuning");
+ ModelElement tuning = element.child("tuning");
if (tuning == null) {
return new StorServerProducer(ContentCluster.getClusterName(element), null, null);
}
- ModelElement merges = tuning.getChild("merges");
+ ModelElement merges = tuning.child("merges");
if (merges == null) {
return new StorServerProducer(ContentCluster.getClusterName(element), null, null);
}
return new StorServerProducer(ContentCluster.getClusterName(element),
- merges.getIntegerAttribute("max-per-node"),
- merges.getIntegerAttribute("max-queue-size"));
+ merges.integerAttribute("max-per-node"),
+ merges.integerAttribute("max-queue-size"));
}
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/storagecluster/StorVisitorProducer.java b/config-model/src/main/java/com/yahoo/vespa/model/content/storagecluster/StorVisitorProducer.java
index a831d3866d0..ec93881aae7 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/content/storagecluster/StorVisitorProducer.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/content/storagecluster/StorVisitorProducer.java
@@ -10,18 +10,18 @@ import com.yahoo.vespa.model.builder.xml.dom.ModelElement;
public class StorVisitorProducer implements StorVisitorConfig.Producer {
public static class Builder {
public StorVisitorProducer build(ModelElement element) {
- ModelElement tuning = element.getChild("tuning");
+ ModelElement tuning = element.child("tuning");
if (tuning == null) {
return new StorVisitorProducer();
}
- ModelElement visitors = tuning.getChild("visitors");
+ ModelElement visitors = tuning.child("visitors");
if (visitors == null) {
return new StorVisitorProducer();
}
- return new StorVisitorProducer(visitors.getIntegerAttribute("thread-count"),
- visitors.getIntegerAttribute("max-queue-size"),
+ return new StorVisitorProducer(visitors.integerAttribute("thread-count"),
+ visitors.integerAttribute("max-queue-size"),
visitors.childAsInteger("max-concurrent.fixed"),
visitors.childAsInteger("max-concurrent.variable"));
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/search/SearchDefinitionXMLHandler.java b/config-model/src/main/java/com/yahoo/vespa/model/search/SearchDefinitionXMLHandler.java
index 11758284a31..1054253e3f0 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/search/SearchDefinitionXMLHandler.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/search/SearchDefinitionXMLHandler.java
@@ -2,7 +2,6 @@
package com.yahoo.vespa.model.search;
import com.yahoo.vespa.model.builder.xml.dom.ModelElement;
-import org.w3c.dom.Element;
import java.io.Serializable;
import java.util.List;
@@ -17,9 +16,9 @@ public class SearchDefinitionXMLHandler implements Serializable {
private String sdName;
public SearchDefinitionXMLHandler(ModelElement elem) {
- sdName = elem.getStringAttribute("name");
+ sdName = elem.stringAttribute("name");
if (sdName == null) {
- sdName = elem.getStringAttribute("type");
+ sdName = elem.stringAttribute("type");
}
}