Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoic Prieur-Drevon2018-03-05 18:49:03 -0500
committerLoic Prieur-Drevon2018-04-03 15:47:43 -0400
commit4ccbcbbc940e6581e10b99e3f5b452fcac773c54 (patch)
tree41a06968ca3ded325c7aae9b1aded836e3583b81
parentc57f18ecd2b116444a5610fa6ddb183699fc9fee (diff)
downloadorg.eclipse.tracecompass.incubator-4ccbcbbc940e6581e10b99e3f5b452fcac773c54.tar.gz
org.eclipse.tracecompass.incubator-4ccbcbbc940e6581e10b99e3f5b452fcac773c54.tar.xz
org.eclipse.tracecompass.incubator-4ccbcbbc940e6581e10b99e3f5b452fcac773c54.zip
rest: add an endpoint for timegraph tooltips
Change-Id: I07343c0d8ac7f726bcb38ea2453707bf3a496cb3 Signed-off-by: Loic Prieur-Drevon <loic.prieurdrevon@gmail.com> Reviewed-on: https://git.eclipse.org/r/118729 Tested-by: CI Bot Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
-rw-r--r--trace-server/org.eclipse.tracecompass.incubator.trace.server.jersey.rest.core/src/org/eclipse/tracecompass/incubator/internal/trace/server/jersey/rest/core/services/DataProviderService.java68
1 files changed, 55 insertions, 13 deletions
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/DataProviderService.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/DataProviderService.java
index 17e24578..24f422ed 100644
--- a/trace-server/org.eclipse.tracecompass.incubator.trace.server.jersey.rest.core/src/org/eclipse/tracecompass/incubator/internal/trace/server/jersey/rest/core/services/DataProviderService.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/DataProviderService.java
@@ -11,6 +11,7 @@ package org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.cor
import java.util.EnumSet;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import java.util.UUID;
@@ -188,13 +189,7 @@ public class DataProviderService {
return Response.status(Status.NOT_FOUND).entity(NO_SUCH_TRACE).build();
}
- ITimeGraphDataProvider<@NonNull ITimeGraphEntryModel> provider = manager.getDataProvider(trace,
- providerId, ITimeGraphDataProvider.class);
-
- if (provider == null && providerId != null) {
- // try and find the XML provider for the ID.
- provider = getXmlProvider(trace, providerId, EnumSet.of(OutputType.TIME_GRAPH));
- }
+ ITimeGraphDataProvider<@NonNull ITimeGraphEntryModel> provider = getTimeGraphProvider(trace, providerId);
if (provider == null) {
// The analysis cannot be run on this trace
@@ -233,23 +228,70 @@ public class DataProviderService {
return Response.status(Status.NOT_FOUND).entity(NO_SUCH_TRACE).build();
}
- ITimeGraphDataProvider<@NonNull ITimeGraphEntryModel> provider = manager.getDataProvider(trace,
- providerId, ITimeGraphDataProvider.class);
+ ITimeGraphDataProvider<@NonNull ITimeGraphEntryModel> provider = getTimeGraphProvider(trace, providerId);
- if (provider == null && providerId != null) {
- // try and find the XML provider for the ID.
- provider = getXmlProvider(trace, providerId, EnumSet.of(OutputType.TIME_GRAPH));
+ if (provider == null) {
+ // The analysis cannot be run on this trace
+ return Response.status(Status.METHOD_NOT_ALLOWED).entity(NO_PROVIDER).build();
+ }
+
+ TmfModelResponse<@NonNull List<@NonNull ITimeGraphArrow>> response = provider.fetchArrows(new TimeQueryFilter(start, end, nb), null);
+ return Response.ok(new GenericView<>(trace, response)).build();
+ }
+
+ /**
+ * Query the provider for the time graph tooltips
+ *
+ * @param uuid
+ * desired trace UUID
+ * @param providerId
+ * Eclipse extension point ID for the data provider to query
+ * @param start
+ * lower bound for the query
+ * @param end
+ * upper bound for the query
+ * @param nb
+ * nanoseconds between two data points
+ * @param ids
+ * ids of the entries to query
+ * @return an {@link GenericView} with the results
+ */
+ @GET
+ @Path("/tooltip")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response getTooltip(@PathParam("uuid") UUID uuid,
+ @PathParam("providerId") String providerId,
+ @QueryParam("start") long start,
+ @QueryParam("end") long end,
+ @QueryParam("nb") int nb,
+ @QueryParam("ids") @NotNull Set<Long> ids) {
+ ITmfTrace trace = TraceManagerService.getTraceByUUID(uuid);
+ if (trace == null) {
+ return Response.status(Status.NOT_FOUND).entity(NO_SUCH_TRACE).build();
}
+ ITimeGraphDataProvider<@NonNull ITimeGraphEntryModel> provider = getTimeGraphProvider(trace, providerId);
+
if (provider == null) {
// The analysis cannot be run on this trace
return Response.status(Status.METHOD_NOT_ALLOWED).entity(NO_PROVIDER).build();
}
- TmfModelResponse<List<@NonNull ITimeGraphArrow>> response = provider.fetchArrows(new TimeQueryFilter(start, end, nb), null);
+ TmfModelResponse<@NonNull Map<@NonNull String, @NonNull String>> response = provider.fetchTooltip(new SelectionTimeQueryFilter(start, end, nb, ids), null);
return Response.ok(new GenericView<>(trace, response)).build();
}
+ private ITimeGraphDataProvider<@NonNull ITimeGraphEntryModel> getTimeGraphProvider(@NonNull ITmfTrace trace, String providerId) {
+ ITimeGraphDataProvider<@NonNull ITimeGraphEntryModel> provider = manager.getDataProvider(trace,
+ providerId, ITimeGraphDataProvider.class);
+
+ if (provider == null && providerId != null) {
+ // try and find the XML provider for the ID.
+ provider = getXmlProvider(trace, providerId, EnumSet.of(OutputType.TIME_GRAPH));
+ }
+ return provider;
+ }
+
/**
* Get the XML data provider for a trace, provider id and XML {@link OutputType}
*

Back to the top