Class IndexUtils

java.lang.Object
org.apache.jackrabbit.oak.plugins.index.IndexUtils

public final class IndexUtils extends Object
TODO document
  • Field Details

    • INDEXING_PHASE_LOGGER

      public static final Logger INDEXING_PHASE_LOGGER
  • Method Details

    • getOrCreateOakIndex

      public static NodeBuilder getOrCreateOakIndex(NodeBuilder root)
    • createIndexDefinition

      public static NodeBuilder createIndexDefinition(@NotNull @NotNull NodeBuilder index, @NotNull @NotNull String indexDefName, boolean reindex, boolean unique, @NotNull @NotNull Collection<String> propertyNames, @Nullable @Nullable Collection<String> declaringNodeTypeNames)
      Create a new property index definition below the given indexNode.
      Parameters:
      index - The oak:index node builder
      indexDefName - The name of the new property index.
      reindex - true if the the reindex flag should be turned on.
      unique - true if the index is expected the assert property uniqueness.
      propertyNames - The property names that should be indexed.
      declaringNodeTypeNames - The declaring node type names or null.
      Returns:
      the NodeBuilder of the new index definition.
    • createIndexDefinition

      public static Tree createIndexDefinition(@NotNull @NotNull Tree indexNode, @NotNull @NotNull String indexDefName, boolean unique, @NotNull @NotNull String[] propertyNames, @NotNull @NotNull String... declaringNodeTypeNames) throws RepositoryException
      Create a new property2 index definition below the given indexNode.
      Parameters:
      indexNode -
      indexDefName -
      unique -
      propertyNames -
      declaringNodeTypeNames -
      Throws:
      RepositoryException
    • createIndexDefinition

      public static Tree createIndexDefinition(@NotNull @NotNull Tree indexNode, @NotNull @NotNull String indexDefName, boolean unique, @NotNull @NotNull Collection<String> propertyNames, @Nullable @Nullable Collection<String> declaringNodeTypeNames, @NotNull @NotNull String propertyIndexType, @Nullable @Nullable Map<String,String> properties) throws RepositoryException
      Create a new property index definition below the given indexNode of the provided propertyIndexType.
      Parameters:
      indexNode -
      indexDefName -
      unique -
      propertyNames -
      declaringNodeTypeNames -
      propertyIndexType -
      properties - any additional property to be added to the index definition.
      Throws:
      RepositoryException
    • createReferenceIndex

      public static void createReferenceIndex(@NotNull @NotNull NodeBuilder index)
    • isIndexNodeType

      public static boolean isIndexNodeType(NodeState state)
    • isIndexNodeType

      public static boolean isIndexNodeType(NodeState state, String typeIn)
    • createIndexDefinition

      public static NodeBuilder createIndexDefinition(@NotNull @NotNull NodeBuilder indexNode, @NotNull @NotNull String indexDefName, boolean unique, @NotNull @NotNull Iterable<String> propertyNames, @Nullable @Nullable String[] declaringNodeTypeNames, @NotNull @NotNull String propertyIndexType, Map<String,String> properties) throws RepositoryException
      Create a new property index definition below the given indexNode of the provided propertyIndexType.
      Parameters:
      indexNode - the oak:index
      indexDefName - the node for the index definition
      unique - true if uniqueness
      propertyNames - the list of properties to be indexed
      declaringNodeTypeNames -
      propertyIndexType - the type of the PropertyIndex
      properties - any additional property to be added to the index definition.
      Throws:
      RepositoryException
    • getAsyncLaneName

      @Nullable public static @Nullable String getAsyncLaneName(NodeState idxState, String indexPath)
    • getAsyncLaneName

      @Nullable public static @Nullable String getAsyncLaneName(NodeState idxState, String indexPath, PropertyState async)
    • getCaller

      @NotNull public static @NotNull String getCaller(@Nullable @Nullable String[] ignoredJavaPackages)
      Retrieves the calling class and method from the call stack; this is determined by unwinding the stack until it finds a combination of full qualified classname + method (separated by ".") which do not start with any of the values provided by the ignoredJavaPackages parameters. If the provided parameters cover all stack frames, the whole query is considered to be internal, where the actual caller doesn't matter (or cannot be determined clearly). In this case a short message indicating this is returned. If the ignoredJavaPackages parameter is null or empty, the caller is not looked up, but instead it is assumed, that the feature is not configured; in that case a short messages is returned indicating that the feature is not configured.
      Parameters:
      ignoredJavaPackages - the java packages or class names
      Returns:
      the calling class or another non-null value
    • getFilteredCheckpoints

      public static Map<String,Map<String,String>> getFilteredCheckpoints(NodeStore store, Predicate<Map.Entry<String,Map<String,String>>> predicate)
      Returns a Map consisting of checkpoints and checkpointInfoMap filtered based on a given predicate which can utilise checkpoint info map for filtering
      Parameters:
      store -
      predicate - predicate used for filtering of checkpoints
      Returns:
      Map<String, Map<String,String>> filteredCheckpoint Map
    • getSortedCheckpointMap

      public static Map<String,Map<String,String>> getSortedCheckpointMap(Map<String,Map<String,String>> checkpointMap, String keyForComparator)
      Returns a map with checkpoint name as key and checkpoint metadata map as value, sorted on the basis of particular key in the metadata map. For example - given the following checkpoints in the system along with their associated metadata maps - checkpoint3 - {created-epoch=123458, creator=creator1} checkpoint1 - {created-epoch=123456, creator=creator2} checkpoint2 - {created-epoch=123457, creator=creator3} This method should return - {checkpoint1={created-epoch=123456, creator=creator2}, checkpoint2={created-epoch=123457, creator=creator3}, checkpoint3={created-epoch=123458, creator=creator1}}
      Parameters:
      checkpointMap - - the map consisting of checkpoints as keys and checkpoint metadata map as values
      keyForComparator - - key in the metadata map of the checkpoint that can be used as comparator to sort on checkpoint creation time.
      Returns:
      Map<String, Map<String,String>> sorted checkpoint map