> Hmm, what storage are you using? At least with a DocumentNodeStore that > would fail with an exception because you need to pass the builder
I'm using a SegmentNodeStore with a FileDataStore: File repositoryFile = new File(repositoryRootFolder, "repository"); File dataStoreFile = new File(repositoryRootFolder, "datastore"); FileDataStore fileDataStore = new FileDataStore(); fileDataStore.init(dataStoreFile.getAbsolutePath()); DataStoreBlobStore dataStoreBlobStore = new DataStoreBlobStore(fileDataStore); FileStore fileStore = FileStoreBuilder.fileStoreBuilder(repositoryFile).withBlobStore(dataStoreBlobStore).build(); NodeStore nodeStore = SegmentNodeStoreBuilders.builder(fileStore).build(); Jcr jcr = new Jcr(new Oak(nodeStore)).with(new InitialContent()).with(new SecurityProviderImpl()); > 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. I tried to create a custom VersionHook with no version providers, then I created the Oak object with that hook, but it did not work. It fails inside NodeDelegate.isProtected when checking if is a protected type. Did I do something wrong? Marco. On Wed, Jan 10, 2018 at 8:56 AM Marcel Reutegger <[email protected]> wrote: > 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 >
