use of org.apache.jackrabbit.oak.plugins.index.PathFilter in project jackrabbit-oak by apache.
the class SecondaryStoreCacheService method activate.
@Activate
private void activate(BundleContext context, Map<String, Object> config) {
bundleContext = context;
whiteboard = new OsgiWhiteboard(context);
String[] includedPaths = toStringArray(config.get(PROP_INCLUDES), new String[] { "/" });
//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
}
Aggregations