public final CHAIN doBuild(DeployState deployState, TreeConfigProducer<AnyConfigProducer> ancestor, Element producerSpec) {
        ComponentsBuilder<COMPONENT> componentsBuilder =
                new ComponentsBuilder<>(deployState, ancestor, allowedComponentTypes, List.of(producerSpec), outerComponentTypeByComponentName);
        ChainSpecification specWithoutInnerComponents =
                new ChainSpecificationBuilder(producerSpec).build(componentsBuilder.getOuterComponentReferences());

        CHAIN chain = buildChain(deployState, ancestor, producerSpec, specWithoutInnerComponents);
        addInnerComponents(chain, componentsBuilder.getComponentDefinitions());

        return chain;
    }
Base functionality for all chain builders (docprocChain, searchChain, provider, source)
@author Tony Vaagenes
config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/chains/DomChainBuilderBase.java