Skip to content

Commit

Permalink
Remove Spring dependencies in API resource management API
Browse files Browse the repository at this point in the history
  • Loading branch information
NipuniBhagya committed Oct 7, 2024
1 parent a76694f commit a936809
Show file tree
Hide file tree
Showing 20 changed files with 220 additions and 312 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@
</build>

<dependencies>
<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,6 +18,7 @@

package org.wso2.carbon.identity.api.server.api.resource.common;

import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.identity.api.resource.collection.mgt.APIResourceCollectionManager;
import org.wso2.carbon.identity.api.resource.mgt.APIResourceManager;
import org.wso2.carbon.identity.oauth.OAuthAdminServiceImpl;
Expand All @@ -27,67 +28,56 @@
*/
public class APIResourceManagementServiceHolder {

private static APIResourceManager apiResourceManager;
private static APIResourceCollectionManager apiResourceCollectionManager;
private static OAuthAdminServiceImpl oAuthAdminServiceImpl;
private APIResourceManagementServiceHolder() {}

/**
* Get APIResourceManager osgi service.
*
* @return APIResourceManager.
*/
public static APIResourceManager getApiResourceManager() {
private static class APIResourceManagerHolder {

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

/**
* Set APIResourceManager osgi service.
*
* @param apiResourceManager APIResourceManager.
*/
public static void setApiResourceManager(APIResourceManager apiResourceManager) {
private static class APIResourceCollectionManagerHolder {

APIResourceManagementServiceHolder.apiResourceManager = apiResourceManager;
static final APIResourceCollectionManager SERVICE = (APIResourceCollectionManager) PrivilegedCarbonContext
.getThreadLocalCarbonContext()
.getOSGiService(APIResourceCollectionManager.class, null);
}

/**
* Get APIResourceCollectionManager osgi service.
*
* @return APIResourceCollectionManager.
*/
public static APIResourceCollectionManager getApiResourceCollectionManager() {
private static class OAuthAdminServiceImplHolder {

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

/**
* Set APIResourceCollectionManager osgi service.
* Get APIResourceManager osgi service.
*
* @param apiResourceCollectionManager APIResourceCollectionManager.
* @return APIResourceManager.
*/
public static void setApiResourceCollectionManager(APIResourceCollectionManager apiResourceCollectionManager) {
public static APIResourceManager getApiResourceManager() {

APIResourceManagementServiceHolder.apiResourceCollectionManager = apiResourceCollectionManager;
return APIResourceManagerHolder.SERVICE;
}

/**
* Get OAuthAdminServiceImpl instance.
* Get APIResourceCollectionManager osgi service.
*
* @return OAuthAdminServiceImpl instance.
* @return APIResourceCollectionManager.
*/
public static OAuthAdminServiceImpl getOAuthAdminServiceImpl() {
public static APIResourceCollectionManager getApiResourceCollectionManager() {

return oAuthAdminServiceImpl;
return APIResourceCollectionManagerHolder.SERVICE;
}

/**
* Set OAuthAdminServiceImpl instance.
* Get OAuthAdminServiceImpl instance.
*
* @param oAuthAdminServiceImpl OAuthAdminServiceImpl instance.
* @return OAuthAdminServiceImpl instance.
*/
public static void setOAuthAdminServiceImpl(OAuthAdminServiceImpl oAuthAdminServiceImpl) {
public static OAuthAdminServiceImpl getOAuthAdminServiceImpl() {

APIResourceManagementServiceHolder.oAuthAdminServiceImpl = oAuthAdminServiceImpl;
return OAuthAdminServiceImplHolder.SERVICE;
}
}

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,6 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</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,7 +18,6 @@

package org.wso2.carbon.identity.api.server.api.resource.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;
Expand All @@ -38,6 +37,7 @@
import javax.ws.rs.*;
import javax.ws.rs.core.Response;
import io.swagger.annotations.*;
import org.wso2.carbon.identity.api.server.api.resource.v1.factories.ApiResourcesApiServiceFactory;

import javax.validation.constraints.*;

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

public class ApiResourcesApi {

@Autowired
private ApiResourcesApiService delegate;
private final ApiResourcesApiService delegate;

public ApiResourcesApi() {
this.delegate = ApiResourcesApiServiceFactory.getApiResourcesApi();
}

@Valid
@POST
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 @@ -24,7 +24,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.api.resource.v1.factories.MetaApiServiceFactory;

import javax.validation.Valid;
import javax.ws.rs.GET;
Expand All @@ -39,8 +39,11 @@

public class MetaApi {

@Autowired
private MetaApiService delegate;
private final MetaApiService delegate;

public MetaApi() {
this.delegate = MetaApiServiceFactory.getMetaApi();
}

@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,7 +18,6 @@

package org.wso2.carbon.identity.api.server.api.resource.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;
Expand All @@ -32,6 +31,7 @@
import javax.ws.rs.*;
import javax.ws.rs.core.Response;
import io.swagger.annotations.*;
import org.wso2.carbon.identity.api.server.api.resource.v1.factories.ScopesApiServiceFactory;

import javax.validation.constraints.*;

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

public class ScopesApi {

@Autowired
private ScopesApiService delegate;
private final ScopesApiService delegate;

public ScopesApi() {
this.delegate = ScopesApiServiceFactory.getScopesApi();
}

@Valid
@GET
Expand Down
Loading

0 comments on commit a936809

Please sign in to comment.