Hi,

On 09/01/18 15:19, Marco Piovesana wrote:
thanks Marcel,
I tried to use EmptyHook and empty CommitInfo just to try it out:

NodeBuilder newBuilder =
versionNodeState.builder().setProperty("custom:trashed", true);
nodeStore.merge(newBuilder, EmptyHook.INSTANCE, CommitInfo.EMPTY);

Hmm, what storage are you using? At least with a DocumentNodeStore that would fail with an exception because you need to pass the builder instance of the root node state to the merge method.

E.g. the NodeStoreTest shows how this is done:
https://github.com/apache/jackrabbit-oak/blob/1.8/oak-it/src/test/java/org/apache/jackrabbit/oak/spi/state/NodeStoreTest.java

but the modification applied to the builder is not applied to the
FrozenNode after the merge (no errors are displayed). Am I missing
something? The hooks are additional actions/validators or they are what
actually apply the modifications defined in the NodeBuilder?

They can perform additional modifications on the builder and validate changes.

Other question, as you pointed out this is a very delicate operation, is
there anything at a higher level that I can use to modify a FrozenNode
property?

You could move up to the Oak API [0]. This is the layer between the NodeStore and the JCR API. When you construct the Oak repository you would probably have to omit the version related editors, otherwise your changes will be rejected. The version store is considered protected and only well defined operations like checkin, checkout, etc. are allowed.

Regards
 Marcel

[0] https://jackrabbit.apache.org/oak/docs/oak_api/overview.html#Key_API_entry_points

Reply via email to