From 948fe0b9654f37b7ae5e8de4e6975dd9ac2169fc Mon Sep 17 00:00:00 2001 From: Nipuni Paaris Date: Mon, 9 Dec 2024 15:47:44 +0530 Subject: [PATCH] [Spring Cleanup] Remove Spring dependencies in action management API (#684) * Remove Spring dependencies in action management API * Resolve PR comments --- .../pom.xml | 5 -- .../common/ActionManagementServiceHolder.java | 20 +++---- .../factory/ActionMgtOSGiServiceFactory.java | 50 ---------------- .../pom.xml | 5 -- .../action/management/v1/ActionsApi.java | 26 +++----- .../factories/ActionsApiServiceFactory.java | 12 +++- .../core/ServerActionManagementService.java | 60 +++++++++---------- .../ActionManagementServiceFactory.java | 51 ++++++++++++++++ .../v1/impl/ActionsApiServiceImpl.java | 13 +++- .../META-INF/cxf/action-server-v1-cxf.xml | 33 ---------- 10 files changed, 116 insertions(+), 159 deletions(-) delete mode 100644 components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.common/src/main/java/org/wso2/carbon/identity/api/server/action/management/common/factory/ActionMgtOSGiServiceFactory.java create mode 100644 components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.v1/src/main/java/org/wso2/carbon/identity/api/server/action/management/v1/factories/ActionManagementServiceFactory.java delete mode 100644 components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.v1/src/main/resources/META-INF/cxf/action-server-v1-cxf.xml diff --git a/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.common/pom.xml b/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.common/pom.xml index e5faec6c98..f2c521d7e3 100644 --- a/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.common/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.common/pom.xml @@ -44,11 +44,6 @@ - - org.springframework - spring-web - provided - javax.ws.rs javax.ws.rs-api diff --git a/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.common/src/main/java/org/wso2/carbon/identity/api/server/action/management/common/ActionManagementServiceHolder.java b/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.common/src/main/java/org/wso2/carbon/identity/api/server/action/management/common/ActionManagementServiceHolder.java index f5cb787494..b4aae85db1 100644 --- a/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.common/src/main/java/org/wso2/carbon/identity/api/server/action/management/common/ActionManagementServiceHolder.java +++ b/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.common/src/main/java/org/wso2/carbon/identity/api/server/action/management/common/ActionManagementServiceHolder.java @@ -18,6 +18,7 @@ package org.wso2.carbon.identity.api.server.action.management.common; +import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.identity.action.management.ActionManagementService; /** @@ -25,7 +26,12 @@ */ public class ActionManagementServiceHolder { - private static ActionManagementService actionManagementService; + private ActionManagementServiceHolder() {} + + private static class ActionServiceHolder { + static final ActionManagementService SERVICE = (ActionManagementService) PrivilegedCarbonContext + .getThreadLocalCarbonContext().getOSGiService(ActionManagementService.class, null); + } /** * Get ActionManagementService osgi service. @@ -34,16 +40,6 @@ public class ActionManagementServiceHolder { */ public static ActionManagementService getActionManagementService() { - return actionManagementService; - } - - /** - * Set ActionManagementService osgi service. - * - * @param actionManagementService ActionManagementService. - */ - public static void setActionManagementService(ActionManagementService actionManagementService) { - - ActionManagementServiceHolder.actionManagementService = actionManagementService; + return ActionServiceHolder.SERVICE; } } diff --git a/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.common/src/main/java/org/wso2/carbon/identity/api/server/action/management/common/factory/ActionMgtOSGiServiceFactory.java b/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.common/src/main/java/org/wso2/carbon/identity/api/server/action/management/common/factory/ActionMgtOSGiServiceFactory.java deleted file mode 100644 index 3cd4a9a4f3..0000000000 --- a/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.common/src/main/java/org/wso2/carbon/identity/api/server/action/management/common/factory/ActionMgtOSGiServiceFactory.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 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.api.server.action.management.common.factory; - -import org.springframework.beans.factory.config.AbstractFactoryBean; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.identity.action.management.ActionManagementService; - -/** - * Factory class for ActionManagementOSGiService. - */ -public class ActionMgtOSGiServiceFactory extends AbstractFactoryBean { - - private ActionManagementService actionManagementService; - - @Override - public Class getObjectType() { - - return Object.class; - } - - @Override - protected ActionManagementService createInstance() throws Exception { - - if (this.actionManagementService == null) { - actionManagementService = (ActionManagementService) PrivilegedCarbonContext. - getThreadLocalCarbonContext().getOSGiService(ActionManagementService.class, null); - if (actionManagementService == null) { - throw new Exception("Action Management Service is not available."); - } - } - return this.actionManagementService; - } -} diff --git a/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.v1/pom.xml b/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.v1/pom.xml index ab07414623..47148eecab 100644 --- a/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.v1/pom.xml +++ b/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.v1/pom.xml @@ -82,11 +82,6 @@ - - org.springframework - spring-web - provided - org.wso2.carbon.identity.server.api org.wso2.carbon.identity.api.server.common diff --git a/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/action/management/v1/ActionsApi.java b/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/action/management/v1/ActionsApi.java index a87f949f88..6427e6b6d4 100644 --- a/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/action/management/v1/ActionsApi.java +++ b/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/action/management/v1/ActionsApi.java @@ -18,35 +18,23 @@ package org.wso2.carbon.identity.api.server.action.management.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.api.server.action.management.v1.ActionBasicResponse; -import org.wso2.carbon.identity.api.server.action.management.v1.ActionModel; -import org.wso2.carbon.identity.api.server.action.management.v1.ActionResponse; -import org.wso2.carbon.identity.api.server.action.management.v1.ActionTypesResponseItem; -import org.wso2.carbon.identity.api.server.action.management.v1.ActionUpdateModel; -import org.wso2.carbon.identity.api.server.action.management.v1.AuthenticationTypeProperties; -import org.wso2.carbon.identity.api.server.action.management.v1.Error; -import org.wso2.carbon.identity.api.server.action.management.v1.ActionsApiService; - import javax.validation.Valid; import javax.ws.rs.*; import javax.ws.rs.core.Response; import io.swagger.annotations.*; - -import javax.validation.constraints.*; +import org.wso2.carbon.identity.api.server.action.management.v1.factories.ActionsApiServiceFactory; @Path("/actions") @Api(description = "The actions API") public class ActionsApi { - @Autowired - private ActionsApiService delegate; + private final ActionsApiService delegate; + + public ActionsApi() { + + this.delegate = ActionsApiServiceFactory.getActionsApi(); + } @Valid @POST diff --git a/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/action/management/v1/factories/ActionsApiServiceFactory.java b/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/action/management/v1/factories/ActionsApiServiceFactory.java index a004542f2d..2a4693dcc0 100644 --- a/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/action/management/v1/factories/ActionsApiServiceFactory.java +++ b/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/action/management/v1/factories/ActionsApiServiceFactory.java @@ -21,12 +21,20 @@ import org.wso2.carbon.identity.api.server.action.management.v1.ActionsApiService; import org.wso2.carbon.identity.api.server.action.management.v1.impl.ActionsApiServiceImpl; +/** + * Factory class for Actions API Service. + */ public class ActionsApiServiceFactory { - private final static ActionsApiService service = new ActionsApiServiceImpl(); + private final static ActionsApiService SERVICE = new ActionsApiServiceImpl(); + /** + * Get Actions API Service. + * + * @return ActionsApiService. + */ public static ActionsApiService getActionsApi() { - return service; + return SERVICE; } } diff --git a/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.v1/src/main/java/org/wso2/carbon/identity/api/server/action/management/v1/core/ServerActionManagementService.java b/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.v1/src/main/java/org/wso2/carbon/identity/api/server/action/management/v1/core/ServerActionManagementService.java index a4cf6ba42c..c496d57c47 100644 --- a/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.v1/src/main/java/org/wso2/carbon/identity/api/server/action/management/v1/core/ServerActionManagementService.java +++ b/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.v1/src/main/java/org/wso2/carbon/identity/api/server/action/management/v1/core/ServerActionManagementService.java @@ -22,11 +22,11 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.context.CarbonContext; +import org.wso2.carbon.identity.action.management.ActionManagementService; import org.wso2.carbon.identity.action.management.exception.ActionMgtException; import org.wso2.carbon.identity.action.management.model.Action; import org.wso2.carbon.identity.action.management.model.Authentication; import org.wso2.carbon.identity.action.management.model.EndpointConfig; -import org.wso2.carbon.identity.api.server.action.management.common.ActionManagementServiceHolder; import org.wso2.carbon.identity.api.server.action.management.v1.ActionBasicResponse; import org.wso2.carbon.identity.api.server.action.management.v1.ActionModel; import org.wso2.carbon.identity.api.server.action.management.v1.ActionResponse; @@ -58,9 +58,15 @@ */ public class ServerActionManagementService { + private final ActionManagementService actionManagementService; private static final Log LOG = LogFactory.getLog(ServerActionManagementService.class); private static final Set NOT_IMPLEMENTED_ACTION_TYPES = new HashSet<>(); + public ServerActionManagementService(ActionManagementService actionManagementService) { + + this.actionManagementService = actionManagementService; + } + static { NOT_IMPLEMENTED_ACTION_TYPES.add(Action.ActionTypes.PRE_UPDATE_PASSWORD.getPathParam()); NOT_IMPLEMENTED_ACTION_TYPES.add(Action.ActionTypes.PRE_UPDATE_PROFILE.getPathParam()); @@ -72,9 +78,8 @@ public ActionResponse createAction(String actionType, ActionModel actionModel) { try { handleNotImplementedActionTypes(actionType); - return buildActionResponse(ActionManagementServiceHolder.getActionManagementService() - .addAction(actionType, buildAction(actionModel), - CarbonContext.getThreadLocalCarbonContext().getTenantDomain())); + return buildActionResponse(actionManagementService.addAction(actionType, buildAction(actionModel), + CarbonContext.getThreadLocalCarbonContext().getTenantDomain())); } catch (ActionMgtException e) { throw ActionMgtEndpointUtil.handleActionMgtException(e); } @@ -84,9 +89,8 @@ public List getActionsByActionType(String actionType) { try { handleNotImplementedActionTypes(actionType); - List actions = ActionManagementServiceHolder.getActionManagementService() - .getActionsByActionType(actionType, - CarbonContext.getThreadLocalCarbonContext().getTenantDomain()); + List actions = actionManagementService.getActionsByActionType(actionType, + CarbonContext.getThreadLocalCarbonContext().getTenantDomain()); List actionResponses = new ArrayList<>(); for (Action action : actions) { @@ -102,16 +106,14 @@ public ActionResponse getActionByActionId(String actionType, String actionId) { try { handleNotImplementedActionTypes(actionType); - Action action = ActionManagementServiceHolder.getActionManagementService() - .getActionByActionId(actionType, actionId, - CarbonContext.getThreadLocalCarbonContext().getTenantDomain()); + Action action = actionManagementService.getActionByActionId(actionType, actionId, + CarbonContext.getThreadLocalCarbonContext().getTenantDomain()); if (action == null) { throw ActionMgtEndpointUtil.handleException(Response.Status.NOT_FOUND, ERROR_NO_ACTION_FOUND_ON_GIVEN_ACTION_TYPE_AND_ID); } - return buildActionResponse(ActionManagementServiceHolder.getActionManagementService() - .getActionByActionId(actionType, actionId, - CarbonContext.getThreadLocalCarbonContext().getTenantDomain())); + return buildActionResponse(actionManagementService.getActionByActionId(actionType, actionId, + CarbonContext.getThreadLocalCarbonContext().getTenantDomain())); } catch (ActionMgtException e) { throw ActionMgtEndpointUtil.handleActionMgtException(e); } @@ -121,9 +123,9 @@ public ActionResponse updateAction(String actionType, String actionId, ActionUpd try { handleNotImplementedActionTypes(actionType); - return buildActionResponse(ActionManagementServiceHolder.getActionManagementService() - .updateAction(actionType, actionId, buildUpdatingAction(actionUpdateModel), - CarbonContext.getThreadLocalCarbonContext().getTenantDomain())); + return buildActionResponse(actionManagementService.updateAction(actionType, actionId, + buildUpdatingAction(actionUpdateModel), + CarbonContext.getThreadLocalCarbonContext().getTenantDomain())); } catch (ActionMgtException e) { throw ActionMgtEndpointUtil.handleActionMgtException(e); } @@ -133,7 +135,7 @@ public void deleteAction(String actionType, String actionId) { try { handleNotImplementedActionTypes(actionType); - ActionManagementServiceHolder.getActionManagementService().deleteAction(actionType, actionId, + actionManagementService.deleteAction(actionType, actionId, CarbonContext.getThreadLocalCarbonContext().getTenantDomain()); } catch (ActionMgtException e) { throw ActionMgtEndpointUtil.handleActionMgtException(e); @@ -144,9 +146,8 @@ public ActionBasicResponse activateAction(String actionType, String actionId) { try { handleNotImplementedActionTypes(actionType); - return buildActionBasicResponse(ActionManagementServiceHolder.getActionManagementService() - .activateAction(actionType, actionId, - CarbonContext.getThreadLocalCarbonContext().getTenantDomain())); + return buildActionBasicResponse(actionManagementService.activateAction(actionType, actionId, + CarbonContext.getThreadLocalCarbonContext().getTenantDomain())); } catch (ActionMgtException e) { throw ActionMgtEndpointUtil.handleActionMgtException(e); } @@ -156,9 +157,8 @@ public ActionBasicResponse deactivateAction(String actionType, String actionId) try { handleNotImplementedActionTypes(actionType); - return buildActionBasicResponse(ActionManagementServiceHolder.getActionManagementService() - .deactivateAction(actionType, actionId, - CarbonContext.getThreadLocalCarbonContext().getTenantDomain())); + return buildActionBasicResponse(actionManagementService.deactivateAction(actionType, actionId, + CarbonContext.getThreadLocalCarbonContext().getTenantDomain())); } catch (ActionMgtException e) { throw ActionMgtEndpointUtil.handleActionMgtException(e); } @@ -170,8 +170,8 @@ public List getActionTypes() { LOG.debug("Retrieving Action Types."); } try { - Map actionsCountPerType = ActionManagementServiceHolder.getActionManagementService() - .getActionsCountPerType(CarbonContext.getThreadLocalCarbonContext().getTenantDomain()); + Map actionsCountPerType = actionManagementService.getActionsCountPerType(CarbonContext + .getThreadLocalCarbonContext().getTenantDomain()); List actionTypesResponseItems = new ArrayList<>(); for (Action.ActionTypes actionType : Action.ActionTypes.values()) { @@ -193,15 +193,15 @@ public List getActionTypes() { } public ActionResponse updateActionEndpointAuthentication(String actionType, String actionId, String authType, - AuthenticationTypeProperties authenticationTypeProperties) { + AuthenticationTypeProperties authenticationTypeProperties) { try { handleNotImplementedActionTypes(actionType); Authentication authentication = buildAuthentication(getAuthTypeFromPath(authType), authenticationTypeProperties.getProperties()); - return buildActionResponse(ActionManagementServiceHolder.getActionManagementService() - .updateActionEndpointAuthentication(actionType, actionId, authentication, - CarbonContext.getThreadLocalCarbonContext().getTenantDomain())); + return buildActionResponse(actionManagementService.updateActionEndpointAuthentication(actionType, + actionId, authentication, + CarbonContext.getThreadLocalCarbonContext().getTenantDomain())); } catch (ActionMgtException e) { throw ActionMgtEndpointUtil.handleActionMgtException(e); } @@ -299,7 +299,7 @@ private Action buildUpdatingAction(ActionUpdateModel actionUpdateModel) { /** * Get Authentication object from the Authentication Type and Authentication properties. * - * @param authType Authentication Type. + * @param authType Authentication Type. * @param authPropertiesMap Authentication properties. * @return Authentication object. */ diff --git a/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.v1/src/main/java/org/wso2/carbon/identity/api/server/action/management/v1/factories/ActionManagementServiceFactory.java b/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.v1/src/main/java/org/wso2/carbon/identity/api/server/action/management/v1/factories/ActionManagementServiceFactory.java new file mode 100644 index 0000000000..a6ffd4172d --- /dev/null +++ b/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.v1/src/main/java/org/wso2/carbon/identity/api/server/action/management/v1/factories/ActionManagementServiceFactory.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 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.api.server.action.management.v1.factories; + +import org.wso2.carbon.identity.action.management.ActionManagementService; +import org.wso2.carbon.identity.api.server.action.management.common.ActionManagementServiceHolder; +import org.wso2.carbon.identity.api.server.action.management.v1.core.ServerActionManagementService; + +/** + * Factory class for Action Management Service. + */ +public class ActionManagementServiceFactory { + + private static final ServerActionManagementService SERVICE; + + static { + ActionManagementService actionManagementService = ActionManagementServiceHolder.getActionManagementService(); + + if (actionManagementService == null) { + throw new IllegalStateException("ActionManagementService is not available from OSGi context."); + } + + SERVICE = new ServerActionManagementService(actionManagementService); + } + + /** + * Get Action Management Service. + * + * @return ServerActionManagementService. + */ + public static ServerActionManagementService getActionManagementService() { + + return SERVICE; + } +} diff --git a/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.v1/src/main/java/org/wso2/carbon/identity/api/server/action/management/v1/impl/ActionsApiServiceImpl.java b/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.v1/src/main/java/org/wso2/carbon/identity/api/server/action/management/v1/impl/ActionsApiServiceImpl.java index 53e10c9d89..8ed555b6e7 100644 --- a/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.v1/src/main/java/org/wso2/carbon/identity/api/server/action/management/v1/impl/ActionsApiServiceImpl.java +++ b/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.v1/src/main/java/org/wso2/carbon/identity/api/server/action/management/v1/impl/ActionsApiServiceImpl.java @@ -18,7 +18,6 @@ package org.wso2.carbon.identity.api.server.action.management.v1.impl; -import org.springframework.beans.factory.annotation.Autowired; import org.wso2.carbon.identity.api.server.action.management.v1.ActionModel; import org.wso2.carbon.identity.api.server.action.management.v1.ActionResponse; import org.wso2.carbon.identity.api.server.action.management.v1.ActionUpdateModel; @@ -26,6 +25,7 @@ import org.wso2.carbon.identity.api.server.action.management.v1.AuthenticationTypeProperties; import org.wso2.carbon.identity.api.server.action.management.v1.constants.ActionMgtEndpointConstants; import org.wso2.carbon.identity.api.server.action.management.v1.core.ServerActionManagementService; +import org.wso2.carbon.identity.api.server.action.management.v1.factories.ActionManagementServiceFactory; import org.wso2.carbon.identity.api.server.common.ContextLoader; import java.net.URI; @@ -39,8 +39,15 @@ */ public class ActionsApiServiceImpl implements ActionsApiService { - @Autowired - ServerActionManagementService serverActionManagementService; + private final ServerActionManagementService serverActionManagementService; + + public ActionsApiServiceImpl() { + try { + this.serverActionManagementService = ActionManagementServiceFactory.getActionManagementService(); + } catch (Exception e) { + throw new RuntimeException("Error occurred while initiating server action management service.", e); + } + } @Override public Response createAction(String actionType, ActionModel actionModel) { diff --git a/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.v1/src/main/resources/META-INF/cxf/action-server-v1-cxf.xml b/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.v1/src/main/resources/META-INF/cxf/action-server-v1-cxf.xml deleted file mode 100644 index e7afa6af90..0000000000 --- a/components/org.wso2.carbon.identity.api.server.action.management/org.wso2.carbon.identity.api.server.action.management.v1/src/main/resources/META-INF/cxf/action-server-v1-cxf.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - -