Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Spring Cleanup] Remove Spring dependencies in user organization API #222

Open
wants to merge 1 commit into
base: feature-spring-cleanup
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,71 +28,56 @@
*/
public class UserOrganizationServiceHolder {

private static OrganizationUserResidentResolverService organizationUserResidentResolverService;
private UserOrganizationServiceHolder() {

private static OrganizationManager organizationManagementService;
private static ApplicationManagementService applicationManagementService;
}

/**
* Method to get the organization user resident resolver OSGi service.
*
* @return OrganizationUserResidentResolverService.
*/
public static OrganizationUserResidentResolverService getOrganizationUserResidentResolverService() {
private static class OrganizationUserResidentResolverServiceHolder {

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

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

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

/**
* Get organization management service.
*
* @return Organization management service.
*/
public static OrganizationManager getOrganizationManagementService() {
private static class ApplicationManagementServiceHolder {

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

/**
* Set Organization management OSGi service.
* Method to get the organization user resident resolver OSGi service.
*
* @param organizationManagementService Organization management service.
* @return OrganizationUserResidentResolverService.
*/
public static void setOrganizationManagementService(
OrganizationManager organizationManagementService) {
public static OrganizationUserResidentResolverService getOrganizationUserResidentResolverService() {

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

/**
* Get application management service.
* Get organization management service.
*
* @return Application management service.
* @return Organization management service.
*/
public static ApplicationManagementService getApplicationManagementService() {
public static OrganizationManager getOrganizationManagementService() {

return applicationManagementService;
return OrganizationManagerHolder.SERVICE;
}

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

UserOrganizationServiceHolder.applicationManagementService = applicationManagementService;
return ApplicationManagementServiceHolder.SERVICE;
}
}

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.getMeApiService();
}

@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