Class ConnectionUtils

java.lang.Object
org.pipservices3.components.connect.ConnectionUtils

public class ConnectionUtils extends Object
A set of utility functions to process connection parameters
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    composeUri(org.pipservices3.commons.config.ConfigParams options, String defaultProtocol, int defaultPort)
    Composes URI from config parameters.
    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
    static org.pipservices3.commons.config.ConfigParams
    exclude(org.pipservices3.commons.config.ConfigParams options, List<String> keys)
    Excludes specified keys from the config parameters.
    static org.pipservices3.commons.config.ConfigParams
    include(org.pipservices3.commons.config.ConfigParams options, List<String> keys)
    Includes specified keys from the config parameters.
    static org.pipservices3.commons.config.ConfigParams
    parseUri(String uri, String defaultProtocol, int defaultPort)
    Parses URI into config parameters.
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 merge
      options2 - second options to merge
      keys - 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 options
      fromName - 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: '&param2'=xyzinvalid input: '&'...
      Parameters:
      uri - the URI to be parsed
      defaultProtocol - a default protocol
      defaultPort - 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: '&param2'=xyzinvalid input: '&'...
      Parameters:
      options - configuration parameters
      defaultProtocol - a default protocol
      defaultPort - 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.