Search in sources :

Example 1 with VespaSpoolerService

use of com.yahoo.vespa.model.clients.VespaSpoolerService 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)

Aggregations

SpoolerConfig (com.yahoo.vespa.config.content.spooler.SpoolerConfig)1 SimpleConfigProducer (com.yahoo.vespa.model.SimpleConfigProducer)1 VespaSpooler (com.yahoo.vespa.model.clients.VespaSpooler)1 VespaSpoolerService (com.yahoo.vespa.model.clients.VespaSpoolerService)1 FeederConfig (com.yahoo.vespaclient.config.FeederConfig)1 Element (org.w3c.dom.Element)1