Search in sources :

Example 1 with Converter

use of org.eclipse.microprofile.config.spi.Converter in project Payara by payara.

the class ConfigProviderResolverImpl method getDiscoveredConverters.

List<Converter> getDiscoveredConverters(ApplicationInfo appInfo) {
    LinkedList<Converter> converters = appInfo.getTransientAppMetaData(CUSTOM_CONVERTERS_KEY, LinkedList.class);
    if (converters == null) {
        converters = new LinkedList<>();
        // resolve custom config sources
        ServiceLoader<Converter> serviceLoader = ServiceLoader.load(Converter.class, appInfo.getAppClassLoader());
        for (Converter converter : serviceLoader) {
            converters.add(converter);
        }
        appInfo.addTransientAppMetaData(CUSTOM_CONVERTERS_KEY, converters);
    }
    return converters;
}
Also used : ChronoUnitConverter(fish.payara.nucleus.microprofile.config.converters.ChronoUnitConverter) LongConverter(fish.payara.nucleus.microprofile.config.converters.LongConverter) OffsetDateTimeConverter(fish.payara.nucleus.microprofile.config.converters.OffsetDateTimeConverter) Converter(org.eclipse.microprofile.config.spi.Converter) DoubleConverter(fish.payara.nucleus.microprofile.config.converters.DoubleConverter) OffsetTimeConverter(fish.payara.nucleus.microprofile.config.converters.OffsetTimeConverter) InstantConverter(fish.payara.nucleus.microprofile.config.converters.InstantConverter) IntegerConverter(fish.payara.nucleus.microprofile.config.converters.IntegerConverter) LocalTimeConverter(fish.payara.nucleus.microprofile.config.converters.LocalTimeConverter) BooleanConverter(fish.payara.nucleus.microprofile.config.converters.BooleanConverter) DurationConverter(fish.payara.nucleus.microprofile.config.converters.DurationConverter) URLConverter(fish.payara.nucleus.microprofile.config.converters.URLConverter) LocalDateTimeConverter(fish.payara.nucleus.microprofile.config.converters.LocalDateTimeConverter) InetAddressConverter(fish.payara.nucleus.microprofile.config.converters.InetAddressConverter) FloatConverter(fish.payara.nucleus.microprofile.config.converters.FloatConverter) LocalDateConverter(fish.payara.nucleus.microprofile.config.converters.LocalDateConverter)

Example 2 with Converter

use of org.eclipse.microprofile.config.spi.Converter in project Payara by payara.

the class ConfigProviderResolverImpl method getDefaultConverters.

List<Converter> getDefaultConverters() {
    LinkedList<Converter> result = new LinkedList<>();
    result.add(new BooleanConverter());
    result.add(new IntegerConverter());
    result.add(new LongConverter());
    result.add(new FloatConverter());
    result.add(new DoubleConverter());
    result.add(new DurationConverter());
    result.add(new LocalTimeConverter());
    result.add(new LocalDateConverter());
    result.add(new LocalDateTimeConverter());
    result.add(new OffsetDateTimeConverter());
    result.add(new OffsetTimeConverter());
    result.add(new InstantConverter());
    result.add(new URLConverter());
    result.add(new InetAddressConverter());
    result.add(new ChronoUnitConverter());
    return result;
}
Also used : LocalDateConverter(fish.payara.nucleus.microprofile.config.converters.LocalDateConverter) InetAddressConverter(fish.payara.nucleus.microprofile.config.converters.InetAddressConverter) OffsetTimeConverter(fish.payara.nucleus.microprofile.config.converters.OffsetTimeConverter) LocalTimeConverter(fish.payara.nucleus.microprofile.config.converters.LocalTimeConverter) InstantConverter(fish.payara.nucleus.microprofile.config.converters.InstantConverter) DoubleConverter(fish.payara.nucleus.microprofile.config.converters.DoubleConverter) BooleanConverter(fish.payara.nucleus.microprofile.config.converters.BooleanConverter) LinkedList(java.util.LinkedList) LocalDateTimeConverter(fish.payara.nucleus.microprofile.config.converters.LocalDateTimeConverter) ChronoUnitConverter(fish.payara.nucleus.microprofile.config.converters.ChronoUnitConverter) IntegerConverter(fish.payara.nucleus.microprofile.config.converters.IntegerConverter) LongConverter(fish.payara.nucleus.microprofile.config.converters.LongConverter) URLConverter(fish.payara.nucleus.microprofile.config.converters.URLConverter) ChronoUnitConverter(fish.payara.nucleus.microprofile.config.converters.ChronoUnitConverter) LongConverter(fish.payara.nucleus.microprofile.config.converters.LongConverter) OffsetDateTimeConverter(fish.payara.nucleus.microprofile.config.converters.OffsetDateTimeConverter) Converter(org.eclipse.microprofile.config.spi.Converter) DoubleConverter(fish.payara.nucleus.microprofile.config.converters.DoubleConverter) OffsetTimeConverter(fish.payara.nucleus.microprofile.config.converters.OffsetTimeConverter) InstantConverter(fish.payara.nucleus.microprofile.config.converters.InstantConverter) IntegerConverter(fish.payara.nucleus.microprofile.config.converters.IntegerConverter) LocalTimeConverter(fish.payara.nucleus.microprofile.config.converters.LocalTimeConverter) BooleanConverter(fish.payara.nucleus.microprofile.config.converters.BooleanConverter) DurationConverter(fish.payara.nucleus.microprofile.config.converters.DurationConverter) URLConverter(fish.payara.nucleus.microprofile.config.converters.URLConverter) LocalDateTimeConverter(fish.payara.nucleus.microprofile.config.converters.LocalDateTimeConverter) InetAddressConverter(fish.payara.nucleus.microprofile.config.converters.InetAddressConverter) FloatConverter(fish.payara.nucleus.microprofile.config.converters.FloatConverter) LocalDateConverter(fish.payara.nucleus.microprofile.config.converters.LocalDateConverter) DurationConverter(fish.payara.nucleus.microprofile.config.converters.DurationConverter) FloatConverter(fish.payara.nucleus.microprofile.config.converters.FloatConverter) OffsetDateTimeConverter(fish.payara.nucleus.microprofile.config.converters.OffsetDateTimeConverter)

Example 3 with Converter

use of org.eclipse.microprofile.config.spi.Converter in project Payara by payara.

the class ConfigProviderResolverImpl method getConfig.

Config getConfig(ApplicationInfo appInfo) {
    Config result;
    // manage server level config first
    if (appInfo == null) {
        result = serverLevelConfig;
        if (result == null) {
            LinkedList<ConfigSource> sources = new LinkedList<>();
            LinkedList<Converter> converters = new LinkedList<>();
            sources.addAll(getDefaultSources());
            converters.addAll(getDefaultConverters());
            serverLevelConfig = new PayaraConfig(sources, converters);
            result = serverLevelConfig;
        }
    } else {
        // look for an application specific one
        result = appInfo.getTransientAppMetaData(METADATA_KEY, Config.class);
        if (result == null) {
            // build an application specific configuration
            initialiseApplicationConfig(appInfo);
            LinkedList<ConfigSource> sources = new LinkedList<>();
            LinkedList<Converter> converters = new LinkedList<>();
            sources.addAll(getDefaultSources());
            sources.addAll(getDiscoveredSources(appInfo));
            converters.addAll(getDefaultConverters());
            converters.addAll(getDiscoveredConverters(appInfo));
            result = new PayaraConfig(sources, converters);
            appInfo.addTransientAppMetaData(METADATA_KEY, result);
        }
    }
    return result;
}
Also used : SystemPropertyConfigSource(fish.payara.nucleus.microprofile.config.source.SystemPropertyConfigSource) ServerConfigSource(fish.payara.nucleus.microprofile.config.source.ServerConfigSource) ConfigSource(org.eclipse.microprofile.config.spi.ConfigSource) ModuleConfigSource(fish.payara.nucleus.microprofile.config.source.ModuleConfigSource) ConfigConfigSource(fish.payara.nucleus.microprofile.config.source.ConfigConfigSource) EnvironmentConfigSource(fish.payara.nucleus.microprofile.config.source.EnvironmentConfigSource) SecretsDirConfigSource(fish.payara.nucleus.microprofile.config.source.SecretsDirConfigSource) ApplicationConfigSource(fish.payara.nucleus.microprofile.config.source.ApplicationConfigSource) ClusterConfigSource(fish.payara.nucleus.microprofile.config.source.ClusterConfigSource) JNDIConfigSource(fish.payara.nucleus.microprofile.config.source.JNDIConfigSource) PropertiesConfigSource(fish.payara.nucleus.microprofile.config.source.PropertiesConfigSource) DomainConfigSource(fish.payara.nucleus.microprofile.config.source.DomainConfigSource) Config(org.eclipse.microprofile.config.Config) ChronoUnitConverter(fish.payara.nucleus.microprofile.config.converters.ChronoUnitConverter) LongConverter(fish.payara.nucleus.microprofile.config.converters.LongConverter) OffsetDateTimeConverter(fish.payara.nucleus.microprofile.config.converters.OffsetDateTimeConverter) Converter(org.eclipse.microprofile.config.spi.Converter) DoubleConverter(fish.payara.nucleus.microprofile.config.converters.DoubleConverter) OffsetTimeConverter(fish.payara.nucleus.microprofile.config.converters.OffsetTimeConverter) InstantConverter(fish.payara.nucleus.microprofile.config.converters.InstantConverter) IntegerConverter(fish.payara.nucleus.microprofile.config.converters.IntegerConverter) LocalTimeConverter(fish.payara.nucleus.microprofile.config.converters.LocalTimeConverter) BooleanConverter(fish.payara.nucleus.microprofile.config.converters.BooleanConverter) DurationConverter(fish.payara.nucleus.microprofile.config.converters.DurationConverter) URLConverter(fish.payara.nucleus.microprofile.config.converters.URLConverter) LocalDateTimeConverter(fish.payara.nucleus.microprofile.config.converters.LocalDateTimeConverter) InetAddressConverter(fish.payara.nucleus.microprofile.config.converters.InetAddressConverter) FloatConverter(fish.payara.nucleus.microprofile.config.converters.FloatConverter) LocalDateConverter(fish.payara.nucleus.microprofile.config.converters.LocalDateConverter) LinkedList(java.util.LinkedList)

Aggregations

BooleanConverter (fish.payara.nucleus.microprofile.config.converters.BooleanConverter)3 ChronoUnitConverter (fish.payara.nucleus.microprofile.config.converters.ChronoUnitConverter)3 DoubleConverter (fish.payara.nucleus.microprofile.config.converters.DoubleConverter)3 DurationConverter (fish.payara.nucleus.microprofile.config.converters.DurationConverter)3 FloatConverter (fish.payara.nucleus.microprofile.config.converters.FloatConverter)3 InetAddressConverter (fish.payara.nucleus.microprofile.config.converters.InetAddressConverter)3 InstantConverter (fish.payara.nucleus.microprofile.config.converters.InstantConverter)3 IntegerConverter (fish.payara.nucleus.microprofile.config.converters.IntegerConverter)3 LocalDateConverter (fish.payara.nucleus.microprofile.config.converters.LocalDateConverter)3 LocalDateTimeConverter (fish.payara.nucleus.microprofile.config.converters.LocalDateTimeConverter)3 LocalTimeConverter (fish.payara.nucleus.microprofile.config.converters.LocalTimeConverter)3 LongConverter (fish.payara.nucleus.microprofile.config.converters.LongConverter)3 OffsetDateTimeConverter (fish.payara.nucleus.microprofile.config.converters.OffsetDateTimeConverter)3 OffsetTimeConverter (fish.payara.nucleus.microprofile.config.converters.OffsetTimeConverter)3 URLConverter (fish.payara.nucleus.microprofile.config.converters.URLConverter)3 Converter (org.eclipse.microprofile.config.spi.Converter)3 LinkedList (java.util.LinkedList)2 ApplicationConfigSource (fish.payara.nucleus.microprofile.config.source.ApplicationConfigSource)1 ClusterConfigSource (fish.payara.nucleus.microprofile.config.source.ClusterConfigSource)1 ConfigConfigSource (fish.payara.nucleus.microprofile.config.source.ConfigConfigSource)1