On 18/12/2015 14:03, Michael Dürig wrote:
> ...
> 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.
Maybe false alarm. While checking the code I saw our implementation is
based on LinkedHashSet (0) which by Javadoc (1) it seems to consider
already the unique aspect of each element as it would be for an HashSet.

>>> Note that insertion order is not affected if an element is
>>> re-inserted into the set. (An element e is reinserted into a set s
>>> if s.add(e) is invoked when s.contains(e) would return true
>>> immediately prior to the invocation.)

(0)
https://github.com/apache/jackrabbit-oak/blob/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/Jcr.java#L85
(1) http://docs.oracle.com/javase/7/docs/api/java/util/LinkedHashSet.html

>> 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()).

I like the idea. Can we list off the items that should be removed so
that we'll file an issue about it?

https://github.com/apache/jackrabbit-oak/blob/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/Jcr.java#L111

>> 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.

Makes sense.

Davide


Reply via email to