You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by GitBox <gi...@apache.org> on 2021/12/16 15:28:37 UTC

[GitHub] [jackrabbit-oak] jelmini opened a new pull request #443: OAK-9553: Add config support for multiple mounts in CompositeNodeStore

jelmini opened a new pull request #443:
URL: https://github.com/apache/jackrabbit-oak/pull/443


   Add MountInfoConfig configuration factory, which can be used to
   configure multiple read-only mounts.
   MountInfoProviderService can now be configured with the list of expected
   mounts, so it can wait for all of them before registering a
   MountInfoProvider.
   For backward-compatibility, MountInfoProviderService can still be used
   to configure a single read-only mount, but all such properties are now
   marked as deprecated.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [jackrabbit-oak] jelmini commented on a change in pull request #443: OAK-9553: Add config support for multiple mounts in CompositeNodeStore

Posted by GitBox <gi...@apache.org>.
jelmini commented on a change in pull request #443:
URL: https://github.com/apache/jackrabbit-oak/pull/443#discussion_r783361918



##########
File path: oak-store-composite/src/main/java/org/apache/jackrabbit/oak/composite/package-info.java
##########
@@ -55,7 +55,7 @@
  *  This is obviously correct but may be slow.
  *  {@link org.apache.jackrabbit.oak.composite.CompositionContext#getContributingStores(java.lang.String, java.util.function.Function)}
  */
-@Version("0.3.0")
+@Version("0.4.0")

Review comment:
       As discussed, bumping now to 1.0.0 could break user code. Best done in a separate PR.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [jackrabbit-oak] jelmini commented on pull request #443: OAK-9553: Add config support for multiple mounts in CompositeNodeStore

Posted by GitBox <gi...@apache.org>.
jelmini commented on pull request #443:
URL: https://github.com/apache/jackrabbit-oak/pull/443#issuecomment-1021153326


   Added integration tests using Pax Exam in oak-store-composite, validating the new configuration of multiple read-only mounts, as well as backward compatibility with previous configuration.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [jackrabbit-oak] kwin commented on a change in pull request #443: OAK-9553: Add config support for multiple mounts in CompositeNodeStore

Posted by GitBox <gi...@apache.org>.
kwin commented on a change in pull request #443:
URL: https://github.com/apache/jackrabbit-oak/pull/443#discussion_r777996601



##########
File path: oak-store-composite/src/main/java/org/apache/jackrabbit/oak/composite/MountInfoConfig.java
##########
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.jackrabbit.oak.composite;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.PropertyUnbounded;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.jackrabbit.oak.commons.PropertiesUtil;
+import org.osgi.framework.BundleContext;
+
+import static java.util.stream.Collectors.toList;
+
+@Component(label = "Apache Jackrabbit Oak MountInfo Config", configurationFactory = true, metatype = true)

Review comment:
       Compare also with the ongoing effort tracked in https://issues.apache.org/jira/browse/OAK-6741. Mixing both approaches in the same module shouldn't be a problem.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [jackrabbit-oak] smiroslav merged pull request #443: OAK-9553: Add config support for multiple mounts in CompositeNodeStore

Posted by GitBox <gi...@apache.org>.
smiroslav merged pull request #443:
URL: https://github.com/apache/jackrabbit-oak/pull/443


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [jackrabbit-oak] jelmini commented on a change in pull request #443: OAK-9553: Add config support for multiple mounts in CompositeNodeStore

Posted by GitBox <gi...@apache.org>.
jelmini commented on a change in pull request #443:
URL: https://github.com/apache/jackrabbit-oak/pull/443#discussion_r782839691



##########
File path: oak-store-composite/src/main/java/org/apache/jackrabbit/oak/composite/MountInfoConfig.java
##########
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.jackrabbit.oak.composite;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.PropertyUnbounded;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.jackrabbit.oak.commons.PropertiesUtil;
+import org.osgi.framework.BundleContext;
+
+import static java.util.stream.Collectors.toList;
+
+@Component(label = "Apache Jackrabbit Oak MountInfo Config", configurationFactory = true, metatype = true)

Review comment:
       Thanks for your suggestion, @kwin. I have migrated the classes touched by this PR to the official OSGi component annotations. 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [jackrabbit-oak] jelmini commented on pull request #443: OAK-9553: Add config support for multiple mounts in CompositeNodeStore

Posted by GitBox <gi...@apache.org>.
jelmini commented on pull request #443:
URL: https://github.com/apache/jackrabbit-oak/pull/443#issuecomment-1021153326


   Added integration tests using Pax Exam in oak-store-composite, validating the new configuration of multiple read-only mounts, as well as backward compatibility with previous configuration.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [jackrabbit-oak] kwin commented on a change in pull request #443: OAK-9553: Add config support for multiple mounts in CompositeNodeStore

Posted by GitBox <gi...@apache.org>.
kwin commented on a change in pull request #443:
URL: https://github.com/apache/jackrabbit-oak/pull/443#discussion_r777994875



##########
File path: oak-store-composite/src/main/java/org/apache/jackrabbit/oak/composite/MountInfoConfig.java
##########
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.jackrabbit.oak.composite;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.PropertyUnbounded;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.jackrabbit.oak.commons.PropertiesUtil;
+import org.osgi.framework.BundleContext;
+
+import static java.util.stream.Collectors.toList;
+
+@Component(label = "Apache Jackrabbit Oak MountInfo Config", configurationFactory = true, metatype = true)

Review comment:
       For new components rather use the official OSGi component annotations: https://github.com/apache/jackrabbit-oak/blob/9a2cf021772ac577d161f1409ada6edd9642a441/oak-parent/pom.xml#L548

##########
File path: oak-store-composite/src/main/java/org/apache/jackrabbit/oak/composite/MountInfoConfig.java
##########
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.jackrabbit.oak.composite;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.PropertyUnbounded;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.jackrabbit.oak.commons.PropertiesUtil;
+import org.osgi.framework.BundleContext;
+
+import static java.util.stream.Collectors.toList;
+
+@Component(label = "Apache Jackrabbit Oak MountInfo Config", configurationFactory = true, metatype = true)
+@Service(MountInfoConfig.class)
+public class MountInfoConfig {
+
+    private static final String[] PROP_MOUNTED_PATHS_DEFAULT = {};
+
+    @Property(label = "Mounted paths",
+        unbounded = PropertyUnbounded.ARRAY,
+        description = "Paths which are part of private mount"
+    )
+    private static final String PROP_MOUNT_PATHS = "mountedPaths";
+    private List<String> paths;
+
+    static final String PROP_MOUNT_NAME_DEFAULT = "private";
+
+    @Property(label = "Mount name",
+        description = "Name of the mount",
+        value = PROP_MOUNT_NAME_DEFAULT
+    )
+    private static final String PROP_MOUNT_NAME = "mountName";
+    private String mountName;
+
+    private static final String[] PROP_PATHS_SUPPORTING_FRAGMENTS_DEFAULT = {"/"};
+
+    @Property(label = "Paths supporting fragments",
+        unbounded = PropertyUnbounded.ARRAY,
+        description = "oak:mount-* under this paths will be included to mounts",
+        value = {"/"}
+    )
+    private static final String PROP_PATHS_SUPPORTING_FRAGMENTS = "pathsSupportingFragments";
+    private List<String> pathsSupportingFragments;
+
+    private static final boolean PROP_MOUNT_READONLY_DEFAULT = true;
+
+    @Property(label = "Readonly",
+        description = "If enabled then mount would be considered as readonly",
+        boolValue = PROP_MOUNT_READONLY_DEFAULT
+    )
+    private static final String PROP_MOUNT_READONLY = "readOnlyMount";
+
+    private boolean readOnly;
+
+    public MountInfoConfig() {
+    }
+
+    MountInfoConfig(String mountName, List<String> paths, List<String> pathsSupportingFragments, boolean readOnly) {
+        this.mountName = mountName;
+        this.paths = trimAll(paths);
+        this.pathsSupportingFragments = trimAll(pathsSupportingFragments);
+        this.readOnly = readOnly;
+    }
+
+    @Activate
+    private void activate(BundleContext bundleContext, Map<String, ?> config) {

Review comment:
       You should use component property types to ease dealing with defaults and generating meta type information at the same time.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [jackrabbit-oak] jelmini commented on a change in pull request #443: OAK-9553: Add config support for multiple mounts in CompositeNodeStore

Posted by GitBox <gi...@apache.org>.
jelmini commented on a change in pull request #443:
URL: https://github.com/apache/jackrabbit-oak/pull/443#discussion_r782848325



##########
File path: oak-store-composite/src/main/java/org/apache/jackrabbit/oak/composite/MountInfoConfig.java
##########
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.jackrabbit.oak.composite;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.PropertyUnbounded;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.jackrabbit.oak.commons.PropertiesUtil;
+import org.osgi.framework.BundleContext;
+
+import static java.util.stream.Collectors.toList;
+
+@Component(label = "Apache Jackrabbit Oak MountInfo Config", configurationFactory = true, metatype = true)
+@Service(MountInfoConfig.class)
+public class MountInfoConfig {
+
+    private static final String[] PROP_MOUNTED_PATHS_DEFAULT = {};
+
+    @Property(label = "Mounted paths",
+        unbounded = PropertyUnbounded.ARRAY,
+        description = "Paths which are part of private mount"
+    )
+    private static final String PROP_MOUNT_PATHS = "mountedPaths";
+    private List<String> paths;
+
+    static final String PROP_MOUNT_NAME_DEFAULT = "private";
+
+    @Property(label = "Mount name",
+        description = "Name of the mount",
+        value = PROP_MOUNT_NAME_DEFAULT
+    )
+    private static final String PROP_MOUNT_NAME = "mountName";
+    private String mountName;
+
+    private static final String[] PROP_PATHS_SUPPORTING_FRAGMENTS_DEFAULT = {"/"};
+
+    @Property(label = "Paths supporting fragments",
+        unbounded = PropertyUnbounded.ARRAY,
+        description = "oak:mount-* under this paths will be included to mounts",
+        value = {"/"}
+    )
+    private static final String PROP_PATHS_SUPPORTING_FRAGMENTS = "pathsSupportingFragments";
+    private List<String> pathsSupportingFragments;
+
+    private static final boolean PROP_MOUNT_READONLY_DEFAULT = true;
+
+    @Property(label = "Readonly",
+        description = "If enabled then mount would be considered as readonly",
+        boolValue = PROP_MOUNT_READONLY_DEFAULT
+    )
+    private static final String PROP_MOUNT_READONLY = "readOnlyMount";
+
+    private boolean readOnly;
+
+    public MountInfoConfig() {
+    }
+
+    MountInfoConfig(String mountName, List<String> paths, List<String> pathsSupportingFragments, boolean readOnly) {
+        this.mountName = mountName;
+        this.paths = trimAll(paths);
+        this.pathsSupportingFragments = trimAll(pathsSupportingFragments);
+        this.readOnly = readOnly;
+    }
+
+    @Activate
+    private void activate(BundleContext bundleContext, Map<String, ?> config) {

Review comment:
       In the context of moving to the official OSGi component annotations, the properties are now defined on an `@interface` annotated with `@ObjectClassDefinition` and `@AttributeDefinition`. 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [jackrabbit-oak] smiroslav commented on a change in pull request #443: OAK-9553: Add config support for multiple mounts in CompositeNodeStore

Posted by GitBox <gi...@apache.org>.
smiroslav commented on a change in pull request #443:
URL: https://github.com/apache/jackrabbit-oak/pull/443#discussion_r781353965



##########
File path: oak-store-composite/src/main/java/org/apache/jackrabbit/oak/composite/package-info.java
##########
@@ -55,7 +55,7 @@
  *  This is obviously correct but may be slow.
  *  {@link org.apache.jackrabbit.oak.composite.CompositionContext#getContributingStores(java.lang.String, java.util.function.Function)}
  */
-@Version("0.3.0")
+@Version("0.4.0")

Review comment:
       According to guideline below, this should be 1.0.0
   https://semver.org/#how-do-i-know-when-to-release-100




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org