use of com.yahoo.vespa.model.SimpleConfigProducer in project vespa by vespa-engine.
the class DomAdminV2Builder method getConfigServers.
// Extra stupid because configservers tag is voluntary
private List<Configserver> getConfigServers(AbstractConfigProducer parent, Element adminE) {
SimpleConfigProducer configServers = new SimpleConfigProducer(parent, "configservers");
List<Configserver> cfgs = new ArrayList<>();
Element configserversE = XML.getChild(adminE, "configservers");
if (configserversE == null) {
Element configserverE = XML.getChild(adminE, "configserver");
if (configserverE == null) {
configserverE = XML.getChild(adminE, "adminserver");
} else {
parent.deployLogger().log(LogLevel.INFO, "Specifying configserver without parent element configservers in services.xml is deprecated");
}
Configserver cfgs0 = new ConfigserverBuilder(0).build(configServers, configserverE);
cfgs0.setProp("index", 0);
cfgs.add(cfgs0);
return cfgs;
}
// configservers tag in use
int i = 0;
for (Element configserverE : XML.getChildren(configserversE, "configserver")) {
Configserver cfgsrv = new ConfigserverBuilder(i).build(configServers, configserverE);
cfgsrv.setProp("index", i);
cfgs.add(cfgsrv);
i++;
}
return cfgs;
}
use of com.yahoo.vespa.model.SimpleConfigProducer in project vespa by vespa-engine.
the class DomV20ClientsBuilder method createSpoolers.
/**
* Creates VespaSpooler objects using the given xml Element.
*/
private void createSpoolers(AbstractConfigProducer pcp, Element element, Clients clients) {
String jvmArgs = null;
if (element.hasAttribute(VespaDomBuilder.JVMARGS_ATTRIB_NAME))
jvmArgs = element.getAttribute(VespaDomBuilder.JVMARGS_ATTRIB_NAME);
SimpleConfigProducer spoolerCfg = new VespaDomBuilder.DomSimpleConfigProducerBuilder(element.getNodeName()).build(pcp, element);
Element spoolersFeederOptions = findFeederOptions(element);
createSpoolMasters(spoolerCfg, element);
for (Element e : XML.getChildren(element, "spooler")) {
String configId = e.getAttribute("id").trim();
FeederConfig.Builder feederConfig = getFeederConfig(spoolersFeederOptions, e);
SpoolerConfig.Builder spoolConfig = getSpoolConfig(e);
if (configId.length() == 0) {
int index = clients.getVespaSpoolers().size();
VespaSpoolerService spoolerService = new VespaSpoolerServiceBuilder(index, new VespaSpooler(feederConfig, spoolConfig)).build(spoolerCfg, e);
if ("".equals(spoolerService.getJvmArgs()) && jvmArgs != null)
spoolerService.setJvmArgs(jvmArgs);
spoolerService.setProp("index", String.valueOf(index));
clients.getVespaSpoolers().add(spoolerService);
} else {
new VespaSpoolerProducerBuilder(configId, new VespaSpooler(feederConfig, spoolConfig)).build(spoolerCfg, e);
}
}
}
use of com.yahoo.vespa.model.SimpleConfigProducer in project vespa by vespa-engine.
the class MultilevelDispatchTest method createCluster.
private ContentCluster createCluster(String dispatchXml) throws Exception {
String[] hosts = { "mh0", "mh1", "mh2", "mh3", "mh4", "mh5" };
MockRoot root = ContentClusterUtils.createMockRoot(hosts);
ContentCluster cluster = ContentClusterUtils.createCluster(createClusterXml(getGroupXml(), Optional.of(dispatchXml), 1, 1), root);
AbstractConfigProducer<Dispatch> dispatchParent = new SimpleConfigProducer<>(root, "tlds");
HostResource hostResource = new HostResource(new Host(root, "mockhost"));
IndexedSearchCluster index = cluster.getSearch().getIndexed();
index.addTld(dispatchParent, hostResource);
index.setupDispatchGroups();
root.freezeModelTopology();
cluster.validate();
return cluster;
}
Aggregations