Skip to content

Commit 1a1e4f8

Browse files
committed
tmf: Introduce "IMAGE" data provider type
Followed by introducing the configurable reports data providers, this commit proposes a new data provider type called "IMAGE", which is related to different types of configurable image reports, such as jpg, png, svg, etc. [Added] A new data provider type called "IMAGE" Signed-off-by: Kaveh Shahedi <kaveh.shahedi@ericsson.com>
1 parent 3923557 commit 1a1e4f8

2 files changed

Lines changed: 69 additions & 20 deletions

File tree

tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/dataprovider/IDataProviderDescriptor.java

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,13 @@
2929
public interface IDataProviderDescriptor {
3030

3131
/**
32-
* The type of the data provider. The purpose of the type to indicate
33-
* to the clients the type of viewer to visualize or whether they can
34-
* share a common x-axis (e.g. time).
32+
* The type of the data provider. The purpose of the type to indicate to the
33+
* clients the type of viewer to visualize or whether they can share a
34+
* common x-axis (e.g. time).
3535
*
3636
* The following types share common x-axis/time axis:
3737
*
38-
* {@link #TREE_TIME_XY}
39-
* {@link #TIME_GRAPH}
38+
* {@link #TREE_TIME_XY} {@link #TIME_GRAPH}
4039
*
4140
* @author Loic Prieur-Drevon
4241
* @author Bernd Hufmann
@@ -47,22 +46,39 @@ public enum ProviderType {
4746
*/
4847
TABLE,
4948
/**
50-
* A provider for a tree, whose entries have XY series. The x-series is time.
49+
* A provider for a tree, whose entries have XY series. The x-series is
50+
* time.
5151
*/
5252
TREE_TIME_XY,
5353
/**
54-
* A provider for a Time Graph model, which has entries with a start and end
55-
* time, each entry has a series of states, arrows link from one series to
56-
* another
54+
* A provider for a Time Graph model, which has entries with a start and
55+
* end time, each entry has a series of states, arrows link from one
56+
* series to another
5757
*/
5858
TIME_GRAPH,
5959
/**
6060
* A provider for a data tree, which has entries (rows) and columns.
61+
*
6162
* @since 6.1
6263
*/
6364
DATA_TREE,
6465
/**
65-
* A provider with no data. Can be used for grouping purposes and/or as data provider configurator.
66+
* A provider for a report, which can be an image, report, text, etc.
67+
* The sub-type of the provider is used to indicate the type of report.
68+
*
69+
* @since 10.3
70+
*/
71+
REPORT,
72+
/**
73+
* A provider for an image data (e.g., png, jpeg, etc.)
74+
*
75+
* @since 10.3
76+
*/
77+
IMAGE,
78+
/**
79+
* A provider with no data. Can be used for grouping purposes and/or as
80+
* data provider configurator.
81+
*
6682
* @since 9.5
6783
*/
6884
NONE
@@ -110,7 +126,7 @@ public enum ProviderType {
110126
* Gets the input configuration used to create this data provider.
111127
*
112128
* @return the {@link ITmfConfiguration} configuration use to create this
113-
* data provider, or null if not applicable
129+
* data provider, or null if not applicable
114130
* @since 9.5
115131
*/
116132
default @Nullable ITmfConfiguration getConfiguration() {
@@ -124,4 +140,14 @@ public enum ProviderType {
124140
default IDataProviderCapabilities getCapabilities() {
125141
return DataProviderCapabilities.NULL_INSTANCE;
126142
}
143+
144+
/**
145+
* Gets the sub-type of this data provider.
146+
*
147+
* @return the sub-type or null if not applicable
148+
* @since 10.3
149+
*/
150+
default @Nullable ProviderType getSubType() {
151+
return null;
152+
}
127153
}

tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/model/DataProviderDescriptor.java

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public class DataProviderDescriptor implements IDataProviderDescriptor {
3333
private final String fName;
3434
private final String fDescription;
3535
private final ProviderType fType;
36+
private final @Nullable ProviderType fSubType;
3637
private final @Nullable String fParentId;
3738
private final @Nullable ITmfConfiguration fConfiguration;
3839
private final IDataProviderCapabilities fCapabilities;
@@ -48,6 +49,7 @@ private DataProviderDescriptor(Builder builder) {
4849
fName = builder.fName;
4950
fDescription = builder.fDescription;
5051
fType = Objects.requireNonNull(builder.fType);
52+
fSubType = builder.fSubType;
5153
fParentId = builder.fParentId;
5254
fConfiguration = builder.fConfiguration;
5355
fCapabilities = builder.fCapabilities;
@@ -68,6 +70,11 @@ public ProviderType getType() {
6870
return fType;
6971
}
7072

73+
@Override
74+
public @Nullable ProviderType getSubType() {
75+
return fSubType;
76+
}
77+
7178
@Override
7279
public String getDescription() {
7380
return fDescription;
@@ -93,10 +100,11 @@ public IDataProviderCapabilities getCapabilities() {
93100
public String toString() {
94101
return getClass().getSimpleName() + " [fName=" + getName()
95102
+ ", fDescription=" + getDescription() + ", fType=" + getType()
96-
+ ", fId=" + getId()
97-
+ ", fParentId=" + fParentId
98-
+ ", fConfiguration=" + fConfiguration
99-
+ ", fCapabilities=" + fCapabilities
103+
+ ", fId=" + getId()
104+
+ ", fSubType=" + fSubType
105+
+ ", fParentId=" + fParentId
106+
+ ", fConfiguration=" + fConfiguration
107+
+ ", fCapabilities=" + fCapabilities
100108
+ "]";
101109
}
102110

@@ -107,24 +115,26 @@ public boolean equals(@Nullable Object arg0) {
107115
}
108116
DataProviderDescriptor other = (DataProviderDescriptor) arg0;
109117
return Objects.equals(fName, other.fName) && Objects.equals(fId, other.fId)
110-
&& Objects.equals(fType, other.fType) && Objects.equals(fDescription, other.fDescription)
111-
&& Objects.equals(fParentId, other.fParentId) && Objects.equals(fConfiguration, other.fConfiguration)
112-
&& Objects.equals(fCapabilities, other.fCapabilities);
118+
&& Objects.equals(fType, other.fType) && Objects.equals(fSubType, other.fSubType)
119+
&& Objects.equals(fDescription, other.fDescription) && Objects.equals(fParentId, other.fParentId)
120+
&& Objects.equals(fConfiguration, other.fConfiguration) && Objects.equals(fCapabilities, other.fCapabilities);
113121
}
114122

115123
@Override
116124
public int hashCode() {
117-
return Objects.hash(fParentId, fName, fId, fType, fDescription, fConfiguration, fCapabilities);
125+
return Objects.hash(fParentId, fName, fId, fType, fSubType, fDescription, fConfiguration, fCapabilities);
118126
}
119127

120128
/**
121-
* A builder class to build instances implementing interface {@link IDataProviderDescriptor}
129+
* A builder class to build instances implementing interface
130+
* {@link IDataProviderDescriptor}
122131
*/
123132
public static class Builder {
124133
private String fId = ""; //$NON-NLS-1$
125134
private String fName = ""; //$NON-NLS-1$
126135
private String fDescription = ""; //$NON-NLS-1$
127136
private @Nullable ProviderType fType = null;
137+
private @Nullable ProviderType fSubType = null;
128138
private @Nullable String fParentId = null;
129139
private @Nullable ITmfConfiguration fConfiguration = null;
130140
private IDataProviderCapabilities fCapabilities = DataProviderCapabilities.NULL_INSTANCE;
@@ -184,6 +194,19 @@ public Builder setProviderType(ProviderType type) {
184194
return this;
185195
}
186196

197+
/**
198+
* Sets the data provider sub type
199+
*
200+
* @param subType
201+
* the data provider sub type to set
202+
* @return the builder instance.
203+
* @since 10.3
204+
*/
205+
public Builder setProviderSubType(@Nullable ProviderType subType) {
206+
fSubType = subType;
207+
return this;
208+
}
209+
187210
/**
188211
* Sets the parent ID of the descriptor
189212
*

0 commit comments

Comments
 (0)