当前位置: 首页>>代码示例>>Java>>正文


Java DefaultConfigurationFactoryFactory类代码示例

本文整理汇总了Java中io.dropwizard.configuration.DefaultConfigurationFactoryFactory的典型用法代码示例。如果您正苦于以下问题:Java DefaultConfigurationFactoryFactory类的具体用法?Java DefaultConfigurationFactoryFactory怎么用?Java DefaultConfigurationFactoryFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DefaultConfigurationFactoryFactory类属于io.dropwizard.configuration包,在下文中一共展示了DefaultConfigurationFactoryFactory类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getConfiguration

import io.dropwizard.configuration.DefaultConfigurationFactoryFactory; //导入依赖的package包/类
@Override
public RestlerConfig getConfiguration()  {
    ObjectMapper objectMapper = Jackson.newObjectMapper();

    ValidatorFactory validatorFactory = Validation
            .byProvider(HibernateValidator.class)
            .configure()
            .addValidatedValueHandler(new OptionalValidatedValueUnwrapper())
            .buildValidatorFactory();


    final ConfigurationFactory<RestlerConfig> configurationFactory =
            new DefaultConfigurationFactoryFactory<RestlerConfig>().create(RestlerConfig.class, validatorFactory.getValidator(), objectMapper, "dw");

    try {
        return configurationFactory.build(new FileConfigurationSourceProvider(), TEST_CONFIG_FILE);
    } catch (Exception e) {
        throw new RuntimeException("Cannot get test configuration", e);
    }
}
 
开发者ID:researchgate,项目名称:restler,代码行数:21,代码来源:TestRestlerModule.java

示例2: configure

import io.dropwizard.configuration.DefaultConfigurationFactoryFactory; //导入依赖的package包/类
@Override
protected void configure() {
    bind(ConfigHealthCheck.class).asEagerSingleton();
    bind(ConfigDataBootstrap.class).asEagerSingleton();
    bind(TrustStoreConfiguration.class).to(ConfigConfiguration.class);
    bind(new TypeLiteral<ConfigurationFactoryFactory<IdentityProviderConfigEntityData>>() {}).toInstance(new DefaultConfigurationFactoryFactory<IdentityProviderConfigEntityData>());
    bind(new TypeLiteral<ConfigurationFactoryFactory<TransactionConfigEntityData>>(){}).toInstance(new DefaultConfigurationFactoryFactory<TransactionConfigEntityData>());
    bind(new TypeLiteral<ConfigurationFactoryFactory<MatchingServiceConfigEntityData>>(){}).toInstance(new DefaultConfigurationFactoryFactory<MatchingServiceConfigEntityData>());
    bind(new TypeLiteral<ConfigurationFactoryFactory<CountriesConfigEntityData>>(){}).toInstance(new DefaultConfigurationFactoryFactory<CountriesConfigEntityData>());
    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(ObjectMapper.class).toInstance(new ObjectMapper().registerModule(new GuavaModule()));
    bind(LevelsOfAssuranceConfigValidator.class).toInstance(new LevelsOfAssuranceConfigValidator());
    bind(CertificateChainConfigValidator.class);
    bind(CertificateChainValidator.class);
    bind(TrustStoreForCertificateProvider.class);
    bind(X509CertificateFactory.class).toInstance(new X509CertificateFactory());
    bind(KeyStoreCache.class);
    bind(ExceptionFactory.class);
    bind(OCSPCertificateChainValidityChecker.class);
    bind(EntityConfigDataToCertificateDtoTransformer.class);
    bind(OCSPCertificateChainValidator.class);
    bind(IdpPredicateFactory.class);
    bind(KeyStoreLoader.class).toInstance(new KeyStoreLoader());
    bind(OCSPPKIXParametersProvider.class).toInstance(new OCSPPKIXParametersProvider());
    bind(PKIXParametersProvider.class).toInstance(new PKIXParametersProvider());
}
 
开发者ID:alphagov,项目名称:verify-hub,代码行数:34,代码来源:ConfigModule.java

示例3: parse

import io.dropwizard.configuration.DefaultConfigurationFactoryFactory; //导入依赖的package包/类
/**
 * Parses the given configuration file and returns a configuration object.
 *
 * @param configurationFileName The name of the configuration file.
 * @return A configuration object.
 * @throws IOException The IO error that contains detail information.
 * @throws ConfigurationException The configuration error that contains detail information.
 */
public static ApiConfiguration parse(String configurationFileName)
  throws IOException, ConfigurationException {
  if (StringUtils.isBlank(configurationFileName)) {
    throw new IllegalArgumentException("Configuration file cannot be blank");
  }

  ObjectMapper objectMapper = null;
  if (configurationFileName.endsWith("yml") || configurationFileName.endsWith("yaml")) {
    objectMapper = Jackson.newObjectMapper(new YAMLFactory());
  } else if (configurationFileName.endsWith("json")) {
    objectMapper = Jackson.newObjectMapper(new JsonFactory());
  } else {
    throw new IllegalArgumentException("Unrecognized configuration file type");
  }

  ValidatorFactory validatorFactory = Validation
      .byProvider(HibernateValidator.class)
      .configure()
      .addValidatedValueHandler(new OptionalValidatedValueUnwrapper())
      .buildValidatorFactory();

  final ConfigurationFactory<ApiConfiguration> configurationFactory =
      new DefaultConfigurationFactoryFactory<ApiConfiguration>()
        .create(ApiConfiguration.class, validatorFactory.getValidator(), objectMapper, "dw");

  final File file = new File(configurationFileName);
  if (!file.exists()) {
    throw new FileNotFoundException("Configuration file " + configurationFileName + " not found");
  }

  return configurationFactory.build(file);
}
 
开发者ID:zeelichsheng,项目名称:auth,代码行数:41,代码来源:ConfigurationParser.java

示例4: testViaDW

import io.dropwizard.configuration.DefaultConfigurationFactoryFactory; //导入依赖的package包/类
@Test
public void testViaDW() throws Exception
{
    Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
    ObjectMapper objectMapper = Jackson.newObjectMapper();
    ConfigurationFactory<MyConfiguration> configurationFactory = new DefaultConfigurationFactoryFactory<MyConfiguration>().create(MyConfiguration.class, validator, objectMapper, "dw");
    MyConfiguration configuration = configurationFactory.build(new FlexibleConfigurationSourceProvider(), "%{\"testValue\": \"override\"}");
    Assert.assertEquals("override", configuration.testValue);
}
 
开发者ID:soabase,项目名称:soabase,代码行数:10,代码来源:TestFlexibleConfigurationSourceProvider.java

示例5: buildConfigurationFromString

import io.dropwizard.configuration.DefaultConfigurationFactoryFactory; //导入依赖的package包/类
private UserInfoConfiguration buildConfigurationFromString(String fileLocation) throws Exception {
    final File file = new File(Resources.getResource(fileLocation).toURI());

    return new DefaultConfigurationFactoryFactory<UserInfoConfiguration>()
            .create(UserInfoConfiguration.class, BaseValidator.newValidator(), Jackson.newObjectMapper(), "dw")
            .build(file);
}
 
开发者ID:wdawson,项目名称:dropwizard-auth-example,代码行数:8,代码来源:UserInfoConfigurationTest.java

示例6: setup

import io.dropwizard.configuration.DefaultConfigurationFactoryFactory; //导入依赖的package包/类
@Before
public void setup() throws Exception {
    final File configFile = new File(Resources.getResource("dropwizard/valid-conf.yml").toURI());

    configuration = new DefaultConfigurationFactoryFactory<UserInfoConfiguration>()
            .create(UserInfoConfiguration.class, BaseValidator.newValidator(), Jackson.newObjectMapper(), "dw")
            .build(configFile);

    // Common Expectations
    when(environment.healthChecks()).thenReturn(healthCheckRegistry);
    when(environment.jersey()).thenReturn(jerseyEnvironment);

    assertThat(configuration.getData().getNamesResource()).isEqualTo("fixtures/users/test-names.txt");
}
 
开发者ID:wdawson,项目名称:dropwizard-auth-example,代码行数:15,代码来源:UserInfoApplicationTest.java

示例7: configure

import io.dropwizard.configuration.DefaultConfigurationFactoryFactory; //导入依赖的package包/类
@Override
protected void configure() {
    bind(TrustStoreConfiguration.class).to(SamlSoapProxyConfiguration.class);
    bind(EventSinkProxy.class).to(EventSinkHttpProxy.class);
    bind(PublicKeyInputStreamFactory.class).toInstance(new PublicKeyFileInputStreamFactory());
    bind(InternalPublicKeyStore.class).to(HubMetadataPublicKeyStore.class);
    bind(RestfulClientConfiguration.class).to(SamlSoapProxyConfiguration.class);
    bind(Client.class).toProvider(DefaultClientProvider.class).asEagerSingleton();
    bind(new TypeLiteral<ConfigurationFactoryFactory<SupportedMsaVersions>>() {}).toInstance(new DefaultConfigurationFactoryFactory<SupportedMsaVersions>() {});
    bind(new TypeLiteral<SupportedMsaVersionsRepository>() {}).asEagerSingleton();
    bind(SupportedMsaVersionsBootstrap.class).asEagerSingleton();
    bind(SupportedMsaVersionsLoader.class).asEagerSingleton();
    bind(MetadataRefreshTask.class).asEagerSingleton();
    bind(ConfigServiceKeyStore.class).asEagerSingleton();
    bind(ExpiredCertificateMetadataFilter.class).toInstance(new ExpiredCertificateMetadataFilter());
    bind(UrlConfigurationSourceProvider.class).toInstance(new UrlConfigurationSourceProvider());
    bind(TrustStoreForCertificateProvider.class);
    bind(JsonResponseProcessor.class);
    bind(ObjectMapper.class).toInstance(new ObjectMapper());
    bind(X509CertificateFactory.class).toInstance(new X509CertificateFactory());
    bind(CertificateChainValidator.class);
    bind(CertificatesConfigProxy.class);
    bind(PKIXParametersProvider.class).toInstance(new PKIXParametersProvider());
    bind(KeyStoreCache.class);
    bind(KeyStoreLoader.class).toInstance(new KeyStoreLoader());
    bind(MatchingServiceHealthCheckHandler.class);
    bind(MatchingServiceHealthChecker.class);
    bind(MatchingServiceConfigProxy.class);
    bind(MatchingServiceHealthCheckClient.class);
    bind(HealthCheckEventLogger.class);
    bind(SamlEngineProxy.class);
    bind(HealthCheckSoapRequestClient.class);
    bind(AttributeQueryRequestRunnableFactory.class);
    bind(ExecuteAttributeQueryRequest.class);
    bind(AttributeQueryRequestClient.class);
    bind(ProtectiveMonitoringLogger.class).toInstance(new ProtectiveMonitoringLogger());
    bind(SoapRequestClient.class);
    bind(HubMatchingServiceResponseReceiverProxy.class);
    bind(ExternalCommunicationEventLogger.class);
    bind(SoapMessageManager.class).toInstance(new SoapMessageManager());
    bind(IpAddressResolver.class).toInstance(new IpAddressResolver());
    bind(TimeoutEvaluator.class).toInstance(new TimeoutEvaluator());
    bind(MetadataHealthCheckRegistry.class).asEagerSingleton();
}
 
开发者ID:alphagov,项目名称:verify-hub,代码行数:45,代码来源:SamlSoapProxyModule.java


注:本文中的io.dropwizard.configuration.DefaultConfigurationFactoryFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。