From 469d5a1904b6b7541bf1eb8ed144af3c91426632 Mon Sep 17 00:00:00 2001 From: Bernd Hufmann Date: Thu, 19 Dec 2024 13:18:51 -0500 Subject: [PATCH] server: remove unused filter and XML manager service XMLManagerService has been deprecated and is replaced by ConfigurationManagerService. The FilterService class and its endpoints exists but the implementation has not been done. Besides, the implementation can be done using the ConfigurationManagerService and hence the FilterService is obsolete. Signed-off-by: Bernd Hufmann --- .../stubs/webapp/TestWebApplication.java | 2 - .../rest/core/services/FilterService.java | 107 ---------------- .../rest/core/services/XmlManagerService.java | 121 ------------------ .../rest/core/webapp/WebApplication.java | 2 - 4 files changed, 232 deletions(-) delete mode 100644 trace-server/org.eclipse.tracecompass.incubator.trace.server.jersey.rest.core/src/org/eclipse/tracecompass/incubator/internal/trace/server/jersey/rest/core/services/FilterService.java delete mode 100644 trace-server/org.eclipse.tracecompass.incubator.trace.server.jersey.rest.core/src/org/eclipse/tracecompass/incubator/internal/trace/server/jersey/rest/core/services/XmlManagerService.java diff --git a/trace-server/org.eclipse.tracecompass.incubator.trace.server.jersey.rest.core.tests/src/org/eclipse/tracecompass/incubator/trace/server/jersey/rest/core/tests/stubs/webapp/TestWebApplication.java b/trace-server/org.eclipse.tracecompass.incubator.trace.server.jersey.rest.core.tests/src/org/eclipse/tracecompass/incubator/trace/server/jersey/rest/core/tests/stubs/webapp/TestWebApplication.java index 54af8e84b..9a5d581c4 100644 --- a/trace-server/org.eclipse.tracecompass.incubator.trace.server.jersey.rest.core.tests/src/org/eclipse/tracecompass/incubator/trace/server/jersey/rest/core/tests/stubs/webapp/TestWebApplication.java +++ b/trace-server/org.eclipse.tracecompass.incubator.trace.server.jersey.rest.core.tests/src/org/eclipse/tracecompass/incubator/trace/server/jersey/rest/core/tests/stubs/webapp/TestWebApplication.java @@ -14,7 +14,6 @@ import org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.services.BookmarkManagerService; import org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.services.ConfigurationManagerService; import org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.services.ExperimentManagerService; -import org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.services.FilterService; import org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.services.HealthService; import org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.services.IdentifierService; import org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.services.TraceManagerService; @@ -46,7 +45,6 @@ protected void registerResourcesAndMappers(ResourceConfig rc) { rc.register(TraceManagerService.class); rc.register(ExperimentManagerService.class); rc.register(TestDataProviderService.class); - rc.register(FilterService.class); rc.register(HealthService.class); rc.register(IdentifierService.class); rc.register(ConfigurationManagerService.class); diff --git a/trace-server/org.eclipse.tracecompass.incubator.trace.server.jersey.rest.core/src/org/eclipse/tracecompass/incubator/internal/trace/server/jersey/rest/core/services/FilterService.java b/trace-server/org.eclipse.tracecompass.incubator.trace.server.jersey.rest.core/src/org/eclipse/tracecompass/incubator/internal/trace/server/jersey/rest/core/services/FilterService.java deleted file mode 100644 index f87333bcf..000000000 --- a/trace-server/org.eclipse.tracecompass.incubator.trace.server.jersey.rest.core/src/org/eclipse/tracecompass/incubator/internal/trace/server/jersey/rest/core/services/FilterService.java +++ /dev/null @@ -1,107 +0,0 @@ -/********************************************************************** - * Copyright (c) 2019 Ericsson - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License 2.0 which - * accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - **********************************************************************/ - -package org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.services; - -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.Response.Status; - -import io.swagger.v3.oas.annotations.Hidden; - -/** - * Service to manage filters - * - * @author Simon Delisle - */ -@Hidden -@Path("/filters") -public class FilterService { - - /** - * Get a list of all the filters available on the server - * - * @return List of filters - */ - @GET - @Produces(MediaType.APPLICATION_JSON) - public Response getFilters() { - return Response.status(Status.NOT_IMPLEMENTED).build(); - } - - /** - * Create a new filter on the server - * - * @param filter - * Filter to create - * @return Created filter - */ - @POST - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public Response createFilter(Object filter) { - return Response.status(Status.NOT_IMPLEMENTED).build(); - } - - /** - * Get a specific filter - * - * @param filterId - * Filter Id - * @return Filter - */ - @GET - @Path("/{filterId}") - @Produces(MediaType.APPLICATION_JSON) - public Response getFilter(@PathParam("filterId") String filterId) { - return Response.status(Status.NOT_IMPLEMENTED).build(); - } - - /** - * Update a specific filter - * - * @param filterId - * Filter Id - * @param filter - * Filter used to update the given filter - * @return Updated filter - */ - @PUT - @Path("/{filterId}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public Response updateFilter(@PathParam("filterId") String filterId, - Object filter) { - return Response.status(Status.NOT_IMPLEMENTED).build(); - } - - /** - * Delete a specific filter - * - * @param filterId - * Id of the filter to delete - * @return Deleted filter - */ - @DELETE - @Path("/{filterId}") - @Produces(MediaType.APPLICATION_JSON) - public Response deleteFilter(@PathParam("filterId") String filterId) { - return Response.status(Status.NOT_IMPLEMENTED).build(); - } -} diff --git a/trace-server/org.eclipse.tracecompass.incubator.trace.server.jersey.rest.core/src/org/eclipse/tracecompass/incubator/internal/trace/server/jersey/rest/core/services/XmlManagerService.java b/trace-server/org.eclipse.tracecompass.incubator.trace.server.jersey.rest.core/src/org/eclipse/tracecompass/incubator/internal/trace/server/jersey/rest/core/services/XmlManagerService.java deleted file mode 100644 index 81e0cdb83..000000000 --- a/trace-server/org.eclipse.tracecompass.incubator.trace.server.jersey.rest.core/src/org/eclipse/tracecompass/incubator/internal/trace/server/jersey/rest/core/services/XmlManagerService.java +++ /dev/null @@ -1,121 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2018 Ericsson - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License 2.0 which - * accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ - -package org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.services; - -import java.io.File; -import java.util.Objects; - -import javax.ws.rs.DELETE; -import javax.ws.rs.FormParam; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.Response.Status; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.tracecompass.internal.tmf.analysis.xml.core.module.XmlAnalysisModuleSource; -import org.eclipse.tracecompass.internal.tmf.analysis.xml.core.module.XmlUtils; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Maps; - -import io.swagger.v3.oas.annotations.Hidden; - -/** - * XML analysis and provider management - * - * @author Loic Prieur-Drevon - * @deprecated use {@link ConfigurationManagerService} instead - */ -@Deprecated -@Hidden -@Path("/xml") -@SuppressWarnings("restriction") -public class XmlManagerService { - - /** - * Getter for the list of available XML files - * - * @return list of available XML files, encapsulated in a response. - */ - @GET - @Produces(MediaType.APPLICATION_JSON) - public Response getXml() { - return Response.ok(Maps.transformValues(XmlUtils.listFiles(), File::getAbsolutePath)).build(); - } - - /** - * POST a new XML file to the server - * - * @param path - * path to the file - * @return status for adding new XML - */ - @POST - public Response postXml(@FormParam("path") String path) { - return updateXml(path, true); - } - - /** - * PUT an XML file to the server - * - * @param path - * path to the file - * @return status for adding new XML - */ - @PUT - public Response putXml(@FormParam("path") String path) { - return updateXml(path, false); - } - - /** - * End point to delete an XML file by name - * - * @param name - * XML file name - * @return OK - */ - @DELETE - @Path("/{name}") - public Response deleteXml(@PathParam("name") String name) { - if (!XmlUtils.listFiles().containsKey(name)) { - return Response.status(Status.NOT_FOUND).build(); - } - XmlUtils.deleteFiles(ImmutableList.of(Objects.requireNonNull(name))); - XmlUtils.saveFilesStatus(); - return Response.ok().build(); - } - - private static Response updateXml(String path, boolean addFile) { - File file = new File(path); - - IStatus status = XmlUtils.xmlValidate(file); - if (status.isOK()) { - if (addFile) { - status = XmlUtils.addXmlFile(file); - } else { - XmlUtils.updateXmlFile(file); - } - if (status.isOK()) { - XmlAnalysisModuleSource.notifyModuleChange(); - XmlUtils.saveFilesStatus(); - return Response.ok().build(); - } - } - return Response.serverError().build(); - } -} diff --git a/trace-server/org.eclipse.tracecompass.incubator.trace.server.jersey.rest.core/src/org/eclipse/tracecompass/incubator/internal/trace/server/jersey/rest/core/webapp/WebApplication.java b/trace-server/org.eclipse.tracecompass.incubator.trace.server.jersey.rest.core/src/org/eclipse/tracecompass/incubator/internal/trace/server/jersey/rest/core/webapp/WebApplication.java index 3b2db4334..9da0f58ff 100644 --- a/trace-server/org.eclipse.tracecompass.incubator.trace.server.jersey.rest.core/src/org/eclipse/tracecompass/incubator/internal/trace/server/jersey/rest/core/webapp/WebApplication.java +++ b/trace-server/org.eclipse.tracecompass.incubator.trace.server.jersey.rest.core/src/org/eclipse/tracecompass/incubator/internal/trace/server/jersey/rest/core/webapp/WebApplication.java @@ -30,7 +30,6 @@ import org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.services.ConfigurationManagerService; import org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.services.DataProviderService; import org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.services.ExperimentManagerService; -import org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.services.FilterService; import org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.services.HealthService; import org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.services.IdentifierService; import org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.services.TraceManagerService; @@ -137,7 +136,6 @@ protected void registerResourcesAndMappers(ResourceConfig rc) { rc.register(TraceManagerService.class); rc.register(ExperimentManagerService.class); rc.register(DataProviderService.class); - rc.register(FilterService.class); rc.register(HealthService.class); rc.register(IdentifierService.class); rc.register(CORSFilter.class);