Skip to content

Commit

Permalink
[Spring Cleanup] Remove Spring dependencies in the Me API (#206)
Browse files Browse the repository at this point in the history
  • Loading branch information
KaveeshaPiumini authored Dec 10, 2024
1 parent ea98472 commit 8ea7115
Show file tree
Hide file tree
Showing 11 changed files with 171 additions and 237 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~ Copyright (c) 2019-2024, WSO2 LLC. (http://www.wso2.com).
~
~ WSO2 Inc. licenses this file to you under the Apache License,
~ WSO2 LLC. licenses this file to you 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
Expand All @@ -28,11 +28,6 @@
<artifactId>org.wso2.carbon.identity.api.user.application.common</artifactId>

<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.framework</groupId>
<artifactId>org.wso2.carbon.identity.application.mgt</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* Copyright (c) 2019-2024, WSO2 LLC. (http://www.wso2.com).
*
* WSO2 Inc. licenses this file to you under the Apache License,
* WSO2 LLC. licenses this file to you 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
Expand All @@ -18,6 +18,7 @@

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

import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.identity.application.mgt.DiscoverableApplicationManager;
import org.wso2.carbon.identity.organization.management.application.OrgApplicationManager;

Expand All @@ -26,28 +27,30 @@
*/
public class ApplicationServiceHolder {

private static OrgApplicationManager orgApplicationManager;
private static DiscoverableApplicationManager discoverableApplicationManager;
private ApplicationServiceHolder () {}

/**
* Get application management service.
*
* @return ApplicationManagementService
*/
public static DiscoverableApplicationManager getDiscoverableApplicationManager() {
private static class OrgApplicationManagerServiceHolder {

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

private static class DiscoverableApplicationManagerServiceHolder {

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

/**
* Set application management service.
* Get application management service.
*
* @param discoverableApplicationManager
* @return ApplicationManagementService
*/
public static void setDiscoverableApplicationManager(DiscoverableApplicationManager
discoverableApplicationManager) {
public static DiscoverableApplicationManager getDiscoverableApplicationManager() {

ApplicationServiceHolder.discoverableApplicationManager = discoverableApplicationManager;
return DiscoverableApplicationManagerServiceHolder.SERVICE;
}

/**
Expand All @@ -57,16 +60,7 @@ public static void setDiscoverableApplicationManager(DiscoverableApplicationMana
*/
public static OrgApplicationManager getOrgApplicationManager() {

return orgApplicationManager;
return OrgApplicationManagerServiceHolder.SERVICE;
}

/**
* Set organization application management service.
*
* @param orgApplicationManager
*/
public static void setOrgApplicationManager(OrgApplicationManager orgApplicationManager) {

ApplicationServiceHolder.orgApplicationManager = orgApplicationManager;
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~ Copyright (c) 2019-2024, WSO2 LLC. (http://www.wso2.com).
~
~ WSO2 Inc. licenses this file to you under the Apache License,
~ WSO2 LLC. licenses this file to you 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
Expand Down Expand Up @@ -110,11 +110,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,26 +1,27 @@
/*
* 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.
*/
* Copyright (c) 2019-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
* 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.rest.api.user.application.v1;

import org.springframework.beans.factory.annotation.Autowired;
import org.wso2.carbon.identity.rest.api.user.application.v1.factories.MeApiServiceFactory;
import org.wso2.carbon.identity.rest.api.user.application.v1.model.ApplicationListResponse;
import org.wso2.carbon.identity.rest.api.user.application.v1.model.ApplicationResponse;
import org.wso2.carbon.identity.rest.api.user.application.v1.model.Error;
import org.wso2.carbon.identity.rest.api.user.application.v1.MeApiService;

import javax.validation.Valid;
import javax.ws.rs.*;
Expand All @@ -34,8 +35,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,30 +1,40 @@
/*
* 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.
*/
* Copyright (c) 2019-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
* 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.rest.api.user.application.v1.factories;

import org.wso2.carbon.identity.rest.api.user.application.v1.MeApiService;
import org.wso2.carbon.identity.rest.api.user.application.v1.impl.MeApiServiceImpl;

/**
* Factory class for MeApiService.
*/
public class MeApiServiceFactory {

private final static MeApiService service = new MeApiServiceImpl();
private final static MeApiService SERVICE = new MeApiServiceImpl();

/**
* Get MeApiService
*
* @return MeApiService
*/
public static MeApiService getMeApi()
{
return service;
return SERVICE;
}
}
Loading

0 comments on commit 8ea7115

Please sign in to comment.