Class IndexName
- java.lang.Object
-
- org.apache.jackrabbit.oak.plugins.index.IndexName
-
- All Implemented Interfaces:
Comparable<IndexName>
public class IndexName extends Object implements 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 Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(IndexName o)
static Collection<String>
filterReplacedIndexes(Collection<String> indexPaths, NodeState rootState, boolean checkIsActive)
Filter out index that are replaced by another index with the same base name but newer version.String
getBaseName()
int
getCustomerVersion()
IndexName
getLatestCustomized(List<IndexName> all)
Get the latest index name object that matches this index base name, and is customized.IndexName
getLatestProduct(List<IndexName> all)
Get the latest product index that matches this index base name.String
getNodeName()
int
getProductVersion()
static boolean
isIndexActive(String indexPath, NodeState rootState)
boolean
isLegal()
boolean
isVersioned()
String
nextCustomizedName()
static IndexName
parse(String nodeName)
Parse the node name.String
toString()
-
-
-
Method Detail
-
parse
public static IndexName parse(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
-
compareTo
public int compareTo(IndexName o)
- Specified by:
compareTo
in interfaceComparable<IndexName>
-
getLatestCustomized
public IndexName getLatestCustomized(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(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 Collection<String> filterReplacedIndexes(Collection<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 pathsrootState
- the root node state (used to find hidden nodes)- Returns:
- the filtered list
-
nextCustomizedName
public String nextCustomizedName()
-
getNodeName
public String getNodeName()
-
getCustomerVersion
public int getCustomerVersion()
-
getProductVersion
public int getProductVersion()
-
getBaseName
public String getBaseName()
-
isVersioned
public boolean isVersioned()
-
isLegal
public boolean isLegal()
-
-