Index: oak-plugins/src/main/java/org/apache/jackrabbit/oak/nodetype/NodeTypeManager.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- oak-plugins/src/main/java/org/apache/jackrabbit/oak/nodetype/NodeTypeManager.java (revision ) +++ oak-plugins/src/main/java/org/apache/jackrabbit/oak/nodetype/NodeTypeManager.java (revision ) @@ -0,0 +1,36 @@ +/* + * 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.nodetype; + +import java.util.Iterator; +import javax.annotation.CheckForNull; +import javax.annotation.Nonnull; +import javax.jcr.RepositoryException; + +import org.apache.jackrabbit.oak.api.Tree; +import org.apache.jackrabbit.oak.spi.nodetype.DefinitionProvider; +import org.apache.jackrabbit.oak.spi.nodetype.EffectiveNodeTypeProvider; + +public interface NodeTypeManager extends EffectiveNodeTypeProvider, DefinitionProvider { + + boolean hasNodeType(@Nonnull String name) throws RepositoryException; + + boolean isNodeType(@Nonnull Tree tree, @Nonnull String name); + + boolean isNodeType(@CheckForNull String primaryTypeName, @Nonnull Iterator mixinTypes, + @Nonnull String nodeTypeName) throws RepositoryException; +} \ No newline at end of file Index: oak-parent/pom.xml IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- oak-parent/pom.xml (revision 1831704) +++ oak-parent/pom.xml (revision ) @@ -200,6 +200,7 @@ !org.apache.jackrabbit.oak.blob.cloud.azure.blobstorage !org.apache.jackrabbit.oak !org.apache.jackrabbit.oak.json + !org.apache.jackrabbit.oak.namepath.impl !org.apache.jackrabbit.oak.plugins.blob !org.apache.jackrabbit.oak.plugins.blob.datastore !org.apache.jackrabbit.oak.plugins.commit Index: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceManagementProviderService.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceManagementProviderService.java (revision ) +++ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceManagementProviderService.java (revision ) @@ -0,0 +1,39 @@ +/* + * 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.plugins.name; + +import javax.annotation.Nonnull; +import javax.jcr.NamespaceRegistry; + +import org.apache.jackrabbit.oak.api.Root; +import org.apache.jackrabbit.oak.namespace.NamespaceManagementProvider; +import org.apache.jackrabbit.oak.spi.commit.EditorProvider; +import org.osgi.service.component.annotations.Component; + +@Component(service = {NamespaceManagementProvider.class}, immediate = true) +public class NamespaceManagementProviderService implements NamespaceManagementProvider { + + @Override + public NamespaceRegistry getReadOnlyNamespaceRegistry(@Nonnull Root root) { + return new ReadOnlyNamespaceRegistry(root); + } + + @Override + public EditorProvider getEditorProvider() { + return new NamespaceEditorProvider(); + } +} \ No newline at end of file Index: oak-plugins/src/main/java/org/apache/jackrabbit/oak/nodetype/NodeTypeManagementProvider.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- oak-plugins/src/main/java/org/apache/jackrabbit/oak/nodetype/NodeTypeManagementProvider.java (revision ) +++ oak-plugins/src/main/java/org/apache/jackrabbit/oak/nodetype/NodeTypeManagementProvider.java (revision ) @@ -0,0 +1,43 @@ +/* + * 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.nodetype; + +import java.io.InputStream; +import java.util.function.Predicate; +import javax.annotation.Nonnull; + +import org.apache.jackrabbit.oak.api.Root; +import org.apache.jackrabbit.oak.namepath.NamePathMapper; +import org.apache.jackrabbit.oak.spi.commit.EditorProvider; +import org.apache.jackrabbit.oak.spi.state.NodeState; +import org.osgi.annotation.versioning.ProviderType; + +@ProviderType +public interface NodeTypeManagementProvider { + + @Nonnull + NodeTypeManager getReadOnlyNodeTypeManager(@Nonnull Root root, @Nonnull NamePathMapper namePathMapper); + + @Nonnull + Predicate getNodeTypePredicate(@Nonnull NodeState node, @Nonnull String... names); + + @Nonnull + EditorProvider getEditorProvider(boolean strict); + + void registerNodeTypes(@Nonnull Root root, @Nonnull InputStream input, @Nonnull String systemId); + +} \ No newline at end of file Index: oak-plugins/src/main/java/org/apache/jackrabbit/oak/identifier/IdentifierManagementProvider.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- oak-plugins/src/main/java/org/apache/jackrabbit/oak/identifier/IdentifierManagementProvider.java (revision ) +++ oak-plugins/src/main/java/org/apache/jackrabbit/oak/identifier/IdentifierManagementProvider.java (revision ) @@ -0,0 +1,30 @@ +/* + * 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.identifier; + +import javax.annotation.Nonnull; + +import org.apache.jackrabbit.oak.api.Root; +import org.osgi.annotation.versioning.ProviderType; + +@ProviderType +public interface IdentifierManagementProvider { + + @Nonnull + IdentifierManager getIdentifierManager(@Nonnull Root root); + +} \ No newline at end of file Index: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/VersionManagementProviderService.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/VersionManagementProviderService.java (revision ) +++ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/VersionManagementProviderService.java (revision ) @@ -0,0 +1,34 @@ +/* + * 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.plugins.version; + +import javax.annotation.Nonnull; + +import org.apache.jackrabbit.oak.api.Root; +import org.apache.jackrabbit.oak.namepath.NamePathMapper; +import org.apache.jackrabbit.oak.version.VersionManagementProvider; +import org.apache.jackrabbit.oak.version.VersionManager; +import org.osgi.service.component.annotations.Component; + +@Component(service = {VersionManagementProvider.class}, immediate = true) +public class VersionManagementProviderService implements VersionManagementProvider { + + @Override + public VersionManager getReadOnlyVersionManager(@Nonnull Root root, @Nonnull NamePathMapper namePathMapper) { + return ReadOnlyVersionManager.getInstance(root, namePathMapper); + } +} \ No newline at end of file Index: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/TypePredicate.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/TypePredicate.java (revision 1831704) +++ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/TypePredicate.java (revision ) @@ -18,17 +18,15 @@ import java.util.Arrays; import java.util.Set; - import javax.annotation.Nonnull; import javax.annotation.Nullable; import com.google.common.base.Predicate; import com.google.common.collect.Iterables; - import org.apache.jackrabbit.oak.api.Tree; +import org.apache.jackrabbit.oak.plugins.tree.TreeUtil; import org.apache.jackrabbit.oak.spi.state.ChildNodeEntry; import org.apache.jackrabbit.oak.spi.state.NodeState; -import org.apache.jackrabbit.oak.plugins.tree.TreeUtil; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Predicates.in; @@ -49,7 +47,7 @@ * * @since Oak 0.11 */ -public class TypePredicate implements Predicate { +public class TypePredicate implements Predicate, java.util.function.Predicate { @Nonnull public static TypePredicate isOrderable(@Nonnull NodeState root) { @@ -199,6 +197,13 @@ } } return false; + } + + //---------------------------------------< java.util.function.Predicate >--- + + @Override + public boolean test(@Nullable NodeState input) { + return apply(input); } //------------------------------------------------------------< Object >-- Index: oak-core/pom.xml IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- oak-core/pom.xml (revision 1831704) +++ oak-core/pom.xml (revision ) @@ -145,6 +145,11 @@ org.apache.jackrabbit + oak-plugins + ${project.version} + + + org.apache.jackrabbit oak-query-spi ${project.version} Index: oak-it-osgi/pom.xml IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- oak-it-osgi/pom.xml (revision 1831704) +++ oak-it-osgi/pom.xml (revision ) @@ -135,6 +135,12 @@ ${project.version} test + + org.apache.jackrabbit + oak-plugins + ${project.version} + test + org.ops4j.pax.exam Index: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/identifier/IdentifierManagementProviderService.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/identifier/IdentifierManagementProviderService.java (revision ) +++ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/identifier/IdentifierManagementProviderService.java (revision ) @@ -0,0 +1,33 @@ +/* + * 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.plugins.identifier; + +import javax.annotation.Nonnull; + +import org.apache.jackrabbit.oak.api.Root; +import org.apache.jackrabbit.oak.identifier.IdentifierManagementProvider; +import org.apache.jackrabbit.oak.identifier.IdentifierManager; +import org.osgi.service.component.annotations.Component; + +@Component(service = {IdentifierManagementProvider.class}, immediate = true) +public class IdentifierManagementProviderService implements IdentifierManagementProvider { + + @Override + public IdentifierManager getIdentifierManager(@Nonnull Root root) { + return new org.apache.jackrabbit.oak.plugins.identifier.IdentifierManager(root); + } +} \ No newline at end of file Index: oak-plugins/pom.xml IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- oak-plugins/pom.xml (revision ) +++ oak-plugins/pom.xml (revision ) @@ -0,0 +1,224 @@ + + + + + org.apache.jackrabbit + oak-parent + 1.10-SNAPSHOT + ../oak-parent/pom.xml + + 4.0.0 + + oak-plugins + Oak Plugins + bundle + + + + + org.apache.felix + maven-bundle-plugin + + + + org.apache.jackrabbit.oak.identifier, + org.apache.jackrabbit.oak.namespace, + org.apache.jackrabbit.oak.nodetype, + org.apache.jackrabbit.oak.version + + + + + + org.apache.rat + apache-rat-plugin + + + **/test-file-1.csv + **/test-file-1.txt + **/test-file-2.txt + **/test-file-2.csv + + + + + org.apache.felix + maven-bundle-plugin + 3.3.0 + true + true + + + org.apache.felix + org.apache.felix.scr.bnd + 1.9.0 + + + + biz.aQute.bnd + bnd + + + + + biz.aQute.bnd + biz.aQute.bndlib + 3.3.0 + + + + true + NONE + + oak + + http://jackrabbit.apache.org/oak/ + + The Apache Software Foundation + + <_nodefaultversion>true + + <_plugin>org.apache.felix.scrplugin.bnd.SCRDescriptorBndPlugin;destdir=${project.build.outputDirectory}; + + + + + baseline + + baseline + + pre-integration-test + + false + false + true + + 1.10-SNAPSHOT + + * + + + + + + scr-metadata + + manifest + + + true + + + + + + + + + + + org.osgi + org.osgi.core + provided + + + org.osgi + org.osgi.compendium + provided + + + org.osgi + org.osgi.annotation + provided + + + + + javax.jcr + jcr + 2.0 + + + org.apache.jackrabbit + jackrabbit-jcr-commons + ${jackrabbit.version} + + + org.apache.jackrabbit + jackrabbit-api + ${jackrabbit.version} + + + + + org.apache.jackrabbit + oak-api + ${project.version} + + + org.apache.jackrabbit + oak-commons + ${project.version} + + + org.apache.jackrabbit + oak-core-spi + ${project.version} + + + org.apache.jackrabbit + oak-store-spi + ${project.version} + + + + + org.slf4j + slf4j-api + + + + + com.google.code.findbugs + jsr305 + + + + + junit + junit + test + + + ch.qos.logback + logback-classic + test + + + org.mockito + mockito-core + 1.10.19 + test + + + + \ No newline at end of file Index: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadOnlyNodeTypeManager.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadOnlyNodeTypeManager.java (revision 1831704) +++ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadOnlyNodeTypeManager.java (revision ) @@ -66,7 +66,7 @@ * related to node type modifications throw * {@link UnsupportedRepositoryOperationException}. */ -public abstract class ReadOnlyNodeTypeManager implements NodeTypeManager, EffectiveNodeTypeProvider, DefinitionProvider { +public abstract class ReadOnlyNodeTypeManager implements NodeTypeManager, org.apache.jackrabbit.oak.nodetype.NodeTypeManager, EffectiveNodeTypeProvider, DefinitionProvider { /** * Returns the internal name for the specified JCR name. Index: oak-plugins/src/main/java/org/apache/jackrabbit/oak/namespace/NamespaceManagementProvider.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- oak-plugins/src/main/java/org/apache/jackrabbit/oak/namespace/NamespaceManagementProvider.java (revision ) +++ oak-plugins/src/main/java/org/apache/jackrabbit/oak/namespace/NamespaceManagementProvider.java (revision ) @@ -0,0 +1,32 @@ +/* + * 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.namespace; + +import javax.annotation.Nonnull; +import javax.jcr.NamespaceRegistry; + +import org.apache.jackrabbit.oak.api.Root; +import org.apache.jackrabbit.oak.spi.commit.EditorProvider; +import org.osgi.annotation.versioning.ProviderType; + +@ProviderType +public interface NamespaceManagementProvider { + + NamespaceRegistry getReadOnlyNamespaceRegistry(@Nonnull Root root); + + EditorProvider getEditorProvider(); +} \ No newline at end of file Index: pom.xml IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- pom.xml (revision 1831704) +++ pom.xml (revision ) @@ -45,6 +45,7 @@ oak-security-spi oak-store-composite oak-store-document + oak-plugins oak-blob-plugins oak-blob Index: oak-it-osgi/test-bundles.xml IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- oak-it-osgi/test-bundles.xml (revision 1831704) +++ oak-it-osgi/test-bundles.xml (revision ) @@ -50,6 +50,7 @@ org.apache.jackrabbit:oak-query-spi org.apache.jackrabbit:oak-security-spi org.apache.jackrabbit:oak-blob-plugins + org.apache.jackrabbit:oak-plugins io.dropwizard.metrics:metrics-core Index: oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/impl/NamePathMapperImpl.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/impl/NamePathMapperImpl.java (revision 1831704) +++ oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/impl/NamePathMapperImpl.java (revision ) @@ -28,7 +28,7 @@ import org.apache.jackrabbit.oak.namepath.JcrPathParser.Listener; import org.apache.jackrabbit.oak.namepath.NameMapper; import org.apache.jackrabbit.oak.namepath.NamePathMapper; -import org.apache.jackrabbit.oak.plugins.identifier.IdentifierManager; +import org.apache.jackrabbit.oak.identifier.IdentifierManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -48,6 +48,11 @@ public NamePathMapperImpl(NameMapper nameMapper) { this.nameMapper = nameMapper; this.idManager = null; + } + + public NamePathMapperImpl(NameMapper nameMapper, org.apache.jackrabbit.oak.plugins.identifier.IdentifierManager idManager) { + this.nameMapper = nameMapper; + this.idManager = idManager; } public NamePathMapperImpl(NameMapper nameMapper, IdentifierManager idManager) { Index: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/ReadOnlyVersionManager.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/ReadOnlyVersionManager.java (revision 1831704) +++ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/ReadOnlyVersionManager.java (revision ) @@ -35,6 +35,7 @@ import org.apache.jackrabbit.oak.plugins.tree.factories.TreeFactory; import org.apache.jackrabbit.oak.spi.state.NodeState; import org.apache.jackrabbit.oak.plugins.tree.TreeUtil; +import org.apache.jackrabbit.oak.version.VersionManager; import org.apache.jackrabbit.oak.spi.version.VersionConstants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -45,7 +46,7 @@ * {@code ReadOnlyVersionManager} provides implementations for read-only * version operations modeled after the ones available in {@link javax.jcr.version.VersionManager}. */ -public abstract class ReadOnlyVersionManager { +public abstract class ReadOnlyVersionManager implements VersionManager { private static final Logger log = LoggerFactory.getLogger(ReadOnlyVersionManager.class); @@ -104,6 +105,11 @@ }; } + @Override + public boolean isVersionStorageTree(@Nonnull Tree tree) { + return isVersionStoreTree(tree); + } + /** * Returns {@code true} if the tree is checked out; otherwise * {@code false}. The root node is always considered checked out. @@ -111,6 +117,7 @@ * @param tree the tree to check. * @return whether the tree is checked out or not. */ + @Override public boolean isCheckedOut(@Nonnull Tree tree) { if (checkNotNull(tree).exists()) { PropertyState p = tree.getProperty(VersionConstants.JCR_ISCHECKEDOUT); @@ -145,6 +152,7 @@ * @throws RepositoryException if an error occurs while checking the node * type of the tree. */ + @Override @CheckForNull public Tree getVersionHistory(@Nonnull Tree versionable) throws UnsupportedRepositoryOperationException, @@ -160,6 +168,7 @@ * @param uuid the uuid of the version tree. * @return the version tree or {@code null} if there is none. */ + @Override @CheckForNull public Tree getVersion(@Nonnull String uuid) { return getIdentifierManager().getTree(uuid); @@ -173,6 +182,7 @@ * @param uuid the uuid of the versionable node * @return the relative path of the version history for the given uuid. */ + @Override @Nonnull public String getVersionHistoryPath(@Nonnull String uuid) { String relPath = ""; @@ -196,6 +206,7 @@ * @throws RepositoryException if an error occurs while checking the node * type of the tree. */ + @Override @CheckForNull public Tree getBaseVersion(@Nonnull Tree versionable) throws UnsupportedRepositoryOperationException, @@ -255,6 +266,7 @@ * * @see VersionConstants#MIX_REP_VERSIONABLE_PATHS */ + @Override @CheckForNull public Tree getVersionable(@Nonnull Tree versionTree, @Nonnull String workspaceName) { Root root = getWorkspaceRoot(); Index: oak-plugins/src/main/java/org/apache/jackrabbit/oak/version/VersionManager.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- oak-plugins/src/main/java/org/apache/jackrabbit/oak/version/VersionManager.java (revision ) +++ oak-plugins/src/main/java/org/apache/jackrabbit/oak/version/VersionManager.java (revision ) @@ -0,0 +1,50 @@ +/* + * 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.version; + +import javax.annotation.CheckForNull; +import javax.annotation.Nonnull; +import javax.jcr.RepositoryException; +import javax.jcr.UnsupportedRepositoryOperationException; + +import org.apache.jackrabbit.oak.api.Tree; +import org.osgi.annotation.versioning.ProviderType; + +@ProviderType +public interface VersionManager { + + boolean isVersionStorageTree(@Nonnull Tree tree); + + boolean isCheckedOut(@Nonnull Tree tree); + + @CheckForNull + Tree getVersionHistory(@Nonnull Tree versionable) throws UnsupportedRepositoryOperationException, RepositoryException; + + @CheckForNull + Tree getVersion(@Nonnull String uuid); + + @Nonnull + String getVersionHistoryPath(@Nonnull String uuid); + + @CheckForNull + Tree getBaseVersion(@Nonnull Tree versionable) throws UnsupportedRepositoryOperationException, RepositoryException; + + @CheckForNull + Tree getVersionable(@Nonnull Tree versionTree, @Nonnull String workspaceName); +} Index: oak-plugins/src/main/java/org/apache/jackrabbit/oak/identifier/IdentifierManager.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- oak-plugins/src/main/java/org/apache/jackrabbit/oak/identifier/IdentifierManager.java (revision ) +++ oak-plugins/src/main/java/org/apache/jackrabbit/oak/identifier/IdentifierManager.java (revision ) @@ -0,0 +1,113 @@ +/* + * 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.identifier; + +import javax.annotation.CheckForNull; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import org.apache.jackrabbit.oak.api.PropertyState; +import org.apache.jackrabbit.oak.api.PropertyValue; +import org.apache.jackrabbit.oak.api.Tree; + +public interface IdentifierManager { + + /** + * Return the identifier of a tree. + * + * @param tree a tree + * @return identifier of {@code tree} + */ + @Nonnull + String getIdentifierFromTree(Tree tree); + + /** + * The possibly non existing tree identified by the specified {@code identifier} or {@code null}. + * + * @param identifier The identifier of the tree such as exposed by {@link #getIdentifier(Tree)} + * @return The tree with the given {@code identifier} or {@code null} if no + * such tree exists. + */ + @CheckForNull + Tree getTree(@Nonnull String identifier); + + /** + * The path of the tree identified by the specified {@code identifier} or {@code null}. + * + * @param identifier The identifier of the tree such as exposed by {@link #getIdentifier(Tree)} + * @return The path of the tree with the given {@code identifier} or {@code null} if no + * such tree exists or if the tree is not accessible. + */ + @CheckForNull + String getPath(@Nonnull String identifier); + + /** + * Returns the path of the tree references by the specified (weak) + * reference {@code PropertyState}. + * + * @param referenceValue A (weak) reference value. + * @return The tree with the given {@code identifier} or {@code null} if no + * such tree exists or isn't accessible to the content session. + */ + @CheckForNull + String getPath(@Nonnull PropertyState referenceValue); + + /** + * Returns the path of the tree references by the specified (weak) + * reference {@code PropertyState}. + * + * @param referenceValue A (weak) reference value. + * @return The tree with the given {@code identifier} or {@code null} if no + * such tree exists or isn't accessible to the content session. + */ + @CheckForNull + String getPath(@Nonnull PropertyValue referenceValue); + + /** + * Searches all reference properties to the specified {@code tree} that match + * the given name and node type constraints. + * + * @param weak if {@code true} only weak references are returned. Otherwise only + * hard references are returned. + * @param tree The tree for which references should be searched. + * @param propertyName A name constraint for the reference properties; + * {@code null} if no constraint should be enforced. + * @return A set of oak paths of those reference properties referring to the + * specified {@code tree} and matching the constraints. + */ + @Nonnull + Iterable getReferences(boolean weak, @Nonnull Tree tree, @Nullable final String propertyName); + + /** + * Searches all reference properties to the specified {@code tree} that match + * the given {@code propertyName} and the specified, mandatory node type + * constraint ({@code ntName}). In contrast to {@link #getReferences} this + * method requires all parameters to be specified, which eases the handling + * of the result set and doesn't require the trees associated with the + * result set to be resolved. + * + * @param tree The tree for which references should be searched. + * @param propertyName The name of the reference properties. + * @param ntName The node type name to be used for the query. + * @param weak if {@code true} only weak references are returned. Otherwise on hard references are returned. + * @return A set of oak paths of those reference properties referring to the + * specified {@code tree} and matching the constraints. + */ + @Nonnull + public Iterable getReferences(@Nonnull Tree tree, @Nonnull final String propertyName, + @Nonnull String ntName, boolean weak); +} \ No newline at end of file Index: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeTypeManagementProviderService.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeTypeManagementProviderService.java (revision ) +++ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeTypeManagementProviderService.java (revision ) @@ -0,0 +1,57 @@ +/* + * 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.plugins.nodetype; + +import java.io.InputStream; +import java.util.function.Predicate; +import javax.annotation.Nonnull; + +import org.apache.jackrabbit.oak.api.Root; +import org.apache.jackrabbit.oak.namepath.NamePathMapper; +import org.apache.jackrabbit.oak.nodetype.NodeTypeManagementProvider; +import org.apache.jackrabbit.oak.nodetype.NodeTypeManager; +import org.apache.jackrabbit.oak.plugins.nodetype.write.NodeTypeRegistry; +import org.apache.jackrabbit.oak.spi.commit.EditorProvider; +import org.apache.jackrabbit.oak.spi.state.NodeState; +import org.osgi.service.component.annotations.Component; + +@Component(service = {NodeTypeManagementProvider.class}, immediate = true) +public class NodeTypeManagementProviderService implements NodeTypeManagementProvider { + + @Nonnull + @Override + public NodeTypeManager getReadOnlyNodeTypeManager(@Nonnull Root root, @Nonnull NamePathMapper namePathMapper) { + return ReadOnlyNodeTypeManager.getInstance(root, namePathMapper); + } + + @Nonnull + @Override + public Predicate getNodeTypePredicate(@Nonnull NodeState node, @Nonnull String... names) { + return new TypePredicate(node, names); + } + + @Nonnull + @Override + public EditorProvider getEditorProvider(boolean strict) { + return new TypeEditorProvider(strict); + } + + @Override + public void registerNodeTypes(@Nonnull Root root, @Nonnull InputStream input, @Nonnull String systemId) { + NodeTypeRegistry.register(root, input, systemId); + } +} \ No newline at end of file Index: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/identifier/IdentifierManager.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/identifier/IdentifierManager.java (revision 1831704) +++ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/identifier/IdentifierManager.java (revision ) @@ -61,7 +61,7 @@ /** * TODO document */ -public class IdentifierManager { +public class IdentifierManager implements org.apache.jackrabbit.oak.identifier.IdentifierManager { private static final Logger log = LoggerFactory.getLogger(IdentifierManager.class); @@ -115,6 +115,12 @@ } } + @Nonnull + @Override + public String getIdentifierFromTree(Tree tree) { + return getIdentifier(tree); + } + /** * The possibly non existing tree identified by the specified {@code identifier} or {@code null}. * @@ -123,6 +129,7 @@ * such tree exists. */ @CheckForNull + @Override public Tree getTree(String identifier) { if (identifier.startsWith("/")) { return root.getTree(identifier); @@ -153,6 +160,7 @@ * such tree exists or if the tree is not accessible. */ @CheckForNull + @Override public String getPath(String identifier) { Tree tree = getTree(identifier); return tree != null && tree.exists() @@ -169,6 +177,7 @@ * such tree exists or isn't accessible to the content session. */ @CheckForNull + @Override public String getPath(PropertyState referenceValue) { int type = referenceValue.getType().tag(); if (type == PropertyType.REFERENCE || type == PropertyType.WEAKREFERENCE) { @@ -187,6 +196,7 @@ * such tree exists or isn't accessible to the content session. */ @CheckForNull + @Override public String getPath(PropertyValue referenceValue) { int type = referenceValue.getType().tag(); if (type == PropertyType.REFERENCE || type == PropertyType.WEAKREFERENCE) { @@ -209,6 +219,7 @@ * specified {@code tree} and matching the constraints. */ @Nonnull + @Override public Iterable getReferences(boolean weak, @Nonnull Tree tree, @Nullable final String propertyName) { if (!effectiveNodeTypeProvider.isNodeType(tree, JcrConstants.MIX_REFERENCEABLE)) { return Collections.emptySet(); // shortcut @@ -301,6 +312,7 @@ * specified {@code tree} and matching the constraints. */ @Nonnull + @Override public Iterable getReferences(@Nonnull Tree tree, @Nonnull final String propertyName, @Nonnull String ntName, boolean weak) { if (!effectiveNodeTypeProvider.isNodeType(tree, JcrConstants.MIX_REFERENCEABLE)) { \ No newline at end of file Index: oak-plugins/src/main/java/org/apache/jackrabbit/oak/version/VersionManagementProvider.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- oak-plugins/src/main/java/org/apache/jackrabbit/oak/version/VersionManagementProvider.java (revision ) +++ oak-plugins/src/main/java/org/apache/jackrabbit/oak/version/VersionManagementProvider.java (revision ) @@ -0,0 +1,30 @@ +/* + * 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.version; + +import javax.annotation.Nonnull; + +import org.apache.jackrabbit.oak.api.Root; +import org.apache.jackrabbit.oak.namepath.NamePathMapper; +import org.osgi.annotation.versioning.ProviderType; + +@ProviderType +public interface VersionManagementProvider { + + @Nonnull + VersionManager getReadOnlyVersionManager(@Nonnull Root root, @Nonnull NamePathMapper namePathMapper); +} \ No newline at end of file