Java Code Examples for org.osgi.service.component.annotations.ReferenceCardinality#MANDATORY

The following examples show how to use org.osgi.service.component.annotations.ReferenceCardinality#MANDATORY . 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.user.profile.mgt.component",
        service = FederatedAssociationManager.class,
        cardinality = ReferenceCardinality.MANDATORY,
        policy = ReferencePolicy.DYNAMIC,
        unbind = "unsetFederatedAssociationManagerService"
)
protected void setFederatedAssociationManagerService(FederatedAssociationManager
                                                                 federatedAssociationManagerService) {

    if (log.isDebugEnabled()) {
        log.debug("Federated Association Manager Service is set in the Application Authentication Framework " +
                "bundle");
    }
    FrameworkServiceDataHolder.getInstance().setFederatedAssociationManager(federatedAssociationManagerService);
}
 
Example 2
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 3
Source File: UserMgtDSComponent.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");
    }
    UserMgtDSComponent.realmService = realmService;
}
 
Example 4
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 5
Source File: IdentityMgtServiceComponent.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
@Reference(
        name = "userSessionManagementService",
        service = UserSessionManagementService.class,
        cardinality = ReferenceCardinality.MANDATORY,
        policy = ReferencePolicy.DYNAMIC,
        unbind = "unsetUserSessionManagementService"
)
protected void setUserSessionManagementService(UserSessionManagementService sessionService) {

    if (log.isDebugEnabled()) {
        log.debug("Setting Session Management Service");
    }

    userSessionManagementService = sessionService;
}
 
Example 6
Source File: TransactionManagerComponent.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
@Reference(name = "transactionmanager",
        service = TransactionManager.class,
        cardinality = ReferenceCardinality.MANDATORY,
        policy = ReferencePolicy.DYNAMIC,
        unbind = "unsetTransactionManager")
protected void setTransactionManager(TransactionManager txManager) {

    synchronized (txManagerComponentLock) {

        log.debug("Setting the Transaction Manager Service");
        TransactionManagerComponent.txManager = txManager;
    }
}
 
Example 7
Source File: UserMgtDSComponent.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) {
    if (log.isDebugEnabled()) {
        log.info("Setting the Registry Service");
    }
    UserMgtDSComponent.registryService = registryService;
}
 
Example 8
Source File: MetricsComponent.java    From msf4j with Apache License 2.0 5 votes vote down vote up
/**
 * This bind method will be called when {@link MetricManagementService} is registered.
 *
 * @param metricManagementService The {@link MetricManagementService} instance registered as an OSGi service
 */
@Reference(
        name = "carbon.metrics.management.service",
        service = MetricManagementService.class,
        cardinality = ReferenceCardinality.MANDATORY,
        policy = ReferencePolicy.DYNAMIC,
        unbind = "unsetMetricManagementService"
)
protected void setMetricManagementService(MetricManagementService metricManagementService) {
    if (logger.isDebugEnabled()) {
        logger.debug("Setting MetricManagementService reference");
    }
    Metrics.getInstance().setMetricManagementService(metricManagementService);
}
 
Example 9
Source File: TemplateMgtUIServiceComponent.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
@Reference(
        name = "realm.service",
        service = org.wso2.carbon.user.core.service.RealmService.class,
        cardinality = ReferenceCardinality.MANDATORY,
        policy = ReferencePolicy.DYNAMIC,
        unbind = "unsetRealmService"
)
protected void setRealmService(RealmService realmService) {

    TemplateManagementUIServiceDataHolder.getInstance().setRealmService(realmService);
    if (realmService != null && log.isDebugEnabled()) {
        log.debug("RealmService is registered in ConsentManager service.");
    }
}
 
Example 10
Source File: InboundEndpointServiceDSComponent.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 = "unsetConfigurationContextService")
protected void setConfigurationContextService(Axis2ConfigurationContextService configurationContextService) {

    log.debug("ConfigurationContextService bound to the ESB initialization process");

    ServiceReferenceHolder.getInstance().setConfigurationContextService(configurationContextService);
}
 
Example 11
Source File: InboundEndpointPersistenceServiceDSComponent.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 = "unsetConfigurationContextService")
protected void setConfigurationContextService(Axis2ConfigurationContextService contextService) {

    this.configContextService = contextService;
}
 
Example 12
Source File: TemplateMgtUIServiceComponent.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
@Reference(
        name = "carbon.identity.template.mgt.component",
        service = org.wso2.carbon.identity.template.mgt.TemplateManager.class,
        cardinality = ReferenceCardinality.MANDATORY,
        policy = ReferencePolicy.DYNAMIC,
        unbind = "unsetTemplateManagementService"
)
protected void setTemplateManagementService(TemplateManager templateManagementService) {

    TemplateManagementUIServiceDataHolder.getInstance().setTemplateManager(templateManagementService);
    if (templateManagementService != null && log.isDebugEnabled()) {
        log.debug("TemplateManager is registered in TemplateManager UI service.");
    }
}
 
Example 13
Source File: TemplateManagerComponent.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 14
Source File: TasksDSComponent.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
@Reference(name = "secret.callback.handler.service",
        service = org.wso2.carbon.securevault.SecretCallbackHandlerService.class,
        cardinality = ReferenceCardinality.MANDATORY,
        policy = ReferencePolicy.DYNAMIC,
        unbind = "unsetSecretCallbackHandlerService")
protected void setSecretCallbackHandlerService(SecretCallbackHandlerService secretCallbackHandlerService) {

    TasksDSComponent.secretCallbackHandlerService = secretCallbackHandlerService;
}
 
Example 15
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 16
Source File: IdentityMgtServiceComponent.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
@Reference(
        name = "registry.search.component",
        service = AttributeSearchService.class,
        cardinality = ReferenceCardinality.MANDATORY,
        policy = ReferencePolicy.DYNAMIC,
        unbind = "unsetAttributeSearchService"
)
protected void setAttributeSearchService(AttributeSearchService searchService) {

    if (log.isDebugEnabled()) {
        log.debug("Setting Registry Attribute Search Service");
    }
    attributeSearchService = searchService;
}
 
Example 17
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 18
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 19
Source File: ServiceBusInitializer.java    From micro-integrator with Apache License 2.0 4 votes vote down vote up
/**
     * Register for inbound hot depoyment
     */
    /*private void registerInboundDeployer(AxisConfiguration axisConfig, SynapseEnvironment synEnv) {

        DeploymentEngine deploymentEngine = (DeploymentEngine) axisConfig.getConfigurator();
        SynapseArtifactDeploymentStore deploymentStore = synEnv.getSynapseConfiguration().getArtifactDeploymentStore();
        String synapseConfigPath = ServiceBusUtils.getSynapseConfigAbsPath(synEnv.getServerContextInformation());
        String inboundDirPath = synapseConfigPath + File.separator + MultiXMLConfigurationBuilder.INBOUND_ENDPOINT_DIR;
        for (InboundEndpoint inboundEndpoint : synEnv.getSynapseConfiguration().getInboundEndpoints()) {
            if (inboundEndpoint.getFileName() != null) {
                deploymentStore.addRestoredArtifact(inboundDirPath + File.separator + inboundEndpoint.getFileName());
            }
        }
        deploymentEngine.addDeployer(new InboundEndpointDeployer(), inboundDirPath, ServiceBusConstants
                .ARTIFACT_EXTENSION);
    }*/

//    @Reference(
//            name = "inbound.endpoint.persistence.service",
//            service = org.wso2.carbon.inbound.endpoint.persistence.service.InboundEndpointPersistenceService.class,
//            cardinality = ReferenceCardinality.OPTIONAL,
//            policy = ReferencePolicy.DYNAMIC,
//            unbind = "unsetInboundPersistenceService")
    /*protected void setInboundPersistenceService(InboundEndpointPersistenceService inboundEndpoint) {
        // This service is just here to make sure that ServiceBus is not getting initialized
        // before the Inbound Endpoint Persistence component is up and running
    }

    protected void unsetInboundPersistenceService(InboundEndpointPersistenceService inboundEndpoint) {

    }*/

    @Reference(
            name = "org.wso2.micro.integrator.ntask.core.service.TaskService",
            service = org.wso2.micro.integrator.ntask.core.service.TaskService.class,
            cardinality = ReferenceCardinality.MANDATORY,
            policy = ReferencePolicy.DYNAMIC,
            unbind = "unsetTaskService")
    protected void setTaskService(TaskService taskService) {

        log.debug("Set Task Service");
        this.taskService = taskService;
    }
 
Example 20
Source File: MicroservicesServerSC.java    From msf4j with Apache License 2.0 4 votes vote down vote up
@Reference(
        name = "carbon.config.provider",
        service = ConfigProvider.class,
        cardinality = ReferenceCardinality.MANDATORY,
        policy = ReferencePolicy.DYNAMIC,
        unbind = "unregisterConfigProvider"
)
protected void registerConfigProvider(ConfigProvider configProvider) {
    DataHolder.getInstance().setConfigProvider(configProvider);
    try {
        final TransportsConfiguration transportsConfiguration;
        Object transportConf = configProvider.getConfigurationObject(STREAMLINED_TRANSPORT_NAMESPACE);
        if (transportConf != null) {
            transportsConfiguration = Utils.resolveTransportsNSConfiguration(transportConf);
        } else {
            transportsConfiguration = configProvider.getConfigurationObject
                    (MSF4JConstants.WSO2_TRANSPORT_HTTP_CONFIG_NAMESPACE, TransportsConfiguration.class);
        }

        CarbonConfiguration carbonConfig = configProvider.getConfigurationObject(CarbonConfiguration.class);
        transportsConfiguration.getListenerConfigurations().forEach(
                listenerConfiguration -> listenerConfiguration.setPort(
                        listenerConfiguration.getPort() + carbonConfig.getPortsConfig().getOffset()));

        Set<ListenerConfiguration> listenerConfigurations =
                transportsConfiguration.getListenerConfigurations();
        if (listenerConfigurations.isEmpty()) {
            listenerConfigurations = new HashSet<>();
            listenerConfigurations.add(new ListenerConfiguration());
        }

        ServerBootstrapConfiguration serverBootstrapConfiguration =
                HttpConnectorUtil.getServerBootstrapConfiguration(transportsConfiguration.getTransportProperties());
        HttpWsConnectorFactory connectorFactory = new DefaultHttpWsConnectorFactory();
        listenerConfigurations.forEach(listenerConfiguration -> {
            ServerConnector serverConnector =
                    connectorFactory.createServerConnector(serverBootstrapConfiguration, listenerConfiguration);
            MicroservicesRegistryImpl microservicesRegistry = new MicroservicesRegistryImpl();
            Map<String, MicroservicesRegistryImpl> microservicesRegistries =
                    DataHolder.getInstance().getMicroservicesRegistries();
            Dictionary<String, String> properties = new Hashtable<>();
            properties.put(MSF4JConstants.CHANNEL_ID, serverConnector.getConnectorID());
            microservicesRegistries.put(serverConnector.getConnectorID(), microservicesRegistry);
            DataHolder.getInstance().getBundleContext()
                    .registerService(MicroservicesRegistry.class, microservicesRegistry, properties);
            listenerConfigurationMap.put(serverConnector.getConnectorID(), listenerConfiguration);
            serverConnectors.add(serverConnector);
        });
    } catch (ConfigurationException e) {
        log.error("Error while loading TransportsConfiguration", e);
        throw new RuntimeException("Error while loading TransportsConfiguration", e);
    }
    StartupServiceUtils.updateServiceCache("wso2-microservices-server", ConfigProvider.class);
}