org.osgi.service.component.annotations.ReferenceCardinality Java Examples

The following examples show how to use org.osgi.service.component.annotations.ReferenceCardinality. 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: FrameworkServiceComponent.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
@Reference(
        name = "identity.response.factory",
        service = HttpIdentityResponseFactory.class,
        cardinality = ReferenceCardinality.MULTIPLE,
        policy = ReferencePolicy.DYNAMIC,
        unbind = "removeHttpIdentityResponseFactory"
)
protected void addHttpIdentityResponseFactory(HttpIdentityResponseFactory factory) {

    FrameworkServiceDataHolder.getInstance().getHttpIdentityResponseFactories().add(factory);
    Collections.sort(FrameworkServiceDataHolder.getInstance().getHttpIdentityResponseFactories(),
            new HandlerComparator());
    Collections.reverse(FrameworkServiceDataHolder.getInstance().getHttpIdentityResponseFactories());
    if (log.isDebugEnabled()) {
        log.debug("Added HttpIdentityResponseFactory : " + factory.getName());
    }
}
 
Example #2
Source File: ConfigurationManagerComponent.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
@Reference(
        name = "configuration.context.service",
        service = ConfigurationContextService.class,
        cardinality = ReferenceCardinality.MANDATORY,
        policy = ReferencePolicy.DYNAMIC,
        unbind = "unsetConfigurationContextService"
)
protected void setConfigurationContextService(ConfigurationContextService configurationContextService) {

    /*
     * ConfigurationManagerComponent checks for the database column, 'CREATED_TIME' in the IDN_CONFIG_RESOURCE
     * table. Database connection creation requires in this task depends on the ConfigurationContextService.
     * This reference will ensure that the ConfigurationContextService is activated before the
     * ConfigurationManagerComponent is activated.
     */
    log.debug("ConfigurationContextService Instance registered.");
}
 
Example #3
Source File: IdentityEventServiceComponent.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
@Reference(
         name = "event.handler", 
         service = org.wso2.carbon.identity.event.handler.AbstractEventHandler.class, 
         cardinality = ReferenceCardinality.MULTIPLE, 
         policy = ReferencePolicy.DYNAMIC, 
         unbind = "unRegisterEventHandler")
protected void registerEventHandler(AbstractEventHandler eventHandler) {
    String handlerName = eventHandler.getName();
    try {
        eventHandler.init(IdentityEventConfigBuilder.getInstance().getModuleConfigurations(handlerName));
    } catch (IdentityEventException | IdentityRuntimeException e) {
        log.warn("Properties for " + handlerName + " is not configured. This event handler will not be activated");
    }
    eventHandlerList.add(eventHandler);
    MessageHandlerComparator messageHandlerComparator = new MessageHandlerComparator(null);
    Collections.sort(eventHandlerList, messageHandlerComparator);
}
 
Example #4
Source File: DataServiceCappDeployerServiceComponent.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
@Reference(
        name = "org.wso2.micro.application.deployer.handler",
        service = org.wso2.micro.application.deployer.handler.AppDeploymentHandler.class,
        cardinality = ReferenceCardinality.AT_LEAST_ONE,
        policy = ReferencePolicy.DYNAMIC,
        unbind = "unsetDataServiceCappDeployer")
protected void setDataServiceCappDeployer(AppDeploymentHandler appDeploymentHandler) {
    if (appDeploymentHandler instanceof DataSourceCappDeployer) {
        if (Objects.isNull(ctx)) {
            // save appDeploymentHandler
            appDepHandler = appDeploymentHandler;
        } else {
            registerDataServiceCappDeployer();
        }
    }
}
 
Example #5
Source File: FrameworkServiceComponent.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
@Reference(
        name = "identity.request.factory",
        service = HttpIdentityRequestFactory.class,
        cardinality = ReferenceCardinality.MULTIPLE,
        policy = ReferencePolicy.DYNAMIC,
        unbind = "removeHttpIdentityRequestFactory"
)
protected void addHttpIdentityRequestFactory(HttpIdentityRequestFactory factory) {

    FrameworkServiceDataHolder.getInstance().getHttpIdentityRequestFactories().add(factory);
    Collections.sort(FrameworkServiceDataHolder.getInstance().getHttpIdentityRequestFactories(),
            new HandlerComparator());
    Collections.reverse(FrameworkServiceDataHolder.getInstance().getHttpIdentityRequestFactories());
    if (log.isDebugEnabled()) {
        log.debug("Added HttpIdentityRequestFactory : " + factory.getName());
    }
}
 
Example #6
Source File: ClaimManagementServiceComponent.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
@Reference(
         name = "registry.service", 
         service = RegistryService.class,
         cardinality = ReferenceCardinality.MANDATORY, 
         policy = ReferencePolicy.DYNAMIC, 
         unbind = "unsetRegistryService")
protected void setRegistryService(RegistryService registryService) {
    try {
        ClaimManagementServiceDataHolder.getInstance().setRegistryService(registryService);
    } catch (Throwable e) {
        log.error("Failed to get a reference to the Registry Service.", e);
    }
    if (log.isDebugEnabled()) {
        log.debug("RegistryService set in Claim Management bundle");
    }
}
 
Example #7
Source File: TasksDSComponent.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
@Reference(name = "org.wso2.carbon.ndatasource",
           service = DataSourceService.class,
           cardinality = ReferenceCardinality.MANDATORY,
           policy = ReferencePolicy.DYNAMIC,
           unbind = "unsetDatasourceHandlerService")
protected void setDatasourceHandlerService(DataSourceService dataSourceService) {
    this.dataSourceService = dataSourceService;
}
 
Example #8
Source File: UserStoreConfigComponent.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
@Reference(
        name = "user.realmservice.default",
        service = RealmService.class,
        cardinality = ReferenceCardinality.MANDATORY,
        policy = ReferencePolicy.DYNAMIC,
        unbind = "unsetRealmService"
)
protected void setRealmService(RealmService realmService) {
    if (log.isDebugEnabled()) {
        log.debug("Setting the Realm Service");
    }
    UserStoreConfigComponent.realmService = realmService;
}
 
Example #9
Source File: IdentityProvisionServiceComponent.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
/**
 * @param entitlementService
 */
@Reference(
         name = "identity.entitlement.service", 
         service = org.wso2.carbon.identity.entitlement.EntitlementService.class, 
         cardinality = ReferenceCardinality.AT_LEAST_ONE, 
         policy = ReferencePolicy.DYNAMIC, 
         unbind = "unsetEntitlementService")
protected void setEntitlementService(EntitlementService entitlementService) {
    if (log.isDebugEnabled()) {
        log.debug("EntitlementService is set in the Application Authentication Framework bundle");
    }
    ProvisioningServiceDataHolder.getInstance().setEntitlementService(entitlementService);
}
 
Example #10
Source File: UsbSerialDiscoveryService.java    From openhab-core with Eclipse Public License 2.0 5 votes vote down vote up
@Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC)
protected void addUsbSerialDiscoveryParticipant(UsbSerialDiscoveryParticipant participant) {
    this.discoveryParticipants.add(participant);
    for (UsbSerialDeviceInformation usbSerialDeviceInformation : previouslyDiscovered) {
        DiscoveryResult result = participant.createResult(usbSerialDeviceInformation);
        if (result != null) {
            thingDiscovered(createDiscoveryResultWithUsbProperties(result, usbSerialDeviceInformation));
        }
    }
}
 
Example #11
Source File: CaptchaMgtServiceComponent.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
@Reference(
        name = "registry.service",
        service = org.wso2.carbon.registry.core.service.RegistryService.class,
        cardinality = ReferenceCardinality.MANDATORY,
        policy = ReferencePolicy.DYNAMIC,
        unbind = "unsetRegistryService"
)
protected void setRegistryService(RegistryService registryService) {

    this.registryService = registryService;
}
 
Example #12
Source File: IdPManagementServiceComponent.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
@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 #13
Source File: WorkflowMgtServiceComponent.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
@Reference(
         name = "user.realmservice.default", 
         service = org.wso2.carbon.user.core.service.RealmService.class, 
         cardinality = ReferenceCardinality.MANDATORY, 
         policy = ReferencePolicy.DYNAMIC, 
         unbind = "unsetRealmService")
protected void setRealmService(RealmService realmService) {
    WorkflowServiceDataHolder.getInstance().setRealmService(realmService);
}
 
Example #14
Source File: ThriftAuthenticationServiceComponent.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
@Reference(
         name = "org.wso2.carbon.user.core", 
         service = org.wso2.carbon.user.core.service.RealmService.class, 
         cardinality = ReferenceCardinality.MANDATORY, 
         policy = ReferencePolicy.DYNAMIC, 
         unbind = "unsetRealmService")
protected void setRealmService(RealmService realmService) {
    setRealmServiceInstance(realmService);
}
 
Example #15
Source File: EntitlementServiceComponent.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
/**
 * sets registry service
 *
 * @param registryService <code>RegistryService</code>
 */
@Reference(
        name = "registry.service",
        service = RegistryService.class,
        cardinality = ReferenceCardinality.MANDATORY,
        policy = ReferencePolicy.DYNAMIC,
        unbind = "unsetRegistryService"
)
protected void setRegistryService(RegistryService registryService) {
    if (log.isDebugEnabled()) {
        log.debug("RegistryService set in Entitlement bundle");
    }
    EntitlementServiceComponent.registryService = registryService;
}
 
Example #16
Source File: FrameworkServiceComponent.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
@Reference(
        name = "consent.mgt.service",
        service = ConsentManager.class,
        cardinality = ReferenceCardinality.MANDATORY,
        policy = ReferencePolicy.DYNAMIC,
        unbind = "unsetConsentMgtService"
)
protected void setConsentMgtService(ConsentManager consentManager) {

    if (log.isDebugEnabled()) {
        log.debug("Consent Manger is set in the Application Authentication Framework bundle.");
    }
    FrameworkServiceDataHolder.getInstance().setConsentManager(consentManager);
}
 
Example #17
Source File: IdentityConsentServiceComponent.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
@Reference(
        name = "identityCoreInitializedEventService",
        service = IdentityCoreInitializedEvent.class,
        cardinality = ReferenceCardinality.MANDATORY,
        policy = ReferencePolicy.DYNAMIC,
        unbind = "unsetIdentityCoreInitializedEventService"
)
protected void setIdentityCoreInitializedEventService(IdentityCoreInitializedEvent identityCoreInitializedEvent) {
    /* reference IdentityCoreInitializedEvent service to guarantee that this component will wait until identity core
     is started */
}
 
Example #18
Source File: FrameworkServiceComponent.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
@Reference(
        name = "identity.post.authn.handler",
        service = PostAuthenticationHandler.class,
        cardinality = ReferenceCardinality.MULTIPLE,
        policy = ReferencePolicy.DYNAMIC,
        unbind = "unsetPostAuthenticationHandler"
)
protected void setPostAuthenticationHandler(PostAuthenticationHandler postAuthenticationHandler) {

    if (log.isDebugEnabled()) {
        log.debug("Post Authenticaion Handler : " + postAuthenticationHandler.getName() + " registered");
    }
    FrameworkServiceDataHolder.getInstance().addPostAuthenticationHandler(postAuthenticationHandler);
}
 
Example #19
Source File: ItemRegistryImpl.java    From openhab-core with Eclipse Public License 2.0 5 votes vote down vote up
@Reference(cardinality = ReferenceCardinality.OPTIONAL, policy = ReferencePolicy.DYNAMIC)
protected void setItemStateConverter(ItemStateConverter itemStateConverter) {
    this.itemStateConverter = itemStateConverter;
    for (Item item : getItems()) {
        ((GenericItem) item).setItemStateConverter(itemStateConverter);
    }
}
 
Example #20
Source File: TemplateManagerComponent.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
@Reference(
        name = "carbon.configuration.mgt.component",
        service = ConfigurationManager.class,
        cardinality = ReferenceCardinality.MANDATORY,
        policy = ReferencePolicy.DYNAMIC,
        unbind = "unsetConfigurationManager")
protected void setConfigurationManager(ConfigurationManager configurationManager) {

    if (log.isDebugEnabled()) {
        log.debug("Configuration Manager service is set in the Template Manager component.");
    }
    TemplateManagerDataHolder.getInstance().setConfigurationManager(configurationManager);
}
 
Example #21
Source File: UserMgtDSComponent.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
@Reference(
         name = "identityCoreInitializedEventService",
         service = org.wso2.carbon.identity.core.util.IdentityCoreInitializedEvent.class,
         cardinality = ReferenceCardinality.MANDATORY,
         policy = ReferencePolicy.DYNAMIC,
         unbind = "unsetIdentityCoreInitializedEventService")
protected void setIdentityCoreInitializedEventService(IdentityCoreInitializedEvent identityCoreInitializedEvent) {
/* reference IdentityCoreInitializedEvent service to guarantee that this component will wait until identity core
     is started */
}
 
Example #22
Source File: ExtensibleTrustManagerImpl.java    From openhab-core with Eclipse Public License 2.0 5 votes vote down vote up
@Override
@Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC)
public void addTlsCertificateProvider(TlsCertificateProvider tlsCertificateProvider) {
    X509ExtendedTrustManager trustManager = new TlsCertificateTrustManagerAdapter(tlsCertificateProvider)
            .getTrustManager();
    mappingFromTlsCertificateProvider.put(tlsCertificateProvider, trustManager);
    addLinkedTrustManager(tlsCertificateProvider.getHostName(), trustManager);
}
 
Example #23
Source File: IdentityConsentServiceComponent.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
@Reference(
        name = "privileged.consent.manager",
        service = PrivilegedConsentManager.class,
        cardinality = ReferenceCardinality.MANDATORY,
        policy = ReferencePolicy.DYNAMIC,
        unbind = "unsetPrivilegedConsentManager"
)
protected void setPrivilegedConsentManager(PrivilegedConsentManager consentManager) {

    if (log.isDebugEnabled()) {
        log.debug("Privileged Consent Manger is set in the Identity Consent Service component bundle.");
    }
    IdentityConsentDataHolder.getInstance().setPrivilegedConsentManager(consentManager);
}
 
Example #24
Source File: IdentityMgtServiceComponent.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
@Reference(
        name = "realm.service",
        service = RealmService.class,
        cardinality = ReferenceCardinality.MANDATORY,
        policy = ReferencePolicy.DYNAMIC,
        unbind = "unsetRealmService"
)
protected void setRealmService(RealmService realmService) {
    log.debug("Setting the Realm Service");
    IdentityMgtServiceComponent.realmService = realmService;
}
 
Example #25
Source File: ModelAdapterFactory.java    From sling-org-apache-sling-models-impl with Apache License 2.0 5 votes vote down vote up
@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 #26
Source File: SecurityMgtServiceComponent.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
@Reference(
        name = "registry.service",
        service = RegistryService.class,
        cardinality = ReferenceCardinality.MANDATORY,
        policy = ReferencePolicy.DYNAMIC,
        unbind = "unsetRegistryService"
)
protected void setRegistryService(RegistryService registryService) {
    if (log.isDebugEnabled()) {
        log.debug("Setting the RegistryService");
    }
    this.registryService = registryService;
    SecurityServiceHolder.setRegistryService(registryService);
}
 
Example #27
Source File: IdentityCoreServiceComponent.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
/**
 *
 * @param client
 */
@Reference(
        name = "is.migration.client",
        service = MigrationClient.class,
        cardinality = ReferenceCardinality.OPTIONAL,
        policy = ReferencePolicy.DYNAMIC,
        unbind = "unsetMigrationClient"
)
protected void setMigrationClient(MigrationClient client) {
    migrationClient = client;
}
 
Example #28
Source File: AutomationResourceBundlesTracker.java    From openhab-core with Eclipse Public License 2.0 5 votes vote down vote up
@SuppressWarnings({ "rawtypes" })
@Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, target = "(provider.type=bundle)")
protected void addProvider(Provider provider) {
    if (provider instanceof AbstractResourceBundleProvider) {
        addAbstractResourceBundleProvider((AbstractResourceBundleProvider) provider);
    }
}
 
Example #29
Source File: TrackControllerImpl.java    From osgi.iot.contest.sdk with Apache License 2.0 5 votes vote down vote up
@Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC)
public void addSignalController(SignalSegmentController c, Map<String, Object> properties) {
    int id = (Integer) properties.get(SegmentController.CONTROLLER_ID);
    signals.put(id, c);

    Optional<String> segment = getSegment(id);

    if (segment.isPresent()) {
        Color color = c.getSignal() ;
        info("initialise signal<{}> to {}", segment.get(), color);
        trackManager.signal(segment.get(), color);
    }
}
 
Example #30
Source File: UserStoreConfigComponent.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
@Reference(
        name = "user.store.configuration",
        service = AbstractUserStoreDAOFactory.class,
        cardinality = ReferenceCardinality.MULTIPLE,
        policy = ReferencePolicy.DYNAMIC,
        unbind = "unsetUserStoreDAOFactory"
)
protected void setUserStoreDAOFactory(AbstractUserStoreDAOFactory userStoreDAOFactory) {

    UserStoreConfigListenersHolder.getInstance().getUserStoreDAOFactories()
            .put(userStoreDAOFactory.getRepository(), userStoreDAOFactory);
    if (log.isDebugEnabled()) {
        log.debug("Added UserStoreDAOFactory : " + userStoreDAOFactory.getRepository());
    }
}