Skip to content

Commit 27a6833

Browse files
committed
tmf.core: Add data fetching capabilities to data providers
Introduce a new interface ITmfDataProviderConfigurationDataFetcher and model class TmfDataProviderConfigurationDataModel to allow data providers to fetch and return custom data based on provider configuration. [Added] Infrastructure of fetching a data provider configuration's data Signed-off-by: Kaveh Shahedi <kaveh.shahedi@ericsson.com>
1 parent 501e408 commit 27a6833

File tree

3 files changed

+113
-1
lines changed

3 files changed

+113
-1
lines changed

tmf/org.eclipse.tracecompass.tmf.core/META-INF/MANIFEST.MF

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ Require-Bundle: org.eclipse.core.runtime,
1818
org.eclipse.tracecompass.tmf.filter.parser,
1919
org.eclipse.jdt.annotation;bundle-version="[2.0.0,3.0.0)";resolution:=optional,
2020
org.apache.commons.lang3
21-
Export-Package: org.eclipse.tracecompass.internal.provisional.tmf.core.model,
21+
Export-Package: org.eclipse.tracecompass.internal.provisional.tmf.core.dataprovider;x-internal:=true,
22+
org.eclipse.tracecompass.internal.provisional.tmf.core.model,
2223
org.eclipse.tracecompass.internal.provisional.tmf.core.model.events;x-friends:="org.eclipse.tracecompass.tmf.core.tests,org.eclipse.tracecompass.analysis.timing.core.tests",
2324
org.eclipse.tracecompass.internal.provisional.tmf.core.model.filter.parser;x-friends:="org.eclipse.tracecompass.tmf.ui,org.eclipse.tracecompass.tmf.core.tests",
2425
org.eclipse.tracecompass.internal.provisional.tmf.core.model.filters;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2025 Ericsson
3+
*
4+
* All rights reserved. This program and the accompanying materials are
5+
* made available under the terms of the Eclipse Public License 2.0 which
6+
* accompanies this distribution, and is available at
7+
* https://www.eclipse.org/legal/epl-2.0/
8+
*
9+
* SPDX-License-Identifier: EPL-2.0
10+
*******************************************************************************/
11+
package org.eclipse.tracecompass.internal.provisional.tmf.core.dataprovider;
12+
13+
import org.eclipse.tracecompass.tmf.core.config.ITmfConfiguration;
14+
import org.eclipse.tracecompass.tmf.core.response.TmfModelResponse;
15+
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
16+
17+
/**
18+
* Interface for data providers that can fetch custom data based on provider configuration.
19+
* Data providers that need to return specialized data types (images, reports, etc.)
20+
* can implement this interface and define the data fetching logic.
21+
*
22+
* @author Kaveh Shahedi
23+
* @since 10.3
24+
*/
25+
public interface ITmfDataProviderConfigurationDataFetcher {
26+
27+
/**
28+
* Get the data for a specific trace and configuration of the data provider.
29+
*
30+
* @param trace
31+
* The trace to get the data for
32+
* @param configuration
33+
* The configuration to get the data for
34+
* @return The report data
35+
* @throws Exception
36+
* If the data cannot be retrieved
37+
*/
38+
TmfModelResponse<TmfDataProviderConfigurationDataModel> getData(ITmfTrace trace, ITmfConfiguration configuration) throws Exception;
39+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2025 Ericsson
3+
*
4+
* All rights reserved. This program and the accompanying materials are
5+
* made available under the terms of the Eclipse Public License 2.0 which
6+
* accompanies this distribution, and is available at
7+
* https://www.eclipse.org/legal/epl-2.0/
8+
*
9+
* SPDX-License-Identifier: EPL-2.0
10+
*******************************************************************************/
11+
package org.eclipse.tracecompass.internal.provisional.tmf.core.dataprovider;
12+
13+
/**
14+
* Data model for the data provider configuration data. This class is used to
15+
* hold the data that is returned by the data provider configuration.
16+
*
17+
* @author Kaveh Shahedi
18+
*/
19+
public class TmfDataProviderConfigurationDataModel {
20+
21+
private Object fContent;
22+
private String fContentType;
23+
private String fContentName;
24+
25+
/**
26+
* Constructor
27+
*
28+
* @param content
29+
* The content of the data model
30+
* @param contentType
31+
* The type of the content
32+
* @param contentName
33+
* The name of the content
34+
*/
35+
public TmfDataProviderConfigurationDataModel(Object content, String contentType, String contentName) {
36+
fContent = content;
37+
fContentType = contentType;
38+
fContentName = contentName;
39+
}
40+
41+
/**
42+
* Get the content of the data model.
43+
* The content type is Object as it can be anything (e.g. image, report, etc.)
44+
*
45+
* @return The content of the data model
46+
*/
47+
public Object getContent() {
48+
return fContent;
49+
}
50+
51+
/**
52+
* Get the type of the content.
53+
* This is used to identify the type of content that is returned by,
54+
* for instance, MIME type (e.g., application/octet-stream for binary data).
55+
*
56+
* @return The type of the content
57+
*/
58+
public String getContentType() {
59+
return fContentType;
60+
}
61+
62+
/**
63+
* Get the name of the content.
64+
* This is used to identify the name the content if required,
65+
* as it could be saved to a file.
66+
*
67+
* @return The name of the content
68+
*/
69+
public String getContentName() {
70+
return fContentName;
71+
}
72+
}

0 commit comments

Comments
 (0)