Skip to content

Commit

Permalink
[Spring Cleanup] Remove Spring dependencies in the script library (#812)
Browse files Browse the repository at this point in the history
  • Loading branch information
lashinijay authored Jan 25, 2025
1 parent 9700372 commit b7de3f4
Show file tree
Hide file tree
Showing 10 changed files with 168 additions and 178 deletions.
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-2025, 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 @@ -29,11 +29,6 @@
<packaging>jar</packaging>

<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.inbound.auth.oauth2</groupId>
<artifactId>org.wso2.carbon.identity.oauth</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,41 @@
/*
* Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* Copyright (c) 2020-2025, WSO2 LLC. (http://www.wso2.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the 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
*
* 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.
* 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.api.server.script.library.common;

import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.identity.functions.library.mgt.FunctionLibraryManagementService;

/**
* Service holder class for script library management.
*/
public class ScriptLibraryServiceHolder {

private static FunctionLibraryManagementService scriptLibaryManagementService;
private ScriptLibraryServiceHolder() {

}

private static class FunctionLibraryManagementServiceHolder {

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

/**
* Get FunctionLibraryManagementService osgi service.
Expand All @@ -32,12 +44,6 @@ public class ScriptLibraryServiceHolder {
*/
public static FunctionLibraryManagementService getScriptLibraryManagementService() {

return scriptLibaryManagementService;
}

public static void setScriptLibraryManagementService(
FunctionLibraryManagementService scriptLibraryManagementService) {

ScriptLibraryServiceHolder.scriptLibaryManagementService = scriptLibraryManagementService;
return FunctionLibraryManagementServiceHolder.SERVICE;
}
}

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-2025, 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 @@ -74,11 +74,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,34 +1,35 @@
/*
* Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* Copyright (c) 2019-2025, WSO2 LLC. (http://www.wso2.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the 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
*
* 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.
* 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.api.server.script.library.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 org.wso2.carbon.identity.api.server.script.library.v1.factories.ScriptLibrariesApiServiceFactory;
import org.wso2.carbon.identity.api.server.script.library.v1.model.Error;

import java.io.File;

import org.wso2.carbon.identity.api.server.script.library.v1.model.ScriptLibraryListResponse;
import org.wso2.carbon.identity.api.server.script.library.v1.model.ScriptLibraryResponse;
import org.wso2.carbon.identity.api.server.script.library.v1.ScriptLibrariesApiService;

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

public class ScriptLibrariesApi {

@Autowired
private ScriptLibrariesApiService delegate;
private final ScriptLibrariesApiService delegate;

public ScriptLibrariesApi() {

this.delegate = ScriptLibrariesApiServiceFactory.getScriptLibrariesApi();
}

@Valid
@POST
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-2025, 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.api.server.script.library.v1.factories;

import org.wso2.carbon.identity.api.server.script.library.v1.ScriptLibrariesApiService;
import org.wso2.carbon.identity.api.server.script.library.v1.impl.ScriptLibrariesApiServiceImpl;

/**
* Factory class for Script Libraries API.
*/
public class ScriptLibrariesApiServiceFactory {

private final static ScriptLibrariesApiService service = new ScriptLibrariesApiServiceImpl();
private static final ScriptLibrariesApiService SERVICE = new ScriptLibrariesApiServiceImpl();

public static ScriptLibrariesApiService getScriptLibrariesApi()
{
return service;
/**
* Get Script Libraries API service.
*
* @return Script Libraries API service.
*/
public static ScriptLibrariesApiService getScriptLibrariesApi() {

return SERVICE;
}
}
Loading

0 comments on commit b7de3f4

Please sign in to comment.