aboutsummaryrefslogtreecommitdiffstats
path: root/config/src/main/java/com/yahoo/config/subscription/DirSource.java
blob: e8f84d80ff9f6bcd178885971541c00fa7811f9e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.config.subscription;

import java.io.File;

/**
 * Source specifying config from a local directory
 * @author Vegard Havdal
 */
public class DirSource implements ConfigSource {
    private final File dir;

    public DirSource(File dir) {
        if ( ! dir.isDirectory()) throw new IllegalArgumentException("Not a directory: " + dir);
        this.dir = dir;
    }

    public FileSource getFile(String name) {
        return new FileSource(new File(dir, name));
    }

}