Interface SourceProvider
-
- All Known Implementing Classes:
AbstractSingleIncludeSourcePathSourceProvider,AbstractSingleIncludeSourceProvider,AbstractSourcePathSourceProvider,AbstractSourceProvider,FileSourceProvider,SingleIncludeNonRelativeSourceProvider,SingleIncludeSourcePathNonRelativeSourceProvider,StringSourceProvider
public interface SourceProviderA 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.sbThis program may include using theincludestatementinc/incProg.sb. The second file is in the directoryinc. If that file includesmyProg.sbthen source provider may provide a reader to the fileinc/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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description SourceReaderget(java.lang.String sourceName)Get a reader to a source when there is no referencing source.SourceReaderget(java.lang.String sourceName, java.lang.String referencingSource)Get a reader to a source specifying the source that references this source.
-
-
-
Method Detail
-
get
SourceReader get(java.lang.String sourceName) throws java.io.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:
java.io.IOException- in case of exception
-
get
SourceReader get(java.lang.String sourceName, java.lang.String referencingSource) throws java.io.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:
java.io.IOException- in case of exception
-
-