Search in sources :

Example 81 with Activate

use of org.osgi.service.component.annotations.Activate in project carbon-apimgt by wso2.

the class ApimgtNotificationServiceComponent method activate.

@Activate
protected void activate(ComponentContext ctxt) {
    ctxt.getBundleContext().registerService(KeyManagerEventHandler.class, new DefaultKeyManagerEventHandlerImpl(), null);
    ctxt.getBundleContext().registerService(EventHandler.class, new WebhooksSubscriptionEventHandler(), null);
    ctxt.getBundleContext().registerService(EventHandler.class, new WebhooksDeliveryEventHandler(), null);
    ctxt.getBundleContext().registerService(NotificationEventService.class, new NotificationEventService(), null);
}
Also used : NotificationEventService(org.wso2.carbon.apimgt.notification.NotificationEventService) WebhooksDeliveryEventHandler(org.wso2.carbon.apimgt.notification.WebhooksDeliveryEventHandler) DefaultKeyManagerEventHandlerImpl(org.wso2.carbon.apimgt.notification.DefaultKeyManagerEventHandlerImpl) WebhooksSubscriptionEventHandler(org.wso2.carbon.apimgt.notification.WebhooksSubscriptionEventHandler) Activate(org.osgi.service.component.annotations.Activate)

Example 82 with Activate

use of org.osgi.service.component.annotations.Activate in project carbon-apimgt by wso2.

the class ExtendedHTTPEventAdapterServiceDS method activate.

@Activate
protected void activate(ComponentContext context) {
    ExtendedHTTPEventAdapterFactory extendedHttpEventAdaptorFactory = new ExtendedHTTPEventAdapterFactory();
    BundleContext bundleContext = context.getBundleContext();
    bundleContext.registerService(OutputEventAdapterFactory.class.getName(), extendedHttpEventAdaptorFactory, null);
    if (log.isDebugEnabled()) {
        log.debug("Successfully deployed the Extended Http event adaptor service");
    }
}
Also used : OutputEventAdapterFactory(org.wso2.carbon.event.output.adapter.core.OutputEventAdapterFactory) ExtendedHTTPEventAdapterFactory(org.wso2.carbon.apimgt.output.adapter.http.ExtendedHTTPEventAdapterFactory) BundleContext(org.osgi.framework.BundleContext) Activate(org.osgi.service.component.annotations.Activate)

Example 83 with Activate

use of org.osgi.service.component.annotations.Activate in project flow by vaadin.

the class Activator method activate.

@Activate
void activate() throws NamespaceException {
    BundleContext context = FrameworkUtil.getBundle(Activator.class).getBundleContext();
    context.registerService(Servlet.class, new FixedViewServlet(), createProperties("/view/*", false));
    context.registerService(Servlet.class, new FixedViewServlet(), createProperties("/context/*", false));
    context.registerService(Servlet.class, new FixedRouterServlet(), createProperties("/new-router-session/*", false));
    context.registerService(Servlet.class, new FixedProductionModeViewServlet(), createProperties("/view-production/*", true));
    context.registerService(Servlet.class, new FixedProductionModeTimingDataViewServlet(), createProperties("/view-production-timing/*", true));
    context.registerService(Servlet.class, new FixedLogoutWithNotificationServlet(), createProperties("/logout-with-notification/*", false));
    context.registerService(Servlet.class, new FixedRouterLayoutCustomScopeServlet(), createProperties("/router-layout-custom-scope/*", false));
    registerPlainJsResource(context);
    String contextName = registerCustomContext(context);
    registerCustomContextServlet(context, contextName);
}
Also used : BundleContext(org.osgi.framework.BundleContext) Activate(org.osgi.service.component.annotations.Activate)

Example 84 with Activate

use of org.osgi.service.component.annotations.Activate in project openems by OpenEMS.

the class JsonPersistenceManager method activate.

@Activate
void activate() {
    // Load default configuration
    loadDefaultConfig();
    // read Json from file
    JsonObject jConfig;
    try {
        jConfig = ConfigUtils.readConfigFromFile(configFile);
    } catch (Exception e) {
        log.error(e.getMessage());
        return;
    }
    // parse config + fill configMap
    parseJsonToConfigMap(jConfig);
}
Also used : JsonObject(com.google.gson.JsonObject) IOException(java.io.IOException) Activate(org.osgi.service.component.annotations.Activate)

Example 85 with Activate

use of org.osgi.service.component.annotations.Activate in project fuse-karaf by jboss-fuse.

the class PatchServiceImpl method activate.

@Activate
void activate(ComponentContext componentContext) throws IOException {
    // Use system bundle' bundle context to avoid running into
    // "Invalid BundleContext" exceptions when updating bundles
    bundleContext = componentContext.getBundleContext().getBundle(0).getBundleContext();
    pool = Executors.newFixedThreadPool(1, ThreadUtils.namedThreadFactory("patch-service"));
    String dir = this.bundleContext.getProperty(PATCH_LOCATION);
    if (dir != null) {
        patchDir = new File(dir);
    } else {
        patchDir = new File(bundleContext.getProperty("karaf.home"), "patches");
        LOG.info("Can't find {} property, defaulting to {}", PATCH_LOCATION, patchDir.getCanonicalPath());
    }
    if (!patchDir.isDirectory()) {
        Utils.mkdirs(patchDir);
        if (!patchDir.isDirectory()) {
            throw new PatchException("Unable to create patch folder");
        }
    }
    this.karafHome = new File(bundleContext.getProperty("karaf.home"));
    this.repository = new File(bundleContext.getProperty("karaf.default.repository"));
    helper = new OSGiPatchHelper(karafHome, bundleContext);
    load(true);
    bootTracker = new BootDoneTracker(bundleContext);
    bootTracker.open();
}
Also used : PatchException(org.jboss.fuse.patch.management.PatchException) File(java.io.File) Activate(org.osgi.service.component.annotations.Activate)

Aggregations

Activate (org.osgi.service.component.annotations.Activate)100 BundleContext (org.osgi.framework.BundleContext)13 File (java.io.File)8 OsgiWhiteboard (org.apache.jackrabbit.oak.osgi.OsgiWhiteboard)7 IOException (java.io.IOException)6 Hashtable (java.util.Hashtable)6 ResourceResolver (org.apache.sling.api.resource.ResourceResolver)5 FinderPath (com.liferay.portal.kernel.dao.orm.FinderPath)4 ArrayList (java.util.ArrayList)4 Properties (java.util.Properties)3 ServiceReference (org.osgi.framework.ServiceReference)3 PromiseFactory (org.osgi.util.promise.PromiseFactory)3 ServerStartupObserver (org.wso2.carbon.core.ServerStartupObserver)3 JsonObject (com.google.gson.JsonObject)2 Date (java.util.Date)2 Dictionary (java.util.Dictionary)2 ObjectName (javax.management.ObjectName)2 Whiteboard (org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard)2 WhiteboardExecutor (org.apache.jackrabbit.oak.spi.whiteboard.WhiteboardExecutor)2 LoginException (org.apache.sling.api.resource.LoginException)2