Search in sources :

Example 1 with PathFilter

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
}
Also used : PathFilter(org.apache.jackrabbit.oak.plugins.index.PathFilter) OsgiWhiteboard(org.apache.jackrabbit.oak.osgi.OsgiWhiteboard) Activate(org.apache.felix.scr.annotations.Activate)

Aggregations

Activate (org.apache.felix.scr.annotations.Activate)1 OsgiWhiteboard (org.apache.jackrabbit.oak.osgi.OsgiWhiteboard)1 PathFilter (org.apache.jackrabbit.oak.plugins.index.PathFilter)1