Class FormatVersion
java.lang.Object
org.apache.jackrabbit.oak.plugins.document.FormatVersion
- All Implemented Interfaces:
Comparable<FormatVersion>
The format version currently in use by the DocumentNodeStore and written
to the underlying DocumentStore. A version
canRead(org.apache.jackrabbit.oak.plugins.document.FormatVersion) the current or
older versions.-
Method Summary
Modifier and TypeMethodDescriptionbooleancanRead(FormatVersion other) Returnstrueifthisversion can read data written by theotherversion.intcompareTo(@NotNull FormatVersion other) booleantoString()static FormatVersionReturns a format version for the given String representation.static Iterable<FormatVersion>values()static @NotNull FormatVersionversionOf(@NotNull DocumentStore store) Reads theFormatVersionfrom the given store.booleanwriteTo(@NotNull DocumentStore store) Writes this version to the given document store.
-
Method Details
-
values
- Returns:
- well known format versions.
-
canRead
Returnstrueifthisversion can read data written by theotherversion.- Parameters:
other- the version the data was written in.- Returns:
trueif this version can read,falseotherwise.
-
versionOf
@NotNull public static @NotNull FormatVersion versionOf(@NotNull @NotNull DocumentStore store) throws DocumentStoreException Reads theFormatVersionfrom the given store. This method returnsV0if the store currently does not have a version set.- Parameters:
store- the store to read from.- Returns:
- the format version of the store.
- Throws:
DocumentStoreException- if an error occurs while reading from the store.
-
writeTo
Writes this version to the given document store. The write operation will fail with aDocumentStoreExceptionif the version change is considered incompatible or cannot be applied for some other reason. This includes:- An attempt to downgrade the existing version
- There are active cluster nodes using an existing version
- The version was changed concurrently
- Parameters:
store- the document store.- Returns:
trueif the version in the store was updated,falseotherwise. This method will also returnfalseif the version in the store equals this version and now update was required.- Throws:
DocumentStoreException- if the write operation fails. Reasons include: 1) an attempt to downgrade the existing version, 2) there are active cluster nodes using an existing version, 3) the version was changed concurrently.
-
valueOf
Returns a format version for the given String representation. This method either returns one of the well known versions or an entirely new version if the version is not well known.- Parameters:
s- the String representation of a format version.- Returns:
- the parsed format version.
- Throws:
IllegalArgumentException- if the string is malformed.
-
toString
-
equals
-
compareTo
- Specified by:
compareToin interfaceComparable<FormatVersion>
-