Class ConnectionUtils
java.lang.Object
org.pipservices3.components.connect.ConnectionUtils
A set of utility functions to process connection parameters
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringcomposeUri(org.pipservices3.commons.config.ConfigParams options, String defaultProtocol, int defaultPort) Composes URI from config parameters.static org.pipservices3.commons.config.ConfigParamsconcat(org.pipservices3.commons.config.ConfigParams options1, org.pipservices3.commons.config.ConfigParams options2, List<String> keys) Concatinates two options by combining duplicated properties into comma-separated liststatic org.pipservices3.commons.config.ConfigParamsExcludes specified keys from the config parameters.static org.pipservices3.commons.config.ConfigParamsIncludes specified keys from the config parameters.static org.pipservices3.commons.config.ConfigParamsParses URI into config parameters.static org.pipservices3.commons.config.ConfigParamsRenames property if the target name is not used.
-
Constructor Details
-
ConnectionUtils
public ConnectionUtils()
-
-
Method Details
-
concat
public static org.pipservices3.commons.config.ConfigParams concat(org.pipservices3.commons.config.ConfigParams options1, org.pipservices3.commons.config.ConfigParams options2, List<String> keys) Concatinates two options by combining duplicated properties into comma-separated list- Parameters:
options1- first options to mergeoptions2- second options to mergekeys- when define it limits only to specific keys- Returns:
- configuration params
-
rename
public static org.pipservices3.commons.config.ConfigParams rename(org.pipservices3.commons.config.ConfigParams options, String fromName, String toName) Renames property if the target name is not used.- Parameters:
options- configuration optionsfromName- original property name.toName- property name to rename to.- Returns:
- updated configuration options
-
parseUri
public static org.pipservices3.commons.config.ConfigParams parseUri(String uri, String defaultProtocol, int defaultPort) Parses URI into config parameters. The URI shall be in the following form: protocol://username@password@host1:port1,host2:port2,...?param1=abcinvalid input: '¶m2'=xyzinvalid input: '&'...- Parameters:
uri- the URI to be parseddefaultProtocol- a default protocoldefaultPort- a default port- Returns:
- a configuration parameters with URI elements
-
composeUri
public static String composeUri(org.pipservices3.commons.config.ConfigParams options, String defaultProtocol, int defaultPort) Composes URI from config parameters. The result URI will be in the following form: protocol://username@password@host1:port1,host2:port2,...?param1=abcinvalid input: '¶m2'=xyzinvalid input: '&'...- Parameters:
options- configuration parametersdefaultProtocol- a default protocoldefaultPort- a default port- Returns:
- a composed URI
-
include
public static org.pipservices3.commons.config.ConfigParams include(org.pipservices3.commons.config.ConfigParams options, List<String> keys) Includes specified keys from the config parameters.- Parameters:
options- configuration parameters to be processed.keys- a list of keys to be included.- Returns:
- a processed config parameters.
-
exclude
public static org.pipservices3.commons.config.ConfigParams exclude(org.pipservices3.commons.config.ConfigParams options, List<String> keys) Excludes specified keys from the config parameters.- Parameters:
options- configuration parameters to be processed.keys- a list of keys to be excluded.- Returns:
- a processed config parameters.
-