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 TypeMethodDescriptionboolean
canRead
(FormatVersion other) Returnstrue
ifthis
version can read data written by theother
version.int
compareTo
(@NotNull FormatVersion other) boolean
toString()
static FormatVersion
Returns a format version for the given String representation.static Iterable<FormatVersion>
values()
static @NotNull FormatVersion
versionOf
(@NotNull DocumentStore store) Reads theFormatVersion
from the given store.boolean
writeTo
(@NotNull DocumentStore store) Writes this version to the given document store.
-
Method Details
-
values
- Returns:
- well known format versions.
-
canRead
Returnstrue
ifthis
version can read data written by theother
version.- Parameters:
other
- the version the data was written in.- Returns:
true
if this version can read,false
otherwise.
-
versionOf
@NotNull public static @NotNull FormatVersion versionOf(@NotNull @NotNull DocumentStore store) throws DocumentStoreException Reads theFormatVersion
from the given store. This method returnsV0
if 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 aDocumentStoreException
if 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:
true
if the version in the store was updated,false
otherwise. This method will also returnfalse
if 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:
compareTo
in interfaceComparable<FormatVersion>
-