use of org.apache.jackrabbit.oak.spi.state.NodeStoreProvider in project jackrabbit-oak by apache.
the class SecondaryStoreCacheServiceTest method configureDefaultServices.
@Before
public void configureDefaultServices() {
context.registerService(BlobStore.class, new MemoryBlobStore());
context.registerService(NodeStoreProvider.class, new NodeStoreProvider() {
@Override
public NodeStore getNodeStore() {
return secondaryStore;
}
}, ImmutableMap.<String, Object>of("role", "secondary"));
context.registerService(Executor.class, Executors.newSingleThreadExecutor());
context.registerService(StatisticsProvider.class, StatisticsProvider.NOOP);
MockOsgi.injectServices(cacheService, context.bundleContext());
}
use of org.apache.jackrabbit.oak.spi.state.NodeStoreProvider in project jackrabbit-oak by apache.
the class SegmentNodeStoreFactory method activate.
@Activate
public void activate(ComponentContext context) throws IOException {
String role = property(ROLE, context);
// In secondaryNodeStore mode customBlobStore is always enabled
boolean isSecondaryStoreMode = "secondary".equals(role);
boolean customBlobStore = Boolean.parseBoolean(property(CUSTOM_BLOB_STORE, context)) || isSecondaryStoreMode;
boolean registerRepositoryDescriptors = Boolean.parseBoolean(property(REGISTER_DESCRIPTORS, context));
log.info("activate: SegmentNodeStore '" + role + "' starting.");
if (blobStore == null && customBlobStore) {
log.info("BlobStore use enabled. SegmentNodeStore would be initialized when BlobStore would be available");
return;
}
if (role != null) {
registrations = Closer.create();
OsgiWhiteboard whiteboard = new OsgiWhiteboard(context.getBundleContext());
final SegmentNodeStore store = SegmentNodeStoreService.registerSegmentStore(context, blobStore, statisticsProvider, registrations, whiteboard, role, registerRepositoryDescriptors);
if (store != null) {
Map<String, Object> props = new HashMap<String, Object>();
props.put(NodeStoreProvider.ROLE, role);
registrations.register(asCloseable(whiteboard.register(NodeStoreProvider.class, new NodeStoreProvider() {
@Override
public NodeStore getNodeStore() {
return store;
}
}, props)));
log.info("Registered NodeStoreProvider backed by SegmentNodeStore of type '{}'", role);
}
}
}
Aggregations