Class IndexName

  • All Implemented Interfaces:
    java.lang.Comparable<IndexName>

    public class IndexName
    extends java.lang.Object
    implements java.lang.Comparable<IndexName>
    An index name, which possibly contains two version numbers: the product version number, and the customer version number. The format of an index node name is: - The name of the index, - optionally a dash ('-') and the product version number, - optionally "-custom-" and the customer version number. If the node name doesn't contain version numbers / dashes, then version 0 is assumed (for both the product version number and customer version number).
    • Method Detail

      • parse

        public static IndexName parse​(java.lang.String nodeName)
        Parse the node name. Both node names with version and without version are supported.
        Parameters:
        nodeName - the node name (starting from root; e.g. "/oak:index/lucene")
        Returns:
        the index name object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • compareTo

        public int compareTo​(IndexName o)
        Specified by:
        compareTo in interface java.lang.Comparable<IndexName>
      • getLatestCustomized

        public IndexName getLatestCustomized​(java.util.List<IndexName> all)
        Get the latest index name object that matches this index base name, and is customized.
        Parameters:
        all - the list of all indexes
        Returns:
        the lastest customized index, or null if none
      • getLatestProduct

        public IndexName getLatestProduct​(java.util.List<IndexName> all)
        Get the latest product index that matches this index base name.
        Parameters:
        all - the list of all indexes
        Returns:
        the latest product index, or null if none
      • filterReplacedIndexes

        public static java.util.Collection<java.lang.String> filterReplacedIndexes​(java.util.Collection<java.lang.String> indexPaths,
                                                                                   NodeState rootState,
                                                                                   boolean checkIsActive)
        Filter out index that are replaced by another index with the same base name but newer version. Indexes without a version number in the name are always used, except if there is an active index with the same base name but a newer version. Active indexes have a hidden ":oak:mount-" node, which means they are indexed in the read-only node store.
        Parameters:
        indexPaths - the set of index paths
        rootState - the root node state (used to find hidden nodes)
        Returns:
        the filtered list
      • nextCustomizedName

        public java.lang.String nextCustomizedName()
      • isIndexActive

        public static boolean isIndexActive​(java.lang.String indexPath,
                                            NodeState rootState)
      • getNodeName

        public java.lang.String getNodeName()
      • getCustomerVersion

        public int getCustomerVersion()
      • getProductVersion

        public int getProductVersion()
      • getBaseName

        public java.lang.String getBaseName()
      • isVersioned

        public boolean isVersioned()
      • isLegal

        public boolean isLegal()