diff --git a/components/org.wso2.carbon.identity.api.server.permission.management/org.wso2.carbon.identity.api.server.permission.management.common/pom.xml b/components/org.wso2.carbon.identity.api.server.permission.management/org.wso2.carbon.identity.api.server.permission.management.common/pom.xml index 42a8c273d3..2a7175f487 100644 --- a/components/org.wso2.carbon.identity.api.server.permission.management/org.wso2.carbon.identity.api.server.permission.management.common/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.permission.management/org.wso2.carbon.identity.api.server.permission.management.common/pom.xml @@ -50,11 +50,6 @@ org.wso2.carbon.user.mgt provided - - org.springframework - spring-context - provided - diff --git a/components/org.wso2.carbon.identity.api.server.permission.management/org.wso2.carbon.identity.api.server.permission.management.common/src/main/java/org/wso2/carbon/identity/api/server/permission/management/common/RolePermissionManagementServiceDataHolder.java b/components/org.wso2.carbon.identity.api.server.permission.management/org.wso2.carbon.identity.api.server.permission.management.common/src/main/java/org/wso2/carbon/identity/api/server/permission/management/common/RolePermissionManagementServiceDataHolder.java index c7d67f7bfb..6b134c8fe9 100644 --- a/components/org.wso2.carbon.identity.api.server.permission.management/org.wso2.carbon.identity.api.server.permission.management.common/src/main/java/org/wso2/carbon/identity/api/server/permission/management/common/RolePermissionManagementServiceDataHolder.java +++ b/components/org.wso2.carbon.identity.api.server.permission.management/org.wso2.carbon.identity.api.server.permission.management.common/src/main/java/org/wso2/carbon/identity/api/server/permission/management/common/RolePermissionManagementServiceDataHolder.java @@ -15,6 +15,7 @@ */ package org.wso2.carbon.identity.api.server.permission.management.common; +import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.user.mgt.RolePermissionManagementService; /** @@ -22,26 +23,16 @@ */ public class RolePermissionManagementServiceDataHolder { - private static RolePermissionManagementService rolePermissionManagementService; + private RolePermissionManagementServiceDataHolder() {} - /** - * Get Role Permission Management Service. - * - * @return RolePermissionManagementService. - */ - public static RolePermissionManagementService getRolePermissionManagementService() { - return rolePermissionManagementService; + private static class ServiceHolder { + static final RolePermissionManagementService INSTANCE = + (RolePermissionManagementService) PrivilegedCarbonContext + .getThreadLocalCarbonContext() + .getOSGiService(RolePermissionManagementService.class, null); } - /** - * Set RolePermissionManagementService. - * - * @param rolePermissionManagementService RolePermissionManagementService. - */ - public static void setRolePermissionManagementService(RolePermissionManagementService - rolePermissionManagementService) { - RolePermissionManagementServiceDataHolder.rolePermissionManagementService = - rolePermissionManagementService; + public static RolePermissionManagementService getRolePermissionManagementService() { + return ServiceHolder.INSTANCE; } - } diff --git a/components/org.wso2.carbon.identity.api.server.permission.management/org.wso2.carbon.identity.api.server.permission.management.common/src/main/java/org/wso2/carbon/identity/api/server/permission/management/common/RolePermissionManagementServiceFactory.java b/components/org.wso2.carbon.identity.api.server.permission.management/org.wso2.carbon.identity.api.server.permission.management.common/src/main/java/org/wso2/carbon/identity/api/server/permission/management/common/RolePermissionManagementServiceFactory.java deleted file mode 100644 index 78c2b4c99e..0000000000 --- a/components/org.wso2.carbon.identity.api.server.permission.management/org.wso2.carbon.identity.api.server.permission.management.common/src/main/java/org/wso2/carbon/identity/api/server/permission/management/common/RolePermissionManagementServiceFactory.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.wso2.carbon.identity.api.server.permission.management.common; - -import org.springframework.beans.factory.config.AbstractFactoryBean; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.user.mgt.RolePermissionManagementService; - -/** - * RolePermissionManagementService Factory class. - */ -public class RolePermissionManagementServiceFactory extends AbstractFactoryBean { - - private RolePermissionManagementService rolePermissionManagementService; - - @Override - public Class getObjectType() { - - return RolePermissionManagementService.class; - } - - @Override - protected RolePermissionManagementService createInstance() throws Exception { - - if (this.rolePermissionManagementService != null) { - return this.rolePermissionManagementService; - } else { - RolePermissionManagementService rolePermissionManagementService = (RolePermissionManagementService) - PrivilegedCarbonContext.getThreadLocalCarbonContext() - .getOSGiService(RolePermissionManagementService.class, null); - if (rolePermissionManagementService != null) { - this.rolePermissionManagementService = rolePermissionManagementService; - } else { - throw new Exception("Unable to get the RolePermissionManagementServiceImpl"); - } - return rolePermissionManagementService; - } - } -} diff --git a/components/org.wso2.carbon.identity.api.server.permission.management/org.wso2.carbon.identity.api.server.permission.management.v1/pom.xml b/components/org.wso2.carbon.identity.api.server.permission.management/org.wso2.carbon.identity.api.server.permission.management.v1/pom.xml index c397fdf8da..b4a85e65e5 100644 --- a/components/org.wso2.carbon.identity.api.server.permission.management/org.wso2.carbon.identity.api.server.permission.management.v1/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.permission.management/org.wso2.carbon.identity.api.server.permission.management.v1/pom.xml @@ -104,11 +104,6 @@ cxf-rt-rs-service-description provided - - org.springframework - spring-web - provided - javax.ws.rs javax.ws.rs-api @@ -149,22 +144,12 @@ jackson-jaxrs-json-provider provided - - org.springframework - spring-context - provided - org.wso2.carbon.identity.server.api org.wso2.carbon.identity.api.server.permission.management.common ${project.version} provided - - org.springframework - spring-beans - provided - org.wso2.carbon.identity.server.api org.wso2.carbon.identity.api.server.common diff --git a/components/org.wso2.carbon.identity.api.server.permission.management/org.wso2.carbon.identity.api.server.permission.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/permission/management/v1/PermissionManagementApi.java b/components/org.wso2.carbon.identity.api.server.permission.management/org.wso2.carbon.identity.api.server.permission.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/permission/management/v1/PermissionManagementApi.java index 731e3de1f5..bef80492c6 100644 --- a/components/org.wso2.carbon.identity.api.server.permission.management/org.wso2.carbon.identity.api.server.permission.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/permission/management/v1/PermissionManagementApi.java +++ b/components/org.wso2.carbon.identity.api.server.permission.management/org.wso2.carbon.identity.api.server.permission.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/permission/management/v1/PermissionManagementApi.java @@ -21,7 +21,7 @@ import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import io.swagger.annotations.Authorization; -import org.springframework.beans.factory.annotation.Autowired; +import org.wso2.carbon.identity.api.server.permission.management.v1.impl.PermissionManagementApiServiceImpl; import org.wso2.carbon.identity.api.server.permission.management.v1.model.Error; import org.wso2.carbon.identity.api.server.permission.management.v1.model.Permission; @@ -36,8 +36,11 @@ public class PermissionManagementApi { - @Autowired - private PermissionManagementApiService delegate; + private final PermissionManagementApiService delegate; + + public PermissionManagementApi() { + this.delegate = new PermissionManagementApiServiceImpl(); + } @Valid @GET 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/impl/PermissionManagementApiServiceImpl.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/impl/PermissionManagementApiServiceImpl.java index 4a27b38c44..6f0937ad2e 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/impl/PermissionManagementApiServiceImpl.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/impl/PermissionManagementApiServiceImpl.java @@ -16,7 +16,6 @@ package org.wso2.carbon.identity.api.server.permission.management.v1.impl; -import org.springframework.beans.factory.annotation.Autowired; import org.wso2.carbon.identity.api.server.permission.management.v1.PermissionManagementApiService; import org.wso2.carbon.identity.api.server.permission.management.v1.core.PermissionManagementService; @@ -27,8 +26,11 @@ */ public class PermissionManagementApiServiceImpl implements PermissionManagementApiService { - @Autowired - private PermissionManagementService permissionManagementService; + private final PermissionManagementService permissionManagementService; + + public PermissionManagementApiServiceImpl() { + this.permissionManagementService = new PermissionManagementService(); + } @Override public Response permissionManagementPermissionsGet() { diff --git a/components/org.wso2.carbon.identity.api.server.permission.management/org.wso2.carbon.identity.api.server.permission.management.v1/src/main/resources/META-INF/cxf/permission-management-v1-cxf.xml b/components/org.wso2.carbon.identity.api.server.permission.management/org.wso2.carbon.identity.api.server.permission.management.v1/src/main/resources/META-INF/cxf/permission-management-v1-cxf.xml deleted file mode 100644 index 93f9a7c76f..0000000000 --- a/components/org.wso2.carbon.identity.api.server.permission.management/org.wso2.carbon.identity.api.server.permission.management.v1/src/main/resources/META-INF/cxf/permission-management-v1-cxf.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - diff --git a/components/org.wso2.carbon.identity.api.server.permission.management/pom.xml b/components/org.wso2.carbon.identity.api.server.permission.management/pom.xml index 99366cfc36..e60bd3c8dc 100644 --- a/components/org.wso2.carbon.identity.api.server.permission.management/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.permission.management/pom.xml @@ -44,10 +44,6 @@ org.wso2.carbon.user.mgt.common provided - - org.springframework - spring-beans -