Search in sources :

Example 16 with PathFilter

use of org.apache.jackrabbit.oak.spi.filter.PathFilter in project jackrabbit-oak by apache.

the class SecondaryStoreCacheService method activate.

@Activate
private void activate(BundleContext context, Configuration config) {
    bundleContext = context;
    whiteboard = new OsgiWhiteboard(context);
    String[] includedPaths = config.includedPaths();
    // TODO Support for exclude is not possible as once a NodeState is loaded from secondary
    // store it assumes that complete subtree is in same store. With exclude it would need to
    // check for each child access and route to primary
    pathFilter = new PathFilter(asList(includedPaths), Collections.<String>emptyList());
    SecondaryStoreBuilder builder = new SecondaryStoreBuilder(secondaryStoreProvider.getNodeStore()).differ(differ).metaPropNames(DocumentNodeStore.META_PROP_NAMES).statisticsProvider(statisticsProvider).pathFilter(pathFilter);
    SecondaryStoreCache cache = builder.buildCache();
    SecondaryStoreObserver observer = builder.buildObserver(cache);
    registerObserver(observer, config);
    regs.add(bundleContext.registerService(DocumentNodeStateCache.class.getName(), cache, null));
// TODO Need to see OSGi dynamics. Its possible that DocumentNodeStore works after the cache
// gets deregistered but the SegmentNodeState instances might still be in use and that would cause
// failure
}
Also used : PathFilter(org.apache.jackrabbit.oak.spi.filter.PathFilter) OsgiWhiteboard(org.apache.jackrabbit.oak.osgi.OsgiWhiteboard) Activate(org.osgi.service.component.annotations.Activate)

Aggregations

PathFilter (org.apache.jackrabbit.oak.spi.filter.PathFilter)16 Test (org.junit.Test)13 NodeBuilder (org.apache.jackrabbit.oak.spi.state.NodeBuilder)12 AbstractDocumentNodeState (org.apache.jackrabbit.oak.plugins.document.AbstractDocumentNodeState)6 RevisionVector (org.apache.jackrabbit.oak.plugins.document.RevisionVector)4 Predicate (com.google.common.base.Predicate)3 Collections.emptyList (java.util.Collections.emptyList)3 StatisticsProvider (org.apache.jackrabbit.oak.stats.StatisticsProvider)3 RemovalCause (com.google.common.cache.RemovalCause)2 Lists (com.google.common.collect.Lists)2 File (java.io.File)2 Arrays.asList (java.util.Arrays.asList)2 Collections.singletonList (java.util.Collections.singletonList)2 List (java.util.List)2 Executors (java.util.concurrent.Executors)2 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)2 Consumer (java.util.function.Consumer)2 Preconditions.checkNotNull (com.google.common.base.Preconditions.checkNotNull)1 Predicates (com.google.common.base.Predicates)1 Strings (com.google.common.base.Strings)1