use of com.yahoo.config.model.producer.AbstractConfigProducer in project vespa by vespa-engine.
the class ContainerCluster method addDefaultRootHandler.
public void addDefaultRootHandler() {
if (hasHandlerWithBinding(ROOT_HANDLER_BINDING))
return;
Handler<AbstractConfigProducer<?>> handler = new Handler<>(new ComponentModel(BundleInstantiationSpecification.getFromStrings(BINDINGS_OVERVIEW_HANDLER_CLASS, null, null), // null bundle, as the handler is in container-disc
null));
handler.addServerBindings(ROOT_HANDLER_BINDING);
addComponent(handler);
}
use of com.yahoo.config.model.producer.AbstractConfigProducer in project vespa by vespa-engine.
the class DocumentFactoryBuilder method buildDocumentFactories.
public static void buildDocumentFactories(ContainerCluster cluster, Element spec) {
Map<String, String> types = new LinkedHashMap<>();
for (Element e : XML.getChildren(spec, "document")) {
String type = e.getAttribute("type");
String clazz = e.getAttribute("class");
// Empty pkg is forbidden in the documentgen Mojo.
if (clazz.indexOf('.') < 0)
throw new IllegalArgumentException("Malformed class for <document> binding, must be a full class with package: " + clazz);
String pkg = clazz.substring(0, clazz.lastIndexOf('.'));
String concDocFactory = pkg + "." + CONCRETE_DOC_FACTORY_CLASS;
String bundle = e.getAttribute("bundle");
Component<AbstractConfigProducer<?>, ComponentModel> component = new Component<>(new ComponentModel(BundleInstantiationSpecification.getFromStrings(concDocFactory, concDocFactory, bundle)));
if (!cluster.getComponentsMap().containsKey(component.getComponentId()))
cluster.addComponent(component);
types.put(type, concDocFactory);
}
cluster.concreteDocumentTypes().putAll(types);
}
use of com.yahoo.config.model.producer.AbstractConfigProducer in project vespa by vespa-engine.
the class StorageNode method getConfig.
@Override
public void getConfig(StorServerConfig.Builder builder) {
super.getConfig(builder);
builder.node_capacity(getCapacity());
for (AbstractConfigProducer producer : getChildren().values()) {
((PersistenceEngine) producer).getConfig(builder);
}
}
use of com.yahoo.config.model.producer.AbstractConfigProducer in project vespa by vespa-engine.
the class DomServiceClusterBuilder method doBuild.
@Override
protected ServiceCluster doBuild(AbstractConfigProducer ancestor, Element spec) {
ServiceCluster cluster = new ServiceCluster(ancestor, name, spec.getAttribute("command"));
int nodeIndex = 0;
for (Element nodeSpec : XML.getChildren(spec, "node")) {
com.yahoo.vespa.model.generic.service.Service service = new DomServiceBuilder(nodeIndex).build(cluster, nodeSpec);
// and store them in ServiceCluster. Then have some way of referencing them from each service.
for (Element subServiceSpec : XML.getChildren(spec, "module")) {
String subServiceName = subServiceSpec.getAttribute("name");
Map<String, AbstractConfigProducer<?>> map = service.getChildren();
// Add only non-conflicting modules. Does not merge unspecified configs that are specified in root though.
if (!map.containsKey(subServiceName))
new DomModuleBuilder(subServiceName).build(service, subServiceSpec);
}
nodeIndex++;
}
return cluster;
}
use of com.yahoo.config.model.producer.AbstractConfigProducer in project vespa by vespa-engine.
the class RankSetupValidator method writeConfigs.
private void writeConfigs(String dir, AbstractConfigProducer producer) throws IOException {
RankProfilesConfig.Builder rpcb = new RankProfilesConfig.Builder();
RankProfilesConfig.Producer.class.cast(producer).getConfig(rpcb);
RankProfilesConfig rpc = new RankProfilesConfig(rpcb);
writeConfig(dir, RankProfilesConfig.getDefName() + ".cfg", rpc);
IndexschemaConfig.Builder iscb = new IndexschemaConfig.Builder();
IndexschemaConfig.Producer.class.cast(producer).getConfig(iscb);
IndexschemaConfig isc = new IndexschemaConfig(iscb);
writeConfig(dir, IndexschemaConfig.getDefName() + ".cfg", isc);
AttributesConfig.Builder acb = new AttributesConfig.Builder();
AttributesConfig.Producer.class.cast(producer).getConfig(acb);
AttributesConfig ac = new AttributesConfig(acb);
writeConfig(dir, AttributesConfig.getDefName() + ".cfg", ac);
RankingConstantsConfig.Builder rccb = new RankingConstantsConfig.Builder();
RankingConstantsConfig.Producer.class.cast(producer).getConfig(rccb);
RankingConstantsConfig rcc = new RankingConstantsConfig(rccb);
writeConfig(dir, RankingConstantsConfig.getDefName() + ".cfg", rcc);
ImportedFieldsConfig.Builder ifcb = new ImportedFieldsConfig.Builder();
ImportedFieldsConfig.Producer.class.cast(producer).getConfig(ifcb);
ImportedFieldsConfig ifc = new ImportedFieldsConfig(ifcb);
writeConfig(dir, ImportedFieldsConfig.getDefName() + ".cfg", ifc);
}
Aggregations