All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.deepsense.neptune.clientlibrary.config.user.FileBasedUserConfiguration Maven / Gradle / Ivy

There is a newer version: 1.6.1
Show newest version
/**
 * Copyright (c) 2016, CodiLime Inc.
 */

package io.deepsense.neptune.clientlibrary.config.user;

import com.google.common.base.Preconditions;
import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.HierarchicalINIConfiguration;

import java.io.File;

public final class FileBasedUserConfiguration extends StaticUserConfiguration {

    public static FileBasedUserConfiguration create(File configFile) throws ConfigurationException {

        Preconditions.checkNotNull(configFile);

        Configuration iniConfiguration = new HierarchicalINIConfiguration(configFile);

        return new FileBasedUserConfiguration(
                iniConfiguration.getString("Neptune.username"),
                iniConfiguration.getString("Neptune.password"));
    }

    private FileBasedUserConfiguration(String username, String password) {
        super(username, password);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy