summaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java/com/yahoo/vespa/model/container/component/chain/ProcessingHandler.java
blob: 3f68a0a2709d0fd999f124322bc868cc65d57808 (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
// 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.container.bundle.BundleInstantiationSpecification;
import com.yahoo.container.core.ChainsConfig;
import com.yahoo.osgi.provider.model.ComponentModel;
import com.yahoo.config.model.producer.AbstractConfigProducer;
import com.yahoo.vespa.model.container.component.Handler;


/**
 * Represents a handler for processing chains.
 *
 * @author gjoranv
 */
public class ProcessingHandler<CHAINS extends Chains<?>>
        extends Handler<AbstractConfigProducer<?>>
        implements ChainsConfig.Producer {

    protected final CHAINS chains;

    public ProcessingHandler(CHAINS chains, String handlerClass) {
        this(chains, BundleInstantiationSpecification.getInternalProcessingSpecificationFromStrings(handlerClass, null));
    }

    public ProcessingHandler(CHAINS chains, String handlerClass, String bundle) {
        this(chains, BundleInstantiationSpecification.getFromStrings(handlerClass, null, bundle));
    }

    private ProcessingHandler(CHAINS chains, BundleInstantiationSpecification spec) {
        super(new ComponentModel(spec, null));
        this.chains = chains;
    }

    @Override
    public void getConfig(ChainsConfig.Builder builder) {
        chains.getConfig(builder);
    }

}