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));
}
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());
}
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;
}
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);
}
Aggregations