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

ec.gob.senescyt.sniese.commons.configurations.ConfiguracionSnieseBase Maven / Gradle / Ivy

There is a newer version: 2.0.5
Show newest version
package ec.gob.senescyt.sniese.commons.configurations;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonUnwrapped;
import com.google.common.annotations.VisibleForTesting;
import io.dropwizard.Configuration;
import io.dropwizard.jetty.HttpConnectorFactory;
import io.dropwizard.server.DefaultServerFactory;

import javax.validation.Valid;

public class ConfiguracionSnieseBase extends Configuration {

    @Valid
    @JsonUnwrapped
    private ConfiguracionSegura configuracionSegura;

    @Valid
    @JsonUnwrapped
    private ConfiguracionPersistente configuracionPersistente;

    public ConfiguracionSnieseBase() {
        // do nothing
    }

    @VisibleForTesting
    public ConfiguracionSnieseBase(ConfiguracionPersistente configuracionPersistente, ConfiguracionSegura configuracionSegura) {
        this.configuracionPersistente = configuracionPersistente;
        this.configuracionSegura = configuracionSegura;
    }

    @JsonIgnore
    public String getPuertoHttps() {
        final DefaultServerFactory serverFactory = (DefaultServerFactory) getServerFactory();
        final HttpConnectorFactory httpConnectorFactory = (HttpConnectorFactory) serverFactory.getApplicationConnectors().get(1);
        return String.valueOf(httpConnectorFactory.getPort());
    }

    public ConfiguracionSegura getConfiguracionSegura() {
        return configuracionSegura;
    }

    public ConfiguracionPersistente getConfiguracionPersistente() {
        return configuracionPersistente;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy