aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java/com/yahoo/vespa/model/container/component/chain/ChainedComponent.java
blob: 2354298779d475ed5e8818333fac61d52911a0a2 (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
// Copyright Yahoo. 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.ComponentId;
import com.yahoo.component.chain.model.ChainedComponentModel;
import com.yahoo.config.model.producer.AnyConfigProducer;
import com.yahoo.config.model.producer.TreeConfigProducer;
import com.yahoo.vespa.model.container.component.Component;


/**
 * @author Tony Vaagenes
 * @author gjoranv
 *
 * Base class for all ChainedComponent config producers.
 */
public class ChainedComponent<T extends ChainedComponentModel> extends Component<AnyConfigProducer, T> {

    public ChainedComponent(T model) {
        super(model);
    }

    public void initialize() {}

    @Override
    public ComponentId getGlobalComponentId() {
        return model.getComponentId().nestInNamespace(namespace());
    }

    private ComponentId namespace() {
        var owner = getParent().getParent();
        return (owner instanceof Chain<?> chain) ? chain.getGlobalComponentId() : null;
    }
}