Skip to content

Commit 057a18e

Browse files
committed
tmf: extend api for configuration 5
1 parent db1f3e5 commit 057a18e

1 file changed

Lines changed: 24 additions & 8 deletions

File tree

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

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
import com.google.gson.JsonParseException;
2727

2828
/**
29-
*
29+
* This class meant to be extended by data provider factories that want to be
30+
* able to handle configurations.
3031
*/
3132
public abstract class AbstractTmfDataProviderConfigurator implements ITmfDataProviderConfigurator{
3233
/**
@@ -48,16 +49,16 @@ protected Table<String, ITmfTrace, ITmfConfiguration> getConfigurationTable(){
4849
public @NonNull IDataProviderDescriptor createDataProviderDescriptors(ITmfTrace trace, ITmfConfiguration configuration) throws TmfConfigurationException {
4950

5051
if (configuration.getName().equals(TmfConfiguration.UNKNOWN)) {
51-
throw new TmfConfigurationException("Missing configuration name of InAndOut analysis"); //$NON-NLS-1$
52+
throw new TmfConfigurationException("Missing configuration name"); //$NON-NLS-1$
5253
}
5354

5455
if (configuration.getSourceTypeId().equals(TmfConfiguration.UNKNOWN)) {
55-
throw new TmfConfigurationException("Missing configuration type for InAndOut analysis"); //$NON-NLS-1$
56+
throw new TmfConfigurationException("Missing configuration type"); //$NON-NLS-1$
5657
}
5758

5859
String description = configuration.getDescription();
5960
if (configuration.getDescription().equals(TmfConfiguration.UNKNOWN)) {
60-
description = "InAndOut Analysis defined by configuration " + configuration.getName(); //$NON-NLS-1$
61+
description = "Data provider defined by configuration " + configuration.getName(); //$NON-NLS-1$
6162
}
6263

6364
TmfConfiguration.Builder builder = new TmfConfiguration.Builder();
@@ -80,15 +81,22 @@ protected Table<String, ITmfTrace, ITmfConfiguration> getConfigurationTable(){
8081

8182
/**
8283
* @param config
84+
* a configuration
8385
* @return A data provider descriptor based on the configuration parameter
8486
*/
8587
protected abstract IDataProviderDescriptor getDescriptorFromConfig(ITmfConfiguration config);
8688

8789
/**
88-
* This is the method that handles what happens when a configuration is applied
90+
* This is the method that handles what happens when a configuration is
91+
* applied
92+
*
8993
* @param trace
94+
* trace to which the configuration should be applied
9095
* @param config
96+
* the configuration to be applied
9197
* @param writeConfig
98+
* true if the configuration should be written to disk, false
99+
* otherwise
92100
*/
93101
protected abstract void applyConfiguration(ITmfTrace trace, ITmfConfiguration config, boolean writeConfig);
94102

@@ -109,9 +117,13 @@ public void removeDataProviderDescriptor(ITmfTrace trace, IDataProviderDescripto
109117
}
110118

111119
/**
112-
* This is the method that handles what happens when a configuration is removed (e.g. remove analysis, dp etc)
120+
* This is the method that handles what happens when a configuration is
121+
* removed (e.g. remove analysis, dp etc)
122+
*
113123
* @param trace
124+
* trace to which the configuration should be applied
114125
* @param config
126+
* the configuration to be applied
115127
*/
116128
protected abstract void removeConfiguration(@NonNull ITmfTrace trace, @NonNull ITmfConfiguration config);
117129

@@ -141,8 +153,7 @@ public void traceOpened(TmfTraceOpenedSignal signal) {
141153
readAndApplyConfiguration(trace, configs);
142154
}
143155
} catch (TmfConfigurationException e) {
144-
// FIXME: use proper logging
145-
// Activator.logError("Error applying configurations for trace " + trace.getName(), e); //$NON-NLS-1$
156+
Activator.logError("Error applying configurations for trace " + trace.getName(), e); //$NON-NLS-1$
146157
}
147158
}
148159

@@ -220,6 +231,11 @@ protected static void writeConfiguration(ITmfConfiguration configuration, IPath
220231
}
221232
}
222233

234+
/**
235+
* @param trace
236+
* the trace to which the configuration should be applied to
237+
* @return the path where the configuration should be stored
238+
*/
223239
@SuppressWarnings("null")
224240
protected @NonNull abstract IPath getConfigurationRootFolder(@NonNull ITmfTrace trace);
225241

0 commit comments

Comments
 (0)