aboutsummaryrefslogtreecommitdiffstats
path: root/config-application-package/src/main/java/com/yahoo/config/model/application/provider/AppSubDirs.java
blob: a4a71a1cc8bbaddf53d44c10fcb1898328ebdf80 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.config.model.application.provider;

import com.yahoo.collections.Tuple2;
import com.yahoo.config.application.api.ApplicationPackage;

import java.io.File;

/**
 * Definitions of sub-directories of an application package.
 *
 * @author hmusum
 */
public class AppSubDirs {

    private final Tuple2<File, String> root;
    private final Tuple2<File, String> routingtables;
    private final Tuple2<File, String> configDefs;

    public AppSubDirs(File root) {
        this.root = new Tuple2<>(root, root.getName());
        routingtables = createTuple(ApplicationPackage.ROUTINGTABLES_DIR);
        configDefs = createTuple(ApplicationPackage.CONFIG_DEFINITIONS_DIR);
    }

    private Tuple2<File, String> createTuple(String name) {
        return new Tuple2<>(file(name), name);
    }

    public File file(String subPath) {
        return new File(root.first, subPath);
    }

    public File root() {
        return root.first;
    }

    public File configDefs() {
        return configDefs.first;
    }
    public Tuple2<File, String> routingTables() {
        return routingtables;
    }

}