use of org.apache.felix.scr.annotations.Activate in project jackrabbit-oak by apache.
the class SecondaryStoreCacheService method activate.
@Activate
private void activate(BundleContext context, Map<String, Object> config) {
bundleContext = context;
whiteboard = new OsgiWhiteboard(context);
String[] includedPaths = toStringArray(config.get(PROP_INCLUDES), new String[] { "/" });
//TODO Support for exclude is not possible as once a NodeState is loaded from secondary
//store it assumes that complete subtree is in same store. With exclude it would need to
//check for each child access and route to primary
pathFilter = new PathFilter(asList(includedPaths), Collections.<String>emptyList());
SecondaryStoreBuilder builder = new SecondaryStoreBuilder(secondaryStoreProvider.getNodeStore()).differ(differ).metaPropNames(DocumentNodeStore.META_PROP_NAMES).statisticsProvider(statisticsProvider).pathFilter(pathFilter);
SecondaryStoreCache cache = builder.buildCache();
SecondaryStoreObserver observer = builder.buildObserver(cache);
registerObserver(observer, config);
regs.add(bundleContext.registerService(DocumentNodeStateCache.class.getName(), cache, null));
//TODO Need to see OSGi dynamics. Its possible that DocumentNodeStore works after the cache
//gets deregistered but the SegmentNodeState instances might still be in use and that would cause
//failure
}
use of org.apache.felix.scr.annotations.Activate in project jackrabbit-oak by apache.
the class FileBlobStoreService method activate.
@Activate
protected void activate(ComponentContext context, Map<String, Object> config) {
String homeDir = lookup(context, PROP_HOME);
if (homeDir != null) {
log.info("Initializing the FileBlobStore with homeDir [{}]", homeDir);
}
BlobStore blobStore = new FileBlobStore(FilenameUtils.concat(homeDir, "datastore"));
PropertiesUtil.populate(blobStore, config, false);
Dictionary<String, Object> props = new Hashtable<String, Object>();
if (context.getProperties().get(PROP_SPLIT_BLOBSTORE) != null) {
props.put(PROP_SPLIT_BLOBSTORE, context.getProperties().get(PROP_SPLIT_BLOBSTORE));
}
reg = context.getBundleContext().registerService(new String[] { BlobStore.class.getName(), GarbageCollectableBlobStore.class.getName() }, blobStore, props);
}
use of org.apache.felix.scr.annotations.Activate 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.felix.scr.annotations.Activate 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);
}
use of org.apache.felix.scr.annotations.Activate in project sling by apache.
the class SlingAuthenticator method activate.
// ---------- SCR integration
@SuppressWarnings("unused")
@Activate
private void activate(final BundleContext bundleContext, final Map<String, Object> properties) {
modified(properties);
AuthenticatorWebConsolePlugin plugin = new AuthenticatorWebConsolePlugin(this);
Hashtable<String, Object> props = new Hashtable<String, Object>();
props.put("felix.webconsole.label", plugin.getLabel());
props.put("felix.webconsole.title", plugin.getTitle());
props.put("felix.webconsole.category", "Sling");
props.put(Constants.SERVICE_DESCRIPTION, "Sling Request Authenticator WebConsole Plugin");
props.put(Constants.SERVICE_VENDOR, properties.get(Constants.SERVICE_VENDOR));
webConsolePlugin = bundleContext.registerService("javax.servlet.Servlet", plugin, props);
serviceListener = SlingAuthenticatorServiceListener.createListener(bundleContext, this.authRequiredCache);
authHandlerTracker = new AuthenticationHandlerTracker(bundleContext, authHandlerCache);
engineAuthHandlerTracker = new EngineAuthenticationHandlerTracker(bundleContext, authHandlerCache);
authInfoPostProcessorTracker = new ServiceTracker(bundleContext, AuthenticationInfoPostProcessor.SERVICE_NAME, null);
authInfoPostProcessorTracker.open();
}
Aggregations