Interface SourceProvider

All Known Implementing Classes:
AbstractSingleIncludeSourcePathSourceProvider, AbstractSingleIncludeSourceProvider, AbstractSourcePathSourceProvider, AbstractSourceProvider, FileSourceProvider, SingleIncludeNonRelativeSourceProvider, SingleIncludeSourcePathNonRelativeSourceProvider, StringSourceProvider

public interface SourceProvider
A source provider gives a reader for a source based upon the name of the source.

When source files reference each other the source provider may alter its behavior finding the source based on which source is referencing the other source.

For example you want to get a reader to the source named myProg.sb This program may include using the include statement inc/incProg.sb. The second file is in the directory inc. If that file includes myProg.sb then source provider may provide a reader to the file inc/myProg.sb.

Source providers may provide readers reading the source from files, database, svn and other locations.

NOTE: Although the source can come from different sources, the aim is to have a naming in the BASIC source code that hides the physical source of the code. Therefore the referencing source is also given as String and not abstracted to a class. The simplest and implemented case is to think it as the file name absolute or relative to the main source file. In case the source comes from some other type of source like DB then similar naming scheme should be implemented so that the programs are more or less portable.

Author:
Peter Verhas
  • Method Summary

    Modifier and Type
    Method
    Description
    get(String sourceName)
    Get a reader to a source when there is no referencing source.
    get(String sourceName, String referencingSource)
    Get a reader to a source specifying the source that references this source.
  • Method Details

    • get

      SourceReader get(String sourceName) throws IOException
      Get a reader to a source when there is no referencing source. This is the main source.
      Parameters:
      sourceName - the name of the source
      Returns:
      reader reading the source file.
      Throws:
      IOException - in case of exception
    • get

      SourceReader get(String sourceName, String referencingSource) throws IOException
      Get a reader to a source specifying the source that references this source.
      Parameters:
      sourceName - the name of the source to get the reader to.
      referencingSource - the name of the source that is referencing the source to read.
      Returns:
      return value
      Throws:
      IOException - in case of exception