Class ClusterSpecifier

  • All Implemented Interfaces:
    Serializable

    public final class ClusterSpecifier
    extends Object
    implements Serializable
    A "URL-like" entity that identifies a cluster. ClusterSpecifiers are keyed by their scheme(), which identifies the type of cluster. For the DataRush cluster, the scheme is either "dr" for the distributed cluster or "pseudodistributed" for the pseudo-distributed cluster. The general syntax of a cluster specifier is "scheme://host:port?option1=value1&option2=value2".
    See Also:
    Serialized Form
    • Field Detail

      • PSEUDO_DISTRIBUTED

        public static final ClusterSpecifier PSEUDO_DISTRIBUTED
        Constant for the pseudo-distributed cluster
    • Method Detail

      • isPseudoDistributed

        public boolean isPseudoDistributed()
        Returns whether this is the special pseudo-distributed cluser.
        Returns:
        whether this is the pseudo-distributed cluster.
      • scheme

        public String scheme()
        Returns the schema of the specifier.
        Returns:
        the schema of the specifier.
      • host

        public String host()
        Returns the host of the specifier
        Returns:
        the host of the specifier
      • port

        public int port()
        Returns the port of the specifier.
        Returns:
        the port of the specifier.
      • multiOptions

        public Map<String,​List<String>> multiOptions()
        Returns the options of the specifier
        Returns:
        the options of the specifier
      • options

        public Map<String,​String> options()
        Returns the options of the specifier. For multi-valued options, the values in the map will be equal to the first value of the option.
        Returns:
        the options of the specifier
      • scheme

        public ClusterSpecifier scheme​(String scheme)
        Returns a new specifier with the scheme set to the specified value
        Parameters:
        scheme - the new scheme
        Returns:
        a new specifier
      • host

        public ClusterSpecifier host​(String host)
        Returns a new specifier with the host set to the specified value
        Parameters:
        host - the new host
        Returns:
        a new specifier
      • port

        public ClusterSpecifier port​(int port)
        Returns a new specifier with the port set to the specified value
        Parameters:
        port - the new port
        Returns:
        a new specifier
      • options

        public ClusterSpecifier options​(Map<String,​List<String>> options)
        Returns a new specifier with the options set to the specified value
        Parameters:
        options - the new options
        Returns:
        a new specifier
      • multiOption

        public List<String> multiOption​(String name)
        Returns a multi-valued option of the given name
        Parameters:
        name - the name of the option
        Returns:
        the value of the option. Returned value may be empty but will never be null.
      • option

        public String option​(String name)
        Returns the option of the given name. In this event that is is a multi-valued option, will return the first value.
        Parameters:
        name - the name of the option
        Returns:
        the value of the option
      • option

        public ClusterSpecifier option​(String name,
                                       String value)
        Returns a new specifier with the given option set to the specified value
        Parameters:
        name - the name of the option
        value - the value of the option
        Returns:
        a new specifier with the given option set to the specified value
      • option

        public ClusterSpecifier option​(String name,
                                       List<String> value)
        Returns a new specifier with the given option set to the specified value
        Parameters:
        name - the name of the option
        value - the value of the option
        Returns:
        a new specifier with the given option set to the specified value
      • create

        public static ClusterSpecifier create()
        Returns a cluster specifier with default settings.
        Returns:
        a cluster specifier with default settings
      • parse

        public static ClusterSpecifier parse​(String uristr)
                                      throws URISyntaxException
        Parses the given cluster specifier string. This expects a string of the form "scheme://host:port?option1=value1&option2=value2".
        Parameters:
        uristr - the string
        Returns:
        a cluster specifier
        Throws:
        URISyntaxException - if there was a parse error
      • format

        public String format()
        Formats this cluster specifier in a format that can be parsed using parse(String).
        Returns:
        a formatted cluster specifier