use of org.apache.felix.scr.annotations.Activate in project jackrabbit-oak by apache.
the class StandbyStoreService method activate.
@Activate
private void activate(ComponentContext context) {
SegmentStore segmentStore = storeProvider.getSegmentStore();
if (!(segmentStore instanceof FileStore)) {
throw new IllegalArgumentException("Unexpected SegmentStore implementation");
}
FileStore fileStore = (FileStore) segmentStore;
String mode = valueOf(context.getProperties().get(MODE));
if (MODE_PRIMARY.equals(mode)) {
bootstrapMaster(context, fileStore);
return;
}
if (MODE_STANDBY.equals(mode)) {
bootstrapSlave(context, fileStore);
return;
}
throw new IllegalArgumentException(String.format("Unexpected mode property, got '%s'", mode));
}
use of org.apache.felix.scr.annotations.Activate in project jackrabbit-oak by apache.
the class EmbeddedSolrServerConfigurationProvider method activate.
@Activate
protected void activate(ComponentContext componentContext) throws Exception {
solrHome = String.valueOf(componentContext.getProperties().get(SOLR_HOME_PATH));
File file = new File(solrHome);
if (!file.exists()) {
assert file.createNewFile();
}
solrCoreName = String.valueOf(componentContext.getProperties().get(SOLR_CORE_NAME));
solrServerConfiguration = new EmbeddedSolrServerConfiguration(solrHome, solrCoreName);
}
use of org.apache.felix.scr.annotations.Activate 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));
}
}
use of org.apache.felix.scr.annotations.Activate in project jackrabbit-oak by apache.
the class SolrQueryIndexProviderService method activate.
@SuppressWarnings("UnusedDeclaration")
@Activate
protected void activate(ComponentContext componentContext) {
Object value = componentContext.getProperties().get(QUERY_TIME_AGGREGATION);
boolean queryTimeAggregation = PropertiesUtil.toBoolean(value, QUERY_TIME_AGGREGATION_DEFAULT);
if (solrServerProvider != null && oakSolrConfigurationProvider != null) {
QueryIndexProvider solrQueryIndexProvider = new SolrQueryIndexProvider(solrServerProvider, oakSolrConfigurationProvider, nodeAggregator);
log.debug("creating Solr query index provider {} query time aggregation", queryTimeAggregation ? "with" : "without");
if (queryTimeAggregation) {
solrQueryIndexProvider = AggregateIndexProvider.wrap(solrQueryIndexProvider);
}
regs.add(componentContext.getBundleContext().registerService(QueryIndexProvider.class.getName(), solrQueryIndexProvider, null));
}
}
use of org.apache.felix.scr.annotations.Activate in project sling by apache.
the class DefaultHandlerService method activate.
@Activate
@Modified
@SuppressWarnings("unused")
private void activate(final Map<String, Object> properties) {
final String collectionType = OsgiUtil.toString(properties.get(SlingWebDavServlet.TYPE_COLLECTIONS), SlingWebDavServlet.TYPE_COLLECTIONS_DEFAULT);
final String nonCollectionType = OsgiUtil.toString(properties.get(SlingWebDavServlet.TYPE_NONCOLLECTIONS), SlingWebDavServlet.TYPE_NONCOLLECTIONS_DEFAULT);
final String contentType = OsgiUtil.toString(properties.get(SlingWebDavServlet.TYPE_CONTENT), SlingWebDavServlet.TYPE_CONTENT_DEFAULT);
this.delegatee = new DefaultHandler(null, collectionType, nonCollectionType, contentType);
}
Aggregations