Java Code Examples for org.osgi.service.component.ComponentContext#getBundleContext()
The following examples show how to use
org.osgi.service.component.ComponentContext#getBundleContext() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DataServicesDSComponent.java From micro-integrator with Apache License 2.0 | 6 votes |
@Activate protected void activate(ComponentContext ctxt) { try { BundleContext bundleContext = ctxt.getBundleContext(); bundleContext.registerService(Axis2ConfigurationContextObserver.class.getName(), new DSAxis2ConfigurationContextObserver(), null); // bundleContext.registerService(DSDummyService.class.getName(), new DSDummyService(), null); // bundleContext.registerService(TransactionManagerDummyService.class.getName(), // new TransactionManagerDummyService(), null); log.debug("Data Services bundle is activated "); } catch (Throwable e) { log.error(e.getMessage(), e); /* don't throw exception */ } }
Example 2
Source File: EventBrokerBuilderDS.java From carbon-commons with Apache License 2.0 | 6 votes |
/** * initialize the cep service here. * * @param context */ @Activate protected void activate(ComponentContext context) { this.eventBrokerHandler = new EventBrokerHandler(context); // need to differ the bundle deployment if the Qpid bundle is in the plugins directory and it is not // started boolean isQpidBundlePresent = false; final BundleContext bundleContext = context.getBundleContext(); for (Bundle bundle : bundleContext.getBundles()) { if (bundle.getSymbolicName().equals("org.wso2.carbon.qpid")) { isQpidBundlePresent = true; break; } } if (isQpidBundlePresent) { // if the Qpid bundle is present we register an event broker handler // so that the qpid compoent will notify that. context.getBundleContext().registerService(EventBundleNotificationService.class.getName(), this .eventBrokerHandler, null); } else { this.eventBrokerHandler.startEventBroker(); } }
Example 3
Source File: ConnectedCupServiceComponent.java From product-iots with Apache License 2.0 | 6 votes |
protected void activate(ComponentContext ctx) { if (log.isDebugEnabled()) { log.debug("Activating Connected Cup Service Component"); } try { BundleContext bundleContext = ctx.getBundleContext(); connectedCupServiceRegRef = bundleContext.registerService(DeviceManagementService.class.getName(), new ConnectedCupManagerService(), null); if (log.isDebugEnabled()) { log.debug("Connected Cup Service Component has been successfully activated"); } } catch (Throwable e) { log.error("Error occurred while activating Connected Cup Service Component", e); } }
Example 4
Source File: IdentityClaimManagementServiceComponent.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
@Activate protected void activate(ComponentContext ctxt) { try { BundleContext bundleCtx = ctxt.getBundleContext(); IdentityClaimManagementServiceDataHolder.getInstance().setBundleContext(bundleCtx); ClaimMetadataStoreFactory claimMetadataStoreFactory = new ClaimMetadataStoreFactory(); bundleCtx.registerService(ClaimManagerFactory.class.getName(), claimMetadataStoreFactory, null); ClaimMetadataManagementService claimManagementService = new ClaimMetadataManagementServiceImpl(); bundleCtx.registerService(ClaimMetadataManagementService.class.getName(), claimManagementService, null); IdentityClaimManagementServiceDataHolder.getInstance().setClaimManagementService(claimManagementService); bundleCtx.registerService(TenantMgtListener.class.getName(), new ClaimMetadataTenantMgtListener(), null); registerClaimConfigListener(bundleCtx); if (log.isDebugEnabled()) { log.debug("Identity Claim Management Core bundle is activated"); } } catch (Throwable e) { log.error("Error occurred while activating Identity Claim Management Service Component", e); } }
Example 5
Source File: BaseThingHandlerFactory.java From openhab-core with Eclipse Public License 2.0 | 5 votes |
/** * Initializes the {@link BaseThingHandlerFactory}. If this method is overridden by a sub class, the implementing * method must call <code>super.activate(componentContext)</code> first. * * @param componentContext component context (must not be null) */ protected void activate(ComponentContext componentContext) { bundleContext = componentContext.getBundleContext(); thingTypeRegistryServiceTracker = new ServiceTracker<>(bundleContext, ThingTypeRegistry.class.getName(), null); thingTypeRegistryServiceTracker.open(); configDescriptionRegistryServiceTracker = new ServiceTracker<>(bundleContext, ConfigDescriptionRegistry.class.getName(), null); configDescriptionRegistryServiceTracker.open(); }
Example 6
Source File: I18nProviderImpl.java From openhab-core with Eclipse Public License 2.0 | 5 votes |
@Activate @SuppressWarnings("unchecked") public I18nProviderImpl(ComponentContext componentContext) { initDimensionMap(); modified((Map<String, Object>) componentContext.getProperties()); this.resourceBundleTracker = new ResourceBundleTracker(componentContext.getBundleContext(), this); this.resourceBundleTracker.open(); }
Example 7
Source File: CertificateManagementServiceComponent.java From carbon-device-mgt with Apache License 2.0 | 5 votes |
@SuppressWarnings("unused") protected void activate(ComponentContext componentContext) { try { if (log.isDebugEnabled()) { log.debug("Initializing certificate management core bundle"); } CertificateConfigurationManager.getInstance().initConfig(); CertificateManagementConfig config = CertificateConfigurationManager.getInstance().getCertificateManagementConfig(); DataSourceConfig dsConfig = config.getCertificateManagementRepository().getDataSourceConfig(); CertificateManagementDAOFactory.init(dsConfig); BundleContext bundleContext = componentContext.getBundleContext(); /* If -Dsetup option enabled then create Certificate management database schema */ String setupOption = System.getProperty(CertificateManagementConstants.SETUP_PROPERTY); if (setupOption != null) { if (log.isDebugEnabled()) { log.debug("-Dsetup is enabled. Certificate management repository schema initialization is about to " + "begin"); } this.setupDeviceManagementSchema(dsConfig); } bundleContext.registerService(CertificateManagementService.class.getName(), CertificateManagementServiceImpl.getInstance(), null); bundleContext.registerService(SCEPManager.class.getName(), new SCEPManagerImpl(), null); if (log.isDebugEnabled()) { log.debug("Certificate management core bundle has been successfully initialized"); } } catch (Throwable e) { log.error("Error occurred while initializing certificate management core bundle", e); } }
Example 8
Source File: WorkflowTemplateServiceComponent.java From carbon-identity with Apache License 2.0 | 5 votes |
protected void activate(ComponentContext context) { try { BundleContext bundleContext = context.getBundleContext(); String templateParamMetaDataXML = readTemplateParamMetaDataXML(TemplateConstant.TEMPLATE_PARAMETER_METADATA_FILE_NAME); bundleContext.registerService(AbstractTemplate.class, new MultiStepApprovalTemplate(templateParamMetaDataXML),null); }catch(Throwable e){ log.error("Error occurred while activating WorkflowTemplateServiceComponent bundle, " + e.getMessage()); } }
Example 9
Source File: RemoteResourceProviderFactory.java From sling-whiteboard with Apache License 2.0 | 5 votes |
@Activate private void activate(RemoteResourceProviderFactoryConfiguration configuration, ComponentContext componentContext) { this.configuration = configuration; bundleContext = componentContext.getBundleContext(); for (RegistrationMapping mapping : mappings.values()) { mapping.registerResourceProviderIfNeeded(bundleContext); } }
Example 10
Source File: ModalDialogMetadataProvider.java From gvnix with GNU General Public License v3.0 | 5 votes |
/** * The activate method for this OSGi component, this will be called by the * OSGi container upon bundle activation (result of the 'addon install' * command) * * @param context the component context can be used to get access to the * OSGi container (ie find out if certain bundles are active) */ protected void activate(ComponentContext cContext) { context = cContext.getBundleContext(); getMetadataDependencyRegistry().registerDependency( PhysicalTypeIdentifier.getMetadataIdentiferType(), getProvidesType()); // addMetadataTrigger(new JavaType( // "org.springframework.stereotype.Controller")); // we don't need to listen changes over our Annotation // @GvNIXModalDialogs because it must always be in @Controller class addMetadataTrigger(MODAL_DIALOGS); }
Example 11
Source File: WSImportMetadataProvider.java From gvnix with GNU General Public License v3.0 | 5 votes |
protected void activate(ComponentContext cContext) { context = cContext.getBundleContext(); // Ensure we're notified of all metadata related to physical Java types, // in particular their initial creation getMetadataDependencyRegistry().registerDependency( PhysicalTypeIdentifier.getMetadataIdentiferType(), getProvidesType()); addMetadataTrigger(new JavaType(GvNIXWebServiceProxy.class.getName())); }
Example 12
Source File: DatatablesJspMetadataListener.java From gvnix with GNU General Public License v3.0 | 5 votes |
protected void activate(final ComponentContext cContext) { context = cContext.getBundleContext(); getMetadataDependencyRegistry().registerDependency( DatatablesMetadata.getMetadataIdentiferType(), getProvidesType()); getMetadataDependencyRegistry() .registerDependency( WebFinderMetadata.getMetadataIdentiferType(), getProvidesType()); getMetadataDependencyRegistry().addNotificationListener(this); }
Example 13
Source File: StartupBundleEntryFactory.java From sling-whiteboard with Apache License 2.0 | 4 votes |
@Activate public void activate(ComponentContext context) { this.bundleContext = context.getBundleContext(); }
Example 14
Source File: BaseDynamicCommandDescriptionProvider.java From openhab-core with Eclipse Public License 2.0 | 4 votes |
@Activate protected void activate(ComponentContext componentContext) { bundleContext = componentContext.getBundleContext(); }
Example 15
Source File: WebBinderOperationsImpl.java From gvnix with GNU General Public License v3.0 | 4 votes |
protected void activate(ComponentContext cContext) { context = cContext.getBundleContext(); }
Example 16
Source File: ItemRegistryImpl.java From smarthome with Eclipse Public License 2.0 | 4 votes |
@Activate protected void activate(final ComponentContext componentContext) { super.activate(componentContext.getBundleContext()); }
Example 17
Source File: ReportJspMetadataListener.java From gvnix with GNU General Public License v3.0 | 4 votes |
protected void activate(ComponentContext cContext) { context = cContext.getBundleContext(); getMetadataDependencyRegistry().registerDependency( ReportMetadata.getMetadataIdentiferType(), getProvidesType()); }
Example 18
Source File: JpaGeoOperationsImpl.java From gvnix with GNU General Public License v3.0 | 4 votes |
protected void activate(ComponentContext cContext) { context = cContext.getBundleContext(); }
Example 19
Source File: JpaBatchMetadataProvider.java From gvnix with GNU General Public License v3.0 | 3 votes |
/** * The activate method for this OSGi component, this will be called by the * OSGi container upon bundle activation (result of the 'addon install' * command) * * @param context the component context can be used to get access to the * OSGi container (ie find out if certain bundles are active) */ protected void activate(ComponentContext cContext) { context = cContext.getBundleContext(); getMetadataDependencyRegistry().registerDependency( PhysicalTypeIdentifier.getMetadataIdentiferType(), getProvidesType()); addMetadataTrigger(new JavaType(GvNIXJpaBatch.class.getName())); }
Example 20
Source File: AutomationCommandsPluggable.java From smarthome with Eclipse Public License 2.0 | 2 votes |
/** * Activating this component - called from DS. * * @param componentContext */ @Activate protected void activate(ComponentContext componentContext) { super.initialize(componentContext.getBundleContext(), moduleTypeRegistry, templateRegistry, ruleRegistry); }