protected void activate(ComponentContext ctx) { try { // Register the valves with Tomcat ArrayList<CarbonTomcatValve> valves = new ArrayList<CarbonTomcatValve>(); valves.add(new TenantLazyLoaderValve()); if (GhostDeployerUtils.isGhostOn()) { valves.add(new GhostWebappDeployerValve()); // registering WebappUnloader as an OSGi service WebappUnloader webappUnloader = new WebappUnloader(); ctx.getBundleContext() .registerService(ArtifactUnloader.class.getName(), webappUnloader, null); GhostWebappMetaArtifactsLoader artifactsLoader = new GhostWebappMetaArtifactsLoader(); ctx.getBundleContext() .registerService(GhostMetaArtifactsLoader.class.getName(), artifactsLoader, null); } else { setServerURLParam(DataHolder.getServerConfigContext()); } // adding TenantLazyLoaderValve first in the TomcatContainer if Url mapping available if (DataHolder.getHotUpdateService() != null // && TomcatValveContainer.isValveExists(new UrlMapperValve //TODO: Fix this // once URLMapper component becomes available ) { TomcatValveContainer.addValves(WebappsConstants.VALVE_INDEX, valves); } else { TomcatValveContainer.addValves(valves); } } catch (Throwable e) { log.error("Error occurred while activating WebappManagementServiceComponent", e); } }
protected void activate(ComponentContext componentContext) throws AgentServerException { if (log.isDebugEnabled()) { log.debug("Starting the Bam Event Receiver Server component"); } initialize(); BAMEventReceiverComponentManager.getInstance().init(registryService); ServiceReference serviceReference = componentContext.getBundleContext().getServiceReference(AgentServer.class.getName()); if (serviceReference != null) { agentServer = (AgentServer) componentContext.getBundleContext().getService(serviceReference); } agentServer.subscribe(new BAMAgentCallback()); }
protected void activate(ComponentContext context) { BundleContext bundleContext = context.getBundleContext(); tracker = new ExternalRepositoryProcessorTracker( bundleContext, ExternalRepositoryProcessor.class.getName(), null); tracker.open(); }
protected void activate(ComponentContext componentContext) { if (log.isDebugEnabled()) { log.debug("RSS Cluster tools Admin bundle is activated."); } try { BundleContext bundleContext = componentContext.getBundleContext(); PrivilegedCarbonContext.startTenantFlow(); PrivilegedCarbonContext.getThreadLocalCarbonContext() .setTenantId(MultitenantConstants.SUPER_TENANT_ID); bundleContext.registerService( TransactionManagerDummyService.class.getName(), new TransactionManagerDummyService(), null); UsageManagerDataHolder.getInstance().initTransactionManager(); // initialize configurations StorageMetaDataConfig.getInstance().init(); StorageDataPublishManager.getInstance().init(taskService, secretCallbackHandlerService); UsageManagerDataHolder.getInstance().setRSSManagerService(this.RSSManagerService); UsageManagerDataHolder.getInstance().setRealmService(realmService); } catch (Exception e) { log.error(e); if (log.isDebugEnabled()) { log.debug("Error while initializing configurations ", e); } } finally { PrivilegedCarbonContext.endTenantFlow(); } }
@Activate protected void activate(ComponentContext componentContext) throws Exception { LOG.info("Starting Activation of AMQ Broker "); try { Dictionary<?, ?> properties = componentContext.getProperties(); BundleContext bundleContext = componentContext.getBundleContext(); String brokerUrl = (String) properties.get(ACTIVEMQ_BROKER_URL); broker = new BrokerService(); // generate a full path String slingHome = bundleContext.getProperty("sling.home"); String dataPath = slingHome + "/activemq-data"; LOG.info("Setting Data Path to [{}] [{}] ", new Object[] {slingHome, dataPath}); broker.setDataDirectory(dataPath); String federatedBrokerUrl = (String) properties.get(ACTIVEMQ_FEDERATED_BROKER_URL); if (federatedBrokerUrl != null && federatedBrokerUrl.length() > 0) { LOG.info("Federating ActiveMQ [" + federatedBrokerUrl + "]"); NetworkConnector connector = broker.addNetworkConnector(federatedBrokerUrl); connector.setDuplex(true); } // configure the broker LOG.info("Adding ActiveMQ connector [" + brokerUrl + "]"); broker.addConnector(brokerUrl); broker.start(); } catch (Exception e) { LOG.info(e.getMessage(), e); throw e; } }
protected void activate(ComponentContext ctxt) { // You may delete all references to metatype service if // your algorithm does not require parameters and return // null in the createParameters() method MetaTypeService mts = (MetaTypeService) ctxt.locateService("MTS"); provider = mts.getMetaTypeInformation(ctxt.getBundleContext().getBundle()); }
@Activate public void activate(ComponentContext componentContext) throws IOException, ParserConfigurationException, SAXException { BundleContext bundleContext = componentContext.getBundleContext(); solrHome = Utils.getSolrHome(bundleContext); multiMasterProperties = getMultiMasterProperties(toMap(componentContext.getProperties())); }
protected void activate(ComponentContext context) { // Registering OAuth2Service as a OSGIService bundleContext = context.getBundleContext(); bundleContext.registerService( ApplicationManagementService.class.getName(), new ApplicationManagementService(), null); log.info("Identity ApplicationManagementComponent bundle is activated"); }
protected void activate(final ComponentContext cContext) { context = cContext.getBundleContext(); getMetadataDependencyRegistry() .registerDependency(PhysicalTypeIdentifier.getMetadataIdentiferType(), getProvidesType()); setIgnoreTriggerAnnotations(true); setDependsOnGovernorBeingAClass(false); }
protected void activate(ComponentContext ctxt) { log.info("Initializing the BPMN core component..."); try { BundleContext bundleContext = ctxt.getBundleContext(); BPMNServerHolder holder = BPMNServerHolder.getInstance(); ActivitiEngineBuilder activitiEngineBuilder = new ActivitiEngineBuilder(); holder.setEngine(activitiEngineBuilder.buildEngine()); holder.setTenantManager(new TenantManager()); BPMNRestExtensionHolder restHolder = BPMNRestExtensionHolder.getInstance(); restHolder.setRestInvoker(new RESTInvoker()); bundleContext.registerService( WaitBeforeShutdownObserver.class.getName(), new BPMNEngineShutdown(), null); // DataSourceHandler dataSourceHandler = new DataSourceHandler(); // dataSourceHandler.initDataSource(activitiEngineBuilder.getDataSourceJndiName()); // dataSourceHandler.closeDataSource(); // } catch (BPMNMetaDataTableCreationException e) { // log.error("Could not create BPMN checksum table", e); // } catch (DatabaseConfigurationException e) { // log.error("Could not create BPMN checksum table", e); } catch (Throwable e) { log.error("Failed to initialize the BPMN core component.", e); } }
protected void activate(ComponentContext context) { try { bundleContext = context.getBundleContext(); if (CommonUtil.getStratosConfig() == null) { StratosConfiguration stratosConfig = CommonUtil.loadStratosConfiguration(); CommonUtil.setStratosConfig(stratosConfig); } // Loading the EULA if (CommonUtil.getEula() == null) { String eula = CommonUtil.loadTermsOfUsage(); CommonUtil.setEula(eula); } // packageInfos = new PackageInfoHolder(); // context.getBundleContext().registerService( // PackageInfoHolder.class.getName(), packageInfos, null); // Register manager configuration OSGI service try { StratosConfiguration stratosConfiguration = CommonUtil.loadStratosConfiguration(); bundleContext.registerService( StratosConfiguration.class.getName(), stratosConfiguration, null); if (log.isDebugEnabled()) { log.debug("******* Cloud Common Service bundle is activated ******* "); } } catch (Exception ex) { String msg = "An error occurred while initializing Cloud Common Service as an OSGi Service"; log.error(msg, ex); } } catch (Throwable e) { log.error("Error in activating Cloud Common Service Component" + e.toString()); } }
@Override public Bundle[] getBundles() { if (m_ctx == null) { return null; } return m_ctx.getBundleContext().getBundles(); }
protected void activate(ComponentContext context) { BundleContext bundleContext = context.getBundleContext(); bundleContext.registerService(AdapterComponent.class, new AdapterComponent(), null); if (log.isDebugEnabled()) { log.debug("Social Activity service is activated with Adaptor implementation"); } }
protected void activate(ComponentContext context) { BundleContext bundleContext = context.getBundleContext(); tracker = new SearchResultProcessorTracker(bundleContext); tracker.open(); siteSearchResultProcessor = new SiteSearchResultProcessor(); siteSearchResultProcessor.bindSiteService(siteService); }
public DefaultAuthorizablesLoader( AuthorizablePostProcessService authorizablePostProcessService, ComponentContext componentContext, SlingRepository repository) { this.authorizablePostProcessService = authorizablePostProcessService; this.bundle = componentContext.getBundleContext().getBundle(); this.repository = repository; }
private void registerAxis2ConfigurationContextObserver(ComponentContext context) { context .getBundleContext() .registerService( Axis2ConfigurationContextObserver.class.getName(), new Axis2ConfigurationContextObserverImpl(), null); }
private void registerServices(ComponentContext componentContext) { if (log.isDebugEnabled()) { log.debug("Registering OSGi service DeviceManagementProviderServiceImpl"); } /* Registering Device Management Service */ BundleContext bundleContext = componentContext.getBundleContext(); DeviceManagementProviderService deviceManagementProvider = new DeviceManagementProviderServiceImpl(); DeviceManagementDataHolder.getInstance().setDeviceManagementProvider(deviceManagementProvider); bundleContext.registerService( DeviceManagementProviderService.class.getName(), deviceManagementProvider, null); /* Registering Group Management Service */ GroupManagementProviderService groupManagementProvider = new GroupManagementProviderServiceImpl(); DeviceManagementDataHolder.getInstance() .setGroupManagementProviderService(groupManagementProvider); bundleContext.registerService( GroupManagementProviderService.class.getName(), groupManagementProvider, null); /* Registering Tenant Configuration Management Service */ PlatformConfigurationManagementService tenantConfiguration = new PlatformConfigurationManagementServiceImpl(); bundleContext.registerService( PlatformConfigurationManagementService.class.getName(), tenantConfiguration, null); /* Registering Notification Service */ NotificationManagementService notificationManagementService = new NotificationManagementServiceImpl(); bundleContext.registerService( NotificationManagementService.class.getName(), notificationManagementService, null); /* Registering Scope Management Service */ ScopeManagementService scopeManagementService = new ScopeManagementServiceImpl(); bundleContext.registerService( ScopeManagementService.class.getName(), scopeManagementService, null); /* Registering DeviceAccessAuthorization Service */ DeviceAccessAuthorizationService deviceAccessAuthorizationService = new DeviceAccessAuthorizationServiceImpl(); DeviceManagementDataHolder.getInstance() .setDeviceAccessAuthorizationService(deviceAccessAuthorizationService); bundleContext.registerService( DeviceAccessAuthorizationService.class.getName(), deviceAccessAuthorizationService, null); /* Registering App Management service */ try { AppManagementConfigurationManager.getInstance().initConfig(); AppManagementConfig appConfig = AppManagementConfigurationManager.getInstance().getAppManagementConfig(); bundleContext.registerService( ApplicationManagementProviderService.class.getName(), new ApplicationManagerProviderServiceImpl(appConfig), null); } catch (ApplicationManagementException e) { log.error("Application management service not registered.", e); } }
/** * Returns a mocked {@link ComponentContext} instance. * * @return a {@link ComponentContext} instance */ private ComponentContext getMockedContext() { ComponentContext mockedContext = mock(ComponentContext.class); BundleContext mockedBundleContext = mock(BundleContext.class); Dictionary<String, String> compContextProperties = new Hashtable<String, String>(); // compContextProperties.put("config.factory-pid", null); when(mockedContext.getProperties()).thenReturn(compContextProperties); when(mockedContext.getBundleContext()).thenReturn(mockedBundleContext); return mockedContext; }
/** * Called by the {@link PhantomJsActivator} on service activation. * * @param ctx the component context */ void activate(ComponentContext ctx) { try { prepareScript(); } catch (IOException e) { throw new IllegalStateException(e); } previewGeneratorTracker = new ImagePreviewGeneratorTracker(ctx.getBundleContext()); previewGeneratorTracker.open(); }
protected void activate(ComponentContext context) { try { Util.registerRetrieverServices(context.getBundleContext()); if (log.isDebugEnabled()) { log.debug("******* Tenant Activity bundle is activated ******* "); } } catch (Throwable e) { log.error("******* Error in activating Tenant Activity bundle ******* ", e); } }
/** * This service is being activated so setup it: * * <ul> * <li>Create and open the {@link MetadataDependencyRegistryTracker}. * <li>Set ensure the governor type details represent a class. * <li>Set ignore trigger annotations. It means that other MD providers that want to discover * whether a type has finders can do so. * </ul> */ @Override protected void activate(final ComponentContext cContext) { context = cContext.getBundleContext(); this.registryTracker = new MetadataDependencyRegistryTracker( context, null, PhysicalTypeIdentifier.getMetadataIdentiferType(), getProvidesType()); this.registryTracker.open(); setIgnoreTriggerAnnotations(true); setDependsOnGovernorBeingAClass(false); }
protected void activate(ComponentContext context) { try { if (log.isDebugEnabled()) { log.debug("Identity Management Listener is enabled"); } BundleContext bundleContext = context.getBundleContext(); IdentityPasswordHistoryServiceDataHolder.getInstance().setBundleContext(bundleContext); PasswordHistoryValidationHandler handler = new PasswordHistoryValidationHandler(); context .getBundleContext() .registerService(AbstractEventHandler.class.getName(), handler, null); } catch (Exception e) { log.error("Error while activating identity governance component.", e); } }
protected void activate(ComponentContext context) { BundleContext bundleContext = context.getBundleContext(); WorkflowManagementService workflowService = new WorkflowManagementServiceImpl(); bundleContext.registerService(WorkflowManagementService.class, workflowService, null); WorkflowServiceDataHolder.getInstance().setWorkflowService(workflowService); WorkflowServiceDataHolder.getInstance().setBundleContext(bundleContext); }
private void registerServices(ComponentContext componentContext) { if (log.isDebugEnabled()) { log.debug("Registering email sender service"); } EmailSenderService emailServiceProvider = new EmailSenderServiceImpl(); EmailSenderDataHolder.getInstance().setEmailServiceProvider(emailServiceProvider); componentContext .getBundleContext() .registerService(EmailSenderService.class, emailServiceProvider, null); }
/** @param ctxt */ protected void activate(ComponentContext ctxt) { if (log.isDebugEnabled()) { log.info("Identity STS Mgt bundle is activated"); } bundleContext = ctxt.getBundleContext(); try { initialize(); } catch (Throwable e) { log.error("Failed to load security scenarios", e); } }
protected void activate(ComponentContext ctxt) { if (log.isDebugEnabled()) { log.debug("Carbon STS bundle is activated"); } try { BundleContext bundleCtx = ctxt.getBundleContext(); STSServiceDataHolder.getInstance().setBundle(bundleCtx.getBundle()); // Publish the OSGi service Dictionary props = new Hashtable(); props.put(CarbonConstants.AXIS2_CONFIG_SERVICE, AxisObserver.class.getName()); ctxt.getBundleContext() .registerService(AxisObserver.class.getName(), new STSDeploymentInterceptor(), props); // Publish an OSGi service to listen tenant configuration context creation events bundleCtx.registerService( Axis2ConfigurationContextObserver.class.getName(), new STSDeploymentListener(), null); } catch (Throwable e) { log.error("Error occurred while updating carbon STS service", e); } }
/** * This service is being activated so setup it: * * <ul> * <li>Create and open the {@link MetadataDependencyRegistryTracker}. * <li>Registers {@link RooJavaType#ROO_JPA_AUDIT} as additional JavaType that will trigger * metadata registration. * <li>Set ensure the governor type details represent a class. * </ul> */ @Override protected void activate(final ComponentContext cContext) { context = cContext.getBundleContext(); super.setDependsOnGovernorBeingAClass(true); this.registryTracker = new MetadataDependencyRegistryTracker( context, this, PhysicalTypeIdentifier.getMetadataIdentiferType(), getProvidesType()); this.registryTracker.open(); addMetadataTrigger(ROO_JPA_AUDIT); }
@Activate public void activate(ComponentContext componentContext) throws InvalidSyntaxException, ServletException { BundleContext bc = componentContext.getBundleContext(); ServiceReference[] rs = bc.getServiceReferences(DefaultServletDelegate.class.getName(), null); if (rs != null) { for (ServiceReference r : rs) { bindDelegate((DefaultServletDelegate) bc.getService(r)); } } }
/** Callback on component activation. */ protected void activate(ComponentContext cc) { String loadUsers = StringUtils.trimToNull( cc.getBundleContext().getProperty("org.opencastproject.security.demo.loadusers")); // Load the demo users, if necessary if (Boolean.valueOf(loadUsers)) { // Load 100 series and 1000 users, but don't block activation new Loader().start(); } }
/** * initialize the cep service here. * * @param context */ protected void activate(ComponentContext context) { try { CEPServiceInterface cepServiceInterface = createCEPService(); context .getBundleContext() .registerService(CEPServiceInterface.class.getName(), cepServiceInterface, null); registerAxis2ConfigurationContextObserver(context); log.info("Successfully deployed the cep service"); } catch (Throwable e) { log.error("Can not create the cep service ", e); } }