use of org.apache.felix.scr.annotations.Activate in project jackrabbit-oak by apache.
the class LuceneIndexProviderService method activate.
@Activate
private void activate(BundleContext bundleContext, Map<String, ?> config) throws NotCompliantMBeanException, IOException {
boolean disabled = PropertiesUtil.toBoolean(config.get(PROP_DISABLED), PROP_DISABLED_DEFAULT);
hybridIndex = PropertiesUtil.toBoolean(config.get(PROP_HYBRID_INDEXING), PROP_DISABLED_DEFAULT);
if (disabled) {
log.info("Component disabled by configuration");
return;
}
configureIndexDefinitionStorage(config);
configureBooleanClauseLimit(config);
initializeFactoryClassLoaders(getClass().getClassLoader());
if (System.getProperty(BufferedOakDirectory.ENABLE_WRITING_SINGLE_BLOB_INDEX_FILE_PARAM) == null) {
BufferedOakDirectory.setEnableWritingSingleBlobIndexFile(PropertiesUtil.toBoolean(config.get(PROP_NAME_ENABLE_SINGLE_BLOB_PER_INDEX_FILE), PROP_ENABLE_SINGLE_BLOB_PER_INDEX_FILE_DEFAULT));
} else {
log.info("Not setting config for single blob for an index file as it's set by command line!");
}
whiteboard = new OsgiWhiteboard(bundleContext);
threadPoolSize = PropertiesUtil.toInteger(config.get(PROP_THREAD_POOL_SIZE), PROP_THREAD_POOL_SIZE_DEFAULT);
initializeIndexDir(bundleContext, config);
initializeExtractedTextCache(bundleContext, config);
tracker = createTracker(bundleContext, config);
indexProvider = new LuceneIndexProvider(tracker, scorerFactory, augmentorFactory);
initializeActiveBlobCollector(whiteboard, config);
initializeLogging(config);
initialize();
regs.add(bundleContext.registerService(QueryIndexProvider.class.getName(), indexProvider, null));
registerObserver(bundleContext, config);
registerLocalIndexObserver(bundleContext, tracker, config);
registerIndexEditor(bundleContext, tracker, config);
registerIndexInfoProvider(bundleContext);
registerIndexImporterProvider(bundleContext);
registerPropertyIndexCleaner(config, bundleContext);
oakRegs.add(registerMBean(whiteboard, LuceneIndexMBean.class, new LuceneIndexMBeanImpl(indexProvider.getTracker(), nodeStore, indexPathService, getIndexCheckDir(), cleaner), LuceneIndexMBean.TYPE, "Lucene Index statistics"));
registerGCMonitor(whiteboard, indexProvider.getTracker());
}
use of org.apache.felix.scr.annotations.Activate 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 customSegmentStore = Boolean.parseBoolean(property(CUSTOM_SEGMENT_STORE, context));
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 (segmentStore == null && customSegmentStore) {
log.info("customSegmentStore enabled. SegmentNodeStore will be initialized once the custom segment store becomes available");
return;
}
if (role != null) {
registrations = Closer.create();
OsgiWhiteboard whiteboard = new OsgiWhiteboard(context.getBundleContext());
final SegmentNodeStore store = SegmentNodeStoreService.registerSegmentStore(context, blobStore, segmentStore, 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);
}
}
}
use of org.apache.felix.scr.annotations.Activate in project jackrabbit-oak by apache.
the class Registrations method activate.
@Activate
public void activate(ComponentContext context) throws IOException {
Configuration configuration = new Configuration(context);
if (blobStore == null && configuration.hasCustomBlobStore()) {
log.info("BlobStore enabled. SegmentNodeStore will be initialized once the blob " + "store becomes available");
return;
}
if (segmentStore == null && configuration.hasCustomSegmentStore()) {
log.info("customSegmentStore enabled. SegmentNodeStore will be initialized once the custom segment " + "store becomes available");
return;
}
closer = Closer.create();
OsgiWhiteboard whiteboard = new OsgiWhiteboard(context.getBundleContext());
registerSegmentStore(context, blobStore, segmentStore, statisticsProvider, closer, whiteboard, null, true);
}
use of org.apache.felix.scr.annotations.Activate in project jackrabbit-oak by apache.
the class ConsolidatedListenerMBeanImpl method activate.
// ~---------------------------------------< OSGi >
@Activate
private void activate(BundleContext context) {
Whiteboard wb = new OsgiWhiteboard(context);
mbeanReg = registerMBean(wb, ConsolidatedListenerMBean.class, this, ConsolidatedListenerMBean.TYPE, "Consolidated Event Listener statistics");
}
use of org.apache.felix.scr.annotations.Activate in project CQ-Actions by Cognifide.
the class MessageWebsocketServlet method activate.
@Activate
public void activate() throws Exception {
WebSocketBehavior behavior = WebSocketBehavior.SERVER;
WebSocketPolicy policy = new WebSocketPolicy(behavior);
webSocketFactory = new WebSocketServerFactory(policy);
webSocketFactory.register(MessageSocket.class);
webSocketFactory.setCreator(this);
webSocketFactory.start();
}
Aggregations