diff --git a/components/org.wso2.carbon.identity.api.expired.password.identification/org.wso2.carbon.identity.api.expired.password.identification.common/src/main/java/org/wso2/carbon/identity/api/expired/password/identification/common/PasswordExpiryServiceHolder.java b/components/org.wso2.carbon.identity.api.expired.password.identification/org.wso2.carbon.identity.api.expired.password.identification.common/src/main/java/org/wso2/carbon/identity/api/expired/password/identification/common/PasswordExpiryServiceHolder.java index 3a75f56c01..0cde3d712f 100644 --- a/components/org.wso2.carbon.identity.api.expired.password.identification/org.wso2.carbon.identity.api.expired.password.identification.common/src/main/java/org/wso2/carbon/identity/api/expired/password/identification/common/PasswordExpiryServiceHolder.java +++ b/components/org.wso2.carbon.identity.api.expired.password.identification/org.wso2.carbon.identity.api.expired.password.identification.common/src/main/java/org/wso2/carbon/identity/api/expired/password/identification/common/PasswordExpiryServiceHolder.java @@ -29,6 +29,7 @@ public class PasswordExpiryServiceHolder { private PasswordExpiryServiceHolder() {} private static class ExpiredPasswordIdentificationServiceHolder { + static final ExpiredPasswordIdentificationService SERVICE = (ExpiredPasswordIdentificationService) PrivilegedCarbonContext.getThreadLocalCarbonContext() .getOSGiService(ExpiredPasswordIdentificationService.class, null); @@ -40,6 +41,7 @@ private static class ExpiredPasswordIdentificationServiceHolder { * @return ExpiredPassword identification Service. */ public static ExpiredPasswordIdentificationService getExpiredPasswordIdentificationService() { + return ExpiredPasswordIdentificationServiceHolder.SERVICE; } } diff --git a/components/org.wso2.carbon.identity.api.expired.password.identification/org.wso2.carbon.identity.api.expired.password.identification.v1/src/main/java/org/wso2/carbon/identity/api/expired/password/identification/v1/factories/PasswordExpiredUsersManagementApiServiceFactory.java b/components/org.wso2.carbon.identity.api.expired.password.identification/org.wso2.carbon.identity.api.expired.password.identification.v1/src/main/java/org/wso2/carbon/identity/api/expired/password/identification/v1/factories/PasswordExpiredUsersManagementApiServiceFactory.java index 3f800ccfce..683a412fd6 100644 --- a/components/org.wso2.carbon.identity.api.expired.password.identification/org.wso2.carbon.identity.api.expired.password.identification.v1/src/main/java/org/wso2/carbon/identity/api/expired/password/identification/v1/factories/PasswordExpiredUsersManagementApiServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.expired.password.identification/org.wso2.carbon.identity.api.expired.password.identification.v1/src/main/java/org/wso2/carbon/identity/api/expired/password/identification/v1/factories/PasswordExpiredUsersManagementApiServiceFactory.java @@ -32,11 +32,9 @@ public class PasswordExpiredUsersManagementApiServiceFactory { static { ExpiredPasswordIdentificationService expiredPasswordIdentificationService = PasswordExpiryServiceHolder.getExpiredPasswordIdentificationService(); - if (expiredPasswordIdentificationService == null) { throw new IllegalStateException("ExpiredPasswordIdentificationService is not available from OSGi context."); } - SERVICE = new PasswordExpiredUsersManagementApiService(expiredPasswordIdentificationService); } diff --git a/components/org.wso2.carbon.identity.api.idle.account.identification/org.wso2.carbon.identity.api.idle.account.identification.common/src/main/java/org/wso2/carbon/identity/api/idle/account/identification/common/IdleAccountIdentificationServiceHolder.java b/components/org.wso2.carbon.identity.api.idle.account.identification/org.wso2.carbon.identity.api.idle.account.identification.common/src/main/java/org/wso2/carbon/identity/api/idle/account/identification/common/IdleAccountIdentificationServiceHolder.java index d6500dce30..de5b7e8523 100644 --- a/components/org.wso2.carbon.identity.api.idle.account.identification/org.wso2.carbon.identity.api.idle.account.identification.common/src/main/java/org/wso2/carbon/identity/api/idle/account/identification/common/IdleAccountIdentificationServiceHolder.java +++ b/components/org.wso2.carbon.identity.api.idle.account.identification/org.wso2.carbon.identity.api.idle.account.identification.common/src/main/java/org/wso2/carbon/identity/api/idle/account/identification/common/IdleAccountIdentificationServiceHolder.java @@ -29,9 +29,9 @@ public class IdleAccountIdentificationServiceHolder { private IdleAccountIdentificationServiceHolder() {} private static class IdleAccountServiceHolder { + static final IdleAccountIdentificationService SERVICE = - (IdleAccountIdentificationService) PrivilegedCarbonContext - .getThreadLocalCarbonContext() + (IdleAccountIdentificationService) PrivilegedCarbonContext.getThreadLocalCarbonContext() .getOSGiService(IdleAccountIdentificationService.class, null); } diff --git a/components/org.wso2.carbon.identity.api.idle.account.identification/org.wso2.carbon.identity.api.idle.account.identification.v1/src/main/java/org/wso2/carbon/identity/api/idle/account/identification/v1/factories/InactiveUsersManagementApiServiceFactory.java b/components/org.wso2.carbon.identity.api.idle.account.identification/org.wso2.carbon.identity.api.idle.account.identification.v1/src/main/java/org/wso2/carbon/identity/api/idle/account/identification/v1/factories/InactiveUsersManagementApiServiceFactory.java index 657f917479..b536633c0f 100644 --- a/components/org.wso2.carbon.identity.api.idle.account.identification/org.wso2.carbon.identity.api.idle.account.identification.v1/src/main/java/org/wso2/carbon/identity/api/idle/account/identification/v1/factories/InactiveUsersManagementApiServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.idle.account.identification/org.wso2.carbon.identity.api.idle.account.identification.v1/src/main/java/org/wso2/carbon/identity/api/idle/account/identification/v1/factories/InactiveUsersManagementApiServiceFactory.java @@ -32,11 +32,9 @@ public class InactiveUsersManagementApiServiceFactory { static { IdleAccountIdentificationService idleAccountIdentificationService = IdleAccountIdentificationServiceHolder .getIdleAccountIdentificationService(); - if (idleAccountIdentificationService == null) { throw new IllegalStateException("IdleAccountIdentificationService is not available from OSGi context."); } - SERVICE = new InactiveUsersManagementApiService(idleAccountIdentificationService); } diff --git a/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.common/src/main/java/org/wso2/carbon/identity/api/server/action/management/common/ActionManagementServiceHolder.java b/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.common/src/main/java/org/wso2/carbon/identity/api/server/action/management/common/ActionManagementServiceHolder.java index b4aae85db1..d0dcf52139 100644 --- a/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.common/src/main/java/org/wso2/carbon/identity/api/server/action/management/common/ActionManagementServiceHolder.java +++ b/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.common/src/main/java/org/wso2/carbon/identity/api/server/action/management/common/ActionManagementServiceHolder.java @@ -29,6 +29,7 @@ public class ActionManagementServiceHolder { private ActionManagementServiceHolder() {} private static class ActionServiceHolder { + static final ActionManagementService SERVICE = (ActionManagementService) PrivilegedCarbonContext .getThreadLocalCarbonContext().getOSGiService(ActionManagementService.class, null); } diff --git a/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.v1/src/main/java/org/wso2/carbon/identity/api/server/action/management/v1/factories/ActionManagementServiceFactory.java b/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.v1/src/main/java/org/wso2/carbon/identity/api/server/action/management/v1/factories/ActionManagementServiceFactory.java index a6ffd4172d..1ce38088ed 100644 --- a/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.v1/src/main/java/org/wso2/carbon/identity/api/server/action/management/v1/factories/ActionManagementServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.v1/src/main/java/org/wso2/carbon/identity/api/server/action/management/v1/factories/ActionManagementServiceFactory.java @@ -31,11 +31,9 @@ public class ActionManagementServiceFactory { static { ActionManagementService actionManagementService = ActionManagementServiceHolder.getActionManagementService(); - if (actionManagementService == null) { throw new IllegalStateException("ActionManagementService is not available from OSGi context."); } - SERVICE = new ServerActionManagementService(actionManagementService); } @@ -44,7 +42,7 @@ public class ActionManagementServiceFactory { * * @return ServerActionManagementService. */ - public static ServerActionManagementService getActionManagementService() { + public static ServerActionManagementService getServerActionManagementService() { return SERVICE; } diff --git a/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.v1/src/main/java/org/wso2/carbon/identity/api/server/action/management/v1/impl/ActionsApiServiceImpl.java b/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.v1/src/main/java/org/wso2/carbon/identity/api/server/action/management/v1/impl/ActionsApiServiceImpl.java index 8ed555b6e7..ed18c1927a 100644 --- a/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.v1/src/main/java/org/wso2/carbon/identity/api/server/action/management/v1/impl/ActionsApiServiceImpl.java +++ b/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.v1/src/main/java/org/wso2/carbon/identity/api/server/action/management/v1/impl/ActionsApiServiceImpl.java @@ -43,8 +43,8 @@ public class ActionsApiServiceImpl implements ActionsApiService { public ActionsApiServiceImpl() { try { - this.serverActionManagementService = ActionManagementServiceFactory.getActionManagementService(); - } catch (Exception e) { + this.serverActionManagementService = ActionManagementServiceFactory.getServerActionManagementService(); + } catch (IllegalStateException e) { throw new RuntimeException("Error occurred while initiating server action management service.", e); } } diff --git a/components/org.wso2.carbon.identity.api.server.admin.advisory.management/org.wso2.carbon.identity.api.server.admin.advisory.management.common/src/main/java/org/wso2/carbon/identity/api/server/admin/advisory/management/common/AdminAdvisoryManagementServiceHolder.java b/components/org.wso2.carbon.identity.api.server.admin.advisory.management/org.wso2.carbon.identity.api.server.admin.advisory.management.common/src/main/java/org/wso2/carbon/identity/api/server/admin/advisory/management/common/AdminAdvisoryManagementServiceHolder.java index 0b7b9378ff..b80e14fa1a 100644 --- a/components/org.wso2.carbon.identity.api.server.admin.advisory.management/org.wso2.carbon.identity.api.server.admin.advisory.management.common/src/main/java/org/wso2/carbon/identity/api/server/admin/advisory/management/common/AdminAdvisoryManagementServiceHolder.java +++ b/components/org.wso2.carbon.identity.api.server.admin.advisory.management/org.wso2.carbon.identity.api.server.admin.advisory.management.common/src/main/java/org/wso2/carbon/identity/api/server/admin/advisory/management/common/AdminAdvisoryManagementServiceHolder.java @@ -29,6 +29,7 @@ public class AdminAdvisoryManagementServiceHolder { public AdminAdvisoryManagementServiceHolder() {} private static class AdminAdvisoryServiceHolder { + static final AdminAdvisoryManagementService SERVICE = (AdminAdvisoryManagementService) PrivilegedCarbonContext .getThreadLocalCarbonContext().getOSGiService(AdminAdvisoryManagementService.class, null); } diff --git a/components/org.wso2.carbon.identity.api.server.admin.advisory.management/org.wso2.carbon.identity.api.server.admin.advisory.management.v1/src/main/java/org/wso2/carbon/identity/api/server/admin/advisory/management/v1/factories/ServerAdminAdvisoryManagementServiceFactory.java b/components/org.wso2.carbon.identity.api.server.admin.advisory.management/org.wso2.carbon.identity.api.server.admin.advisory.management.v1/src/main/java/org/wso2/carbon/identity/api/server/admin/advisory/management/v1/factories/ServerAdminAdvisoryManagementServiceFactory.java index baf1d4660c..f3c61ef139 100644 --- a/components/org.wso2.carbon.identity.api.server.admin.advisory.management/org.wso2.carbon.identity.api.server.admin.advisory.management.v1/src/main/java/org/wso2/carbon/identity/api/server/admin/advisory/management/v1/factories/ServerAdminAdvisoryManagementServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.server.admin.advisory.management/org.wso2.carbon.identity.api.server.admin.advisory.management.v1/src/main/java/org/wso2/carbon/identity/api/server/admin/advisory/management/v1/factories/ServerAdminAdvisoryManagementServiceFactory.java @@ -32,11 +32,9 @@ public class ServerAdminAdvisoryManagementServiceFactory { static { AdminAdvisoryManagementService adminAdvisoryManagementService = AdminAdvisoryManagementServiceHolder .getAdminAdvisoryManagementService(); - if (adminAdvisoryManagementService == null) { throw new IllegalStateException("AdminAdvisoryManagementService is not available from OSGi context."); } - SERVICE = new ServerAdminAdvisoryManagementService(adminAdvisoryManagementService); } diff --git a/components/org.wso2.carbon.identity.api.server.api.resource/org.wso2.carbon.identity.api.server.api.resource.v1/src/main/java/org/wso2/carbon/identity/api/server/api/resource/v1/factories/ServerAPIResourceCollectionManagementServiceFactory.java b/components/org.wso2.carbon.identity.api.server.api.resource/org.wso2.carbon.identity.api.server.api.resource.v1/src/main/java/org/wso2/carbon/identity/api/server/api/resource/v1/factories/ServerAPIResourceCollectionManagementServiceFactory.java index 64ce6f99b6..b662e2ea49 100644 --- a/components/org.wso2.carbon.identity.api.server.api.resource/org.wso2.carbon.identity.api.server.api.resource.v1/src/main/java/org/wso2/carbon/identity/api/server/api/resource/v1/factories/ServerAPIResourceCollectionManagementServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.server.api.resource/org.wso2.carbon.identity.api.server.api.resource.v1/src/main/java/org/wso2/carbon/identity/api/server/api/resource/v1/factories/ServerAPIResourceCollectionManagementServiceFactory.java @@ -32,11 +32,9 @@ public class ServerAPIResourceCollectionManagementServiceFactory { static { APIResourceCollectionManager apiResourceCollectionManager = APIResourceManagementServiceHolder .getApiResourceCollectionManager(); - if (apiResourceCollectionManager == null) { throw new IllegalStateException("APIResourceCollectionManager is not available from OSGi context."); } - SERVICE = new ServerAPIResourceCollectionManagementService(apiResourceCollectionManager); } diff --git a/components/org.wso2.carbon.identity.api.server.api.resource/org.wso2.carbon.identity.api.server.api.resource.v1/src/main/java/org/wso2/carbon/identity/api/server/api/resource/v1/factories/ServerAPIResourceManagementServiceFactory.java b/components/org.wso2.carbon.identity.api.server.api.resource/org.wso2.carbon.identity.api.server.api.resource.v1/src/main/java/org/wso2/carbon/identity/api/server/api/resource/v1/factories/ServerAPIResourceManagementServiceFactory.java index 611e31a100..586b9379e9 100644 --- a/components/org.wso2.carbon.identity.api.server.api.resource/org.wso2.carbon.identity.api.server.api.resource.v1/src/main/java/org/wso2/carbon/identity/api/server/api/resource/v1/factories/ServerAPIResourceManagementServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.server.api.resource/org.wso2.carbon.identity.api.server.api.resource.v1/src/main/java/org/wso2/carbon/identity/api/server/api/resource/v1/factories/ServerAPIResourceManagementServiceFactory.java @@ -31,11 +31,9 @@ public class ServerAPIResourceManagementServiceFactory { static { APIResourceManager apiResourceManager = APIResourceManagementServiceHolder.getApiResourceManager(); - if (apiResourceManager == null) { throw new IllegalStateException("APIResourceManager is not available from OSGi context."); } - SERVICE = new ServerAPIResourceManagementService(apiResourceManager); } diff --git a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/factories/ServerApplicationSharingServiceFactory.java b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/factories/ServerApplicationSharingServiceFactory.java index 990e88733b..fd08185b48 100644 --- a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/factories/ServerApplicationSharingServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/factories/ServerApplicationSharingServiceFactory.java @@ -30,13 +30,10 @@ public class ServerApplicationSharingServiceFactory { private static final ServerApplicationSharingService SERVICE; static { - OrgApplicationManager orgApplicationManager = ApplicationManagementServiceHolder.getOrgApplicationManager(); - if (orgApplicationManager == null) { throw new IllegalStateException("OrgApplicationManager is not available from OSGi context."); } - SERVICE = new ServerApplicationSharingService(orgApplicationManager); } diff --git a/components/org.wso2.carbon.identity.api.server.authenticators/org.wso2.carbon.identity.api.server.authenticators.common/src/main/java/org/wso2/carbon/identity/api/server/authenticators/common/AuthenticatorsServiceHolder.java b/components/org.wso2.carbon.identity.api.server.authenticators/org.wso2.carbon.identity.api.server.authenticators.common/src/main/java/org/wso2/carbon/identity/api/server/authenticators/common/AuthenticatorsServiceHolder.java index b4f22daeab..f543909082 100644 --- a/components/org.wso2.carbon.identity.api.server.authenticators/org.wso2.carbon.identity.api.server.authenticators.common/src/main/java/org/wso2/carbon/identity/api/server/authenticators/common/AuthenticatorsServiceHolder.java +++ b/components/org.wso2.carbon.identity.api.server.authenticators/org.wso2.carbon.identity.api.server.authenticators.common/src/main/java/org/wso2/carbon/identity/api/server/authenticators/common/AuthenticatorsServiceHolder.java @@ -32,12 +32,14 @@ private AuthenticatorsServiceHolder() { } private static class ApplicationManagementServiceHolder { + static final ApplicationManagementService SERVICE = (ApplicationManagementService) PrivilegedCarbonContext .getThreadLocalCarbonContext() .getOSGiService(ApplicationManagementService.class, null); } private static class IdentityProviderManagerHolder { + static final IdpManager SERVICE = (IdpManager) PrivilegedCarbonContext .getThreadLocalCarbonContext() .getOSGiService(IdpManager.class, null); diff --git a/components/org.wso2.carbon.identity.api.server.authenticators/org.wso2.carbon.identity.api.server.authenticators.v1/pom.xml b/components/org.wso2.carbon.identity.api.server.authenticators/org.wso2.carbon.identity.api.server.authenticators.v1/pom.xml index ff63c209d5..ff9a27cdf9 100644 --- a/components/org.wso2.carbon.identity.api.server.authenticators/org.wso2.carbon.identity.api.server.authenticators.v1/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.authenticators/org.wso2.carbon.identity.api.server.authenticators.v1/pom.xml @@ -164,12 +164,6 @@ commons-beanutils commons-beanutils - - org.wso2.carbon.identity.server.api - org.wso2.carbon.identity.api.server.authenticators.common - ${project.version} - provided - diff --git a/components/org.wso2.carbon.identity.api.server.branding.preference.management/org.wso2.carbon.identity.api.server.branding.preference.management.v1/src/main/java/org/wso2/carbon/identity/api/server/branding/preference/management/v1/factories/BrandingPreferenceManagementServiceFactory.java b/components/org.wso2.carbon.identity.api.server.branding.preference.management/org.wso2.carbon.identity.api.server.branding.preference.management.v1/src/main/java/org/wso2/carbon/identity/api/server/branding/preference/management/v1/factories/BrandingPreferenceManagementServiceFactory.java index e01a523a44..f70471e872 100644 --- a/components/org.wso2.carbon.identity.api.server.branding.preference.management/org.wso2.carbon.identity.api.server.branding.preference.management.v1/src/main/java/org/wso2/carbon/identity/api/server/branding/preference/management/v1/factories/BrandingPreferenceManagementServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.server.branding.preference.management/org.wso2.carbon.identity.api.server.branding.preference.management.v1/src/main/java/org/wso2/carbon/identity/api/server/branding/preference/management/v1/factories/BrandingPreferenceManagementServiceFactory.java @@ -32,11 +32,9 @@ public class BrandingPreferenceManagementServiceFactory { static { BrandingPreferenceManager brandingPreferenceManager = BrandingPreferenceServiceHolder .getBrandingPreferenceManager(); - if (brandingPreferenceManager == null) { throw new IllegalStateException("BrandingPreferenceManager is not available from OSGi context."); } - SERVICE = new BrandingPreferenceManagementService(brandingPreferenceManager); } diff --git a/components/org.wso2.carbon.identity.api.server.claim.management/org.wso2.carbon.identity.api.server.claim.management.common/src/main/java/org/wso2/carbon/identity/api/server/claim/management/common/ClaimManagementDataHolder.java b/components/org.wso2.carbon.identity.api.server.claim.management/org.wso2.carbon.identity.api.server.claim.management.common/src/main/java/org/wso2/carbon/identity/api/server/claim/management/common/ClaimManagementDataHolder.java index 76a17bbb46..a354481de2 100644 --- a/components/org.wso2.carbon.identity.api.server.claim.management/org.wso2.carbon.identity.api.server.claim.management.common/src/main/java/org/wso2/carbon/identity/api/server/claim/management/common/ClaimManagementDataHolder.java +++ b/components/org.wso2.carbon.identity.api.server.claim.management/org.wso2.carbon.identity.api.server.claim.management.common/src/main/java/org/wso2/carbon/identity/api/server/claim/management/common/ClaimManagementDataHolder.java @@ -28,11 +28,13 @@ public class ClaimManagementDataHolder { private static class OrganizationManagerHolder { + static final OrganizationManager SERVICE = (OrganizationManager) PrivilegedCarbonContext .getThreadLocalCarbonContext().getOSGiService(OrganizationManager.class, null); } private static class ClaimMetadataManagementServiceHolder { + static final ClaimMetadataManagementService SERVICE = (ClaimMetadataManagementService) PrivilegedCarbonContext .getThreadLocalCarbonContext().getOSGiService(ClaimMetadataManagementService.class, null); } diff --git a/components/org.wso2.carbon.identity.api.server.claim.management/org.wso2.carbon.identity.api.server.claim.management.common/src/main/java/org/wso2/carbon/identity/api/server/claim/management/common/Constant.java b/components/org.wso2.carbon.identity.api.server.claim.management/org.wso2.carbon.identity.api.server.claim.management.common/src/main/java/org/wso2/carbon/identity/api/server/claim/management/common/Constant.java index 75e33ecc37..be7f1703b3 100644 --- a/components/org.wso2.carbon.identity.api.server.claim.management/org.wso2.carbon.identity.api.server.claim.management.common/src/main/java/org/wso2/carbon/identity/api/server/claim/management/common/Constant.java +++ b/components/org.wso2.carbon.identity.api.server.claim.management/org.wso2.carbon.identity.api.server.claim.management.common/src/main/java/org/wso2/carbon/identity/api/server/claim/management/common/Constant.java @@ -29,6 +29,7 @@ public class Constant { public static final String CMT_PATH_COMPONENT = "/claim-dialects"; public static final String LOCAL_DIALECT_PATH = "local"; public static final String LOCAL_DIALECT = "http://wso2.org/claims"; + public static final String CONTENT_DISPOSITION = "Content-Disposition"; /** * Enum for error messages. diff --git a/components/org.wso2.carbon.identity.api.server.claim.management/org.wso2.carbon.identity.rest.api.server.claim.management.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/claim/management/v1/impl/ClaimManagementApiServiceImpl.java b/components/org.wso2.carbon.identity.api.server.claim.management/org.wso2.carbon.identity.rest.api.server.claim.management.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/claim/management/v1/impl/ClaimManagementApiServiceImpl.java index e5df5edba6..db77fd9e70 100644 --- a/components/org.wso2.carbon.identity.api.server.claim.management/org.wso2.carbon.identity.rest.api.server.claim.management.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/claim/management/v1/impl/ClaimManagementApiServiceImpl.java +++ b/components/org.wso2.carbon.identity.api.server.claim.management/org.wso2.carbon.identity.rest.api.server.claim.management.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/claim/management/v1/impl/ClaimManagementApiServiceImpl.java @@ -36,6 +36,7 @@ import javax.ws.rs.core.Response; import static org.wso2.carbon.identity.api.server.claim.management.common.Constant.CMT_PATH_COMPONENT; +import static org.wso2.carbon.identity.api.server.claim.management.common.Constant.CONTENT_DISPOSITION; import static org.wso2.carbon.identity.api.server.claim.management.common.Constant.LOCAL_DIALECT_PATH; import static org.wso2.carbon.identity.api.server.common.Constants.V1_API_PATH_COMPONENT; import static org.wso2.carbon.identity.api.server.common.ContextLoader.buildURIForHeader; @@ -183,7 +184,7 @@ public Response exportClaimDialectToFile(String dialectId, String accept) { return Response.ok() .type(fileContent.getFileType()) - .header("Content-Disposition", "attachment; filename=\"" + .header(CONTENT_DISPOSITION, "attachment; filename=\"" + fileContent.getFileName() + "\"") .header(HttpHeaders.CACHE_CONTROL, "no-cache, no-store, must-revalidate") .header(HttpHeaders.PRAGMA, "no-cache") diff --git a/components/org.wso2.carbon.identity.api.server.configs/org.wso2.carbon.identity.api.server.configs.common/src/main/java/org/wso2/carbon/identity/api/server/configs/common/ConfigsServiceHolder.java b/components/org.wso2.carbon.identity.api.server.configs/org.wso2.carbon.identity.api.server.configs.common/src/main/java/org/wso2/carbon/identity/api/server/configs/common/ConfigsServiceHolder.java index 3f64257c52..945363ed5e 100644 --- a/components/org.wso2.carbon.identity.api.server.configs/org.wso2.carbon.identity.api.server.configs.common/src/main/java/org/wso2/carbon/identity/api/server/configs/common/ConfigsServiceHolder.java +++ b/components/org.wso2.carbon.identity.api.server.configs/org.wso2.carbon.identity.api.server.configs.common/src/main/java/org/wso2/carbon/identity/api/server/configs/common/ConfigsServiceHolder.java @@ -35,36 +35,43 @@ public class ConfigsServiceHolder { private ConfigsServiceHolder() {} private static class ApplicationManagementServiceHolder { + static final ApplicationManagementService SERVICE = (ApplicationManagementService) PrivilegedCarbonContext .getThreadLocalCarbonContext().getOSGiService(ApplicationManagementService.class, null); } private static class IdpManagerHolder { + static final IdpManager SERVICE = (IdpManager) PrivilegedCarbonContext .getThreadLocalCarbonContext().getOSGiService(IdpManager.class, null); } private static class CORSManagementServiceHolder { + static final CORSManagementService SERVICE = (CORSManagementService) PrivilegedCarbonContext .getThreadLocalCarbonContext().getOSGiService(CORSManagementService.class, null); } private static class RemoteLoggingConfigServiceHolder { + static final RemoteLoggingConfigService SERVICE = (RemoteLoggingConfigService) PrivilegedCarbonContext .getThreadLocalCarbonContext().getOSGiService(RemoteLoggingConfigService.class, null); } private static class ImpersonationConfigMgtServiceHolder { + static final ImpersonationConfigMgtService SERVICE = (ImpersonationConfigMgtService) PrivilegedCarbonContext .getThreadLocalCarbonContext().getOSGiService(ImpersonationConfigMgtService.class, null); } private static class DCRConfigurationMgtServiceHolder { + static final DCRConfigurationMgtService SERVICE = (DCRConfigurationMgtService) PrivilegedCarbonContext .getThreadLocalCarbonContext().getOSGiService(DCRConfigurationMgtService.class, null); } private static class JWTClientAuthenticatorMgtServiceHolder { + static final JWTClientAuthenticatorMgtService SERVICE = (JWTClientAuthenticatorMgtService) PrivilegedCarbonContext.getThreadLocalCarbonContext() .getOSGiService(JWTClientAuthenticatorMgtService.class, null); diff --git a/components/org.wso2.carbon.identity.api.server.cors/org.wso2.carbon.identity.api.server.cors.v1/pom.xml b/components/org.wso2.carbon.identity.api.server.cors/org.wso2.carbon.identity.api.server.cors.v1/pom.xml index efa655fadd..96a3ebc566 100644 --- a/components/org.wso2.carbon.identity.api.server.cors/org.wso2.carbon.identity.api.server.cors.v1/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.cors/org.wso2.carbon.identity.api.server.cors.v1/pom.xml @@ -98,11 +98,6 @@ commons-beanutils commons-beanutils - - org.wso2.carbon.identity.server.api - org.wso2.carbon.identity.api.server.cors.common - compile - diff --git a/components/org.wso2.carbon.identity.api.server.cors/org.wso2.carbon.identity.api.server.cors.v1/src/main/java/org/wso2/carbon/identity/api/server/cors/v1/factories/CORSServiceFactory.java b/components/org.wso2.carbon.identity.api.server.cors/org.wso2.carbon.identity.api.server.cors.v1/src/main/java/org/wso2/carbon/identity/api/server/cors/v1/factories/CORSServiceFactory.java index 2820a0f145..7a91fff188 100644 --- a/components/org.wso2.carbon.identity.api.server.cors/org.wso2.carbon.identity.api.server.cors.v1/src/main/java/org/wso2/carbon/identity/api/server/cors/v1/factories/CORSServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.server.cors/org.wso2.carbon.identity.api.server.cors.v1/src/main/java/org/wso2/carbon/identity/api/server/cors/v1/factories/CORSServiceFactory.java @@ -31,11 +31,9 @@ public class CORSServiceFactory { static { CORSManagementService corsManagementService = CORSServiceHolder.getCorsManagementService(); - if (corsManagementService == null) { throw new IllegalStateException("CORSManagementService is not available from OSGi context."); } - SERVICE = new CORSService(corsManagementService); } diff --git a/components/org.wso2.carbon.identity.api.server.email.template/org.wso2.carbon.identity.api.server.email.template.common/src/main/java/org/wso2/carbon/identity/api/server/email/template/common/EmailTemplatesServiceHolder.java b/components/org.wso2.carbon.identity.api.server.email.template/org.wso2.carbon.identity.api.server.email.template.common/src/main/java/org/wso2/carbon/identity/api/server/email/template/common/EmailTemplatesServiceHolder.java index 338050bddd..d2c39532e3 100644 --- a/components/org.wso2.carbon.identity.api.server.email.template/org.wso2.carbon.identity.api.server.email.template.common/src/main/java/org/wso2/carbon/identity/api/server/email/template/common/EmailTemplatesServiceHolder.java +++ b/components/org.wso2.carbon.identity.api.server.email.template/org.wso2.carbon.identity.api.server.email.template.common/src/main/java/org/wso2/carbon/identity/api/server/email/template/common/EmailTemplatesServiceHolder.java @@ -29,6 +29,7 @@ public class EmailTemplatesServiceHolder { private EmailTemplatesServiceHolder() {} private static class EmailTemplateManagerHolder { + static final EmailTemplateManager SERVICE = (EmailTemplateManager) PrivilegedCarbonContext .getThreadLocalCarbonContext().getOSGiService(EmailTemplateManager.class, null); } diff --git a/components/org.wso2.carbon.identity.api.server.email.template/org.wso2.carbon.identity.rest.api.server.email.template.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/email/template/v1/factories/ServerEmailTemplatesServiceFactory.java b/components/org.wso2.carbon.identity.api.server.email.template/org.wso2.carbon.identity.rest.api.server.email.template.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/email/template/v1/factories/ServerEmailTemplatesServiceFactory.java index 6cd0b13259..863a2b6b7b 100644 --- a/components/org.wso2.carbon.identity.api.server.email.template/org.wso2.carbon.identity.rest.api.server.email.template.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/email/template/v1/factories/ServerEmailTemplatesServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.server.email.template/org.wso2.carbon.identity.rest.api.server.email.template.v1/src/main/java/org/wso2/carbon/identity/rest/api/server/email/template/v1/factories/ServerEmailTemplatesServiceFactory.java @@ -31,11 +31,9 @@ public class ServerEmailTemplatesServiceFactory { static { EmailTemplateManager emailTemplateManager = EmailTemplatesServiceHolder.getEmailTemplateManager(); - if (emailTemplateManager == null) { throw new IllegalStateException("EmailTemplateManager is not available from OSGi context."); } - SERVICE = new ServerEmailTemplatesService(emailTemplateManager); } diff --git a/components/org.wso2.carbon.identity.api.server.email.template/org.wso2.carbon.identity.rest.api.server.email.template.v2/pom.xml b/components/org.wso2.carbon.identity.api.server.email.template/org.wso2.carbon.identity.rest.api.server.email.template.v2/pom.xml index 7533331a3f..f185f523dd 100644 --- a/components/org.wso2.carbon.identity.api.server.email.template/org.wso2.carbon.identity.rest.api.server.email.template.v2/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.email.template/org.wso2.carbon.identity.rest.api.server.email.template.v2/pom.xml @@ -170,11 +170,5 @@ org.wso2.carbon.identity.server.api org.wso2.carbon.identity.api.server.email.template.common - - org.wso2.carbon.identity.server.api - org.wso2.carbon.identity.rest.api.server.email.template.v1 - 1.2.228-SNAPSHOT - compile - diff --git a/components/org.wso2.carbon.identity.api.server.email.template/org.wso2.carbon.identity.rest.api.server.email.template.v2/src/main/java/org/wso2/carbon/identity/rest/api/server/email/template/v2/factories/ApplicationEmailTemplatesServiceFactory.java b/components/org.wso2.carbon.identity.api.server.email.template/org.wso2.carbon.identity.rest.api.server.email.template.v2/src/main/java/org/wso2/carbon/identity/rest/api/server/email/template/v2/factories/ApplicationEmailTemplatesServiceFactory.java index 3e9e96e525..b2f7fa8bcb 100644 --- a/components/org.wso2.carbon.identity.api.server.email.template/org.wso2.carbon.identity.rest.api.server.email.template.v2/src/main/java/org/wso2/carbon/identity/rest/api/server/email/template/v2/factories/ApplicationEmailTemplatesServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.server.email.template/org.wso2.carbon.identity.rest.api.server.email.template.v2/src/main/java/org/wso2/carbon/identity/rest/api/server/email/template/v2/factories/ApplicationEmailTemplatesServiceFactory.java @@ -31,11 +31,9 @@ public class ApplicationEmailTemplatesServiceFactory { static { EmailTemplateManager emailTemplateManager = EmailTemplatesServiceHolder.getEmailTemplateManager(); - if (emailTemplateManager == null) { throw new IllegalStateException("EmailTemplateManager is not available from OSGi context."); } - SERVICE = new ApplicationEmailTemplatesService(emailTemplateManager); } diff --git a/components/org.wso2.carbon.identity.api.server.email.template/org.wso2.carbon.identity.rest.api.server.email.template.v2/src/main/java/org/wso2/carbon/identity/rest/api/server/email/template/v2/factories/ServerEmailTemplatesServiceFactory.java b/components/org.wso2.carbon.identity.api.server.email.template/org.wso2.carbon.identity.rest.api.server.email.template.v2/src/main/java/org/wso2/carbon/identity/rest/api/server/email/template/v2/factories/ServerEmailTemplatesServiceFactory.java index ed710d0ab9..7a6fc29bf5 100644 --- a/components/org.wso2.carbon.identity.api.server.email.template/org.wso2.carbon.identity.rest.api.server.email.template.v2/src/main/java/org/wso2/carbon/identity/rest/api/server/email/template/v2/factories/ServerEmailTemplatesServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.server.email.template/org.wso2.carbon.identity.rest.api.server.email.template.v2/src/main/java/org/wso2/carbon/identity/rest/api/server/email/template/v2/factories/ServerEmailTemplatesServiceFactory.java @@ -31,11 +31,9 @@ public class ServerEmailTemplatesServiceFactory { static { EmailTemplateManager emailTemplateManager = EmailTemplatesServiceHolder.getEmailTemplateManager(); - if (emailTemplateManager == null) { throw new IllegalStateException("EmailTemplateManager is not available from OSGi context."); } - SERVICE = new ServerEmailTemplatesService(emailTemplateManager); } diff --git a/components/org.wso2.carbon.identity.api.server.identity.governance/org.wso2.carbon.identity.api.server.identity.governance.v1/src/main/java/org/wso2/carbon/identity/api/server/identity/governance/v1/factories/ServerIdentityGovernanceServiceFactory.java b/components/org.wso2.carbon.identity.api.server.identity.governance/org.wso2.carbon.identity.api.server.identity.governance.v1/src/main/java/org/wso2/carbon/identity/api/server/identity/governance/v1/factories/ServerIdentityGovernanceServiceFactory.java index 1680880a57..27587e0959 100644 --- a/components/org.wso2.carbon.identity.api.server.identity.governance/org.wso2.carbon.identity.api.server.identity.governance.v1/src/main/java/org/wso2/carbon/identity/api/server/identity/governance/v1/factories/ServerIdentityGovernanceServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.server.identity.governance/org.wso2.carbon.identity.api.server.identity.governance.v1/src/main/java/org/wso2/carbon/identity/api/server/identity/governance/v1/factories/ServerIdentityGovernanceServiceFactory.java @@ -31,11 +31,9 @@ public class ServerIdentityGovernanceServiceFactory { static { IdentityGovernanceService identityGovernanceService = GovernanceDataHolder.getIdentityGovernanceService(); - if (identityGovernanceService == null) { throw new IllegalStateException("RolePermissionManagementService is not available from OSGi context."); } - SERVICE = new ServerIdentityGovernanceService(identityGovernanceService); } diff --git a/components/org.wso2.carbon.identity.api.server.idv.provider/org.wso2.carbon.identity.api.server.idv.provider.common/src/main/java/org/wso2/carbon/identity/api/server/idv/provider/common/IdentityVerificationServiceHolder.java b/components/org.wso2.carbon.identity.api.server.idv.provider/org.wso2.carbon.identity.api.server.idv.provider.common/src/main/java/org/wso2/carbon/identity/api/server/idv/provider/common/IdentityVerificationServiceHolder.java index c5df0f229e..20ac27e3ae 100644 --- a/components/org.wso2.carbon.identity.api.server.idv.provider/org.wso2.carbon.identity.api.server.idv.provider.common/src/main/java/org/wso2/carbon/identity/api/server/idv/provider/common/IdentityVerificationServiceHolder.java +++ b/components/org.wso2.carbon.identity.api.server.idv.provider/org.wso2.carbon.identity.api.server.idv.provider.common/src/main/java/org/wso2/carbon/identity/api/server/idv/provider/common/IdentityVerificationServiceHolder.java @@ -29,6 +29,7 @@ public class IdentityVerificationServiceHolder { private IdentityVerificationServiceHolder() {}; private static class IdVProviderManagerHolder { + static final IdVProviderManager SERVICE = (IdVProviderManager) PrivilegedCarbonContext .getThreadLocalCarbonContext().getOSGiService(IdVProviderManager.class, null); } diff --git a/components/org.wso2.carbon.identity.api.server.idv.provider/org.wso2.carbon.identity.api.server.idv.provider.v1/src/main/java/org/wso2/carbon/identity/api/server/idv/provider/v1/factories/IdVProviderServiceFactory.java b/components/org.wso2.carbon.identity.api.server.idv.provider/org.wso2.carbon.identity.api.server.idv.provider.v1/src/main/java/org/wso2/carbon/identity/api/server/idv/provider/v1/factories/IdVProviderServiceFactory.java index cacde39b91..f11463dedf 100644 --- a/components/org.wso2.carbon.identity.api.server.idv.provider/org.wso2.carbon.identity.api.server.idv.provider.v1/src/main/java/org/wso2/carbon/identity/api/server/idv/provider/v1/factories/IdVProviderServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.server.idv.provider/org.wso2.carbon.identity.api.server.idv.provider.v1/src/main/java/org/wso2/carbon/identity/api/server/idv/provider/v1/factories/IdVProviderServiceFactory.java @@ -31,11 +31,9 @@ public class IdVProviderServiceFactory { static { IdVProviderManager idvProviderManager = IdentityVerificationServiceHolder.getIdVProviderManager(); - if (idvProviderManager == null) { throw new IllegalStateException("IdVProviderManager is not available from OSGi context."); } - SERVICE = new IdVProviderService(idvProviderManager); } diff --git a/components/org.wso2.carbon.identity.api.server.input.validation/org.wso2.carbon.identity.api.server.input.validation.common/src/main/java/org/wso2/carbon/identity/api/server/input/validation/common/InputValidationServiceHolder.java b/components/org.wso2.carbon.identity.api.server.input.validation/org.wso2.carbon.identity.api.server.input.validation.common/src/main/java/org/wso2/carbon/identity/api/server/input/validation/common/InputValidationServiceHolder.java index d99ccff700..f66cdac761 100644 --- a/components/org.wso2.carbon.identity.api.server.input.validation/org.wso2.carbon.identity.api.server.input.validation.common/src/main/java/org/wso2/carbon/identity/api/server/input/validation/common/InputValidationServiceHolder.java +++ b/components/org.wso2.carbon.identity.api.server.input.validation/org.wso2.carbon.identity.api.server.input.validation.common/src/main/java/org/wso2/carbon/identity/api/server/input/validation/common/InputValidationServiceHolder.java @@ -29,6 +29,7 @@ public class InputValidationServiceHolder { private InputValidationServiceHolder () {}; private static class InputValidationManagementServiceHolder { + static final InputValidationManagementService SERVICE = (InputValidationManagementService) PrivilegedCarbonContext.getThreadLocalCarbonContext() .getOSGiService(InputValidationManagementService.class, null); diff --git a/components/org.wso2.carbon.identity.api.server.input.validation/org.wso2.carbon.identity.api.server.input.validation.v1/src/main/java/org/wso2/carbon/identity/api/server/input/validation/v1/factories/ValidationRulesManagementApiServiceFactory.java b/components/org.wso2.carbon.identity.api.server.input.validation/org.wso2.carbon.identity.api.server.input.validation.v1/src/main/java/org/wso2/carbon/identity/api/server/input/validation/v1/factories/ValidationRulesManagementApiServiceFactory.java index ef4bc02ec8..d0b7044258 100644 --- a/components/org.wso2.carbon.identity.api.server.input.validation/org.wso2.carbon.identity.api.server.input.validation.v1/src/main/java/org/wso2/carbon/identity/api/server/input/validation/v1/factories/ValidationRulesManagementApiServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.server.input.validation/org.wso2.carbon.identity.api.server.input.validation.v1/src/main/java/org/wso2/carbon/identity/api/server/input/validation/v1/factories/ValidationRulesManagementApiServiceFactory.java @@ -32,11 +32,9 @@ public class ValidationRulesManagementApiServiceFactory { static { InputValidationManagementService inputValidationManagementService = InputValidationServiceHolder .getInputValidationMgtService(); - if (inputValidationManagementService == null) { throw new IllegalStateException("InputValidationManagementService is not available from OSGi context."); } - SERVICE = new ValidationRulesManagementApiService(inputValidationManagementService); } diff --git a/components/org.wso2.carbon.identity.api.server.keystore.management/org.wso2.carbon.identity.api.server.keystore.management.common/src/main/java/org/wso2/carbon/identity/api/server/keystore/management/common/KeyStoreManagamentDataHolder.java b/components/org.wso2.carbon.identity.api.server.keystore.management/org.wso2.carbon.identity.api.server.keystore.management.common/src/main/java/org/wso2/carbon/identity/api/server/keystore/management/common/KeyStoreManagamentDataHolder.java index 6cbb39a740..6cb03b7076 100644 --- a/components/org.wso2.carbon.identity.api.server.keystore.management/org.wso2.carbon.identity.api.server.keystore.management.common/src/main/java/org/wso2/carbon/identity/api/server/keystore/management/common/KeyStoreManagamentDataHolder.java +++ b/components/org.wso2.carbon.identity.api.server.keystore.management/org.wso2.carbon.identity.api.server.keystore.management.common/src/main/java/org/wso2/carbon/identity/api/server/keystore/management/common/KeyStoreManagamentDataHolder.java @@ -29,6 +29,7 @@ public class KeyStoreManagamentDataHolder { public KeyStoreManagamentDataHolder() {} private static class KeyStoreManagementServiceHolder { + static final KeyStoreManagementService SERVICE = (KeyStoreManagementService) PrivilegedCarbonContext .getThreadLocalCarbonContext().getOSGiService(KeyStoreManagementService.class, null); } diff --git a/components/org.wso2.carbon.identity.api.server.keystore.management/org.wso2.carbon.identity.api.server.keystore.management.v1/src/main/java/org/wso2/carbon/identity/api/server/keystore/management/v1/factories/KeyStoreServiceFactory.java b/components/org.wso2.carbon.identity.api.server.keystore.management/org.wso2.carbon.identity.api.server.keystore.management.v1/src/main/java/org/wso2/carbon/identity/api/server/keystore/management/v1/factories/KeyStoreServiceFactory.java index e23004f683..e81f5b7569 100644 --- a/components/org.wso2.carbon.identity.api.server.keystore.management/org.wso2.carbon.identity.api.server.keystore.management.v1/src/main/java/org/wso2/carbon/identity/api/server/keystore/management/v1/factories/KeyStoreServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.server.keystore.management/org.wso2.carbon.identity.api.server.keystore.management.v1/src/main/java/org/wso2/carbon/identity/api/server/keystore/management/v1/factories/KeyStoreServiceFactory.java @@ -31,11 +31,9 @@ public class KeyStoreServiceFactory { static { KeyStoreManagementService keyStoreManagementService = KeyStoreManagamentDataHolder.getKeyStoreManager(); - if (keyStoreManagementService == null) { throw new IllegalStateException("KeyStoreManagementService is not available from OSGi context."); } - SERVICE = new KeyStoreService(keyStoreManagementService); } diff --git a/components/org.wso2.carbon.identity.api.server.notification.sender/org.wso2.carbon.identity.api.server.notification.sender.common/src/main/java/org/wso2/carbon/identity/api/server/notification/sender/common/NotificationSenderServiceHolder.java b/components/org.wso2.carbon.identity.api.server.notification.sender/org.wso2.carbon.identity.api.server.notification.sender.common/src/main/java/org/wso2/carbon/identity/api/server/notification/sender/common/NotificationSenderServiceHolder.java index 0feb6c2f74..d2bc338929 100644 --- a/components/org.wso2.carbon.identity.api.server.notification.sender/org.wso2.carbon.identity.api.server.notification.sender.common/src/main/java/org/wso2/carbon/identity/api/server/notification/sender/common/NotificationSenderServiceHolder.java +++ b/components/org.wso2.carbon.identity.api.server.notification.sender/org.wso2.carbon.identity.api.server.notification.sender.common/src/main/java/org/wso2/carbon/identity/api/server/notification/sender/common/NotificationSenderServiceHolder.java @@ -29,6 +29,7 @@ public class NotificationSenderServiceHolder { private NotificationSenderServiceHolder() {} private static class NotificationSenderManagementServiceHolder { + static final NotificationSenderManagementService SERVICE = (NotificationSenderManagementService) PrivilegedCarbonContext.getThreadLocalCarbonContext() .getOSGiService(NotificationSenderManagementService.class, null); diff --git a/components/org.wso2.carbon.identity.api.server.notification.sender/org.wso2.carbon.identity.api.server.notification.sender.v1/src/main/java/org/wso2/carbon/identity/api/server/notification/sender/v1/factories/NotificationSenderManagementServiceFactory.java b/components/org.wso2.carbon.identity.api.server.notification.sender/org.wso2.carbon.identity.api.server.notification.sender.v1/src/main/java/org/wso2/carbon/identity/api/server/notification/sender/v1/factories/NotificationSenderManagementServiceFactory.java index 8aafbf9733..a7e4f9c4a1 100644 --- a/components/org.wso2.carbon.identity.api.server.notification.sender/org.wso2.carbon.identity.api.server.notification.sender.v1/src/main/java/org/wso2/carbon/identity/api/server/notification/sender/v1/factories/NotificationSenderManagementServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.server.notification.sender/org.wso2.carbon.identity.api.server.notification.sender.v1/src/main/java/org/wso2/carbon/identity/api/server/notification/sender/v1/factories/NotificationSenderManagementServiceFactory.java @@ -32,11 +32,9 @@ public class NotificationSenderManagementServiceFactory { org.wso2.carbon.identity.notification.sender.tenant.config.NotificationSenderManagementService notificationSenderManagementService = NotificationSenderServiceHolder .getNotificationSenderManagementService(); - if (notificationSenderManagementService == null) { throw new IllegalStateException("NotificationSenderManagementService is not available from OSGi context."); } - SERVICE = new NotificationSenderManagementService(notificationSenderManagementService); } diff --git a/components/org.wso2.carbon.identity.api.server.oidc.scope.management/org.wso2.carbon.identity.api.server.oidc.scope.management.v1/src/main/java/org/wso2/carbon/identity/api/server/oidc/scope/management/v1/factories/OidcScopeManagementServiceFactory.java b/components/org.wso2.carbon.identity.api.server.oidc.scope.management/org.wso2.carbon.identity.api.server.oidc.scope.management.v1/src/main/java/org/wso2/carbon/identity/api/server/oidc/scope/management/v1/factories/OidcScopeManagementServiceFactory.java index 7e3ee487ff..448f25be40 100644 --- a/components/org.wso2.carbon.identity.api.server.oidc.scope.management/org.wso2.carbon.identity.api.server.oidc.scope.management.v1/src/main/java/org/wso2/carbon/identity/api/server/oidc/scope/management/v1/factories/OidcScopeManagementServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.server.oidc.scope.management/org.wso2.carbon.identity.api.server.oidc.scope.management.v1/src/main/java/org/wso2/carbon/identity/api/server/oidc/scope/management/v1/factories/OidcScopeManagementServiceFactory.java @@ -26,16 +26,14 @@ * Factory class for OidcScopeManagementService. */ public class OidcScopeManagementServiceFactory { + private static final OidcScopeManagementService SERVICE; static { - OAuthAdminServiceImpl oAuthAdminService = OIDCScopeManagementServiceHolder - .getOAuthAdminService(); - + OAuthAdminServiceImpl oAuthAdminService = OIDCScopeManagementServiceHolder.getOAuthAdminService(); if (oAuthAdminService == null) { throw new IllegalStateException("OAuthAdminServiceImpl is not available from OSGi context."); } - SERVICE = new OidcScopeManagementService(oAuthAdminService); } @@ -45,6 +43,7 @@ public class OidcScopeManagementServiceFactory { * @return OidcScopeManagementService */ public static OidcScopeManagementService getPermissionManagementService() { + return SERVICE; } } diff --git a/components/org.wso2.carbon.identity.api.server.organization.configs/org.wso2.carbon.identity.api.server.organization.configs.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/configs/v1/factories/OrganizationConfigsServiceFactory.java b/components/org.wso2.carbon.identity.api.server.organization.configs/org.wso2.carbon.identity.api.server.organization.configs.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/configs/v1/factories/OrganizationConfigsServiceFactory.java index 1721c868ce..7017122b38 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.configs/org.wso2.carbon.identity.api.server.organization.configs.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/configs/v1/factories/OrganizationConfigsServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.server.organization.configs/org.wso2.carbon.identity.api.server.organization.configs.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/configs/v1/factories/OrganizationConfigsServiceFactory.java @@ -32,11 +32,9 @@ public class OrganizationConfigsServiceFactory { static { OrganizationConfigManager organizationConfigManager = OrganizationConfigsServiceHolder .getOrganizationConfigManager(); - if (organizationConfigManager == null) { throw new IllegalStateException("OrganizationConfigManager service is not available from OSGi context."); } - SERVICE = new OrganizationConfigsService(organizationConfigManager); } diff --git a/components/org.wso2.carbon.identity.api.server.organization.role.management/org.wso2.carbon.identity.api.server.organization.role.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/role/management/common/OrganizationRoleManagementServiceHolder.java b/components/org.wso2.carbon.identity.api.server.organization.role.management/org.wso2.carbon.identity.api.server.organization.role.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/role/management/common/OrganizationRoleManagementServiceHolder.java index dea5bce306..9026803e9d 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.role.management/org.wso2.carbon.identity.api.server.organization.role.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/role/management/common/OrganizationRoleManagementServiceHolder.java +++ b/components/org.wso2.carbon.identity.api.server.organization.role.management/org.wso2.carbon.identity.api.server.organization.role.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/role/management/common/OrganizationRoleManagementServiceHolder.java @@ -30,11 +30,13 @@ public class OrganizationRoleManagementServiceHolder { private OrganizationRoleManagementServiceHolder() {} private static class RoleManagerServiceHolder { + static final RoleManager SERVICE = (RoleManager) PrivilegedCarbonContext.getThreadLocalCarbonContext() .getOSGiService(RoleManager.class, null); } private static class OrganizationUserResidentResolverServiceHolder { + static final OrganizationUserResidentResolverService SERVICE = (OrganizationUserResidentResolverService) PrivilegedCarbonContext.getThreadLocalCarbonContext() .getOSGiService(OrganizationUserResidentResolverService.class, null); diff --git a/components/org.wso2.carbon.identity.api.server.organization.user.invitation.management/org.wso2.carbon.identity.api.server.organization.user.invitation.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/invitation/management/v1/factories/GuestApiServiceCoreFactory.java b/components/org.wso2.carbon.identity.api.server.organization.user.invitation.management/org.wso2.carbon.identity.api.server.organization.user.invitation.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/invitation/management/v1/factories/GuestApiServiceCoreFactory.java index 1ccc31cac7..ab40241b66 100644 --- a/components/org.wso2.carbon.identity.api.server.organization.user.invitation.management/org.wso2.carbon.identity.api.server.organization.user.invitation.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/invitation/management/v1/factories/GuestApiServiceCoreFactory.java +++ b/components/org.wso2.carbon.identity.api.server.organization.user.invitation.management/org.wso2.carbon.identity.api.server.organization.user.invitation.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/user/invitation/management/v1/factories/GuestApiServiceCoreFactory.java @@ -31,11 +31,9 @@ public class GuestApiServiceCoreFactory { static { InvitationCoreService invitationCoreService = UserInvitationMgtServiceHolder.getInvitationCoreService(); - if (invitationCoreService == null) { throw new IllegalStateException("InvitationCoreService is not available from OSGi context."); } - SERVICE = new GuestApiServiceCore(invitationCoreService); } diff --git a/components/org.wso2.carbon.identity.api.server.permission.management/org.wso2.carbon.identity.api.server.permission.management.v1/src/main/java/org/wso2/carbon/identity/api/server/permission/management/v1/factories/PermissionManagementServiceFactory.java b/components/org.wso2.carbon.identity.api.server.permission.management/org.wso2.carbon.identity.api.server.permission.management.v1/src/main/java/org/wso2/carbon/identity/api/server/permission/management/v1/factories/PermissionManagementServiceFactory.java index 2bd3232740..0cd8075ee7 100644 --- a/components/org.wso2.carbon.identity.api.server.permission.management/org.wso2.carbon.identity.api.server.permission.management.v1/src/main/java/org/wso2/carbon/identity/api/server/permission/management/v1/factories/PermissionManagementServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.server.permission.management/org.wso2.carbon.identity.api.server.permission.management.v1/src/main/java/org/wso2/carbon/identity/api/server/permission/management/v1/factories/PermissionManagementServiceFactory.java @@ -32,11 +32,9 @@ public class PermissionManagementServiceFactory { static { RolePermissionManagementService rolePermissionManagementService = RolePermissionManagementServiceDataHolder .getRolePermissionManagementService(); - if (rolePermissionManagementService == null) { throw new IllegalStateException("RolePermissionManagementService is not available from OSGi context."); } - SERVICE = new PermissionManagementService(rolePermissionManagementService); } diff --git a/components/org.wso2.carbon.identity.api.server.script.library/org.wso2.carbon.identity.api.server.script.library.v1/src/main/java/org/wso2/carbon/identity/api/server/script/library/v1/factories/ServerScriptLibrariesServiceFactory.java b/components/org.wso2.carbon.identity.api.server.script.library/org.wso2.carbon.identity.api.server.script.library.v1/src/main/java/org/wso2/carbon/identity/api/server/script/library/v1/factories/ServerScriptLibrariesServiceFactory.java index 7fa2374244..d0afefe75e 100644 --- a/components/org.wso2.carbon.identity.api.server.script.library/org.wso2.carbon.identity.api.server.script.library.v1/src/main/java/org/wso2/carbon/identity/api/server/script/library/v1/factories/ServerScriptLibrariesServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.server.script.library/org.wso2.carbon.identity.api.server.script.library.v1/src/main/java/org/wso2/carbon/identity/api/server/script/library/v1/factories/ServerScriptLibrariesServiceFactory.java @@ -32,11 +32,9 @@ public class ServerScriptLibrariesServiceFactory { static { FunctionLibraryManagementService functionLibraryManagementService = ScriptLibraryServiceHolder .getScriptLibraryManagementService(); - if (functionLibraryManagementService == null) { throw new IllegalStateException("FunctionLibraryManagementService is not available from OSGi context."); } - SERVICE = new ServerScriptLibrariesService(functionLibraryManagementService); } diff --git a/components/org.wso2.carbon.identity.api.server.secret.management/org.wso2.carbon.identity.api.server.secret.management.v1/src/main/java/org/wso2/carbon/identity/api/server/secret/management/v1/factories/SecretManagementServiceFactory.java b/components/org.wso2.carbon.identity.api.server.secret.management/org.wso2.carbon.identity.api.server.secret.management.v1/src/main/java/org/wso2/carbon/identity/api/server/secret/management/v1/factories/SecretManagementServiceFactory.java index 0626494e9e..efcdcc4db4 100644 --- a/components/org.wso2.carbon.identity.api.server.secret.management/org.wso2.carbon.identity.api.server.secret.management.v1/src/main/java/org/wso2/carbon/identity/api/server/secret/management/v1/factories/SecretManagementServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.server.secret.management/org.wso2.carbon.identity.api.server.secret.management.v1/src/main/java/org/wso2/carbon/identity/api/server/secret/management/v1/factories/SecretManagementServiceFactory.java @@ -32,11 +32,9 @@ public class SecretManagementServiceFactory { static { SecretManager secretManager = (SecretManager) PrivilegedCarbonContext.getThreadLocalCarbonContext() .getOSGiService(SecretManager.class, null); - if (secretManager == null) { throw new IllegalStateException("SecretManager is not available from OSGi context."); } - SERVICE = new SecretManagementService(secretManager); } diff --git a/components/org.wso2.carbon.identity.api.server.secret.management/org.wso2.carbon.identity.api.server.secret.management.v1/src/main/java/org/wso2/carbon/identity/api/server/secret/management/v1/impl/SecretTypeApiServiceImpl.java b/components/org.wso2.carbon.identity.api.server.secret.management/org.wso2.carbon.identity.api.server.secret.management.v1/src/main/java/org/wso2/carbon/identity/api/server/secret/management/v1/impl/SecretTypeApiServiceImpl.java index f97b5bd57c..162f9b6d31 100644 --- a/components/org.wso2.carbon.identity.api.server.secret.management/org.wso2.carbon.identity.api.server.secret.management.v1/src/main/java/org/wso2/carbon/identity/api/server/secret/management/v1/impl/SecretTypeApiServiceImpl.java +++ b/components/org.wso2.carbon.identity.api.server.secret.management/org.wso2.carbon.identity.api.server.secret.management.v1/src/main/java/org/wso2/carbon/identity/api/server/secret/management/v1/impl/SecretTypeApiServiceImpl.java @@ -40,6 +40,7 @@ public class SecretTypeApiServiceImpl implements SecretTypeApiService { private final SecretTypeManagementService secretTypeManagementService; public SecretTypeApiServiceImpl() { + try { this.secretTypeManagementService = SecretTypeManagementServiceFactory.getSecretTypeManagementService(); } catch (IllegalStateException e) { diff --git a/components/org.wso2.carbon.identity.api.server.secret.management/org.wso2.carbon.identity.api.server.secret.management.v1/src/main/java/org/wso2/carbon/identity/api/server/secret/management/v1/impl/SecretsApiServiceImpl.java b/components/org.wso2.carbon.identity.api.server.secret.management/org.wso2.carbon.identity.api.server.secret.management.v1/src/main/java/org/wso2/carbon/identity/api/server/secret/management/v1/impl/SecretsApiServiceImpl.java index 7ff6a00e53..dbb20e3d96 100644 --- a/components/org.wso2.carbon.identity.api.server.secret.management/org.wso2.carbon.identity.api.server.secret.management.v1/src/main/java/org/wso2/carbon/identity/api/server/secret/management/v1/impl/SecretsApiServiceImpl.java +++ b/components/org.wso2.carbon.identity.api.server.secret.management/org.wso2.carbon.identity.api.server.secret.management.v1/src/main/java/org/wso2/carbon/identity/api/server/secret/management/v1/impl/SecretsApiServiceImpl.java @@ -41,6 +41,7 @@ public class SecretsApiServiceImpl implements SecretsApiService { private final SecretManagementService secretManagementService; public SecretsApiServiceImpl() { + try { this.secretManagementService = SecretManagementServiceFactory.getSecretManagementService(); } catch (IllegalStateException e) { diff --git a/components/org.wso2.carbon.identity.api.server.tenant.management/org.wso2.carbon.identity.api.server.tenant.management.v1/src/main/java/org/wso2/carbon/identity/api/server/tenant/management/v1/factories/ServerTenantManagementServiceFactory.java b/components/org.wso2.carbon.identity.api.server.tenant.management/org.wso2.carbon.identity.api.server.tenant.management.v1/src/main/java/org/wso2/carbon/identity/api/server/tenant/management/v1/factories/ServerTenantManagementServiceFactory.java index e2f26ae23f..610184c88f 100644 --- a/components/org.wso2.carbon.identity.api.server.tenant.management/org.wso2.carbon.identity.api.server.tenant.management.v1/src/main/java/org/wso2/carbon/identity/api/server/tenant/management/v1/factories/ServerTenantManagementServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.server.tenant.management/org.wso2.carbon.identity.api.server.tenant.management.v1/src/main/java/org/wso2/carbon/identity/api/server/tenant/management/v1/factories/ServerTenantManagementServiceFactory.java @@ -31,11 +31,9 @@ public class ServerTenantManagementServiceFactory { static { TenantMgtService tenantMgtService = TenantManagementServiceHolder.getTenantMgtService(); - if (tenantMgtService == null) { throw new IllegalStateException("TenantMgtService is not available from OSGi context."); } - SERVICE = new ServerTenantManagementService(tenantMgtService); }