Search in sources :

Example 16 with OsgiWhiteboard

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

the class AtomicCounterEditorProvider method activate.

@Activate
public void activate(BundleContext context) {
    whiteboard.set(new OsgiWhiteboard(context));
    ThreadFactory tf = new ThreadFactoryBuilder().setNameFormat("atomic-counter-%d").build();
    scheduler.set(Executors.newScheduledThreadPool(10, tf));
}
Also used : ThreadFactory(java.util.concurrent.ThreadFactory) OsgiWhiteboard(org.apache.jackrabbit.oak.osgi.OsgiWhiteboard) ThreadFactoryBuilder(com.google.common.util.concurrent.ThreadFactoryBuilder) Activate(org.apache.felix.scr.annotations.Activate)

Example 17 with OsgiWhiteboard

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

the class AsyncIndexerService method activate.

@Activate
public void activate(BundleContext bundleContext, Map<String, Object> config) {
    List<AsyncConfig> asyncIndexerConfig = getAsyncConfig(PropertiesUtil.toStringArray(config.get(PROP_ASYNC_CONFIG), new String[0]));
    Whiteboard whiteboard = new OsgiWhiteboard(bundleContext);
    indexRegistration = new IndexMBeanRegistration(whiteboard);
    indexEditorProvider.start(whiteboard);
    executor = new WhiteboardExecutor();
    executor.start(whiteboard);
    long leaseTimeOutMin = PropertiesUtil.toInteger(config.get(PROP_LEASE_TIME_OUT), PROP_LEASE_TIMEOUT_DEFAULT);
    if (!(nodeStore instanceof Clusterable)) {
        leaseTimeOutMin = 0;
        log.info("Detected non clusterable setup. Lease checking would be disabled for async indexing");
    }
    TrackingCorruptIndexHandler corruptIndexHandler = createCorruptIndexHandler(config);
    for (AsyncConfig c : asyncIndexerConfig) {
        AsyncIndexUpdate task = new AsyncIndexUpdate(c.name, nodeStore, indexEditorProvider, statisticsProvider, false);
        task.setCorruptIndexHandler(corruptIndexHandler);
        task.setValidatorProviders(Collections.singletonList(validatorProvider));
        task.setLeaseTimeOut(TimeUnit.MINUTES.toMillis(leaseTimeOutMin));
        indexRegistration.registerAsyncIndexer(task, c.timeIntervalInSecs);
        closer.register(task);
    }
    registerAsyncReindexSupport(whiteboard);
    log.info("Configured async indexers {} ", asyncIndexerConfig);
    log.info("Lease time: {} mins and AsyncIndexUpdate configured with {}", leaseTimeOutMin, validatorProvider.getClass().getName());
}
Also used : Clusterable(org.apache.jackrabbit.oak.spi.state.Clusterable) OsgiWhiteboard(org.apache.jackrabbit.oak.osgi.OsgiWhiteboard) WhiteboardExecutor(org.apache.jackrabbit.oak.spi.whiteboard.WhiteboardExecutor) Whiteboard(org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard) OsgiWhiteboard(org.apache.jackrabbit.oak.osgi.OsgiWhiteboard) Activate(org.apache.felix.scr.annotations.Activate)

Example 18 with OsgiWhiteboard

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

the class SecurityProviderRegistration method createSecurityProvider.

private SecurityProvider createSecurityProvider(@Nonnull BundleContext context) {
    InternalSecurityProvider securityProvider = new InternalSecurityProvider();
    // Static, mandatory references
    securityProvider.setAuthenticationConfiguration(ConfigurationInitializer.initializeConfiguration(securityProvider, authenticationConfiguration));
    securityProvider.setPrivilegeConfiguration(ConfigurationInitializer.initializeConfiguration(securityProvider, privilegeConfiguration));
    ConfigurationParameters userParams = ConfigurationParameters.of(ConfigurationParameters.of(UserConstants.PARAM_AUTHORIZABLE_ACTION_PROVIDER, createWhiteboardAuthorizableActionProvider()), ConfigurationParameters.of(UserConstants.PARAM_AUTHORIZABLE_NODE_NAME, createWhiteboardAuthorizableNodeName()), ConfigurationParameters.of(UserConstants.PARAM_USER_AUTHENTICATION_FACTORY, createWhiteboardUserAuthenticationFactory()));
    securityProvider.setUserConfiguration(ConfigurationInitializer.initializeConfiguration(securityProvider, userConfiguration, userParams));
    // Multiple, dynamic references
    ConfigurationParameters restrictionParams = ConfigurationParameters.of(AccessControlConstants.PARAM_RESTRICTION_PROVIDER, createWhiteboardRestrictionProvider());
    ConfigurationInitializer.initializeConfigurations(securityProvider, authorizationConfiguration, restrictionParams);
    securityProvider.setAuthorizationConfiguration(authorizationConfiguration);
    ConfigurationInitializer.initializeConfigurations(securityProvider, principalConfiguration, ConfigurationParameters.EMPTY);
    securityProvider.setPrincipalConfiguration(principalConfiguration);
    ConfigurationInitializer.initializeConfigurations(securityProvider, tokenConfiguration, ConfigurationParameters.EMPTY);
    securityProvider.setTokenConfiguration(tokenConfiguration);
    // Whiteboard
    securityProvider.setWhiteboard(new OsgiWhiteboard(context));
    return securityProvider;
}
Also used : OsgiWhiteboard(org.apache.jackrabbit.oak.osgi.OsgiWhiteboard) ConfigurationParameters(org.apache.jackrabbit.oak.spi.security.ConfigurationParameters)

Example 19 with OsgiWhiteboard

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

the class RepositoryManager method activate.

@Activate
public void activate(BundleContext bundleContext, Map<String, ?> config) throws Exception {
    observationQueueLength = PropertiesUtil.toInteger(prop(config, bundleContext, OBSERVATION_QUEUE_LENGTH), DEFAULT_OBSERVATION_QUEUE_LENGTH);
    if (PropertiesUtil.toBoolean(prop(config, bundleContext, COMMIT_RATE_LIMIT), DEFAULT_COMMIT_RATE_LIMIT)) {
        commitRateLimiter = new CommitRateLimiter();
    } else {
        commitRateLimiter = null;
    }
    fastQueryResultSize = PropertiesUtil.toBoolean(prop(config, bundleContext, FAST_QUERY_RESULT_SIZE), DEFAULT_FAST_QUERY_RESULT_SIZE);
    whiteboard = new OsgiWhiteboard(bundleContext);
    initializers = whiteboard.track(RepositoryInitializer.class);
    editorProvider.start(whiteboard);
    indexEditorProvider.start(whiteboard);
    indexProvider.start(whiteboard);
    registration = registerRepository(bundleContext);
}
Also used : CommitRateLimiter(org.apache.jackrabbit.oak.plugins.observation.CommitRateLimiter) OsgiWhiteboard(org.apache.jackrabbit.oak.osgi.OsgiWhiteboard) RepositoryInitializer(org.apache.jackrabbit.oak.spi.lifecycle.RepositoryInitializer) 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