Java Code Examples for org.osgi.service.component.annotations.ReferenceCardinality#MULTIPLE
The following examples show how to use
org.osgi.service.component.annotations.ReferenceCardinality#MULTIPLE .
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: CryptoImplComponent.java From micro-integrator with Apache License 2.0 | 6 votes |
@Reference(name = "serverConfigurationService", service = CarbonServerConfigurationService.class, policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.MULTIPLE, unbind = "unsetServerConfigurationService") public void setServerConfigurationService(CarbonServerConfigurationService serverConfigurationService) { // Read the internal crypto provider class name from the conf file. this.defaultCryptoService.setInternalCryptoProviderClassName( serverConfigurationService.getFirstProperty("CryptoService.InternalCryptoProviderClassName")); // Read the external crypto provider class name from the conf file. this.defaultCryptoService.setExternalCryptoProviderClassName( serverConfigurationService.getFirstProperty("CryptoService.ExternalCryptoProviderClassName")); // Read resolver configurations readAndOverrideKeyResolverPriorities(serverConfigurationService.getDocumentElement()); }
Example 2
Source File: CryptoImplComponent.java From micro-integrator with Apache License 2.0 | 5 votes |
@Reference(name = "keyResolver", service = KeyResolver.class, cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, unbind = "unsetKeyResolver") public void setKeyResolver(KeyResolver keyResolver) { this.defaultCryptoService.registerKeyResolver(keyResolver); // Re-order the resolvers whenever a new resolver is registered. overrideKeyResolverPriorities(); }
Example 3
Source File: AnnotatedThingActionModuleTypeProvider.java From openhab-core with Eclipse Public License 2.0 | 5 votes |
@Reference(policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.MULTIPLE) public void addAnnotatedThingActions(ThingActions annotatedThingActions) { if (annotatedThingActions.getClass().isAnnotationPresent(ThingActionsScope.class)) { ThingActionsScope scope = annotatedThingActions.getClass().getAnnotation(ThingActionsScope.class); Collection<ModuleInformation> moduleInformations = helper.parseAnnotations(scope.name(), annotatedThingActions); String thingUID = annotatedThingActions.getThingHandler().getThing().getUID().getAsString(); for (ModuleInformation mi : moduleInformations) { mi.setThingUID(thingUID); ModuleType oldType = null; if (moduleInformation.containsKey(mi.getUID())) { oldType = helper.buildModuleType(mi.getUID(), moduleInformation); Set<ModuleInformation> availableModuleConfigs = moduleInformation.get(mi.getUID()); availableModuleConfigs.add(mi); } else { Set<ModuleInformation> configs = ConcurrentHashMap.newKeySet(); configs.add(mi); moduleInformation.put(mi.getUID(), configs); } ModuleType mt = helper.buildModuleType(mi.getUID(), moduleInformation); if (mt != null) { for (ProviderChangeListener<ModuleType> l : changeListeners) { if (oldType != null) { l.updated(this, oldType, mt); } else { l.added(this, mt); } } } } } }
Example 4
Source File: IdPManagementServiceComponent.java From carbon-identity-framework with Apache License 2.0 | 5 votes |
@Reference( name = "identity.core.ConnectorConfig", service = org.wso2.carbon.identity.core.ConnectorConfig.class, cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, unbind = "unsetGovernanceConnector") protected void setIdentityGovernanceConnector(ConnectorConfig identityConnectorConfig) { try { IdpMgtServiceComponentHolder.getInstance().addConnectorConfig(identityConnectorConfig); } catch (IdentityProviderManagementException e) { log.error("Error while clearing the cache with the registered connector config."); } }
Example 5
Source File: ScriptEngineManagerImpl.java From openhab-core with Eclipse Public License 2.0 | 5 votes |
@Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC) public void addScriptEngineFactory(ScriptEngineFactory engineFactory) { List<String> scriptTypes = engineFactory.getScriptTypes(); logger.trace("{}.getScriptTypes(): {}", engineFactory.getClass().getSimpleName(), scriptTypes); for (String scriptType : scriptTypes) { if (isCustomFactory(engineFactory)) { this.customSupport.put(scriptType, engineFactory); } else { this.genericSupport.put(scriptType, engineFactory); } } if (!engineFactory.getScriptTypes().isEmpty()) { ScriptEngine scriptEngine = engineFactory.createScriptEngine(engineFactory.getScriptTypes().get(0)); if (scriptEngine != null) { javax.script.ScriptEngineFactory factory = scriptEngine.getFactory(); logger.debug( "Initialized a {} ScriptEngineFactory for {} ({}): supports {} ({}) with file extensions {}, names {}, and mimetypes {}", (isCustomFactory(engineFactory)) ? "custom" : "generic", factory.getEngineName(), factory.getEngineVersion(), factory.getLanguageName(), factory.getLanguageVersion(), factory.getExtensions(), factory.getNames(), factory.getMimeTypes()); } else { logger.trace("addScriptEngineFactory: engine was null"); } } else { logger.trace("addScriptEngineFactory: scriptTypes was empty"); } }
Example 6
Source File: ManagedItemProvider.java From openhab-core with Eclipse Public License 2.0 | 5 votes |
@Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC) protected void addItemFactory(ItemFactory itemFactory) { itemFactories.add(itemFactory); if (!failedToCreate.isEmpty()) { // retry failed creation attempts Iterator<Entry<String, PersistedItem>> iterator = failedToCreate.entrySet().iterator(); while (iterator.hasNext()) { Entry<String, PersistedItem> entry = iterator.next(); String itemName = entry.getKey(); PersistedItem persistedItem = entry.getValue(); Item item = itemFactory.createItem(persistedItem.itemType, itemName); if (item != null && item instanceof ActiveItem) { iterator.remove(); configureItem(persistedItem, (ActiveItem) item); notifyListenersAboutAddedElement(item); } else { logger.debug("The added item factory '{}' still could not instantiate item '{}'.", itemFactory, itemName); } } if (failedToCreate.isEmpty()) { logger.info("Finished loading the items which could not have been created before."); } } }
Example 7
Source File: ModelAdapterFactory.java From sling-org-apache-sling-models-impl with Apache License 2.0 | 5 votes |
@Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC) protected void bindStaticInjectAnnotationProcessorFactory(final StaticInjectAnnotationProcessorFactory factory, final Map<String, Object> props) { synchronized (staticInjectAnnotationProcessorFactories) { staticInjectAnnotationProcessorFactories.bind(factory, props); this.adapterImplementations.setStaticInjectAnnotationProcessorFactories(staticInjectAnnotationProcessorFactories.get()); } }
Example 8
Source File: WorkflowMgtServiceComponent.java From carbon-identity-framework with Apache License 2.0 | 5 votes |
@Reference( name = "org.wso2.carbon.identity.workflow.mgt.extension.requesthandler", service = org.wso2.carbon.identity.workflow.mgt.extension.WorkflowRequestHandler.class, cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, unbind = "unsetWorkflowRequestHandler") protected void setWorkflowRequestHandler(WorkflowRequestHandler workflowRequestHandler) { WorkflowServiceDataHolder.getInstance().addWorkflowRequestHandler(workflowRequestHandler); }
Example 9
Source File: IdentityClaimManagementServiceComponent.java From carbon-identity-framework with Apache License 2.0 | 5 votes |
@Reference( name = "claim.manager.listener.service", service = org.wso2.carbon.user.core.listener.ClaimManagerListener.class, cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, unbind = "unsetClaimManagerListener") public synchronized void setClaimManagerListener(ClaimManagerListener claimManagerListener) { IdentityClaimManagementServiceDataHolder.getInstance().setClaimManagerListener(claimManagerListener); if (log.isDebugEnabled()) { log.debug("ClaimManagerListener set in Identity Claim Management bundle"); } }
Example 10
Source File: RulesRefresher.java From openhab-core with Eclipse Public License 2.0 | 4 votes |
@Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC) protected void addActionService(ActionService actionService) { if (started) { scheduleRuleRefresh(); } }
Example 11
Source File: ThingRegistryImpl.java From openhab-core with Eclipse Public License 2.0 | 4 votes |
@Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC) protected void addThingHandlerFactory(ThingHandlerFactory thingHandlerFactory) { this.thingHandlerFactories.add(thingHandlerFactory); }
Example 12
Source File: Command.java From osgi.iot.contest.sdk with Apache License 2.0 | 4 votes |
@Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC) void addSwitch(SwitchSegmentController t, ServiceReference<?> ref) { switches.put((Integer) ref.getProperty(SegmentController.CONTROLLER_ID), t); }
Example 13
Source File: SitemapSubscriptionService.java From openhab-core with Eclipse Public License 2.0 | 4 votes |
@Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC) protected void addSitemapProvider(SitemapProvider provider) { sitemapProviders.add(provider); provider.addModelChangeListener(this); }
Example 14
Source File: BindingInfoRegistry.java From openhab-core with Eclipse Public License 2.0 | 4 votes |
@Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC) protected void addBindingInfoProvider(BindingInfoProvider bindingInfoProvider) { if (bindingInfoProvider != null) { bindingInfoProviders.add(bindingInfoProvider); } }
Example 15
Source File: CommunicationManager.java From openhab-core with Eclipse Public License 2.0 | 4 votes |
@Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC) protected void addProfileFactory(ProfileFactory profileFactory) { this.profileFactories.put(profileFactory, ConcurrentHashMap.newKeySet()); }
Example 16
Source File: ItemUIRegistryImpl.java From openhab-core with Eclipse Public License 2.0 | 4 votes |
@Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC) public void addItemUIProvider(ItemUIProvider itemUIProvider) { itemUIProviders.add(itemUIProvider); }
Example 17
Source File: Command.java From osgi.iot.contest.sdk with Apache License 2.0 | 4 votes |
@Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC) void addTrain(TrainController t, ServiceReference<?> ref) { String ch = (String) ref.getProperty("channel"); trains.put(ch.toLowerCase(), t); }
Example 18
Source File: ExtensionResource.java From openhab-core with Eclipse Public License 2.0 | 4 votes |
@Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC) protected void addExtensionService(ExtensionService featureService) { this.extensionServices.add(featureService); }
Example 19
Source File: ConfigDescriptionRegistry.java From openhab-core with Eclipse Public License 2.0 | 4 votes |
@Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC) protected void addConfigDescriptionProvider(ConfigDescriptionProvider configDescriptionProvider) { if (configDescriptionProvider != null) { configDescriptionProviders.add(configDescriptionProvider); } }
Example 20
Source File: AutomationResourceBundlesTracker.java From openhab-core with Eclipse Public License 2.0 | 2 votes |
/** * This method provides functionality for tracking {@link Parser} services. * * @param parser {@link Parser} service * @param properties of the service that has been added. */ @Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, target = "(parser.type=parser.rule)") protected void addParser(Parser<Rule> parser, Map<String, String> properties) { rImporter.addParser(parser, properties); }