Search in sources :

Example 6 with Activate

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));
}
Also used : FileStore(org.apache.jackrabbit.oak.segment.file.FileStore) SegmentStore(org.apache.jackrabbit.oak.segment.SegmentStore) Activate(org.apache.felix.scr.annotations.Activate)

Example 7 with Activate

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);
}
Also used : EmbeddedSolrServerConfiguration(org.apache.jackrabbit.oak.plugins.index.solr.configuration.EmbeddedSolrServerConfiguration) File(java.io.File) Activate(org.apache.felix.scr.annotations.Activate)

Example 8 with Activate

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));
    }
}
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 9 with Activate

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));
    }
}
Also used : SolrQueryIndexProvider(org.apache.jackrabbit.oak.plugins.index.solr.query.SolrQueryIndexProvider) SolrQueryIndexProvider(org.apache.jackrabbit.oak.plugins.index.solr.query.SolrQueryIndexProvider) QueryIndexProvider(org.apache.jackrabbit.oak.spi.query.QueryIndexProvider) Activate(org.apache.felix.scr.annotations.Activate)

Example 10 with Activate

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);
}
Also used : DefaultHandler(org.apache.jackrabbit.server.io.DefaultHandler) Modified(org.apache.felix.scr.annotations.Modified) Activate(org.apache.felix.scr.annotations.Activate)

Aggregations

Activate (org.apache.felix.scr.annotations.Activate)153 ConfigurationException (org.osgi.service.cm.ConfigurationException)31 ServiceTracker (org.osgi.util.tracker.ServiceTracker)20 BundleContext (org.osgi.framework.BundleContext)19 File (java.io.File)15 OsgiWhiteboard (org.apache.jackrabbit.oak.osgi.OsgiWhiteboard)12 URL (java.net.URL)11 Hashtable (java.util.Hashtable)11 ServiceReference (org.osgi.framework.ServiceReference)11 ServiceTrackerCustomizer (org.osgi.util.tracker.ServiceTrackerCustomizer)9 HashSet (java.util.HashSet)8 IOException (java.io.IOException)7 HashMap (java.util.HashMap)7 Map (java.util.Map)6 Session (javax.jcr.Session)5 StandardMBean (javax.management.StandardMBean)5 Whiteboard (org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard)5 Filter (org.osgi.framework.Filter)5 InputStream (java.io.InputStream)4 ArrayList (java.util.ArrayList)4