Skip to content

Commit

Permalink
[Spring Cleanup] Remove Spring dependencies in the User Organization …
Browse files Browse the repository at this point in the history
…Management API (#208)
  • Loading branch information
KaveeshaPiumini authored Dec 10, 2024
1 parent 8ea7115 commit dbf71b2
Show file tree
Hide file tree
Showing 15 changed files with 153 additions and 281 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2023, WSO2 LLC. (http://www.wso2.com).
~ Copyright (c) 2023-2024, WSO2 LLC. (http://www.wso2.com).
~
~ WSO2 LLC. licenses this file to you under the Apache License,
~ Version 2.0 (the "License"); you may not use this file except
Expand Down Expand Up @@ -29,11 +29,6 @@
<artifactId>org.wso2.carbon.identity.api.user.organization.common</artifactId>

<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023, WSO2 LLC. (http://www.wso2.com).
* Copyright (c) 2023-2024, WSO2 LLC. (http://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
Expand All @@ -18,6 +18,7 @@

package org.wso2.carbon.identity.api.user.organization.common;

import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.identity.application.mgt.ApplicationManagementService;
import org.wso2.carbon.identity.organization.management.service.OrganizationManager;
import org.wso2.carbon.identity.organization.management.service.OrganizationUserResidentResolverService;
Expand All @@ -27,51 +28,47 @@
*/
public class UserOrganizationServiceHolder {

private static OrganizationUserResidentResolverService organizationUserResidentResolverService;
private UserOrganizationServiceHolder () {}

private static OrganizationManager organizationManagementService;
private static ApplicationManagementService applicationManagementService;
private static class OrganizationUserResidentResolverServiceHolder {

/**
* Method to get the organization user resident resolver OSGi service.
*
* @return OrganizationUserResidentResolverService.
*/
public static OrganizationUserResidentResolverService getOrganizationUserResidentResolverService() {
static final OrganizationUserResidentResolverService SERVICE = (OrganizationUserResidentResolverService)
PrivilegedCarbonContext.getThreadLocalCarbonContext()
.getOSGiService(OrganizationUserResidentResolverService.class, null);
}

return organizationUserResidentResolverService;
private static class OrganizationManagementServiceHolder {

static final OrganizationManager SERVICE = (OrganizationManager)
PrivilegedCarbonContext.getThreadLocalCarbonContext()
.getOSGiService(OrganizationManager.class, null);
}

/**
* Set OrganizationUserResidentResolverService OSGi service.
*
* @param organizationUserResidentResolverService OrganizationUserResidentResolverService.
*/
public static void setOrganizationUserResidentResolverService(
OrganizationUserResidentResolverService organizationUserResidentResolverService) {
private static class ApplicationManagementServiceHolder {

UserOrganizationServiceHolder.organizationUserResidentResolverService = organizationUserResidentResolverService;
static final ApplicationManagementService SERVICE = (ApplicationManagementService)
PrivilegedCarbonContext.getThreadLocalCarbonContext()
.getOSGiService(ApplicationManagementService.class, null);
}

/**
* Get organization management service.
* Method to get the organization user resident resolver OSGi service.
*
* @return Organization management service.
* @return OrganizationUserResidentResolverService.
*/
public static OrganizationManager getOrganizationManagementService() {
public static OrganizationUserResidentResolverService getOrganizationUserResidentResolverService() {

return organizationManagementService;
return OrganizationUserResidentResolverServiceHolder.SERVICE;
}

/**
* Set Organization management OSGi service.
* Get organization management service.
*
* @param organizationManagementService Organization management service.
* @return Organization management service.
*/
public static void setOrganizationManagementService(
OrganizationManager organizationManagementService) {
public static OrganizationManager getOrganizationManagementService() {

UserOrganizationServiceHolder.organizationManagementService = organizationManagementService;
return OrganizationManagementServiceHolder.SERVICE;
}

/**
Expand All @@ -81,17 +78,7 @@ public static void setOrganizationManagementService(
*/
public static ApplicationManagementService getApplicationManagementService() {

return applicationManagementService;
return ApplicationManagementServiceHolder.SERVICE;
}

/**
* Set application management OSGi service.
*
* @param applicationManagementService Application management service.
*/
public static void setApplicationManagementService(
ApplicationManagementService applicationManagementService) {

UserOrganizationServiceHolder.applicationManagementService = applicationManagementService;
}
}

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2023, WSO2 LLC. (http://www.wso2.com).
~ Copyright (c) 2023-2024, WSO2 LLC. (http://www.wso2.com).
~
~ WSO2 LLC. licenses this file to you under the Apache License,
~ Version 2.0 (the "License"); you may not use this file except
Expand Down Expand Up @@ -41,11 +41,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
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023, WSO2 LLC. (http://www.wso2.com).
* Copyright (c) 2023-2024, WSO2 LLC. (http://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
Expand All @@ -18,15 +18,14 @@

package org.wso2.carbon.identity.rest.api.user.organization.v1;

import org.springframework.beans.factory.annotation.Autowired;
import org.apache.cxf.jaxrs.ext.multipart.Attachment;
import org.apache.cxf.jaxrs.ext.multipart.Multipart;
import java.io.InputStream;
import java.util.List;

import org.wso2.carbon.identity.rest.api.user.organization.v1.factories.MeApiServiceFactory;
import org.wso2.carbon.identity.rest.api.user.organization.v1.model.Error;
import org.wso2.carbon.identity.rest.api.user.organization.v1.model.OrganizationsResponse;
import org.wso2.carbon.identity.rest.api.user.organization.v1.MeApiService;

import javax.validation.Valid;
import javax.ws.rs.*;
Expand All @@ -40,8 +39,12 @@

public class MeApi {

@Autowired
private MeApiService delegate;
private final MeApiService delegate;

public MeApi () {

this.delegate = MeApiServiceFactory.getMeApi();
}

@Valid
@GET
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023, WSO2 LLC. (http://www.wso2.com).
* Copyright (c) 2023-2024, WSO2 LLC. (http://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
Expand All @@ -18,16 +18,15 @@

package org.wso2.carbon.identity.rest.api.user.organization.v1;

import org.springframework.beans.factory.annotation.Autowired;
import org.apache.cxf.jaxrs.ext.multipart.Attachment;
import org.apache.cxf.jaxrs.ext.multipart.Multipart;
import java.io.InputStream;
import java.util.List;

import org.wso2.carbon.identity.rest.api.user.organization.v1.factories.RootApiServiceFactory;
import org.wso2.carbon.identity.rest.api.user.organization.v1.model.BasicOrganizationObject;
import org.wso2.carbon.identity.rest.api.user.organization.v1.model.Error;
import org.wso2.carbon.identity.rest.api.user.organization.v1.model.RootOrganizationResponse;
import org.wso2.carbon.identity.rest.api.user.organization.v1.RootApiService;

import javax.validation.Valid;
import javax.ws.rs.*;
Expand All @@ -41,8 +40,12 @@

public class RootApi {

@Autowired
private RootApiService delegate;
private final RootApiService delegate;

public RootApi() {

this.delegate = RootApiServiceFactory.getRootApi();
}

@Valid
@GET
Expand Down
Loading

0 comments on commit dbf71b2

Please sign in to comment.