Class IndexDefMergerUtils

java.lang.Object
org.apache.jackrabbit.oak.index.merge.IndexDefMergerUtils

public class IndexDefMergerUtils extends Object
Utility that allows to merge index definitions.
  • Constructor Details

    • IndexDefMergerUtils

      public IndexDefMergerUtils()
  • Method Details

    • merge

      public static JsonObject merge(String path, JsonObject ancestor, String customName, JsonObject custom, JsonObject product, String productName)
      Merge index definition changes.
      Parameters:
      path - the path of the change itself (e.g. /oak:index/lucene-1/indexRules/acme)
      ancestor - the common ancestor (the old product index, e.g. lucene)
      customName - the name of the node of the customized index (e.g. /oak:index/lucene-1-custom-1)
      custom - the latest customized version (e.g. lucene-1-custom-1)
      product - the latest product index (e.g. lucene-2)
      productName - the name of the node of the latest product index (e.g. /oak:index/lucene-2)
      Returns:
      the merged index definition (e.g. lucene-2-custom-1)
    • tryMergeSets

      public static String tryMergeSets(String ancestor, String custom, String product)
    • equalStringValues

      public static boolean equalStringValues(String a, String b)
    • getStringSet

      public static TreeSet<String> getStringSet(String value)
    • getStringOrStringFromSingleValueArray

      public static String getStringOrStringFromSingleValueArray(String value)
    • merge

      public static void merge(JsonObject newIndexes, JsonObject allIndexes)
      For indexes that were modified both by the customer and in the product, merge the changes, and create a new index. The new index (if any) is stored in the "newIndexes" object.
      Parameters:
      newIndexes - the new indexes
      allIndexes - all index definitions (including the new ones)