From d9381953733a8ce800926d1733504dda460e1a9b Mon Sep 17 00:00:00 2001 From: pasindu Date: Mon, 5 Feb 2024 19:55:18 +0530 Subject: [PATCH] Fix osgi reference addings in Service components --- .../APIIntegrationClientServiceComponent.java | 21 ++++---- .../CEAManagementServiceComponent.java | 48 +++++++++-------- .../internal/EnforcementServiceComponent.java | 35 +++++++------ .../pom.xml | 5 ++ ...DeviceOrganizationMgtServiceComponent.java | 51 ++++++++++--------- .../UserStoreRoleMappingServiceComponent.java | 46 +++++++++-------- .../DataPublisherServiceComponent.java | 7 ++- .../OAuthAuthenticatorServiceComponent.java | 21 ++++---- 8 files changed, 129 insertions(+), 105 deletions(-) diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/internal/APIIntegrationClientServiceComponent.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/internal/APIIntegrationClientServiceComponent.java index babfad55d9..8343372d54 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/internal/APIIntegrationClientServiceComponent.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/internal/APIIntegrationClientServiceComponent.java @@ -27,19 +27,14 @@ import org.wso2.carbon.apimgt.integration.client.configs.APIMConfigReader; import org.wso2.carbon.apimgt.integration.client.service.IntegrationClientService; import io.entgra.device.mgt.core.identity.jwt.client.extension.service.JWTClientManagerService; -/** - * @scr.component name="org.wso2.carbon.api.integration.client" immediate="true" - * @scr.reference name="api.integration.client.service" - * interface="io.entgra.device.mgt.core.identity.jwt.client.extension.service.JWTClientManagerService" - * cardinality="1..1" - * policy="dynamic" - * bind="setJWTClientManagerService" - * unbind="unsetJWTClientManagerService" - */ +@Component( + name = "org.wso2.carbon.api.integration.client", + immediate = true) public class APIIntegrationClientServiceComponent { private static Log log = LogFactory.getLog(APIIntegrationClientServiceComponent.class); + @Activate protected void activate(ComponentContext componentContext) { try { if (log.isDebugEnabled()) { @@ -59,10 +54,18 @@ public class APIIntegrationClientServiceComponent { } } + @Deactivate protected void deactivate(ComponentContext componentContext) { //do nothing } + @Reference( + name = "api.integration.client.service", + service = org.wso2.carbon.apimgt.impl.APIManagerConfigurationService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + bind = "setJWTClientManagerService", + unbind = "unsetJWTClientManagerService") protected void setJWTClientManagerService(JWTClientManagerService jwtClientManagerService) { if (jwtClientManagerService != null) { log.debug("jwtClientManagerService service is initialized"); diff --git a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.core/src/main/java/io/entgra/device/mgt/core/cea/mgt/core/internal/CEAManagementServiceComponent.java b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.core/src/main/java/io/entgra/device/mgt/core/cea/mgt/core/internal/CEAManagementServiceComponent.java index 624391eb7c..007134a78d 100644 --- a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.core/src/main/java/io/entgra/device/mgt/core/cea/mgt/core/internal/CEAManagementServiceComponent.java +++ b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.core/src/main/java/io/entgra/device/mgt/core/cea/mgt/core/internal/CEAManagementServiceComponent.java @@ -29,34 +29,17 @@ import io.entgra.device.mgt.core.cea.mgt.core.task.CEAPolicyMonitoringTaskManage import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.*; import org.wso2.carbon.ndatasource.core.DataSourceService; import org.wso2.carbon.ntask.core.service.TaskService; -/** - * @scr.component name="io.entgra.device.mgt.core.cea.mgt.core.CEAManagementServiceComponent" immediate="true" - * @scr.reference name="org.wso2.carbon.ndatasource" - * interface="org.wso2.carbon.ndatasource.core.DataSourceService" - * cardinality="1..1" - * policy="dynamic" - * bind="setDataSourceService" - * unbind="unsetDataSourceService" - * @scr.reference name="io.entgra.device.mgt.core.cea.mgt.enforcementServiceManager" - * interface="io.entgra.device.mgt.core.cea.mgt.common.service.EnforcementServiceManager" - * cardinality="1..1" - * policy="dynamic" - * bind="setEnforcementServiceManager" - * unbind="unsetEnforcementServiceManager" - * @scr.reference name="ntask.component" - * interface="org.wso2.carbon.ntask.core.service.TaskService" - * cardinality="1..1" - * policy="dynamic" - * bind="setTaskService" - * unbind="unsetTaskService" - */ - +@Component( + name = "io.entgra.device.mgt.core.cea.mgt.core.CEAManagementServiceComponent", + immediate = true) public class CEAManagementServiceComponent { private static final Log log = LogFactory.getLog(CEAManagementServiceComponent.class); + @Activate protected void activate(ComponentContext componentContext) { try { CEAConfigManager ceaConfigManager = CEAConfigManager.getInstance(); @@ -72,6 +55,13 @@ public class CEAManagementServiceComponent { } } + @Reference( + name = "org.wso2.carbon.ndatasource", + service = org.wso2.carbon.ndatasource.core.DataSourceService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + bind = "setDataSourceService", + unbind = "unsetDataSourceService") protected void setDataSourceService(DataSourceService dataSourceService) { // This is to avoid cea management component getting initialized before the underlying datasource registered } @@ -80,6 +70,13 @@ public class CEAManagementServiceComponent { // Do nothing } + @Reference( + name = "io.entgra.device.mgt.core.cea.mgt.enforcementServiceManager", + service = io.entgra.device.mgt.core.cea.mgt.common.service.EnforcementServiceManager.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + bind = "setEnforcementServiceManager", + unbind = "unsetEnforcementServiceManager") protected void setEnforcementServiceManager(EnforcementServiceManager enforcementServiceManager) { CEAManagementDataHolder.getInstance().setEnforcementServiceManager(enforcementServiceManager); if (log.isDebugEnabled()) { @@ -94,6 +91,13 @@ public class CEAManagementServiceComponent { } } + @Reference( + name = "ntask.component", + service = org.wso2.carbon.ntask.core.service.TaskService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + bind = "setTaskService", + unbind = "unsetTaskService") protected void setTaskService(TaskService taskService) { CEAManagementDataHolder.getInstance().setTaskService(taskService); if (log.isDebugEnabled()) { diff --git a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.enforce/src/main/java/io/entgra/device/mgt/core/cea/mgt/enforce/internal/EnforcementServiceComponent.java b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.enforce/src/main/java/io/entgra/device/mgt/core/cea/mgt/enforce/internal/EnforcementServiceComponent.java index d890eb62f0..29e69dcfd9 100644 --- a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.enforce/src/main/java/io/entgra/device/mgt/core/cea/mgt/enforce/internal/EnforcementServiceComponent.java +++ b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.enforce/src/main/java/io/entgra/device/mgt/core/cea/mgt/enforce/internal/EnforcementServiceComponent.java @@ -25,27 +25,16 @@ import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProvide import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.*; import org.wso2.carbon.user.core.service.RealmService; -/** - * @scr.component name="io.entgra.device.mgt.core.cea.mgt.enforcementServiceManager" immediate="true" - * @scr.reference name="org.wso2.carbon.device.manager" - * interface="io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService" - * cardinality="1..1" - * policy="dynamic" - * bind="setDeviceManagementServiceProviderService" - * unbind="unsetDeviceManagementServiceProviderService" - * @scr.reference name="user.realmservice.default" - * interface="org.wso2.carbon.user.core.service.RealmService" - * cardinality="1..1" - * policy="dynamic" - * bind="setRealmService" - * unbind="unsetRealmService" - */ - +@Component( + name = "io.entgra.device.mgt.core.cea.mgt.enforcementServiceManager", + immediate = true) public class EnforcementServiceComponent { private static final Log log = LogFactory.getLog(EnforcementServiceComponent.class); + @Activate protected void activate(ComponentContext componentContext) { try { EnforcementServiceManager enforcementServiceManager = new EnforcementServiceManagerImpl(); @@ -60,6 +49,13 @@ public class EnforcementServiceComponent { } } + @Reference( + name = "org.wso2.carbon.device.manager", + service = io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + bind = "setDeviceManagementServiceProviderService", + unbind = "unsetDeviceManagementServiceProviderService") protected void setDeviceManagementServiceProviderService(DeviceManagementProviderService deviceManagementProviderService) { EnforcementServiceComponentDataHolder.getInstance().setDeviceManagementProviderService(deviceManagementProviderService); if (log.isDebugEnabled()) { @@ -74,6 +70,13 @@ public class EnforcementServiceComponent { } } + @Reference( + name = "user.realmservice.default", + service = org.wso2.carbon.user.core.service.RealmService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + bind = "setRealmService", + unbind = "unsetRealmService") protected void setRealmService(RealmService realmService) { EnforcementServiceComponentDataHolder.getInstance().setRealmService(realmService); if (log.isDebugEnabled()) { diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/pom.xml index 77aa526c4e..79dd397d74 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/pom.xml @@ -95,6 +95,11 @@ + + org.apache.felix + org.apache.felix.scr.ds-annotations + provided + org.wso2.carbon org.wso2.carbon.ndatasource.core diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/internal/DeviceOrganizationMgtServiceComponent.java b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/internal/DeviceOrganizationMgtServiceComponent.java index b7a84ca31a..0cf012c990 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/internal/DeviceOrganizationMgtServiceComponent.java +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/internal/DeviceOrganizationMgtServiceComponent.java @@ -31,28 +31,11 @@ import org.osgi.framework.BundleContext; import org.osgi.service.component.ComponentContext; import org.wso2.carbon.ndatasource.core.DataSourceService; import org.wso2.carbon.registry.core.service.RegistryService; +import org.osgi.service.component.annotations.*; -/** - * @scr.component name="io.entgra.device.mgt.core.device.mgt.extensions.device.organization.internal.DeviceOrganizationMgtServiceComponent" immediate="true" - * @scr.reference name="org.wso2.carbon.device.manager" - * interface="io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService" - * cardinality="1..1" - * policy="dynamic" - * bind="setDeviceManagementService" - * unbind="unsetDeviceManagementService" - * @scr.reference name="org.wso2.carbon.ndatasource" - * interface="org.wso2.carbon.ndatasource.core.DataSourceService" - * cardinality="1..1" - * policy="dynamic" - * bind="setDataSourceService" - * unbind="unsetDataSourceService" - * @scr.reference name="registry.service" - * interface="org.wso2.carbon.registry.core.service.RegistryService" - * cardinality="0..1" - * policy="dynamic" - * bind="setRegistryService" - * unbind="unsetRegistryService" - */ +@Component( + name = "io.entgra.device.mgt.core.device.mgt.extensions.device.organization.internal.DeviceOrganizationMgtServiceComponent", + immediate = true) public class DeviceOrganizationMgtServiceComponent { private static final Log log = LogFactory.getLog(DeviceOrganizationMgtServiceComponent.class); @@ -60,6 +43,7 @@ public class DeviceOrganizationMgtServiceComponent { /** * @param componentContext */ + @Activate protected void activate(ComponentContext componentContext) { if (log.isDebugEnabled()) { @@ -87,6 +71,7 @@ public class DeviceOrganizationMgtServiceComponent { /** * @param componentContext */ + @Deactivate protected void deactivate(ComponentContext componentContext) { if (log.isDebugEnabled()) { log.debug("De-activating Device Organization Management Service Component"); @@ -94,6 +79,13 @@ public class DeviceOrganizationMgtServiceComponent { } @SuppressWarnings("unused") + @Reference( + name = "org.wso2.carbon.device.manager", + service = io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + bind = "setDeviceManagementService", + unbind = "unsetDeviceManagementService") protected void setDeviceManagementService(DeviceManagementProviderService deviceManagementProviderService) { if (log.isDebugEnabled()) { log.debug("Setting Device Management Service to Device Organization Mgt SC"); @@ -112,6 +104,14 @@ public class DeviceOrganizationMgtServiceComponent { /** * @param dataSourceService */ + + @Reference( + name = "org.wso2.carbon.ndatasource", + service = org.wso2.carbon.ndatasource.core.DataSourceService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + bind = "setDataSourceService", + unbind = "unsetDataSourceService") protected void setDataSourceService(DataSourceService dataSourceService) { if (log.isDebugEnabled()) { log.debug("Data source service set to Device Organization Mgt component"); @@ -128,7 +128,13 @@ public class DeviceOrganizationMgtServiceComponent { } } - + @Reference( + name = "registry.service", + service = org.wso2.carbon.registry.core.service.RegistryService.class, + cardinality = ReferenceCardinality.OPTIONAL, + policy = ReferencePolicy.DYNAMIC, + bind = "setRegistryService", + unbind = "unsetRegistryService") protected void setRegistryService(RegistryService registryService) { if (log.isDebugEnabled()) { log.debug("RegistryService set to Device Organization Mgt component"); @@ -143,5 +149,4 @@ public class DeviceOrganizationMgtServiceComponent { DeviceOrganizationMgtDataHolder.getInstance().setRegistryService(null); } - } diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.userstore.role.mapper/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/userstore/role/mapper/internal/UserStoreRoleMappingServiceComponent.java b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.userstore.role.mapper/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/userstore/role/mapper/internal/UserStoreRoleMappingServiceComponent.java index 2471c18403..9e2c3ae1e0 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.userstore.role.mapper/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/userstore/role/mapper/internal/UserStoreRoleMappingServiceComponent.java +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.userstore.role.mapper/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/userstore/role/mapper/internal/UserStoreRoleMappingServiceComponent.java @@ -25,36 +25,19 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.osgi.framework.BundleContext; import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.*; import org.wso2.carbon.core.ServerStartupObserver; import org.wso2.carbon.user.core.service.RealmService; import org.wso2.carbon.utils.ConfigurationContextService; -/** - * @scr.component name="io.entgra.device.mgt.core.device.mgt.extensions.userstore.role.mapper.internal.UserStoreRoleMappingServiceComponent" - * immediate="true" - * @scr.reference name="user.realmservice.default" - * interface="org.wso2.carbon.user.core.service.RealmService" - * cardinality="1..1" - * policy="dynamic" - * bind="setRealmService" - * unbind="unsetRealmService" - * @scr.reference name="config.context.service" - * interface="org.wso2.carbon.utils.ConfigurationContextService" - * cardinality="0..1" - * policy="dynamic" - * bind="setConfigurationContextService" - * unbind="unsetConfigurationContextService" - * @scr.reference name="entgra.heart.beat.service" - * interface="io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service.HeartBeatManagementService" - * cardinality="0..1" - * policy="dynamic" - * bind="setHeartBeatService" - * unbind="unsetHeartBeatService" - */ +@Component( + name = "io.entgra.device.mgt.core.device.mgt.extensions.userstore.role.mapper.internal.UserStoreRoleMappingServiceComponent", + immediate = true) public class UserStoreRoleMappingServiceComponent { private static final Log log = LogFactory.getLog(UserStoreRoleMappingServiceComponent.class); + @Activate protected void activate(ComponentContext ctx) { if (log.isDebugEnabled()) { log.debug("Activating Role Management Service Component"); @@ -72,12 +55,19 @@ public class UserStoreRoleMappingServiceComponent { } } + @Deactivate protected void deactivate(ComponentContext ctx) { if (log.isDebugEnabled()) { log.debug("De-activating Role Manager Service Component"); } } + @Reference( + name = "user.realmservice.default", + service = org.wso2.carbon.user.core.service.RealmService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRealmService") protected void setConfigurationContextService(ConfigurationContextService configurationContextService) { if (log.isDebugEnabled()) { log.debug("Setting ConfigurationContextService"); @@ -86,6 +76,12 @@ public class UserStoreRoleMappingServiceComponent { UserStoreRoleMappingDataHolder.getInstance().setConfigurationContextService(configurationContextService); } + @Reference( + name = "config.context.service", + service = org.wso2.carbon.utils.ConfigurationContextService.class, + cardinality = ReferenceCardinality.OPTIONAL, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetConfigurationContextService") protected void unsetConfigurationContextService(ConfigurationContextService configurationContextService) { if (log.isDebugEnabled()) { log.debug("Un-setting ConfigurationContextService"); @@ -118,6 +114,12 @@ public class UserStoreRoleMappingServiceComponent { } @SuppressWarnings("unused") + @Reference( + name = "entgra.heart.beat.service", + service = io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service.HeartBeatManagementService.class, + cardinality = ReferenceCardinality.OPTIONAL, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetHeartBeatService") protected void setHeartBeatService(HeartBeatManagementService heartBeatService) { if (log.isDebugEnabled()) { log.debug("Setting heart beat service"); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/src/main/java/org/wso2/carbon/device/mgt/analytics/data/publisher/internal/DataPublisherServiceComponent.java b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/src/main/java/org/wso2/carbon/device/mgt/analytics/data/publisher/internal/DataPublisherServiceComponent.java index fe2cad0ea1..0e83028553 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/src/main/java/org/wso2/carbon/device/mgt/analytics/data/publisher/internal/DataPublisherServiceComponent.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/src/main/java/org/wso2/carbon/device/mgt/analytics/data/publisher/internal/DataPublisherServiceComponent.java @@ -27,10 +27,9 @@ import org.wso2.carbon.device.mgt.analytics.data.publisher.config.AnalyticsConfi import org.wso2.carbon.device.mgt.analytics.data.publisher.service.EventsPublisherService; import org.wso2.carbon.device.mgt.analytics.data.publisher.service.EventsPublisherServiceImpl; -/** - * @scr.component name="org.wso2.carbon.device.mgt.analytics.data.publisher.internal.DataPublisherServiceComponent" - * immediate="true" - */ +@Component( + name = "org.wso2.carbon.device.mgt.analytics.data.publisher.internal.DataPublisherServiceComponent", + immediate = true) public class DataPublisherServiceComponent { private ServiceRegistration analyticsServiceRef; diff --git a/components/identity-extensions/org.wso2.carbon.identity.authenticator.backend.oauth/src/main/java/org/wso2/carbon/identity/authenticator/backend/oauth/internal/OAuthAuthenticatorServiceComponent.java b/components/identity-extensions/org.wso2.carbon.identity.authenticator.backend.oauth/src/main/java/org/wso2/carbon/identity/authenticator/backend/oauth/internal/OAuthAuthenticatorServiceComponent.java index 0da3fa41ef..c4ec7e8aa1 100755 --- a/components/identity-extensions/org.wso2.carbon.identity.authenticator.backend.oauth/src/main/java/org/wso2/carbon/identity/authenticator/backend/oauth/internal/OAuthAuthenticatorServiceComponent.java +++ b/components/identity-extensions/org.wso2.carbon.identity.authenticator.backend.oauth/src/main/java/org/wso2/carbon/identity/authenticator/backend/oauth/internal/OAuthAuthenticatorServiceComponent.java @@ -26,20 +26,15 @@ import org.wso2.carbon.core.services.authentication.CarbonServerAuthenticator; import org.wso2.carbon.identity.authenticator.backend.oauth.OauthAuthenticator; import org.wso2.carbon.identity.oauth2.OAuth2TokenValidationService; -/** - * @scr.component name="org.wso2.carbon.identity.backend.oauth.authenticator" immediate="true" - * @scr.reference name="identity.oauth2.validation.service" - * interface="org.wso2.carbon.identity.oauth2.OAuth2TokenValidationService" - * cardinality="1..1" - * policy="dynamic" - * bind="setOAuth2ValidationService" - * unbind="unsetOAuth2ValidationService" - */ +@Component( + name = "org.wso2.carbon.identity.backend.oauth.authenticator", + immediate = true) public class OAuthAuthenticatorServiceComponent { private static final Log log = LogFactory.getLog(OAuthAuthenticatorServiceComponent.class); @SuppressWarnings("unused") + @Activate protected void activate(ComponentContext componentContext) { if (log.isDebugEnabled()) { log.debug("Starting Backend OAuthAuthenticator Framework Bundle"); @@ -47,6 +42,7 @@ public class OAuthAuthenticatorServiceComponent { } @SuppressWarnings("unused") + @Deactivate protected void deactivate(ComponentContext componentContext) { //do nothing } @@ -57,6 +53,13 @@ public class OAuthAuthenticatorServiceComponent { * @param tokenValidationService An instance of OAuth2TokenValidationService. */ @SuppressWarnings("unused") + @Reference( + name = "identity.oauth2.validation.service", + service = org.wso2.carbon.identity.oauth2.OAuth2TokenValidationService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + bind = "setOAuth2ValidationService", + unbind = "unsetOAuth2ValidationService") protected void setOAuth2ValidationService(OAuth2TokenValidationService tokenValidationService) { if (log.isDebugEnabled()) { log.debug("Setting OAuth2TokenValidationService Service");