private void buildModels(ModelNode node, ApplicationType applicationType, DeployState deployState, VespaModel vespaModel, AbstractConfigProducer parent, List<Element> elements) { for (Element servicesElement : elements) { ConfigModel model = buildModel(node, applicationType, deployState, vespaModel, parent, servicesElement); if (model.isServing()) add(model); } }
/** * Constructs a new config model given a context. * * @param modelContext The model context. */ public ConfigModel(ConfigModelContext modelContext) { super(); this.id = modelContext.getProducerId(); }
private ConfigModel buildModel(ModelNode node, ApplicationType applicationType, DeployState deployState, VespaModel vespaModel, AbstractConfigProducer parent, Element servicesElement) { ConfigModelBuilder builder = node.builder; ConfigModelContext context = ConfigModelContext.create(applicationType, deployState, vespaModel, this, parent, getIdString(servicesElement)); return builder.build(node, servicesElement, context); }
@Override public ConfigModelRepo configModelRepo() { return new ConfigModelRepo(); }
public void setupRouting(DeployState deployState, VespaModel vespaModel, ConfigModelRepo configModels) { if (admin != null) { Routing routing = configModels.getRouting(); if (routing == null) { routing = new Routing(ConfigModelContext.create(deployState, vespaModel, configModels, this, "routing")); configModels.add(routing); } this.routing = routing; } }
/** Creates a Vespa Model from internal model types only */ public VespaModel(ApplicationPackage app) throws IOException, SAXException { this(app, new NullConfigModelRegistry()); }
/** Create a new context with a different config model producer id */ public ConfigModelContext withId(String producerId) { return ConfigModelContext.create(deployState, vespaModel, configModelRepoAdder, parent, producerId); }
/** Returns the one and only HostSystem of this VespaModel */ public HostSystem getHostSystem() { return root.getHostSystem(); }
/** * Returns the admin component of the vespamodel. * * @return Admin */ public Admin getAdmin() { return root.getAdmin(); }
/** Returns the routing config model. This might be null. */ public Routing getRouting() { return configModelRepo.getRouting(); }
/** * Initialize part 2.: * Prepare all config models for starting. Must be called after plugins are loaded and frozen. */ public void prepareConfigModels(DeployState deployState) { for (ConfigModel model : configModels) { model.prepare(this, deployState); } }
private void setupRouting(DeployState deployState) { root.setupRouting(deployState, this, configModelRepo); }
public FileDistributionConfigProducer getFileDistributionConfigProducer() { return root.getFileDistributionConfigProducer(); }
/** * Create an application context from a parent producer and an id. * * @param deployState the global deploy state for this model * @param parent the parent to be used for the config model * @param producerId the id to be used for the config model * @return a model context that can be passed to a model */ public static ConfigModelContext create(DeployState deployState, VespaModel vespaModel, ConfigModelRepoAdder configModelRepoAdder, AbstractConfigProducer parent, String producerId) { return new ConfigModelContext(ApplicationType.DEFAULT, deployState, vespaModel, configModelRepoAdder, parent, producerId); }
public Clients getClients() { return configModelRepo.getClients(); }
public ConfigModelRegistry() { this(new EmptyTerminalRegistry()); }
/** Creates a Vespa Model from internal model types only */ public VespaModel(DeployState deployState) throws IOException, SAXException { this(new NullConfigModelRegistry(), deployState); }
public ConfigModelContext with(VespaModel vespaModel) { return ConfigModelContext.create(deployState, vespaModel, configModelRepoAdder, parent, producerId); }
/** Create a new context with a different parent */ public ConfigModelContext withParent(AbstractConfigProducer newParent) { return ConfigModelContext.create(deployState, vespaModel, configModelRepoAdder, newParent, producerId); }