Search in sources :

Example 71 with Singleton

use of javax.inject.Singleton in project verify-hub by alphagov.

the class SamlSoapProxyModule method getPrometheusClientService.

@Provides
@Singleton
private PrometheusClient getPrometheusClientService(Environment environment, SamlSoapProxyConfiguration configConfiguration, MatchingServiceConfigProxy matchingServiceConfigProxy, MatchingServiceHealthChecker matchingServiceHealthChecker) {
    PrometheusClient prometheusClientService = new PrometheusClient(environment, configConfiguration, matchingServiceConfigProxy, matchingServiceHealthChecker);
    prometheusClientService.createMatchingServiceHealthCheckMetrics();
    return prometheusClientService;
}
Also used : PrometheusClient(uk.gov.ida.hub.samlsoapproxy.client.PrometheusClient) Singleton(javax.inject.Singleton) Provides(com.google.inject.Provides)

Example 72 with Singleton

use of javax.inject.Singleton in project verify-hub by alphagov.

the class SamlSoapProxyModule method jsonClient.

@Provides
@Singleton
public JsonClient jsonClient(JsonResponseProcessor jsonResponseProcessor, Environment environment, SamlSoapProxyConfiguration configuration) {
    Client client = new ClientProvider(environment, configuration.getJerseyClientConfiguration(), configuration.getEnableRetryTimeOutConnections(), "samlSoapProxyClient").get();
    ErrorHandlingClient errorHandlingClient = new ErrorHandlingClient(client);
    return new JsonClient(errorHandlingClient, jsonResponseProcessor);
}
Also used : JsonClient(uk.gov.ida.jerseyclient.JsonClient) DefaultClientProvider(uk.gov.ida.jerseyclient.DefaultClientProvider) ClientProvider(uk.gov.ida.restclient.ClientProvider) HealthCheckSoapRequestClient(uk.gov.ida.hub.samlsoapproxy.client.HealthCheckSoapRequestClient) MatchingServiceHealthCheckClient(uk.gov.ida.hub.samlsoapproxy.client.MatchingServiceHealthCheckClient) PrometheusClient(uk.gov.ida.hub.samlsoapproxy.client.PrometheusClient) Client(javax.ws.rs.client.Client) AttributeQueryRequestClient(uk.gov.ida.hub.samlsoapproxy.client.AttributeQueryRequestClient) JsonClient(uk.gov.ida.jerseyclient.JsonClient) SoapRequestClient(uk.gov.ida.hub.samlsoapproxy.client.SoapRequestClient) ErrorHandlingClient(uk.gov.ida.jerseyclient.ErrorHandlingClient) ErrorHandlingClient(uk.gov.ida.jerseyclient.ErrorHandlingClient) Singleton(javax.inject.Singleton) Provides(com.google.inject.Provides)

Example 73 with Singleton

use of javax.inject.Singleton in project verify-hub by alphagov.

the class SamlEngineModule method jsonClient.

@Provides
@Singleton
private JsonClient jsonClient(JsonResponseProcessor jsonResponseProcessor, Environment environment, SamlEngineConfiguration configuration) {
    Client client = new ClientProvider(environment, configuration.getJerseyClientConfiguration(), configuration.getEnableRetryTimeOutConnections(), "samlEngineClient").get();
    ErrorHandlingClient errorHandlingClient = new ErrorHandlingClient(client);
    return new JsonClient(errorHandlingClient, jsonResponseProcessor);
}
Also used : JsonClient(uk.gov.ida.jerseyclient.JsonClient) DefaultClientProvider(uk.gov.ida.jerseyclient.DefaultClientProvider) ClientProvider(uk.gov.ida.restclient.ClientProvider) JsonClient(uk.gov.ida.jerseyclient.JsonClient) Client(javax.ws.rs.client.Client) ErrorHandlingClient(uk.gov.ida.jerseyclient.ErrorHandlingClient) RedisClient(io.lettuce.core.RedisClient) ErrorHandlingClient(uk.gov.ida.jerseyclient.ErrorHandlingClient) Singleton(javax.inject.Singleton) Provides(com.google.inject.Provides)

Example 74 with Singleton

use of javax.inject.Singleton in project verify-hub by alphagov.

the class SamlEngineModule method registerMetadataRefreshTask.

@Provides
@Named("VERIFY_METADATA_REFRESH_TASK")
@Singleton
private Task registerMetadataRefreshTask(Environment environment, @Named(VERIFY_METADATA_RESOLVER) MetadataResolver metadataResolver) {
    Task task = new Task("metadata-refresh") {

        @Override
        public void execute(Map<String, List<String>> parameters, PrintWriter output) throws Exception {
            ((AbstractReloadingMetadataResolver) metadataResolver).refresh();
        }
    };
    environment.admin().addTask(task);
    return task;
}
Also used : Task(io.dropwizard.servlets.tasks.Task) AbstractReloadingMetadataResolver(org.opensaml.saml.metadata.resolver.impl.AbstractReloadingMetadataResolver) Map(java.util.Map) PrintWriter(java.io.PrintWriter) Named(javax.inject.Named) Singleton(javax.inject.Singleton) Provides(com.google.inject.Provides)

Example 75 with Singleton

use of javax.inject.Singleton in project verify-hub by alphagov.

the class ConfigModule method getPrometheusClientService.

@Provides
@Singleton
@SuppressWarnings("unused")
private PrometheusClientService getPrometheusClientService(Environment environment, ConfigConfiguration configConfiguration, CertificateService certificateService, OCSPCertificateChainValidityChecker ocspCertificateChainValidityChecker) {
    PrometheusClientService prometheusClientService = new PrometheusClientService(environment, configConfiguration, certificateService, ocspCertificateChainValidityChecker);
    prometheusClientService.createCertificateExpiryDateCheckMetrics();
    prometheusClientService.createCertificateOcspRevocationStatusCheckMetrics();
    return prometheusClientService;
}
Also used : PrometheusClientService(uk.gov.ida.hub.config.application.PrometheusClientService) Singleton(javax.inject.Singleton) Provides(com.google.inject.Provides)

Aggregations

Singleton (javax.inject.Singleton)168 Provides (dagger.Provides)98 Provides (com.google.inject.Provides)57 HttpLoggingInterceptor (okhttp3.logging.HttpLoggingInterceptor)21 Named (javax.inject.Named)17 OkHttpClient (okhttp3.OkHttpClient)17 Cache (okhttp3.Cache)10 List (java.util.List)9 ConfigBinder.configBinder (com.facebook.airlift.configuration.ConfigBinder.configBinder)8 Binder (com.google.inject.Binder)8 Module (com.google.inject.Module)8 CachingStripeMetadataSource (com.facebook.presto.orc.CachingStripeMetadataSource)7 DwrfAwareStripeMetadataSourceFactory (com.facebook.presto.orc.DwrfAwareStripeMetadataSourceFactory)7 OrcDataSourceId (com.facebook.presto.orc.OrcDataSourceId)7 StorageStripeMetadataSource (com.facebook.presto.orc.StorageStripeMetadataSource)7 StripeMetadataSource (com.facebook.presto.orc.StripeMetadataSource)7 StripeMetadataSourceFactory (com.facebook.presto.orc.StripeMetadataSourceFactory)7 CachingOrcFileTailSource (com.facebook.presto.orc.cache.CachingOrcFileTailSource)7 OrcCacheConfig (com.facebook.presto.orc.cache.OrcCacheConfig)7 OrcFileTailSource (com.facebook.presto.orc.cache.OrcFileTailSource)7