Class DeploymentPropertiesUtils
java.lang.Object
org.springframework.cloud.dataflow.rest.util.DeploymentPropertiesUtils
Provides utility methods for formatting and parsing deployment properties.
- Author:
- Eric Bottard, Mark Fisher, Janne Valkealahti, Christian Tzolov, Gunnar Hillert, Ilayaperumal Gopinathan, Glenn Renfro
-
Method Summary
Modifier and TypeMethodDescriptionconvert
(Properties properties) Convert Properties to a Map with String keys and String values.extractAndQualifyDeployerProperties
(Map<String, String> input, String appName) Retain only properties that are meant for the deployer of a given app (those that start withdeployer.[appname]
ordeployer.*
) and qualify all property values with thespring.cloud.deployer.
prefix.static String
Returns a String representation of deployment properties as a comma separated list of key=value pairs.Parses a String comprised of 0 or more comma-delimited key=value pairs where each key has the format:app.[appname].[key]
ordeployer.[appname].[key]
.parseArgumentList
(String s, String delimiter) Parses a String comprised of 0 or more delimited key=value pairs where each key has the format:app.[appname].[key]
ordeployer.[appname].[key]
.parseDeploymentProperties
(String deploymentProperties, File propertiesFile, int which) Parses a deployment properties conditionally either from properties string or file which can be legacy properties file or yaml.parseParamList
(String s, String delimiter) Parses a String comprised of 0 or more delimited key=value pairs where each key has the format:app.[appname].[key]
ordeployer.[appname].[key]
.qualifyDeployerProperties
(Map<String, String> input, String appName) Retain all properties that are meant for the deployer of a given app (those that start withdeployer.[appname]
ordeployer.*
and qualify all property values with thespring.cloud.deployer.
prefix.removeQuoting
(List<String> params) Parses a list of command line parameters and returns a list of parameters which doesn't contain any special quoting either for values or whole parameter.static void
validateDeploymentProperties
(Map<String, String> properties) Ensure that deployment properties only have keys starting withapp.
,deployer.
or,spring.cloud.scheduler.
.static void
validateSkipperDeploymentProperties
(Map<String, String> properties) Ensure that deployment properties only have keys starting withapp.
,deployer.
orversion.
.
-
Method Details
-
parse
Parses a String comprised of 0 or more comma-delimited key=value pairs where each key has the format:app.[appname].[key]
ordeployer.[appname].[key]
. Values may themselves contain commas, since the split points will be based upon the key pattern.Logic of parsing key/value pairs from a string is based on few rules and assumptions 1. keys will not have commas or equals. 2. First raw split is done by commas which will need to be fixed later if value is a comma-delimited list.
- Parameters:
s
- the string to parse- Returns:
- the Map of parsed key value pairs
-
parseParamList
Parses a String comprised of 0 or more delimited key=value pairs where each key has the format:app.[appname].[key]
ordeployer.[appname].[key]
. Values may themselves contain commas, since the split points will be based upon the key pattern.Logic of parsing key/value pairs from a string is based on few rules and assumptions 1. keys will not have commas or equals. 2. First raw split is done by commas which will need to be fixed later if value is a comma-delimited list.
- Parameters:
s
- the string to parsedelimiter
- delimiter used to split the string into pairs- Returns:
- the List key=value pairs
-
parseArgumentList
Parses a String comprised of 0 or more delimited key=value pairs where each key has the format:app.[appname].[key]
ordeployer.[appname].[key]
. Values may themselves contain commas, since the split points will be based upon the key pattern.Logic of parsing key/value pairs from a string is based on few rules and assumptions 1. keys will not have commas or equals. 2. First raw split is done by commas which will need to be fixed later if value is a comma-delimited list.
- Parameters:
s
- the string to parsedelimiter
- delimiter used to split the string into pairs- Returns:
- the List key=value pairs
-
parseDeploymentProperties
public static Map<String,String> parseDeploymentProperties(String deploymentProperties, File propertiesFile, int which) throws IOException Parses a deployment properties conditionally either from properties string or file which can be legacy properties file or yaml.- Parameters:
deploymentProperties
- the deployment properties stringpropertiesFile
- the deployment properties filewhich
- the flag to choose between properties or file- Returns:
- the map of parsed properties
- Throws:
IOException
- if file loading errors
-
validateDeploymentProperties
Ensure that deployment properties only have keys starting withapp.
,deployer.
or,spring.cloud.scheduler.
. In case non supported key is foundIllegalArgumentException
is thrown.- Parameters:
properties
- the properties to check
-
validateSkipperDeploymentProperties
Ensure that deployment properties only have keys starting withapp.
,deployer.
orversion.
. In case non supported key is foundIllegalArgumentException
is thrown.- Parameters:
properties
- the properties to check
-
extractAndQualifyDeployerProperties
public static Map<String,String> extractAndQualifyDeployerProperties(Map<String, String> input, String appName) Retain only properties that are meant for the deployer of a given app (those that start withdeployer.[appname]
ordeployer.*
) and qualify all property values with thespring.cloud.deployer.
prefix.- Parameters:
input
- the deplopyment propertiesappName
- the app name- Returns:
- deployment properties for the spepcific app name
-
qualifyDeployerProperties
public static Map<String,String> qualifyDeployerProperties(Map<String, String> input, String appName) Retain all properties that are meant for the deployer of a given app (those that start withdeployer.[appname]
ordeployer.*
and qualify all property values with thespring.cloud.deployer.
prefix.- Parameters:
input
- the deplopyment propertiesappName
- the app name- Returns:
- deployment properties for the spepcific app name
-
format
Returns a String representation of deployment properties as a comma separated list of key=value pairs.- Parameters:
properties
- the properties to format- Returns:
- the properties formatted as a String
-
convert
Convert Properties to a Map with String keys and String values.- Parameters:
properties
- the properties object- Returns:
- the equivalent
Map<String,String>
-
removeQuoting
Parses a list of command line parameters and returns a list of parameters which doesn't contain any special quoting either for values or whole parameter.- Parameters:
params
- the params- Returns:
- the list
-