[
https://issues.apache.org/jira/browse/OAK-4512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15361395#comment-15361395
]
Chetan Mehrotra commented on OAK-4512:
--------------------------------------
Some quick comments
{noformat}
+ if (mountInfoProvider != null
+ && mountInfoProvider.hasNonDefaultMounts()) {
+ if (serviceRegistration == null) {
+ serviceRegistration =
bundleContext.registerService(PrivateStoreValidatorProvider.class.getName(),
this, null);
+ }
+ } else {
+ unregisterValidatorProvider();
+ }
{noformat}
For above flow
* mountInfoProvider would always be non null. So you can do away null checks.
If no mountInforProvider is present your component would not get activated
* Instance should be registered against
{{org.apache.jackrabbit.oak.spi.commit.EditorProvider}} otherwise it would not
get picked up by Oak
* No need to invoke unregisterValidatorProvider - If mountInfoProvider gets
changed/disabled then your component would get deactivate call which takes care
of deactivation
{noformat}
+ private String getCommitPath(String changeNodeName) {
+ String parentNodePath = path;
+
+ String commitPath = ROOT_PATH.equals(parentNodePath)
+ ? parentNodePath + changeNodeName
+ : parentNodePath + "/" + changeNodeName;
+
+ return commitPath;
{noformat}
You can use {{PathUtils.conact}} for that (from oak-commons) which take care of
root path handling also.
> Detect and log commits to the read-only stores
> ----------------------------------------------
>
> Key: OAK-4512
> URL: https://issues.apache.org/jira/browse/OAK-4512
> Project: Jackrabbit Oak
> Issue Type: Improvement
> Components: core
> Reporter: Florin Iordache
> Attachments: OAK-4512-patch.diff
>
>
> Since the read-only stores will be immutable we should be able to detect
> commits made against them and log an error message via a commit validation
> provider.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)