You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-dev@jackrabbit.apache.org by Tulika Goel <tu...@gmail.com> on 2016/09/16 13:16:12 UTC

Support for major version increment in oak

Hello,



Just to give a brief introduction, we are working on a solution which we
are developing on top of Adobe Experience Manager (which is built upon
Jackrabbit Oak). We have a requirement from one of our customer , where
they want to keep versionable data in JCR repository. They need advanced
version management capabilities where user can create minor and major
versions of a node.



I went through “Versioning Model” section of JCR 2.0 Specification (JSR
283). My understanding of that section is that JCR specification does not
enforce whether the implementation can do only minor or major versioning.

*“Each version has a name unique within its version history that is
assigned automatically on creation of the version. The format of the name
is implementation-dependant.”*

And hence correspondingly in
javax.jcr.version.VersionManager.checkin(java.lang.String absPath) API, the
version name is auto-generated by system.



Now for oak 2.0, I see this version name is always generated by doing a
minor increment for e.g. from 1.1 -> 1.2 -> 1.3. So apparently it seems oak
2.0 is creating “Version Name” by doing minor version number increment.



I just wanted to know if there are any plans to support a major version
increment in future? Or even in current implementation, is there a scenario
under which a new Version object is created with a name which is generated
by incrementing the first number in version name for e.g. 1.0 -> 2.0 -> 3.0
?


Also, I was browsing through the code and I could not locate the file which
contains this logic for determining the version name for new Version
object. Any help on that source file path will be appreciated.



Thanks,

Tulika

Re: Support for major version increment in oak

Posted by Tomek Rekawek <re...@adobe.com>.
Hi Tulika,

> On 16 Sep 2016, at 15:16, Tulika Goel <tu...@gmail.com> wrote:

> I just wanted to know if there are any plans to support a major version
> increment in future? Or even in current implementation, is there a scenario
> under which a new Version object is created with a name which is generated
> by incrementing the first number in version name for e.g. 1.0 -> 2.0 -> 3.0
> ?

The version number reflects what’s the predecessor of the given version entry. If you have a few direct successors of the jcr:rootVersion, they’ll have numbers 1.0, 2.0, 3.0, etc. After that, the successor of 2.0 will be 2.1, etc. The method determining the new version number is ReadWriteVersionManager#calculateVersion and its javadoc contains a detailed description and even an asciiart ;) You’ll find it here:

https://jackrabbit.apache.org/oak/docs/apidocs/org/apache/jackrabbit/oak/plugins/version/ReadWriteVersionManager.html#calculateVersion(org.apache.jackrabbit.oak.spi.state.NodeBuilder,%20org.apache.jackrabbit.oak.spi.state.NodeBuilder)

I don’t think it is or will be possible to create the version number manually. You can, however, label a version. The labels can be any strings, so it’s possible to use them to enforce any versioning schema.

Regards,
Tomek

-- 
Tomek Rękawek | Adobe Research | www.adobe.com
rekawek@adobe.com

Re: Support for major version increment in oak

Posted by Robert Munteanu <ro...@apache.org>.
Hi,

On Fri, 2016-09-16 at 18:46 +0530, Tulika Goel wrote:
> Now for oak 2.0, I see this version name is always generated by doing
> a
> minor increment for e.g. from 1.1 -> 1.2 -> 1.3. So apparently it
> seems oak
> 2.0 is creating \u201cVersion Name\u201d by doing minor version number
> increment.

I am by no means a specialist in JCR versioning, but wanted to point
out that there is no Oak 2.0 :-) So it would be nice if you could tell
us exactly what version of Oak you're using and maybe someone with more
knowledge about versioning will be able to offer actual advice.

Robert