Search in sources :

Example 21 with Mount

use of org.apache.jackrabbit.oak.spi.mount.Mount in project jackrabbit-oak by apache.

the class MultiplexingIndexWriter method deleteDocuments.

@Override
public void deleteDocuments(String path) throws IOException {
    Mount mount = mountInfoProvider.getMountByPath(path);
    getWriter(mount).deleteDocuments(path);
    // Note that one mount cannot be part of another mount
    if (mount.isDefault()) {
        // If any mount falls under given path then delete all documents in that
        for (Mount m : mountInfoProvider.getMountsPlacedUnder(path)) {
            getWriter(m).deleteAll();
        }
    }
}
Also used : Mount(org.apache.jackrabbit.oak.spi.mount.Mount)

Example 22 with Mount

use of org.apache.jackrabbit.oak.spi.mount.Mount in project jackrabbit-oak by apache.

the class NodeCounterEditor method leaveNew.

public void leaveNew(NodeState before, NodeState after) throws CommitFailedException {
    if (countOffsets.isEmpty()) {
        return;
    }
    root.callback.indexUpdate();
    for (Map.Entry<Mount, Integer> e : countOffsets.entrySet()) {
        NodeBuilder builder = getBuilder(e.getKey());
        int countOffset = e.getValue();
        PropertyState p = builder.getProperty(COUNT_HASH_PROPERTY_NAME);
        long count = p == null ? 0 : p.getValue(Type.LONG);
        count += countOffset;
        if (count <= 0) {
            if (builder.getChildNodeCount(1) >= 0) {
                builder.removeProperty(COUNT_HASH_PROPERTY_NAME);
            } else {
                builder.remove();
            }
        } else {
            builder.setProperty(COUNT_HASH_PROPERTY_NAME, count);
        }
    }
}
Also used : Mount(org.apache.jackrabbit.oak.spi.mount.Mount) NodeBuilder(org.apache.jackrabbit.oak.spi.state.NodeBuilder) HashMap(java.util.HashMap) Map(java.util.Map) PropertyState(org.apache.jackrabbit.oak.api.PropertyState)

Aggregations

Mount (org.apache.jackrabbit.oak.spi.mount.Mount)22 Test (org.junit.Test)9 MountInfoProvider (org.apache.jackrabbit.oak.spi.mount.MountInfoProvider)7 NodeBuilder (org.apache.jackrabbit.oak.spi.state.NodeBuilder)5 Map (java.util.Map)3 PropertyState (org.apache.jackrabbit.oak.api.PropertyState)3 NodeState (org.apache.jackrabbit.oak.spi.state.NodeState)3 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 Tree (org.apache.jackrabbit.oak.api.Tree)2 IndexUpdateProvider (org.apache.jackrabbit.oak.plugins.index.IndexUpdateProvider)2 EmptyNodeState (org.apache.jackrabbit.oak.plugins.memory.EmptyNodeState)2 EditorHook (org.apache.jackrabbit.oak.spi.commit.EditorHook)2 Mounts.defaultMountInfoProvider (org.apache.jackrabbit.oak.spi.mount.Mounts.defaultMountInfoProvider)2 SimpleMountInfoProvider (org.apache.jackrabbit.oak.spi.mount.SimpleMountInfoProvider)2 ImmutableList (com.google.common.collect.ImmutableList)1 Maps.newHashMap (com.google.common.collect.Maps.newHashMap)1 Sets.newIdentityHashSet (com.google.common.collect.Sets.newIdentityHashSet)1 Principal (java.security.Principal)1 Collection (java.util.Collection)1