Java Code Examples for org.osgi.service.component.annotations.ReferencePolicy#DYNAMIC

The following examples show how to use org.osgi.service.component.annotations.ReferencePolicy#DYNAMIC . 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.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 2
Source File: UserMgtDSComponent.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
@Reference(
        name = "org.wso2.carbon.user.core.listener.UserOperationEventListener",
        service = UserOperationEventListener.class,
        cardinality = ReferenceCardinality.MULTIPLE,
        policy = ReferencePolicy.DYNAMIC,
        unbind = "unsetUserOperationEventListenerService")
protected synchronized void setUserOperationEventListenerService(
        UserOperationEventListener userOperationEventListenerService) {

    userOperationEventListenerCollection = null;
    if (userOperationEventListeners == null) {
        userOperationEventListeners = new TreeMap<>();
    }
    userOperationEventListeners
            .put(userOperationEventListenerService.getExecutionOrderId(), userOperationEventListenerService);
}
 
Example 3
Source File: ApplicationManagementServiceComponent.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");
    }
    ApplicationManagementServiceComponentHolder.getInstance().setRealmService(realmService);
}
 
Example 4
Source File: APIHandlerServiceComponent.java    From carbon-apimgt with Apache License 2.0 5 votes vote down vote up
@Reference(
        name = "api.manager.jwt.validation.service",
        service = org.wso2.carbon.apimgt.impl.jwt.JWTValidationService.class,
        cardinality = ReferenceCardinality.MANDATORY,
        policy = ReferencePolicy.DYNAMIC,
        unbind = "unsetJWTValidationService")
protected void setJWTValidationService(JWTValidationService jwtValidationService) {

    if (log.isDebugEnabled()) {
        log.debug("JWT Validation service bound to the API handlers");
    }
    ServiceReferenceHolder.getInstance().setJwtValidationService(jwtValidationService);
}
 
Example 5
Source File: FrameworkServiceComponent.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
@Reference(
        name = "claim.meta.mgt.service",
        service = ClaimMetadataManagementService.class,
        cardinality = ReferenceCardinality.MANDATORY,
        policy = ReferencePolicy.DYNAMIC,
        unbind = "unsetClaimMetaMgtService"
)
protected void setClaimMetaMgtService(ClaimMetadataManagementService claimMetaMgtService) {

    FrameworkServiceDataHolder.getInstance().setClaimMetadataManagementService(claimMetaMgtService);
}
 
Example 6
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 7
Source File: APIManagerComponent.java    From carbon-apimgt with Apache License 2.0 5 votes vote down vote up
@Reference(
        name = "notifier.component",
        service = Notifier.class,
        cardinality = ReferenceCardinality.MULTIPLE,
        policy = ReferencePolicy.DYNAMIC,
        unbind = "removeNotifiers")
protected void addNotifier(Notifier notifier) {
    List<Notifier> notifierList = ServiceReferenceHolder.getInstance().getNotifiersMap().get(notifier.getType());
    if (notifierList == null) {
        notifierList = new ArrayList<>();
    }
    notifierList.add(notifier);
    ServiceReferenceHolder.getInstance().getNotifiersMap().put(notifier.getType(), notifierList);
}
 
Example 8
Source File: UrlMapperServiceComponent.java    From carbon-commons with Apache License 2.0 5 votes vote down vote up
@Reference(
        name = "tomcat.service.provider",
        service = org.wso2.carbon.tomcat.api.CarbonTomcatService.class,
        cardinality = ReferenceCardinality.MANDATORY,
        policy = ReferencePolicy.DYNAMIC,
        unbind = "unsetCarbonTomcatService")
protected void setCarbonTomcatService(CarbonTomcatService carbonTomcatService) {
    // keeping the carbonTomcatService in UrlMapperAdminService class
    DataHolder.getInstance().setCarbonTomcatService(carbonTomcatService);
}
 
Example 9
Source File: AuthenticationServiceComponent.java    From carbon-commons 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) {

    this.realmService = realmService;
}
 
Example 10
Source File: ThingTypeResource.java    From smarthome with Eclipse Public License 2.0 4 votes vote down vote up
@Reference(cardinality = ReferenceCardinality.OPTIONAL, policy = ReferencePolicy.DYNAMIC)
protected void setThingTypeRegistry(ThingTypeRegistry thingTypeRegistry) {
    this.thingTypeRegistry = thingTypeRegistry;
}
 
Example 11
Source File: AuthenticationHandler.java    From smarthome with Eclipse Public License 2.0 4 votes vote down vote up
@Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, target = "(context=javax.servlet.http.HttpServletRequest)")
public void addCredentialsExtractor(CredentialsExtractor<HttpServletRequest> extractor) {
    this.extractors.add(extractor);
}
 
Example 12
Source File: ChannelTypeResource.java    From smarthome with Eclipse Public License 2.0 4 votes vote down vote up
@Reference(cardinality = ReferenceCardinality.OPTIONAL, policy = ReferencePolicy.DYNAMIC)
protected void setChannelTypeRegistry(ChannelTypeRegistry channelTypeRegistry) {
    this.channelTypeRegistry = channelTypeRegistry;
}
 
Example 13
Source File: Examples.java    From osgi.enroute.examples with Apache License 2.0 4 votes vote down vote up
@Reference(policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.MULTIPLE, target = "(component.name=*FixedCronScheduleComponent)")
void addFixed(CronJob<?> fsc) {
	if (fsc instanceof FixedCronScheduleComponent)
		this.fsc.set((FixedCronScheduleComponent) fsc);
}
 
Example 14
Source File: ItemResource.java    From smarthome with Eclipse Public License 2.0 4 votes vote down vote up
@Reference(cardinality = ReferenceCardinality.OPTIONAL, policy = ReferencePolicy.DYNAMIC)
protected void setMetadataSelectorMatcher(MetadataSelectorMatcher metadataSelectorMatcher) {
    this.metadataSelectorMatcher = metadataSelectorMatcher;
}
 
Example 15
Source File: HABotResource.java    From org.openhab.ui.habot with Eclipse Public License 1.0 4 votes vote down vote up
@Reference(cardinality = ReferenceCardinality.OPTIONAL, policy = ReferencePolicy.DYNAMIC)
public void setNotificationService(NotificationService notificationService) {
    this.notificationService = notificationService;
}
 
Example 16
Source File: ConfigDescriptionValidatorImpl.java    From smarthome with Eclipse Public License 2.0 4 votes vote down vote up
@Reference(cardinality = ReferenceCardinality.OPTIONAL, policy = ReferencePolicy.DYNAMIC)
protected void setTranslationProvider(TranslationProvider translationProvider) {
    this.translationProvider = translationProvider;
}
 
Example 17
Source File: ModuleTypeI18nServiceImpl.java    From smarthome with Eclipse Public License 2.0 4 votes vote down vote up
@Reference(cardinality = ReferenceCardinality.OPTIONAL, policy = ReferencePolicy.DYNAMIC)
protected void setTranslationProvider(TranslationProvider i18nProvider) {
    this.i18nProvider = i18nProvider;
}
 
Example 18
Source File: Command.java    From osgi.iot.contest.sdk with Apache License 2.0 4 votes vote down vote up
@Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC)
void addSwitch(SwitchSegmentController t, ServiceReference<?> ref) {
	switches.put((Integer) ref.getProperty(SegmentController.CONTROLLER_ID), t);
}
 
Example 19
Source File: WebAppServlet.java    From smarthome with Eclipse Public License 2.0 4 votes vote down vote up
@Reference(cardinality = ReferenceCardinality.AT_LEAST_ONE, policy = ReferencePolicy.DYNAMIC)
public void addSitemapProvider(SitemapProvider sitemapProvider) {
    this.sitemapProviders.add(sitemapProvider);
}
 
Example 20
Source File: ExtensionResource.java    From smarthome with Eclipse Public License 2.0 4 votes vote down vote up
@Reference(cardinality = ReferenceCardinality.OPTIONAL, policy = ReferencePolicy.DYNAMIC)
protected void setEventPublisher(EventPublisher eventPublisher) {
    this.eventPublisher = eventPublisher;
}