Search in sources :

Example 1 with SimpleConfigProducer

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;
}
Also used : SimpleConfigProducer(com.yahoo.vespa.model.SimpleConfigProducer) Element(org.w3c.dom.Element) ArrayList(java.util.ArrayList) Configserver(com.yahoo.vespa.model.admin.Configserver)

Example 2 with SimpleConfigProducer

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);
        }
    }
}
Also used : SimpleConfigProducer(com.yahoo.vespa.model.SimpleConfigProducer) Element(org.w3c.dom.Element) FeederConfig(com.yahoo.vespaclient.config.FeederConfig) SpoolerConfig(com.yahoo.vespa.config.content.spooler.SpoolerConfig) VespaSpoolerService(com.yahoo.vespa.model.clients.VespaSpoolerService) VespaSpooler(com.yahoo.vespa.model.clients.VespaSpooler)

Example 3 with SimpleConfigProducer

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;
}
Also used : HostResource(com.yahoo.vespa.model.HostResource) MockRoot(com.yahoo.config.model.test.MockRoot) SimpleConfigProducer(com.yahoo.vespa.model.SimpleConfigProducer) Host(com.yahoo.vespa.model.Host) Matchers.containsString(org.hamcrest.Matchers.containsString) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster)

Aggregations

SimpleConfigProducer (com.yahoo.vespa.model.SimpleConfigProducer)3 Element (org.w3c.dom.Element)2 MockRoot (com.yahoo.config.model.test.MockRoot)1 SpoolerConfig (com.yahoo.vespa.config.content.spooler.SpoolerConfig)1 Host (com.yahoo.vespa.model.Host)1 HostResource (com.yahoo.vespa.model.HostResource)1 Configserver (com.yahoo.vespa.model.admin.Configserver)1 VespaSpooler (com.yahoo.vespa.model.clients.VespaSpooler)1 VespaSpoolerService (com.yahoo.vespa.model.clients.VespaSpoolerService)1 ContentCluster (com.yahoo.vespa.model.content.cluster.ContentCluster)1 FeederConfig (com.yahoo.vespaclient.config.FeederConfig)1 ArrayList (java.util.ArrayList)1 Matchers.containsString (org.hamcrest.Matchers.containsString)1