Skip to content

Commit 3923557

Browse files
committed
tmf: Add hideDataProvider extension point element
Add hideDataProvider element with idRegex and tracetype attributes to the org.eclipse.tracecompass.tmf.core.dataprovider extension point. Add dataprovider.ini configuration file template to be stored in the o.e.tc.tmf.core plug-in state location. In DataProviderManager methods, filter-out data provider descriptors and factories that are hidden by the hideDataProvider element, or the dataprovider.ini configuration file, but that are not shown by the configuration file. Note that factories cannot be hidden for a specific trace type. Define constant DataProviderConstants.CONFIG_SEPARATOR. Describe use of CONFIG_SEPARATOR in ITmfDataProviderConfigurator's createDataProviderDescriptors() method. Signed-off-by: Patrick Tasse <patrick.tasse@gmail.com>
1 parent a081aac commit 3923557

8 files changed

Lines changed: 248 additions & 13 deletions

File tree

releng/org.eclipse.tracecompass.integration.core.tests/build.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ bin.includes = META-INF/,\
1414
.,\
1515
plugin.properties,\
1616
about.html,\
17-
build.properties
17+
build.properties,\
18+
plugin.xml
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<?eclipse version="3.4"?>
3+
<plugin>
4+
<extension
5+
point="org.eclipse.tracecompass.tmf.core.dataprovider">
6+
<dataProviderFactory
7+
class="org.eclipse.tracecompass.integration.core.tests.dataproviders.HiddenDataProviderFactory"
8+
id="org.eclipse.tracecompass.integration.core.tests.hidden.dataprovider">
9+
</dataProviderFactory>
10+
<hideDataProvider
11+
idRegex="org.eclipse.tracecompass.integration.core.tests.hidden.dataprovider"
12+
tracetype="*">
13+
</hideDataProvider>
14+
</extension>
15+
16+
</plugin>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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+
12+
package org.eclipse.tracecompass.integration.core.tests.dataproviders;
13+
14+
import java.util.Arrays;
15+
import java.util.Collection;
16+
17+
import org.eclipse.jdt.annotation.NonNull;
18+
import org.eclipse.jdt.annotation.Nullable;
19+
import org.eclipse.tracecompass.tmf.core.dataprovider.IDataProviderDescriptor;
20+
import org.eclipse.tracecompass.tmf.core.dataprovider.IDataProviderDescriptor.ProviderType;
21+
import org.eclipse.tracecompass.tmf.core.dataprovider.IDataProviderFactory;
22+
import org.eclipse.tracecompass.tmf.core.model.DataProviderDescriptor;
23+
import org.eclipse.tracecompass.tmf.core.model.tree.ITmfTreeDataModel;
24+
import org.eclipse.tracecompass.tmf.core.model.tree.ITmfTreeDataProvider;
25+
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
26+
27+
/**
28+
* Hidden data provider factory
29+
*/
30+
public class HiddenDataProviderFactory implements IDataProviderFactory {
31+
32+
private static final String ID = "org.eclipse.tracecompass.integration.core.tests.hidden.dataprovider";
33+
private static final String NAME = "Hidden";
34+
private static final String DESCRIPTION = "Hidden data provider for integration tests";
35+
private static final IDataProviderDescriptor DESCRIPTOR = new DataProviderDescriptor.Builder()
36+
.setId(ID)
37+
.setName(NAME)
38+
.setDescription(DESCRIPTION)
39+
.setProviderType(ProviderType.NONE)
40+
.build();
41+
42+
/**
43+
* Constructor
44+
*/
45+
public HiddenDataProviderFactory() {
46+
System.out.println("HiddenDataProviderFactory()");
47+
}
48+
49+
@Override
50+
public @Nullable ITmfTreeDataProvider<? extends ITmfTreeDataModel> createProvider(@NonNull ITmfTrace trace) {
51+
return null;
52+
}
53+
54+
@Override
55+
public @NonNull Collection<IDataProviderDescriptor> getDescriptors(@NonNull ITmfTrace trace) {
56+
return Arrays.asList(DESCRIPTOR);
57+
}
58+
}

tmf/org.eclipse.tracecompass.tmf.core/schema/org.eclipse.tracecompass.tmf.core.dataprovider.exsd

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717
</appinfo>
1818
</annotation>
1919
<complexType>
20-
<sequence minOccurs="1" maxOccurs="unbounded">
20+
<sequence minOccurs="0" maxOccurs="unbounded">
2121
<element ref="dataProviderFactory"/>
22+
<element ref="hideDataProvider"/>
2223
</sequence>
2324
<attribute name="point" type="string" use="required">
2425
<annotation>
@@ -69,6 +70,30 @@
6970
</complexType>
7071
</element>
7172

73+
<element name="hideDataProvider">
74+
<annotation>
75+
<documentation>
76+
Hide data providers with id matching the given regex for an optionally given trace type. Can be overridden by dataprovider.ini configuration file.
77+
</documentation>
78+
</annotation>
79+
<complexType>
80+
<attribute name="idRegex" type="string" use="required">
81+
<annotation>
82+
<documentation>
83+
A regular expression for matching data provider IDs to be hidden.
84+
</documentation>
85+
</annotation>
86+
</attribute>
87+
<attribute name="tracetype" type="string">
88+
<annotation>
89+
<documentation>
90+
The optional trace type ID of the data providers to be hidden. If empty, absent or *, the data provider will be hidden for all trace types.
91+
</documentation>
92+
</annotation>
93+
</attribute>
94+
</complexType>
95+
</element>
96+
7297
<annotation>
7398
<appinfo>
7499
<meta.section type="since"/>
@@ -100,7 +125,7 @@
100125
<meta.section type="copyright"/>
101126
</appinfo>
102127
<documentation>
103-
Copyright (c) 2017 Ericsson
128+
Copyright (c) 2017, 2025 Ericsson
104129

105130
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 &amp;lt;a href=&amp;quot;https://www.eclipse.org/legal/epl-2.0/&amp;quot;&amp;gt;https://www.eclipse.org/legal/epl-2.0/&amp;lt;/a&amp;gt;
106131

tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/component/DataProviderConstants.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2019 Ericsson
2+
* Copyright (c) 2019, 2025 Ericsson
33
*
44
* All rights reserved. This program and the accompanying materials are made
55
* available under the terms of the Eclipse Public License 2.0 which
@@ -25,6 +25,12 @@ public class DataProviderConstants {
2525
*/
2626
public static final String ID_SEPARATOR = ":"; //$NON-NLS-1$
2727

28+
/**
29+
* Separator between base analysis ID and config ID in secondary ID
30+
* @since 9.6
31+
*/
32+
public static final String CONFIG_SEPARATOR = "+"; //$NON-NLS-1$
33+
2834
private DataProviderConstants() {
2935
// Empty constructor
3036
}

tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/config/ITmfDataProviderConfigurator.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2024 Ericsson
2+
* Copyright (c) 2024, 2025 Ericsson
33
*
44
* All rights reserved. This program and the accompanying materials are
55
* made available under the terms of the Eclipse Public License 2.0 which
@@ -13,6 +13,7 @@
1313

1414
import java.util.List;
1515

16+
import org.eclipse.tracecompass.tmf.core.component.DataProviderConstants;
1617
import org.eclipse.tracecompass.tmf.core.dataprovider.DataProviderManager;
1718
import org.eclipse.tracecompass.tmf.core.dataprovider.IDataProviderDescriptor;
1819
import org.eclipse.tracecompass.tmf.core.exceptions.TmfConfigurationException;
@@ -33,17 +34,21 @@ public interface ITmfDataProviderConfigurator {
3334
/**
3435
* Prepares a data provider based on input parameters and returns its
3536
* corresponding data provider descriptor.
36-
*
37+
* <p>
3738
* The input configuration instance will have default parameters (e.g. name,
3839
* description or sourceTypeId) and custom parameters which are described by
3940
* the corresponding {@link ITmfConfigurationSourceType#getSchemaFile()} or
4041
* by the list of
4142
* {@link ITmfConfigurationSourceType#getConfigParamDescriptors()}.
42-
*
43+
* <p>
4344
* The data provider descriptor shall return the parent data provider ID
4445
* through {@link IDataProviderDescriptor#getParentId()}, as well as the
4546
* creation configuration through
4647
* {@link IDataProviderDescriptor#getConfiguration()}.
48+
* <p>
49+
* The created data provider's ID and any created analysis module's ID should be
50+
* appended with {@link DataProviderConstants#CONFIG_SEPARATOR} followed
51+
* by the configuration ID.
4752
*
4853
* @param trace
4954
* The trace (or experiment) instance

0 commit comments

Comments
 (0)