use of uk.gov.ida.hub.config.data.ConfigEntityDataRepository in project verify-hub by alphagov.
the class ConfigValidCommand method run.
@Override
public void run(Bootstrap<ConfigConfiguration> bootstrap, Namespace namespace, ConfigConfiguration configuration) throws Exception {
Injector injector = Guice.createInjector(new AbstractModule() {
@Override
protected void configure() {
bind(new TypeLiteral<ConfigurationFactoryFactory<IdentityProviderConfigEntityData>>() {
}).toInstance(new DefaultConfigurationFactoryFactory<>());
bind(new TypeLiteral<ConfigurationFactoryFactory<MatchingServiceConfigEntityData>>() {
}).toInstance(new DefaultConfigurationFactoryFactory<>());
bind(new TypeLiteral<ConfigurationFactoryFactory<TransactionConfigEntityData>>() {
}).toInstance(new DefaultConfigurationFactoryFactory<>());
bind(new TypeLiteral<ConfigurationFactoryFactory<CountriesConfigEntityData>>() {
}).toInstance(new DefaultConfigurationFactoryFactory<>());
bind(new TypeLiteral<ConfigDataSource<TransactionConfigEntityData>>() {
}).to(FileBackedTransactionConfigDataSource.class).asEagerSingleton();
bind(new TypeLiteral<ConfigDataSource<MatchingServiceConfigEntityData>>() {
}).to(FileBackedMatchingServiceConfigDataSource.class).asEagerSingleton();
bind(new TypeLiteral<ConfigDataSource<IdentityProviderConfigEntityData>>() {
}).to(FileBackedIdentityProviderConfigDataSource.class).asEagerSingleton();
bind(new TypeLiteral<ConfigDataSource<CountriesConfigEntityData>>() {
}).to(FileBackedCountriesConfigDataSource.class).asEagerSingleton();
bind(new TypeLiteral<ConfigEntityDataRepository<TransactionConfigEntityData>>() {
}).asEagerSingleton();
bind(new TypeLiteral<ConfigEntityDataRepository<CountriesConfigEntityData>>() {
}).asEagerSingleton();
bind(new TypeLiteral<ConfigEntityDataRepository<MatchingServiceConfigEntityData>>() {
}).asEagerSingleton();
bind(new TypeLiteral<ConfigEntityDataRepository<IdentityProviderConfigEntityData>>() {
}).asEagerSingleton();
bind(ConfigConfiguration.class).toInstance(configuration);
bind(LevelsOfAssuranceConfigValidator.class).toInstance(new LevelsOfAssuranceConfigValidator());
bind(TrustStoreConfiguration.class).to(ConfigConfiguration.class);
bind(TrustStoreForCertificateProvider.class);
bind(CertificateChainConfigValidator.class).annotatedWith(CertificateConfigValidator.class).to(ThrowingCertificateChainConfigValidator.class);
}
});
ConfigDataBootstrap checkConfigValid = injector.getInstance(ConfigDataBootstrap.class);
try {
checkConfigValid.start();
} catch (ConfigValidationException e) {
LOG.info(e.getMessage());
throw e;
}
}
Aggregations