All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.yahoo.vespa.model.container.component.chain.ChainedComponentConfigGenerator Maven / Gradle / Ivy

There is a newer version: 8.441.21
Show newest version
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.container.component.chain;

import com.yahoo.component.chain.dependencies.Dependencies;
import com.yahoo.component.chain.model.ChainedComponentModel;
import com.yahoo.container.core.ChainsConfig;

import java.util.Set;

import static com.yahoo.container.core.ChainsConfig.Components;

/**
 * @author Tony Vaagenes
 * @author gjoranv
 *
 * Generates config for all the chained components.
 */
class ChainedComponentConfigGenerator {

    public static void generate(ChainsConfig.Builder builder, Set components) {
         for (ChainedComponent component : components) {
             builder.components(getComponent(component));
         }
     }

    private static Components.Builder getComponent(ChainedComponent component) {
        return new Components.Builder()
                .id(component.getGlobalComponentId().stringValue())
                .dependencies(getDependencies(component));
    }

    private static Components.Dependencies.Builder getDependencies(ChainedComponent component) {
        Dependencies dependencies = component.model.dependencies;
        return new Components.Dependencies.Builder()
                .provides(dependencies.provides())
                .before(dependencies.before())
                .after(dependencies.after());
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy