Class Configuration
java.lang.Object
com.mooltiverse.oss.nyx.configuration.Configuration
- All Implemented Interfaces:
ConfigurationRoot
The Nyx configuration. The configuration is a live object that resolves each option lazily, only when required.
This not only improves the overall performances but is also safer as in case of malformed configuration options, only
those actually needed are resolved.
This means that even if the configuration sources don't change throughout a release process, the state of the configuration may change every time a not yet resolved option is requested and evaluated.
The configuration is layered, where each layer represents a source of configuration options. There is a clear definition of priorities among different layers so there is a clear precedence of options coming from one layer or another. Thanks to this, each option can be overridden by other layer with higher priority.
There must be only one instance of this class for every execution and it's retrieved by
This means that even if the configuration sources don't change throughout a release process, the state of the configuration may change every time a not yet resolved option is requested and evaluated.
The configuration is layered, where each layer represents a source of configuration options. There is a clear definition of priorities among different layers so there is a clear precedence of options coming from one layer or another. Thanks to this, each option can be overridden by other layer with higher priority.
There must be only one instance of this class for every execution and it's retrieved by
Nyx.configuration().-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetBump()Returns the version identifier to bump as it's defined by this configuration.Returns the changelog configuration section.Returns the commit message convention configuration section.Returns the path to a custom configuration file as it's defined by this configuration.Returns the directory to use as the working directory as it's defined by this configuration.Returns the value of the dry run flag as it's defined by this configuration.getGit()Returns the Git configuration section.Returns the initial version defined by this configuration to use when no past version is available in the commit history.Returns selected preset configuration as it's defined by this configuration.Returns the release assets configuration section.Returns the flag that enables tolerance in reading release names with arbitrary prefixes or extra non critical characters as it's defined by this configuration.Returns the prefix to use in release name generation as it's defined by this configuration.Returns the release types configuration section.Returns the value of the resume flag as it's defined by this configuration.Returns the versioning scheme to use as it's defined by this configuration.Returns the services configuration section.Returns the path to a custom shared configuration file as it's defined by this configuration.Returns the path to the file where the NyxStatemust be saved as it's defined by this configuration.Returns the substitutions configuration section.Returns the value of the summary flag as it's defined by this configuration.Returns the path to the file where the Nyx summary must be saved as it's defined by this configuration.Returns the logging verbosity level as it's defined by this configuration.Returns the version defined by this configuration.static voidsetDefaultDirectory(File directory) This method allows to override the default directory that will be returned bygetDirectory().Adds, replaces or removes the layer at theLayerPriority.COMMAND_LINElevel.Adds, replaces or removes the layer at theLayerPriority.PLUGINlevel.Adds, replaces or removes the layer at theLayerPriority.RUNTIMElevel, which is the one that can override all other layers.
-
Constructor Details
-
Configuration
Default constructor. Returns a new configuration object at its initial state. Instances of this class are created using theNyx.configuration()method so this constructor should never be used alone. SeeNyx.configuration()- Throws:
DataAccessException- in case data cannot be read or accessed.IllegalPropertyException- in case some option has been defined but has incorrect values or it can't be resolved.
-
-
Method Details
-
withCommandLineConfiguration
public Configuration withCommandLineConfiguration(ConfigurationLayer layer) throws DataAccessException, IllegalPropertyException Adds, replaces or removes the layer at theLayerPriority.COMMAND_LINElevel.- Parameters:
layer- the configuration layer to set at theLayerPriority.COMMAND_LINElevel. Ifnullany existing configuration layer at the same level is removed (if any).- Returns:
- a reference to this same object.
- Throws:
DataAccessException- in case data cannot be read or accessed.IllegalPropertyException- in case some option has been defined but has incorrect values or it can't be resolved.
-
withPluginConfiguration
public Configuration withPluginConfiguration(ConfigurationLayer layer) throws DataAccessException, IllegalPropertyException Adds, replaces or removes the layer at theLayerPriority.PLUGINlevel.- Parameters:
layer- the configuration layer to set at theLayerPriority.PLUGINlevel. Ifnullany existing configuration layer at the same level is removed (if any).- Returns:
- a reference to this same object.
- Throws:
DataAccessException- in case data cannot be read or accessed.IllegalPropertyException- in case some option has been defined but has incorrect values or it can't be resolved.
-
withRuntimeConfiguration
public Configuration withRuntimeConfiguration(ConfigurationLayer layer) throws DataAccessException, IllegalPropertyException Adds, replaces or removes the layer at theLayerPriority.RUNTIMElevel, which is the one that can override all other layers.- Parameters:
layer- the configuration layer to set at theLayerPriority.RUNTIMElevel. Ifnullany existing configuration layer at the same level is removed (if any).- Returns:
- a reference to this same object.
- Throws:
DataAccessException- in case data cannot be read or accessed.IllegalPropertyException- in case some option has been defined but has incorrect values or it can't be resolved.
-
getBump
Returns the version identifier to bump as it's defined by this configuration.- Specified by:
getBumpin interfaceConfigurationRoot- Returns:
- the configured value for this option or
nullif the value hasn't been defined. - Throws:
DataAccessException- in case the option cannot be read or accessed.IllegalPropertyException- in case the option has been defined but has incorrect values or it can't be resolved.
-
getChangelog
Returns the changelog configuration section.- Specified by:
getChangelogin interfaceConfigurationRoot- Returns:
- the changelog configuration section. Never
null. - Throws:
DataAccessException- in case the option cannot be read or accessed.IllegalPropertyException- in case the option has been defined but has incorrect values or it can't be resolved.
-
getCommitMessageConventions
public CommitMessageConventions getCommitMessageConventions() throws DataAccessException, IllegalPropertyExceptionReturns the commit message convention configuration section.- Specified by:
getCommitMessageConventionsin interfaceConfigurationRoot- Returns:
- the commit message convention configuration section. Never
null. - Throws:
DataAccessException- in case the option cannot be read or accessed.IllegalPropertyException- in case the option has been defined but has incorrect values or it can't be resolved.
-
getConfigurationFile
Returns the path to a custom configuration file as it's defined by this configuration.- Specified by:
getConfigurationFilein interfaceConfigurationRoot- Returns:
- the configured value for this option or
nullif the value hasn't been defined. - Throws:
DataAccessException- in case the option cannot be read or accessed.IllegalPropertyException- in case the option has been defined but has incorrect values or it can't be resolved.
-
getDirectory
Returns the directory to use as the working directory as it's defined by this configuration.- Specified by:
getDirectoryin interfaceConfigurationRoot- Returns:
- the configured value for this option or
nullif the value hasn't been defined. - Throws:
DataAccessException- in case the option cannot be read or accessed.IllegalPropertyException- in case the option has been defined but has incorrect values or it can't be resolved.- See Also:
-
setDefaultDirectory
This method allows to override the default directory that will be returned bygetDirectory(). This method must be invoked before instances ofNyxor other classes are created or the given value may be ignored.- Parameters:
directory- the new default directory. Ifnullthen the standard default directory will be used.
-
getDryRun
Returns the value of the dry run flag as it's defined by this configuration.- Specified by:
getDryRunin interfaceConfigurationRoot- Returns:
- the configured value for this option or
nullif the value hasn't been defined. - Throws:
DataAccessException- in case the option cannot be read or accessed.IllegalPropertyException- in case the option has been defined but has incorrect values or it can't be resolved.
-
getGit
Returns the Git configuration section.- Specified by:
getGitin interfaceConfigurationRoot- Returns:
- the Git configuration section. Never
null. - Throws:
DataAccessException- in case the option cannot be read or accessed.IllegalPropertyException- in case the option has been defined but has incorrect values or it can't be resolved.
-
getInitialVersion
Returns the initial version defined by this configuration to use when no past version is available in the commit history.- Specified by:
getInitialVersionin interfaceConfigurationRoot- Returns:
- the configured value for this option or
nullif the value hasn't been defined. - Throws:
DataAccessException- in case the option cannot be read or accessed.IllegalPropertyException- in case the option has been defined but has incorrect values or it can't be resolved.
-
getPreset
Returns selected preset configuration as it's defined by this configuration.- Specified by:
getPresetin interfaceConfigurationRoot- Returns:
- the configured value for this option or
nullif the value hasn't been defined. - Throws:
DataAccessException- in case the option cannot be read or accessed.IllegalPropertyException- in case the option has been defined but has incorrect values or it can't be resolved.
-
getReleaseAssets
public Map<String,Attachment> getReleaseAssets() throws DataAccessException, IllegalPropertyExceptionReturns the release assets configuration section.- Specified by:
getReleaseAssetsin interfaceConfigurationRoot- Returns:
- the release assets configuration section. Never
null. - Throws:
DataAccessException- in case the option cannot be read or accessed.IllegalPropertyException- in case the option has been defined but has incorrect values or it can't be resolved.
-
getReleaseLenient
Returns the flag that enables tolerance in reading release names with arbitrary prefixes or extra non critical characters as it's defined by this configuration.- Specified by:
getReleaseLenientin interfaceConfigurationRoot- Returns:
- the configured value for this option or
nullif the value hasn't been defined. - Throws:
DataAccessException- in case the option cannot be read or accessed.IllegalPropertyException- in case the option has been defined but has incorrect values or it can't be resolved.
-
getReleasePrefix
Returns the prefix to use in release name generation as it's defined by this configuration.- Specified by:
getReleasePrefixin interfaceConfigurationRoot- Returns:
- the configured value for this option or
nullif the value hasn't been defined. - Throws:
DataAccessException- in case the option cannot be read or accessed.IllegalPropertyException- in case the option has been defined but has incorrect values or it can't be resolved.
-
getReleaseTypes
Returns the release types configuration section.- Specified by:
getReleaseTypesin interfaceConfigurationRoot- Returns:
- the release types configuration section. Never
null. - Throws:
DataAccessException- in case the option cannot be read or accessed.IllegalPropertyException- in case the option has been defined but has incorrect values or it can't be resolved.
-
getResume
Returns the value of the resume flag as it's defined by this configuration.- Specified by:
getResumein interfaceConfigurationRoot- Returns:
- the configured value for this option or
nullif the value hasn't been defined. - Throws:
DataAccessException- in case the option cannot be read or accessed.IllegalPropertyException- in case the option has been defined but has incorrect values or it can't be resolved.
-
getScheme
Returns the versioning scheme to use as it's defined by this configuration.- Specified by:
getSchemein interfaceConfigurationRoot- Returns:
- the configured value for this option or
nullif the value hasn't been defined. - Throws:
DataAccessException- in case the option cannot be read or accessed.IllegalPropertyException- in case the option has been defined but has incorrect values or it can't be resolved.
-
getServices
public Map<String,ServiceConfiguration> getServices() throws DataAccessException, IllegalPropertyExceptionReturns the services configuration section.- Specified by:
getServicesin interfaceConfigurationRoot- Returns:
- the services configuration section. Never
null. - Throws:
DataAccessException- in case the option cannot be read or accessed.IllegalPropertyException- in case the option has been defined but has incorrect values or it can't be resolved.
-
getStateFile
Returns the path to the file where the NyxStatemust be saved as it's defined by this configuration.- Specified by:
getStateFilein interfaceConfigurationRoot- Returns:
- the configured value for this option or
nullif the value hasn't been defined. - Throws:
DataAccessException- in case the option cannot be read or accessed.IllegalPropertyException- in case the option has been defined but has incorrect values or it can't be resolved.
-
getSubstitutions
Returns the substitutions configuration section.- Specified by:
getSubstitutionsin interfaceConfigurationRoot- Returns:
- the substitutions configuration section. Never
null. - Throws:
DataAccessException- in case the option cannot be read or accessed.IllegalPropertyException- in case the option has been defined but has incorrect values or it can't be resolved.
-
getSummary
Returns the value of the summary flag as it's defined by this configuration.- Specified by:
getSummaryin interfaceConfigurationRoot- Returns:
- the configured value for this option or
nullif the value hasn't been defined. - Throws:
DataAccessException- in case the option cannot be read or accessed.IllegalPropertyException- in case the option has been defined but has incorrect values or it can't be resolved.
-
getSummaryFile
Returns the path to the file where the Nyx summary must be saved as it's defined by this configuration.- Specified by:
getSummaryFilein interfaceConfigurationRoot- Returns:
- the configured value for this option or
nullif the value hasn't been defined. - Throws:
DataAccessException- in case the option cannot be read or accessed.IllegalPropertyException- in case the option has been defined but has incorrect values or it can't be resolved.
-
getVerbosity
Returns the logging verbosity level as it's defined by this configuration. Please note that the verbosity option is actually ignored in this library implementation as the event filtering based on the verbosity needs to be configured outside this library, depending on the logging framework deployed along with SLF4J. See here for more.- Specified by:
getVerbosityin interfaceConfigurationRoot- Returns:
- the configured value for this option or
nullif the value hasn't been defined. - Throws:
DataAccessException- in case the option cannot be read or accessed.IllegalPropertyException- in case the option has been defined but has incorrect values or it can't be resolved.
-
getVersion
Returns the version defined by this configuration.- Specified by:
getVersionin interfaceConfigurationRoot- Returns:
- the configured value for this option or
nullif the value hasn't been defined. - Throws:
DataAccessException- in case the option cannot be read or accessed.IllegalPropertyException- in case the option has been defined but has incorrect values or it can't be resolved.
-