Interface IContextId

All Known Implementing Classes:
ContextId

public interface IContextId
A context ID consists of a cluster name (optional) and a context name. (Context IDs without a cluster name are called cluster-less context IDs). A cluster name uniquely identifies a group of cooperating servers. Context names are unique within the given cluster with the exception of the global context that's represented by a null context name value and each server has its own. When a global context ID has a cluster name, a server from the cluster is chosen to represent it.

Non-global contexts may have an additional baseline identification.

Context ID can be represented as a "normalized" string with an exact format: global context ID is an empty string; a cluster-less context ID is the context name; a global context ID with a cluster is slash ('/'), cluster name and slash ('/'); a context ID with a cluster is slash ('/'), cluster name, slash ('/') and context name. Baselines are appended to context names with a preceding slash ('/').

Cluster, context and baseline names should consist only of alphanumeric characters, period and hyphen/minus: .-0-9A-Za-z.

Implementations of this class must be immutable.

Version:
$Revision$ $Date$
Author:
Stepan Roh, Polarion Software
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Delimiter between the context name and the baseline in the normalized string representation.
    static final char
    Delimiter between the context name and the baseline in the normalized string representation.
    static final String
    Delimiter between the cluster name and the context name in the normalized string representation.
    static final char
    Delimiter between the cluster name and the context name in the normalized string representation.
    static final String
    Delimiter between the start of the string and the cluster name in the normalized string representation.
    static final char
    Delimiter between the start of the string and the cluster name in the normalized string representation.
  • Method Summary

    Modifier and Type
    Method
    Description
    Return baseline (if any).
    Return cluster name (if any).
    Return context name (if not global).
    Remove baseline (if any) from this context id and return a new context id.
    Remove cluster name (if any) from this context id and return a new context id.
    setBaseline(String baseline)
    Set baseline of this context id and return a new context id.
    setClusterName(String clusterName)
    Set cluster name of this context id and return a new context id.
    Return the normalized string representation of this context id.
  • Field Details

    • CLUSTER_START_DELIM

      static final String CLUSTER_START_DELIM
      Delimiter between the start of the string and the cluster name in the normalized string representation.
      See Also:
    • CLUSTER_START_DELIM_CHAR

      static final char CLUSTER_START_DELIM_CHAR
      Delimiter between the start of the string and the cluster name in the normalized string representation.
      See Also:
    • CLUSTER_END_DELIM

      static final String CLUSTER_END_DELIM
      Delimiter between the cluster name and the context name in the normalized string representation.
      See Also:
    • CLUSTER_END_DELIM_CHAR

      static final char CLUSTER_END_DELIM_CHAR
      Delimiter between the cluster name and the context name in the normalized string representation.
      See Also:
    • BASELINE_DELIM

      static final String BASELINE_DELIM
      Delimiter between the context name and the baseline in the normalized string representation.
      See Also:
    • BASELINE_DELIM_CHAR

      static final char BASELINE_DELIM_CHAR
      Delimiter between the context name and the baseline in the normalized string representation.
      See Also:
  • Method Details

    • getClusterName

      String getClusterName()
      Return cluster name (if any).
      Returns:
      cluster name or null
    • getContextName

      String getContextName()
      Return context name (if not global).
      Returns:
      context name or null
    • removeClusterName

      IContextId removeClusterName()
      Remove cluster name (if any) from this context id and return a new context id.
      Returns:
      new cluster-less context id
    • setClusterName

      IContextId setClusterName(String clusterName)
      Set cluster name of this context id and return a new context id.
      Parameters:
      clusterName - cluster name
      Returns:
      new context id with cluster name
      Throws:
      IllegalArgumentException - if clusterName is null
    • getBaseline

      String getBaseline()
      Return baseline (if any).
      Returns:
      baseline or null
    • removeBaseline

      IContextId removeBaseline()
      Remove baseline (if any) from this context id and return a new context id.
      Returns:
      new context id without baseline
    • setBaseline

      IContextId setBaseline(String baseline)
      Set baseline of this context id and return a new context id.
      Parameters:
      baseline - baseline
      Returns:
      new context id with baseline
      Throws:
      IllegalArgumentException - if baseline is null
    • toNormalizedString

      String toNormalizedString()
      Return the normalized string representation of this context id.
      Returns:
      normalized string