aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java/com/yahoo/vespa/model/container/component/FileStatusHandlerComponent.java
blob: 90fbaa6ee23bd57268838b0f5b310f9751eb0ce2 (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
// 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;

import com.yahoo.container.core.VipStatusConfig;
import com.yahoo.osgi.provider.model.ComponentModel;

/**
 * Sets up VipStatusHandler that answers OK when a certain file is present.
 *
 * @author Tony Vaagenes
 */
public class FileStatusHandlerComponent extends Handler implements VipStatusConfig.Producer {

    public static final String CLASS = "com.yahoo.container.handler.VipStatusHandler";

    private final String fileName;

    public FileStatusHandlerComponent(String id, String fileName, BindingPattern... bindings) {
        super(new ComponentModel(id, CLASS, null, null));

        this.fileName = fileName;
        addServerBindings(bindings);
    }

    @Override
    public void getConfig(VipStatusConfig.Builder builder) {
        builder.accessdisk(true).
                statusfile(fileName);
    }

}