@@ -24,7 +24,7 @@ public abstract class ProcessingSource
2424 private readonly HashSet < TableDescriptor > metadataTables ;
2525 private readonly ReadOnlyHashSet < TableDescriptor > metadataTablesRO ;
2626
27- // todo: when the constructor that takes a table provider is removed in v2, this should
27+ // todo: when the constructor that takes a table provider is removed in v2, this should
2828 // be removed.
2929 private readonly IProcessingSourceTableProvider tableProvider ;
3030
@@ -51,7 +51,7 @@ protected ProcessingSource()
5151 /// requests the Engine to enable or build a <see cref="TableDescriptor"/> that is in this list, the
5252 /// <see cref="TableDescriptor"/> will be passed into
5353 /// <see cref="ICustomDataProcessor.EnableTable(TableDescriptor)"/> or
54- /// <see cref="ICustomDataProcessor.BuildTable(TableDescriptor, ITableBuilder)"/> for the
54+ /// <see cref="ICustomDataProcessor.BuildTable(TableDescriptor, ITableBuilder)"/> for the
5555 /// <see cref="ICustomDataProcessor"/> returned from
5656 /// <see cref="ProcessingSource.CreateProcessor(IDataSource, IProcessorEnvironment, ProcessorOptions)"/>
5757 /// or
@@ -273,7 +273,7 @@ protected abstract ICustomDataProcessor CreateProcessorCore(
273273 IEnumerable < IDataSource > dataSources ,
274274 IProcessorEnvironment processorEnvironment ,
275275 ProcessorOptions options ) ;
276-
276+
277277 /// <summary>
278278 /// When implemented in a derived class, creates a new
279279 /// instance implementing <see cref="ICustomDataProcessor"/>
@@ -308,9 +308,9 @@ protected virtual ICustomDataProcessor CreateProcessorCore(
308308 throw new InvalidOperationException (
309309 $ "Prior to V2, you must override the { nameof ( CreateProcessorCore ) } which accepts a { nameof ( IDataSourceGroup ) } when implementing { nameof ( IDataSourceGrouper ) } ") ;
310310 }
311-
311+
312312 this . Logger . Warn ( $ "{ this . GetType ( ) . Name } does not support processing user-specified processing groups - falling back to default processing.") ;
313-
313+
314314 // Call v1 methods for now
315315 if ( ! ( dataSourceGroup . ProcessingMode is DefaultProcessingMode ) )
316316 {
@@ -354,6 +354,25 @@ protected virtual void SetLoggerCore(ILogger logger)
354354 {
355355 }
356356
357+ /// <summary>
358+ /// Refreshes the tables expoed by this <see cref="ProcessingSource"/>. This method
359+ /// will re-run the <see cref="IProcessingSourceTableProvider"/> associated with
360+ /// this <see cref="ProcessingSource"/> and update <see cref="DataTables"/> and
361+ /// <see cref="MetadataTables"/> accordingly.
362+ /// </summary>
363+ /// <exception cref="InvalidOperationException">
364+ /// The application environment has not yet been set.
365+ /// </exception>
366+ protected void RefreshTables ( )
367+ {
368+ if ( this . ApplicationEnvironment == null )
369+ {
370+ throw new InvalidOperationException ( "The application environment has not been set." ) ;
371+ }
372+
373+ this . InitializeAllTables ( this . ApplicationEnvironment . Serializer ) ;
374+ }
375+
357376 /// <summary>
358377 /// A derived class may implement this to provide a custom <see cref="IProcessingSourceTableProvider"/>.
359378 /// </summary>
@@ -369,6 +388,9 @@ private void InitializeAllTables(ITableConfigurationsSerializer tableConfigSeria
369388 {
370389 Debug . Assert ( tableConfigSerializer != null ) ;
371390
391+ this . allTables . Clear ( ) ;
392+ this . metadataTables . Clear ( ) ;
393+
372394 IProcessingSourceTableProvider tableProvider = CreateTableProvider ( ) ;
373395 if ( tableProvider == null )
374396 {
0 commit comments