@ParametersAreNonnullByDefault public interface Config extends ImmutableConfig
BackendFactories and
StoreFactory.
All features are all optional: configuration can be created using all or none of them.
Resource.load(Map),
Resource.save(Map)| Modifier and Type | Method and Description |
|---|---|
Config |
addListener(StoreListener listener)
Adds a store listener in this configuration.
|
<V> Config |
addOption(String key,
V value)
Adds a key/value in this configuration.
|
Config |
addStore(Store store)
Adds a feature defined by the given
store in this configuration. |
Config |
autoSave()
Adds the
autoSave feature in this configuration. |
Config |
autoSave(long chunk)
Adds the
autoSave feature, with a defined chunk, in this configuration. |
Config |
cacheContainers()
Adds the
cache-containers feature in this configuration. |
Config |
cacheFeatures()
Adds the
cache-features feature in this configuration. |
Config |
cacheMetaClasses()
Adds the
cache-metaclasses feature in this configuration. |
Config |
cacheSizes()
Adds the
cache-sizes feature in this configuration. |
static boolean |
exists(Path directory)
Checks that a configuration file exists in the
directory. |
static <C extends Config> |
forName(String name,
String variant)
|
static <C extends Config> |
forScheme(String scheme)
|
static <C extends Config> |
load(Path directory)
Loads a configuration from the
directory. |
Config |
log()
Adds the
log feature in this configuration. |
Config |
log(Level level)
Adds the
log feature, with a defined level, in this configuration. |
Config |
merge(ImmutableConfig config)
Merges the given
config in this configuration. |
Config |
merge(Map<String,?> map)
Merges the given
map in this configuration. |
Config |
readOnly()
Adds the
read-only feature in this configuration. |
Config |
recordStats(StoreStats stats)
Adds the
stats feature in this configuration. |
Config |
setMapping(String mapping)
Defines the mapping to use for the created
Backend. |
getMapping, getName, getOption, getOptions, getOptions, getStores, getVariant, hasOption, isReadOnly, save, toMap@Nonnull static <C extends Config> C forName(String name, @Nullable String variant)
C - the type of the configurationname - the name of the factoryvariant - the variant of the bindingConfig@Nonnull static <C extends Config> C forScheme(String scheme)
C - the type of the configurationscheme - the scheme of the factoryConfig@Nonnull static <C extends Config> Optional<C> load(Path directory) throws IOException
directory.C - the type of the configurationdirectory - the directory of the configuration to loadOptional containing the configuration, or Optional.empty() if the directory
does not contains any configurationIOException - if an I/O error occurs during the savingConfigFile.exists(Path)static boolean exists(Path directory)
directory.directory - the directory where to look for a configurationtrue if the directory contains a configuration file@Nonnull Config merge(Map<String,?> map)
map in this configuration. All options defined in the map will be added to this
configuration, with conflict checking.map - the map representation of this configurationImmutableConfig.toMap()@Nonnull Config merge(ImmutableConfig config)
config in this configuration. All options defined in the config will be added to
this configuration, with conflict checking.config - the configuration to merge@Nonnull Config setMapping(String mapping)
Backend.mapping - the class name of the mapping to useNullPointerException - if the mapping is nullInvalidConfigException - if the mapping does not represent a DataMapper
instance, if the associated class cannot be found or if the mapping is already
defined and different from mapping@Nonnull <V> Config addOption(String key, V value)
V - the type of the valuekey - the key to addvalue - the value of the keyNullPointerException - if any parameter is null@Nonnull Config addStore(Store store)
store in this configuration.store - the store declaration to add@Nonnull Config cacheFeatures()
cache-features feature in this configuration.@Nonnull Config cacheContainers()
cache-containers feature in this configuration.@Nonnull Config cacheMetaClasses()
cache-metaclasses feature in this configuration.@Nonnull Config cacheSizes()
cache-sizes feature in this configuration.@Nonnull Config readOnly()
read-only feature in this configuration.@Nonnull Config autoSave()
autoSave feature in this configuration.@Nonnull Config autoSave(@Nonnegative long chunk)
autoSave feature, with a defined chunk, in this configuration.
WARNING: When chunk is zero, the store will be saved at each call.
chunk - the number of database operations between each saveInvalidConfigException - if the chunk is < 0@Nonnull Config addListener(StoreListener listener)
listener - the sotre listener to add@Nonnull Config log()
log feature in this configuration.@Nonnull Config log(Level level)
log feature, with a defined level, in this configuration.level - the logging Level to useNullPointerException - if the level is null@Nonnull Config recordStats(StoreStats stats)
stats feature in this configuration.stats - the stats that will be updatedCopyright © 2013–2019 Atlanmod. All rights reserved.