@Override public ConfigModelRepo configModelRepo() { return new ConfigModelRepo(); }
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); } }
public static List<Content> getContent(ConfigModelRepo pc) { List<Content> contents = new ArrayList<>(); for (ConfigModel model : pc.asMap().values()) if (model instanceof Content) contents.add((Content)model); return contents; }
ModelGraphBuilder graphBuilder = new ModelGraphBuilder(); final List<Element> children = getServiceElements(servicesRoot); children.add(getImplicitAdmin(deployState)); children.addAll(getPermanentServices(deployState)); buildModels(node, getApplicationType(servicesRoot), deployState, vespaModel, root, model2Element.get(node.builder)); for (ConfigModel model : configModels) model.initialize(ConfigModelRepo.this); // XXX deprecated
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; } }
public Clients getClients() { return configModelRepo.getClients(); }
private void verifyClusterControllersOnlyDefinedForContent(ConfigModelRepo configModelRepo) { Admin admin = getAdmin(); if (admin == null || admin.getClusterControllers() == null) return; if (configModelRepo.getContent() == null) { throw new IllegalArgumentException("Declaring <clustercontrollers> in <admin> in services.xml will not work when <content> is not defined"); } }
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); }
private ConfigModelRepo resolveConfigModelRepo() { try { return injector.getInstance(Key.get(ConfigModelRepo.class, CONFIG_MODEL_REPO_NAME)); } catch (Exception e) { return new ConfigModelRepo(); } }
@SuppressWarnings("unchecked") public <T extends ConfigModel> List<T> getModels(Class<T> modelClass) { List<T> modelsOfModelClass = new ArrayList<>(); for (ConfigModel model : asMap().values()) { if (modelClass.isInstance(model)) modelsOfModelClass.add((T)model); } return modelsOfModelClass; }
/** * Factory method to create a JDisc from an application package. * This method allows deploying OSGi bundles(contained in the components subdirectory). * All the OSGi bundles will share the same class loader. * * * * @param path the reference to the application package to use * @param networking enabled or disabled * @return a new JDisc instance */ public static JDisc fromPath(Path path, Networking networking) { return new JDisc(path, false, networking, new ConfigModelRepo()); }
private void createTlds(DeployLogger deployLogger, ConfigModelRepo pc) { for (ConfigModel p : pc.asMap().values()) { if (p instanceof Content) { ((Content)p).createTlds(deployLogger, pc); } } }
/** * Factory method to create a JDisc from an XML String. Note that any components that are referenced in * the XML must be present on the classpath. To deploy OSGi bundles in memory, * use {@link #fromPath(java.nio.file.Path, com.yahoo.application.Networking)}. * * @param xml the XML configuration to use * @return a new JDisc instance */ public static JDisc fromServicesXml(String xml, Networking networking) { Path applicationDir = StandaloneContainerRunner.createApplicationPackage(xml); return new JDisc(applicationDir, true, networking, new ConfigModelRepo()); }
public void createTlds(DeployLogger deployLogger, ConfigModelRepo modelRepo) { IndexedSearchCluster indexedCluster = cluster.getSearch().getIndexed(); if (indexedCluster == null) return; SimpleConfigProducer tldParent = new SimpleConfigProducer(indexedCluster, "tlds"); for (ConfigModel model : modelRepo.asMap().values()) { if ( ! (model instanceof ContainerModel)) continue; ContainerCluster containerCluster = ((ContainerModel) model).getCluster(); if (containerCluster.getSearch() == null) continue; // this is not a qrs cluster log.log(LogLevel.DEBUG, "Adding tlds for indexed cluster " + indexedCluster.getClusterName() + ", container cluster " + containerCluster.getName()); indexedCluster.addTldsWithSameIdsAsContainers(deployLogger, tldParent, containerCluster); } indexedCluster.setupDispatchGroups(deployLogger); }