aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java/com/yahoo/vespa/model/container/docproc/DocprocChain.java
blob: 63c432701667d0ccba887dcc505c95912ed00277 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.container.docproc;

import com.yahoo.collections.Pair;
import com.yahoo.component.chain.model.ChainSpecification;
import com.yahoo.vespa.model.container.component.chain.Chain;

import java.util.Map;

import static com.yahoo.container.core.ChainsConfig.Chains.Type;

/**
 * @author Einar M R Rosenvinge
 */
public class DocprocChain extends Chain<DocumentProcessor> {

    private final Map<Pair<String, String>, String> fieldNameSchemaMap;
    private static final Type.Enum TYPE = Type.Enum.DOCPROC;

    public DocprocChain(ChainSpecification specWithoutInnerComponents, Map<Pair<String,String>, String> fieldNameSchemaMap) {
        super(specWithoutInnerComponents);
        this.fieldNameSchemaMap = fieldNameSchemaMap;
    }

    /**
     * The field name schema map that applies to this whole chain.
     *
     * @return doctype, from → to
     */
    public Map<Pair<String,String>,String> fieldNameSchemaMap() {
        return fieldNameSchemaMap;
    }

    public String getServiceName() {
        return getParent().getParent().getParent().getConfigId() + "/" + getSessionName();
    }

    public String getSessionName() {
        return "chain." + getComponentId().stringValue();
    }

    public Type.Enum getType() {
        return TYPE;
    }

}