On 18.12.15 9:47 , Davide Giannella wrote:
Hello team,
I'm looking through it but if I remember correctly any type of Editor
and IndexEditor is eventually converted into a CommitHook and the whole
list of commit hooks is eventually composed into a single big one:
`CompositeHook.compose()`.
By looking at the code there's no de-duplication, which means that if by
mistake or willingly someone register an Editor twice, depending on the
editor implementation it could execute the operation twice or even going
into a stack overflow.
Am I right in my above statement?
Shall we do anything? Decoupling during the compose?
I wouldn't do this as this would make composition less general and thus
more difficult to comprehend and evolve. What we could do is to add some
sort of validation to the JCR.with() methods where those hooks are
installed and throw an ISE if a hook is installed more than once.
We have a set of "default" CommitHook defined in Jcr(). What is it
making us decide whether something should end in that place?
A hook should go there if it is required for the repository to be JCR
compliant. I however recognize that there might be some stuff here that
is not strictly required. Maybe we could add those via an extra call
(e.g. Jcr.withOakExtensions()).
Additionally, if I'm building an application using Oak, how can I
initiate a repository that does NOT have some of the "default". Should
we change this aspect?
Then just use the Oak() builder as otherwise the resulting repository
wouldn't be JCR anyway.
Michael
Cheers
Davide