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 functionality API #218

Open
wants to merge 6 commits 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,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~ Copyright (c) 2020-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.functionality.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.user.functionality.mgt</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* Copyright (c) 2020-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.functionality.common;

import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.identity.user.functionality.mgt.UserFunctionalityManager;
import org.wso2.carbon.user.core.service.RealmService;

Expand All @@ -26,8 +27,21 @@
*/
public class UserFunctionalityServiceHolder {

private static UserFunctionalityManager userFunctionalityManager;
private static RealmService realmService;
private UserFunctionalityServiceHolder() {

}

private static class UserFunctionalityManagerServiceHolder {

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

private static class RealmServiceHolder {

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

/**
* Get UserFunctionalityManager osgi service.
Expand All @@ -36,26 +50,16 @@ public class UserFunctionalityServiceHolder {
*/
public static UserFunctionalityManager getuserFunctionalityManager() {

return userFunctionalityManager;
return UserFunctionalityManagerServiceHolder.SERVICE;
}

/**
* Set UserFunctionalityManager osgi service.
* Get RealmService osgi service.
*
* @param userFunctionalityManager UserFunctionalityManager
* @return RealmService
*/
public static void setUserFunctionalityManager(UserFunctionalityManager userFunctionalityManager) {

UserFunctionalityServiceHolder.userFunctionalityManager = userFunctionalityManager;
}

public static RealmService getRealmService() {

return realmService;
}

public static void setRealmService(RealmService realmService) {

UserFunctionalityServiceHolder.realmService = realmService;
return RealmServiceHolder.SERVICE;
}
}

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) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~ Copyright (c) 2020-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 @@ -40,11 +40,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,31 +1,32 @@
/*
* Copyright (c) 2020, 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) 2020-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.functionality.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.functionality.v1.factories.MeApiServiceFactory;
import org.wso2.carbon.identity.rest.api.user.functionality.v1.model.Error;
import org.wso2.carbon.identity.rest.api.user.functionality.v1.model.LockStatusResponse;
import org.wso2.carbon.identity.rest.api.user.functionality.v1.model.UserStatusChangeRequest;
import org.wso2.carbon.identity.rest.api.user.functionality.v1.MeApiService;

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

public class MeApi {

@Autowired
private MeApiService delegate;
private final MeApiService delegate;

public MeApi() {

this.delegate = MeApiServiceFactory.getMeApi();
}

@Valid
@PUT
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* Copyright (c) 2020-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,8 +18,7 @@

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

import org.springframework.beans.factory.annotation.Autowired;

import org.wso2.carbon.identity.rest.api.user.functionality.v1.factories.UserIdApiServiceFactory;
import org.wso2.carbon.identity.rest.api.user.functionality.v1.model.Error;
import org.wso2.carbon.identity.rest.api.user.functionality.v1.model.LockStatusResponse;
import org.wso2.carbon.identity.rest.api.user.functionality.v1.model.StatusChangeRequest;
Expand All @@ -34,8 +33,12 @@

public class UserIdApi {

@Autowired
private UserIdApiService delegate;
private final UserIdApiService delegate;

public UserIdApi() {

this.delegate = UserIdApiServiceFactory.getUserIdApi();
}

@Valid
@PUT
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,40 @@
/*
* Copyright (c) 2020, 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) 2020-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.functionality.v1.factories;

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

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

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

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

return SERVICE;
}
}
Loading