blob: 03750dbaa6e84c707f12373b418b52a99e2234a1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model;
import com.yahoo.config.model.ConfigModelRegistry;
import com.yahoo.config.model.admin.AdminModel;
import com.yahoo.config.model.builder.xml.ConfigModelBuilder;
import com.yahoo.config.model.builder.xml.ConfigModelId;
import com.yahoo.vespa.model.builder.xml.dom.DomClientsBuilder;
import com.yahoo.vespa.model.builder.xml.dom.DomRoutingBuilder;
import com.yahoo.vespa.model.container.xml.ContainerModelBuilder;
import com.yahoo.vespa.model.container.xml.ContainerModelBuilder.Networking;
import com.yahoo.vespa.model.content.Content;
import com.yahoo.vespa.model.generic.GenericServicesBuilder;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* Resolves the Vespa config model types
*
* @author bratseth
*/
public class VespaConfigModelRegistry extends ConfigModelRegistry {
private final List<ConfigModelBuilder> builderList = new ArrayList<>();
/** Creates a bundled model class registry which forwards unresolved requests to the argument instance */
public VespaConfigModelRegistry(ConfigModelRegistry chained) {
super(chained);
builderList.add(new AdminModel.BuilderV2());
builderList.add(new AdminModel.BuilderV4());
builderList.add(new DomRoutingBuilder());
builderList.add(new DomClientsBuilder());
builderList.add(new Content.Builder());
builderList.add(new ContainerModelBuilder(false, Networking.enable));
builderList.add(new GenericServicesBuilder());
}
@Override
public Collection<ConfigModelBuilder> resolve(ConfigModelId id) {
Set<ConfigModelBuilder> builders = new HashSet<>(chained().resolve(id));
for (ConfigModelBuilder builder : builderList) {
if (builder.handlesElements().contains(id))
builders.add(builder);
}
return builders;
}
}
|