Search in sources :

Example 6 with OsgiWhiteboard

use of org.apache.jackrabbit.oak.osgi.OsgiWhiteboard 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");
}
Also used : OsgiWhiteboard(org.apache.jackrabbit.oak.osgi.OsgiWhiteboard) ConsolidatedListenerMBean(org.apache.jackrabbit.oak.jcr.observation.jmx.ConsolidatedListenerMBean) Whiteboard(org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard) OsgiWhiteboard(org.apache.jackrabbit.oak.osgi.OsgiWhiteboard) Activate(org.apache.felix.scr.annotations.Activate)

Example 7 with OsgiWhiteboard

use of org.apache.jackrabbit.oak.osgi.OsgiWhiteboard in project jackrabbit-oak by apache.

the class NodeStateSolrServersObserverService method activate.

@Activate
protected void activate(ComponentContext componentContext) throws Exception {
    boolean enabled = PropertiesUtil.toBoolean(componentContext.getProperties().get(ENABLED), false);
    if (enabled) {
        BundleContext bundleContext = componentContext.getBundleContext();
        Whiteboard whiteboard = new OsgiWhiteboard(bundleContext);
        executor = new WhiteboardExecutor();
        executor.start(whiteboard);
        backgroundObserver = new BackgroundObserver(nodeStateSolrServersObserver, executor, 5);
        regs.add(bundleContext.registerService(Observer.class.getName(), backgroundObserver, null));
    }
}
Also used : BackgroundObserver(org.apache.jackrabbit.oak.spi.commit.BackgroundObserver) OsgiWhiteboard(org.apache.jackrabbit.oak.osgi.OsgiWhiteboard) WhiteboardExecutor(org.apache.jackrabbit.oak.spi.whiteboard.WhiteboardExecutor) OsgiWhiteboard(org.apache.jackrabbit.oak.osgi.OsgiWhiteboard) Whiteboard(org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard) BundleContext(org.osgi.framework.BundleContext) Activate(org.apache.felix.scr.annotations.Activate)

Example 8 with OsgiWhiteboard

use of org.apache.jackrabbit.oak.osgi.OsgiWhiteboard 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;
    }
    closer = Closer.create();
    OsgiWhiteboard whiteboard = new OsgiWhiteboard(context.getBundleContext());
    registerSegmentStore(context, blobStore, statisticsProvider, closer, whiteboard, null, true);
}
Also used : OsgiWhiteboard(org.apache.jackrabbit.oak.osgi.OsgiWhiteboard) Activate(org.apache.felix.scr.annotations.Activate)

Example 9 with OsgiWhiteboard

use of org.apache.jackrabbit.oak.osgi.OsgiWhiteboard 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);
        }
    }
}
Also used : NodeStore(org.apache.jackrabbit.oak.spi.state.NodeStore) OsgiWhiteboard(org.apache.jackrabbit.oak.osgi.OsgiWhiteboard) HashMap(java.util.HashMap) NodeStoreProvider(org.apache.jackrabbit.oak.spi.state.NodeStoreProvider) Activate(org.apache.felix.scr.annotations.Activate)

Example 10 with OsgiWhiteboard

use of org.apache.jackrabbit.oak.osgi.OsgiWhiteboard 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());
    whiteboard = new OsgiWhiteboard(bundleContext);
    threadPoolSize = PropertiesUtil.toInteger(config.get(PROP_THREAD_POOL_SIZE), PROP_THREAD_POOL_SIZE_DEFAULT);
    initializeIndexDir(bundleContext, config);
    initializeExtractedTextCache(bundleContext, config);
    IndexTracker tracker = createTracker(bundleContext, config);
    indexProvider = new LuceneIndexProvider(tracker, scorerFactory, augmentorFactory);
    if (PROP_DELETED_BLOB_COLLECTION_ENABLED && blobStore != null) {
        File blobCollectorWorkingDir = new File(indexDir, "deleted-blobs");
        activeDeletedBlobCollector = ActiveDeletedBlobCollectorFactory.newInstance(blobCollectorWorkingDir, executorService);
        log.info("Active blob collector initialized at working dir: {}", blobCollectorWorkingDir);
    } else {
        activeDeletedBlobCollector = ActiveDeletedBlobCollectorFactory.NOOP;
        log.info("Active blob collector set to NOOP. Enable? {}; blobStore: {}", PROP_DELETED_BLOB_COLLECTION_ENABLED, blobStore);
    }
    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);
    oakRegs.add(registerMBean(whiteboard, LuceneIndexMBean.class, new LuceneIndexMBeanImpl(indexProvider.getTracker(), nodeStore, indexPathService, getIndexCheckDir()), LuceneIndexMBean.TYPE, "Lucene Index statistics"));
    registerGCMonitor(whiteboard, indexProvider.getTracker());
}
Also used : OsgiWhiteboard(org.apache.jackrabbit.oak.osgi.OsgiWhiteboard) File(java.io.File) Activate(org.apache.felix.scr.annotations.Activate)

Aggregations

OsgiWhiteboard (org.apache.jackrabbit.oak.osgi.OsgiWhiteboard)19 Activate (org.apache.felix.scr.annotations.Activate)15 Whiteboard (org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard)9 WhiteboardExecutor (org.apache.jackrabbit.oak.spi.whiteboard.WhiteboardExecutor)3 Hashtable (java.util.Hashtable)2 CacheStatsMBean (org.apache.jackrabbit.oak.api.jmx.CacheStatsMBean)2 BundleContext (org.osgi.framework.BundleContext)2 ThreadFactoryBuilder (com.google.common.util.concurrent.ThreadFactoryBuilder)1 File (java.io.File)1 HashMap (java.util.HashMap)1 Executor (java.util.concurrent.Executor)1 ThreadFactory (java.util.concurrent.ThreadFactory)1 MalformedObjectNameException (javax.management.MalformedObjectNameException)1 ObjectName (javax.management.ObjectName)1 Oak (org.apache.jackrabbit.oak.Oak)1 ConsolidatedCacheStatsMBean (org.apache.jackrabbit.oak.api.jmx.ConsolidatedCacheStatsMBean)1 ConsolidatedDataStoreCacheStatsMBean (org.apache.jackrabbit.oak.api.jmx.ConsolidatedDataStoreCacheStatsMBean)1 PersistentCacheStatsMBean (org.apache.jackrabbit.oak.api.jmx.PersistentCacheStatsMBean)1 S3DataStoreStatsMBean (org.apache.jackrabbit.oak.blob.cloud.s3.stats.S3DataStoreStatsMBean)1 Jcr (org.apache.jackrabbit.oak.jcr.Jcr)1