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

The following examples show how to use org.osgi.service.component.annotations.ReferencePolicy. 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: APIHandlerServiceComponent.java    From carbon-apimgt with Apache License 2.0 6 votes vote down vote up
@Reference(
        name = "gateway.artifact.retriever",
        service = ArtifactRetriever.class,
        cardinality = ReferenceCardinality.MULTIPLE,
        policy = ReferencePolicy.DYNAMIC,
        unbind = "removeArtifactRetriever")
protected void addArtifactRetriever(ArtifactRetriever artifactRetriever) {

    GatewayArtifactSynchronizerProperties gatewayArtifactSynchronizerProperties =
            ServiceReferenceHolder.getInstance().getAPIManagerConfiguration()
                    .getGatewayArtifactSynchronizerProperties();

    if (gatewayArtifactSynchronizerProperties.isRetrieveFromStorageEnabled()
            && gatewayArtifactSynchronizerProperties.getRetrieverName().equals(artifactRetriever.getName())) {
        ServiceReferenceHolder.getInstance().setArtifactRetriever(artifactRetriever);

        try {
            ServiceReferenceHolder.getInstance().getArtifactRetriever().init();
        } catch (Exception e) {
            log.error("Error connecting with the Artifact retriever");
            removeArtifactRetriever(null);
        }
    }
}
 
Example #2
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 #3
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 #4
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 #5
Source File: ServiceComponent.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
@Reference(name = "config.context.service",
        service = Axis2ConfigurationContextService.class,
        cardinality = ReferenceCardinality.MANDATORY,
        policy = ReferencePolicy.DYNAMIC,
        unbind = "unsetConfigurationContext")
protected void setConfigurationContext(Axis2ConfigurationContextService configCtx) {
    DataHolder.getInstance().setConfigCtx(configCtx.getServerConfigContext());
}
 
Example #6
Source File: ConsoleSupportKaraf.java    From openhab-core with Eclipse Public License 2.0 5 votes vote down vote up
@Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC)
public void addConsoleCommandExtension(final ConsoleCommandExtension consoleCommandExtension) {
    commands.add(consoleCommandExtension);
    if (sessionFactory != null) {
        registerCommand(consoleCommandExtension);
    }
}
 
Example #7
Source File: FrameworkServiceComponent.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
@Reference(
        name = "osgi.httpservice",
        service = HttpService.class,
        cardinality = ReferenceCardinality.MANDATORY,
        policy = ReferencePolicy.DYNAMIC,
        unbind = "unsetHttpService"
)
protected void setHttpService(HttpService httpService) {

    if (log.isDebugEnabled()) {
        log.debug("HTTP Service is set in the Application Authentication Framework bundle");
    }

    this.httpService = httpService;
}
 
Example #8
Source File: UserRegistrationDSComponent.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) {
    if (log.isDebugEnabled()) {
        log.info("Setting the Realm Service");
    }
    UserRegistrationDSComponent.realmService = realmService;
}
 
Example #9
Source File: ApplicationManagementServiceComponent.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
@Reference(
        name = "application.mgt.authenticator",
        service = AbstractInboundAuthenticatorConfig.class,
        cardinality = ReferenceCardinality.MULTIPLE,
        policy = ReferencePolicy.DYNAMIC,
        unbind = "unsetInboundAuthenticatorConfig"
)
protected void setInboundAuthenticatorConfig(AbstractInboundAuthenticatorConfig authenticator) {
    ApplicationManagementServiceComponentHolder.addInboundAuthenticatorConfig(authenticator);
}
 
Example #10
Source File: HostObjectComponent.java    From carbon-apimgt 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) {
    if (registryService != null && log.isDebugEnabled()) {
        log.debug("Registry service initialized");
    }
    ServiceReferenceHolder.getInstance().setRegistryService(registryService);
}
 
Example #11
Source File: APIHandlerServiceComponent.java    From carbon-apimgt with Apache License 2.0 5 votes vote down vote up
@Reference(
        name = "org.wso2.carbon.apimgt.tracing",
        service = org.wso2.carbon.apimgt.tracing.TracingService.class,
        cardinality = ReferenceCardinality.MANDATORY,
        policy = ReferencePolicy.DYNAMIC,
        unbind = "unsetTracingService")
protected void setTracingService(TracingService tracingService) {

    ServiceReferenceHolder.getInstance().setTracingService(tracingService);
}
 
Example #12
Source File: ThriftAuthenticationServiceComponent.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
@Reference(
         name = "configuration.context", 
         service = org.wso2.carbon.utils.ConfigurationContextService.class, 
         cardinality = ReferenceCardinality.MANDATORY, 
         policy = ReferencePolicy.DYNAMIC, 
         unbind = "unsetConfigurationContext")
protected void setConfigurationContext(ConfigurationContextService configurationContext) {
    this.configurationContext = configurationContext;
}
 
Example #13
Source File: FolderObserver.java    From openhab-core with Eclipse Public License 2.0 5 votes vote down vote up
@Reference(cardinality = ReferenceCardinality.AT_LEAST_ONE, policy = ReferencePolicy.DYNAMIC)
protected void addModelParser(ModelParser modelParser) {
    parsers.add(modelParser.getExtension());

    if (activated) {
        processIgnoredFiles(modelParser.getExtension());
        readyService.markReady(new ReadyMarker(READYMARKER_TYPE, modelParser.getExtension()));
    }
}
 
Example #14
Source File: APITokenMgtServiceComponent.java    From carbon-apimgt with Apache License 2.0 5 votes vote down vote up
/**
 * Initialize the Output EventAdapter Service dependency
 *
 * @param outputEventAdapterService Output EventAdapter Service reference
 */
@Reference(
         name = "event.output.adapter.service", 
         service = org.wso2.carbon.event.output.adapter.core.OutputEventAdapterService.class, 
         cardinality = ReferenceCardinality.MANDATORY, 
         policy = ReferencePolicy.DYNAMIC, 
         unbind = "unsetOutputEventAdapterService")
protected void setOutputEventAdapterService(OutputEventAdapterService outputEventAdapterService) {
    ServiceReferenceHolder.getInstance().setOutputEventAdapterService(outputEventAdapterService);
}
 
Example #15
Source File: IdentityUserProfileServiceComponent.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 #16
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 #17
Source File: UserStoreConfigComponent.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
@Reference(
        name = "server.configuration.service",
        service = ServerConfigurationService.class,
        cardinality = ReferenceCardinality.MANDATORY,
        policy = ReferencePolicy.DYNAMIC,
        unbind = "unsetServerConfigurationService"
)
protected void setServerConfigurationService(ServerConfigurationService serverConfigurationService) {
    if (log.isDebugEnabled()) {
        log.debug("Setting the serverConfigurationService");
    }
    UserStoreConfigComponent.serverConfigurationService = serverConfigurationService;
}
 
Example #18
Source File: AnnotatedActionModuleTypeProvider.java    From smarthome with Eclipse Public License 2.0 5 votes vote down vote up
@Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC)
public void addActionProvider(AnnotatedActions actionProvider, Map<String, Object> properties) {
    Collection<ModuleInformation> moduleInformations = helper.parseAnnotations(actionProvider);

    String configName = getConfigNameFromService(properties);

    for (ModuleInformation mi : moduleInformations) {
        mi.setConfigName(configName);

        ModuleType oldType = null;
        if (this.moduleInformation.containsKey(mi.getUID())) {
            oldType = helper.buildModuleType(mi.getUID(), this.moduleInformation);
            Set<ModuleInformation> availableModuleConfigs = this.moduleInformation.get(mi.getUID());
            availableModuleConfigs.add(mi);
        } else {
            Set<ModuleInformation> configs = ConcurrentHashMap.newKeySet();
            configs.add(mi);
            this.moduleInformation.put(mi.getUID(), configs);
        }

        ModuleType mt = helper.buildModuleType(mi.getUID(), this.moduleInformation);
        if (mt != null) {
            for (ProviderChangeListener<ModuleType> l : changeListeners) {
                if (oldType != null) {
                    l.updated(this, oldType, mt);
                } else {
                    l.added(this, mt);
                }
            }
        }
    }
}
 
Example #19
Source File: StatisticsServiceComponent.java    From carbon-commons with Apache License 2.0 5 votes vote down vote up
@Reference(
        name = "server.configuration",
        service = org.wso2.carbon.base.api.ServerConfigurationService.class,
        cardinality = ReferenceCardinality.MANDATORY,
        policy = ReferencePolicy.DYNAMIC,
        unbind = "unsetServerConfiguration")
protected void setServerConfiguration(ServerConfigurationService serverConfiguration) {

    this.serverConfig = serverConfiguration;
}
 
Example #20
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 #21
Source File: APIUsagePublisherComponent.java    From carbon-apimgt with Apache License 2.0 5 votes vote down vote up
/**
 * Set task service
 *
 * @param taskService task service
 * @throws RegistryException
 */
@Reference(
         name = "ntask.component", 
         service = org.wso2.carbon.ntask.core.service.TaskService.class, 
         cardinality = ReferenceCardinality.MANDATORY, 
         policy = ReferencePolicy.DYNAMIC, 
         unbind = "unsetTaskService")
protected void setTaskService(TaskService taskService) throws RegistryException {
    if (log.isDebugEnabled()) {
        log.debug("TaskService is acquired");
    }
    ServiceReferenceHolder.getInstance().setTaskService(taskService);
}
 
Example #22
Source File: FrameworkServiceComponent.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
@Reference(
        name = "function.library.management.service",
        service = FunctionLibraryManagementService.class,
        cardinality = ReferenceCardinality.MANDATORY,
        policy = ReferencePolicy.DYNAMIC,
        unbind = "unsetFunctionLibraryManagementService"
)
protected void setFunctionLibraryManagementService
        (FunctionLibraryManagementService functionLibraryManagementService) {

    if (log.isDebugEnabled()) {
        log.debug("FunctionLibraryManagementService is set in the Application Authentication Framework bundle");
    }
    FrameworkServiceDataHolder.getInstance().setFunctionLibraryManagementService(functionLibraryManagementService);
}
 
Example #23
Source File: ItemRegistryImpl.java    From smarthome with Eclipse Public License 2.0 5 votes vote down vote up
@Reference(cardinality = ReferenceCardinality.OPTIONAL, policy = ReferencePolicy.DYNAMIC)
public void setCommandDescriptionService(CommandDescriptionService commandDescriptionService) {
    this.commandDescriptionService = commandDescriptionService;

    for (Item item : getItems()) {
        ((GenericItem) item).setCommandDescriptionService(commandDescriptionService);
    }
}
 
Example #24
Source File: CORSManagementServiceComponent.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
/**
 * Set the ConfigurationManager.
 *
 * @param configurationManager
 */
@Reference(
        name = "resource.configuration.manager",
        service = ConfigurationManager.class,
        cardinality = ReferenceCardinality.MANDATORY,
        policy = ReferencePolicy.DYNAMIC,
        unbind = "unsetConfigurationManager"
)
protected void setConfigurationManager(ConfigurationManager configurationManager) {

    if (log.isDebugEnabled()) {
        log.debug("Setting the ConfigurationManager.");
    }
    CORSManagementServiceHolder.getInstance().setConfigurationManager(configurationManager);
}
 
Example #25
Source File: EntitlementServiceComponent.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
@Reference(
        name = "carbon.identity.notification.mgt",
        service = NotificationSender.class,
        cardinality = ReferenceCardinality.MANDATORY,
        policy = ReferencePolicy.DYNAMIC,
        unbind = "unsetNotificationSender"
)
protected void setNotificationSender(NotificationSender notificationSender) {
    if (log.isDebugEnabled()) {
        log.debug("Un-setting notification sender in Entitlement bundle");
    }
    this.notificationSender = notificationSender;
}
 
Example #26
Source File: BluetoothDiscoveryService.java    From smarthome with Eclipse Public License 2.0 5 votes vote down vote up
@Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC)
protected void addBluetoothAdapter(BluetoothAdapter adapter) {
    this.adapters.add(adapter);
    BluetoothDiscoveryListener listener = new BluetoothDiscoveryListener() {

        @Override
        public void deviceDiscovered(BluetoothDevice device) {
            BluetoothDiscoveryService.this.deviceDiscovered(adapter, device);

        }
    };
    adapter.addDiscoveryListener(listener);
    registeredListeners.put(adapter.getUID(), listener);
}
 
Example #27
Source File: IdentityConsentServiceComponent.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
@Reference(
        name = "identity.application.authentication.framework.component",
        service = SSOConsentService.class,
        cardinality = ReferenceCardinality.MANDATORY,
        policy = ReferencePolicy.DYNAMIC,
        unbind = "unsetSSOConsentService"
)
protected void setSSOConsentService(SSOConsentService ssoConsentService) {

    if (log.isDebugEnabled()) {
        log.debug("SSO Consent Service is set in the Identity Consent Service component bundle.");
    }
    IdentityConsentDataHolder.getInstance().setSSOConsentService(ssoConsentService);
}
 
Example #28
Source File: EntitlementServiceComponent.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
@Reference(
        name = "config.context.service",
        service = ConfigurationContextService.class,
        cardinality = ReferenceCardinality.MANDATORY,
        policy = ReferencePolicy.DYNAMIC,
        unbind = "unsetConfigurationContextService"
)
protected void setConfigurationContextService(ConfigurationContextService configCtxtService) {
    if (log.isDebugEnabled()) {
        log.debug("ConfigurationContextService set in EntitlementServiceComponent bundle.");
    }
    EntitlementConfigHolder.getInstance().setConfigurationContextService(configCtxtService);
}
 
Example #29
Source File: ReportingComponent.java    From carbon-commons with Apache License 2.0 5 votes vote down vote up
@Reference(
        name = "org.wso2.carbon.ndatasource.core.DataSourceService",
        service = org.wso2.carbon.ndatasource.core.DataSourceService.class,
        cardinality = ReferenceCardinality.OPTIONAL,
        policy = ReferencePolicy.DYNAMIC,
        unbind = "unsetCarbonDataSourceService")
protected void setCarbonDataSourceService(DataSourceService dataSourceService) {

    if (log.isDebugEnabled()) {
        log.debug("Setting the Carbon Data Sources Service");
    }
    ReportingComponent.dataSourceService1 = dataSourceService;
}
 
Example #30
Source File: WorkflowMgtServiceComponent.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
@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);
}