@@ -66,17 +66,17 @@ protected Table<String, ITmfTrace, ITmfConfiguration> getConfigurationTable(){
6666 return fTmfConfigurationTable ;
6767 }
6868
69- @ Override
70- public @ NonNull IDataProviderDescriptor createDataProviderDescriptors ( ITmfTrace trace , ITmfConfiguration configuration ) throws TmfConfigurationException {
71-
72- if ( configuration . getName (). equals ( TmfConfiguration . UNKNOWN )) {
73- throw new TmfConfigurationException ( "Missing configuration name" ); //$NON-NLS-1$
74- }
75-
76- if ( configuration . getSourceTypeId (). equals ( TmfConfiguration . UNKNOWN )) {
77- throw new TmfConfigurationException ( "Missing configuration type" ); //$NON-NLS-1$
78- }
79-
69+ /**
70+ * Create instances implementing {@link ITmfConfiguration}. Override this
71+ * method if the data provider configurator needs another configuration
72+ * instead of the default {@link TmfConfiguration}
73+ *
74+ * @param configuration
75+ * a object implementing implementing {@link ITmfConfiguration}.
76+ * @return the instance of the class implementing {@link ITmfConfiguration}.
77+ * Default is {@link TmfConfiguration}.
78+ */
79+ protected ITmfConfiguration createConfiguration ( ITmfConfiguration configuration ) {
8080 String description = configuration .getDescription ();
8181 if (configuration .getDescription ().equals (TmfConfiguration .UNKNOWN )) {
8282 description = "Data provider defined by configuration " + configuration .getName (); //$NON-NLS-1$
@@ -89,8 +89,21 @@ protected Table<String, ITmfTrace, ITmfConfiguration> getConfigurationTable(){
8989 .setDescription (description )
9090 .setParameters (configuration .getParameters ())
9191 .build ();
92+ return builder .build ();
93+ }
94+
95+ @ Override
96+ public @ NonNull IDataProviderDescriptor createDataProviderDescriptors (ITmfTrace trace , ITmfConfiguration configuration ) throws TmfConfigurationException {
97+
98+ if (configuration .getName ().equals (TmfConfiguration .UNKNOWN )) {
99+ throw new TmfConfigurationException ("Missing configuration name" ); //$NON-NLS-1$
100+ }
101+
102+ if (configuration .getSourceTypeId ().equals (TmfConfiguration .UNKNOWN )) {
103+ throw new TmfConfigurationException ("Missing configuration type" ); //$NON-NLS-1$
104+ }
92105
93- ITmfConfiguration config = builder . build ( );
106+ ITmfConfiguration config = createConfiguration ( configuration );
94107
95108 applyConfiguration (trace , config , true );
96109 if (fTmfConfigurationTable .contains (config .getId (), trace )) {
@@ -168,11 +181,10 @@ public void traceOpened(TmfTraceOpenedSignal signal) {
168181 List <ITmfConfiguration > configs = readConfigurations (tr );
169182 readAndApplyConfiguration (trace , configs );
170183 }
171- } else {
172- // Read configurations trace
173- List <ITmfConfiguration > configs = readConfigurations (trace );
174- readAndApplyConfiguration (trace , configs );
175184 }
185+ // Read configurations from trace or top level experiment
186+ List <ITmfConfiguration > configs = readConfigurations (trace );
187+ readAndApplyConfiguration (trace , configs );
176188 } catch (TmfConfigurationException e ) {
177189 Activator .logError ("Error applying configurations for trace " + trace .getName (), e ); //$NON-NLS-1$
178190 }
0 commit comments