Skip to content

Commit

Permalink
Remove Spring dependencies in Permission management API
Browse files Browse the repository at this point in the history
  • Loading branch information
NipuniBhagya committed Oct 2, 2024
1 parent a76694f commit 3c1890c
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 128 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@
<artifactId>org.wso2.carbon.user.mgt</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,24 @@
*/
package org.wso2.carbon.identity.api.server.permission.management.common;

import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.user.mgt.RolePermissionManagementService;

/**
* DataHolder class for RolePermissionManagementService.
*/
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;
}

}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,6 @@
<artifactId>cxf-rt-rs-service-description</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
Expand Down Expand Up @@ -149,22 +144,12 @@
<artifactId>jackson-jaxrs-json-provider</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.server.permission.management.common</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.server.common</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -36,8 +36,11 @@

public class PermissionManagementApi {

@Autowired
private PermissionManagementApiService delegate;
private final PermissionManagementApiService delegate;

public PermissionManagementApi() {
this.delegate = new PermissionManagementApiServiceImpl();
}

@Valid
@GET
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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() {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@
<artifactId>org.wso2.carbon.user.mgt.common</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</dependency>
</dependencies>

</project>

0 comments on commit 3c1890c

Please sign in to comment.