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

io.deephaven.engine.util.jpy.JpyConfigLoader Maven / Gradle / Ivy

There is a newer version: 0.37.1
Show newest version
/**
 * Copyright (c) 2016-2022 Deephaven Data Labs and Patent Pending
 */
package io.deephaven.engine.util.jpy;

import io.deephaven.configuration.Configuration;
import io.deephaven.jpy.JpyConfig;
import io.deephaven.jpy.JpyConfigSource;
import java.util.Objects;
import java.util.Optional;
import org.jetbrains.annotations.NotNull;

/**
 * Encapsulates our loading of {@link JpyConfig} from a {@link Configuration}
 */
class JpyConfigLoader implements JpyConfigSource {

    private final Configuration conf;

    JpyConfigLoader(@NotNull Configuration conf) {
        this.conf = Objects.requireNonNull(conf);
    }

    @Override
    public Optional getFlags() {
        return Optional.ofNullable(conf.getStringWithDefault(JPY_FLAGS_PROP, null));
    }

    @Override
    public Optional getExtraPaths() {
        return Optional.ofNullable(conf.getStringWithDefault(JPY_EXTRA_PATHS_PROP, null));
    }

    @Override
    public Optional getPythonHome() {
        return Optional.ofNullable(conf.getStringWithDefault(JPY_PY_HOME_PROP, null));
    }

    @Override
    public Optional getProgramName() {
        return Optional.ofNullable(conf.getStringWithDefault(JPY_PROGRAM_NAME_PROP, null));
    }

    @Override
    public Optional getPythonLib() {
        return Optional.ofNullable(conf.getStringWithDefault(JPY_PY_LIB_PROP, null));
    }

    @Override
    public Optional getJpyLib() {
        return Optional.ofNullable(conf.getStringWithDefault(JPY_JPY_LIB_PROP, null));
    }

    @Override
    public Optional getJdlLib() {
        return Optional.ofNullable(conf.getStringWithDefault(JPY_JDL_LIB_PROP, null));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy