Class DefaultOsConfigurationService
java.lang.Object
de.hybris.platform.mediaconversion.os.config.DefaultOsConfigurationService
- All Implemented Interfaces:
OsConfigurationService
Standard implementation of the
OsConfigurationService interface. This implementation works with String
distance comparison for computing the best matching subdirectory or property key.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringdoRetrieveOsConfigurationKey(String prefix) Does the actual property key resolution (without the cache).protected FiledoRetrieveOsDirectory(File root) Resolves the os specific directory (without the caching).Accesses theConfigurationServiceto use for property (key) resolution.Accesses this systems operation system architecture.Accesses this systems operation system name.retrieveOsConfigurationKey(String prefix) Retrieves the best available configuration/property key for the given prefix.retrieveOsDirectory(File rootDirectory) Evaluates the directory structure of the givenrootDirectoryand return the best matching os specific folder.retrieveOsSpecificProperty(String prefix, String defaultValue) Retrieves the best available configuration/property value instead of just retrieving the best matching key.voidsetConfigurationService(ConfigurationService configurationService) Sets theConfigurationServiceto use for property (key) resolution.voidSets this systems operation system architecture name.voidSets this systems operation system name.
-
Field Details
-
DIRECTORY_FILTER
FileFilteraccepting directories only. Also directories which name start with a dot (.) are skipped.
-
-
Constructor Details
-
DefaultOsConfigurationService
public DefaultOsConfigurationService()
-
-
Method Details
-
retrieveOsSpecificProperty
Retrieves the best available configuration/property value instead of just retrieving the best matching key.- Specified by:
retrieveOsSpecificPropertyin interfaceOsConfigurationService- Parameters:
prefix- the common prefix of all property keys to obeydefaultValue- the default value to return is no such property exists- Returns:
- the property value of the best matching key or the given
defaultValueif no such key exists. - See Also:
-
retrieveOsConfigurationKey
Retrieves the best available configuration/property key for the given prefix. This method behaves exactly the same asOsConfigurationService.retrieveOsDirectory(File), but operates on theConfigurationServiceproperties instead of file system directories.- Specified by:
retrieveOsConfigurationKeyin interfaceOsConfigurationService- Parameters:
prefix- the common prefix of all property keys to obey- Returns:
- the property key matching best this system
- Throws:
NoSuchConfigurationKeyException- if no configuration keys for the given prefix exist- See Also:
-
doRetrieveOsConfigurationKey
Does the actual property key resolution (without the cache).- Parameters:
prefix- the prefix of the configuration key in question- Returns:
- the os specific configuration key
- Throws:
NoSuchConfigurationKeyException- if no such configuration key exists- See Also:
-
retrieveOsDirectory
Evaluates the directory structure of the givenrootDirectoryand return the best matching os specific folder.- Specified by:
retrieveOsDirectoryin interfaceOsConfigurationService- Parameters:
rootDirectory- the base directory containing the two level folder hierarchy of os.name/os.arch- Returns:
- the directory matching best to the system.
- See Also:
-
doRetrieveOsDirectory
Resolves the os specific directory (without the caching).- Parameters:
root- the root directory to analyse.- Returns:
- the best matching directory within the given
rootfor the current operation system and architecture.
-
getConfigurationService
Accesses theConfigurationServiceto use for property (key) resolution.- Returns:
- the
ConfigurationServiceto use
-
setConfigurationService
Sets theConfigurationServiceto use for property (key) resolution. This setter is for Spring IoC wiring.- Parameters:
configurationService- theConfigurationServiceto use
-
getOsName
Accesses this systems operation system name. This property is preset toSystem.getProperty("os.name"), but can be overwritten through spring configuration.- Returns:
- this systems operation system name.
- See Also:
-
setOsName
Sets this systems operation system name. This property is preset toSystem.getProperty("os.name"), but can be overwritten through spring configuration.- Parameters:
osName- the name of this systems operation system.- See Also:
-
getOsArch
Accesses this systems operation system architecture. This property is preset toSystem.getProperty("os.arch"), but can be overwritten through spring configuration.- Returns:
- this systems operation system architecture name.
- See Also:
-
setOsArch
Sets this systems operation system architecture name. This property is preset toSystem.getProperty("os.arch"), but can be overwritten through spring configuration.- Parameters:
osArch- the name of this systems operation system architecture.- See Also:
-