Class ProgramLoader.Builder
- Enclosing class:
ProgramLoader
Program load-
Method Summary
Modifier and TypeMethodDescriptionaddLoaderArg(String name, String value) Adds the givenLoaderargument to use during import.compiler(CompilerSpec cspec) Sets the compiler to use during import.Sets the compiler to use during import.Sets the compiler to use during import.Sets the language to use during import.language(LanguageID id) Sets the language to use during import.Sets the language to use during import.load()Loads the specifiedsourcewith thisProgramLoader.Builder's current configurationloaderArgs(List<Pair<String, String>> args) Sets theLoaderarguments to use during import.Sets the acceptableLoaderto use during import.Sets the acceptableLoaderto use during import.Sets the acceptableLoaders to use during import.Sets theLoaders to use during import.log(MessageLog messageLog) Sets thelogto use during import.mirror(boolean shouldMirror) Sets whether or not the absolute filesystem path of eachLoadedProgramshould be mirrored in the project, rooted at the specifiedproject folder path.monitor(TaskMonitor mon) Sets theTaskMonitorto use during import.Sets the name to use for the importedProgram.Sets theProject.projectFolderPath(String path) Sets the project folder path to load into.source(byte[] b) Sets the required import source to the given bytesSets the required import source to the givenByteProvider.Sets the required import source to the givenFSRLSets the required import source to the givenFileSets the required import source to the given filesystem path
-
Method Details
-
source
Sets the required import source to the givenByteProvider.NOTE: Any previously defined sources will be overwritten.
NOTE: Ownership of the given
ByteProvideris not transfered to thisProgramLoader.Builder, so it is the responsibility of the caller to properlycloseit when done.- Parameters:
p- TheByteProviderto import. Anullvalue will unset the source.- Returns:
- This
ProgramLoader.Builder
-
source
Sets the required import source to the givenFSRLNOTE: Any previously defined sources will be overwritten
- Parameters:
f- TheFSRLto import. Anullvalue will unset the source.- Returns:
- This
ProgramLoader.Builder
-
source
Sets the required import source to the givenFileNOTE: Any previously defined sources will be overwritten
- Parameters:
f- TheFileto import. Anullvalue will unset the source.- Returns:
- This
ProgramLoader.Builder
-
source
Sets the required import source to the given bytesNOTE:
load()will fail if aname(String)is not setNOTE: Any previously defined sources will be overwritten
- Parameters:
b- The bytes to import. Anullvalue will unset the source.- Returns:
- This
ProgramLoader.Builder
-
source
Sets the required import source to the given filesystem pathNOTE: Any previously defined sources will be overwritten
- Parameters:
path- The filesystem path to import. Anullvalue will unset the source.- Returns:
- This
ProgramLoader.Builder
-
project
Sets theProject. Loaders can use this to take advantage of existingDomainFolders andDomainFiles to do custom behaviors such as loading libraries.By default, no
Projectis associated with theProgramLoader.- Parameters:
p- TheProject. Anullvalue will unset the project.- Returns:
- This
ProgramLoader.Builder
-
projectFolderPath
Sets the project folder path to load into.The default project folder path is the root of the project (
"/").- Parameters:
path- The project folder path. Anullvalue will revert the path back to the default value of ("/").- Returns:
- This
ProgramLoader.Builder
-
mirror
Sets whether or not the absolute filesystem path of eachLoadedProgramshould be mirrored in the project, rooted at the specifiedproject folder path.By default, mirroring is off.
- Parameters:
shouldMirror- True if filesystem mirroring should happen; otherwise, false.- Returns:
- This
ProgramLoader.Builder
-
name
- Parameters:
name- The name to use for the importedProgram. Anullvalue will revert the name to theLoader's preferred name.- Returns:
- This
ProgramLoader.Builder
-
loaders
Sets the acceptableLoaders to use during import.By default, all
Loaders are accepted (LoaderService.ACCEPT_ALL).- Parameters:
filter- A filter used to limit theLoaders used during import. Anullvalue will revert back to the default (LoaderService.ACCEPT_ALL).- Returns:
- This
ProgramLoader.Builder
-
loaders
Sets the acceptableLoaderto use during import.By default, all
Loaders are accepted (LoaderService.ACCEPT_ALL).- Parameters:
cls- The class of theLoaderto use during import. Anullvalue will revert back to the default (LoaderService.ACCEPT_ALL).- Returns:
- This
ProgramLoader.Builder
-
loaders
Sets the acceptableLoaderto use during import.By default, all
Loaders are accepted (LoaderService.ACCEPT_ALL).- Parameters:
clsName- The class name of theLoaderto use during import. Anullvalue will revert back to the default (LoaderService.ACCEPT_ALL).- Returns:
- This
ProgramLoader.Builder - Throws:
InvalidInputException- if the given loader class name did not correspond to aLoader
-
loaders
Sets theLoaders to use during import.By default, all
Loaders are accepted (LoaderService.ACCEPT_ALL).- Parameters:
cls- AListof classes ofLoaders to use during import. Anullvalue will revert back to the default (LoaderService.ACCEPT_ALL).- Returns:
- This
ProgramLoader.Builder
-
loaderArgs
- Parameters:
args- AListofLoaderargument name/valuePairs to use during import. Anullvalue will result in noLoaderarguments being used.- Returns:
- This
ProgramLoader.Builder
-
addLoaderArg
Adds the givenLoaderargument to use during import.- Parameters:
name- A singleLoaderargument name to use during import.value- The value that corresponds to the argumentname- Returns:
- This
ProgramLoader.Builder
-
language
Sets the language to use during import.By default, the first "preferred" language is used.
- Parameters:
id- The language id to use during import. Anullvalue will result in the first "preferred" language being used.- Returns:
- This
ProgramLoader.Builder
-
language
Sets the language to use during import.By default, the first "preferred" language is used.
- Parameters:
id- TheLanguageIDto use during import. Anullvalue will result in the first "preferred" language being used.- Returns:
- This
ProgramLoader.Builder
-
language
Sets the language to use during import.By default, the first "preferred" language is used.
- Parameters:
language- TheLanguageto use during import. Anullvalue will result in the first "preferred" language being used.- Returns:
- This
ProgramLoader.Builder
-
compiler
Sets the compiler to use during import.By default, the processor's default compiler is used.
- Parameters:
id- The compiler spec id to use during import. Anullvalue will result in the language's default compiler being used.- Returns:
- This
ProgramLoader.Builder
-
compiler
Sets the compiler to use during import.By default, the processor's default compiler is used.
- Parameters:
id- TheCompilerSpecIDto use during import. Anullvalue will result in the language's default compiler being used.- Returns:
- This
ProgramLoader.Builder
-
compiler
Sets the compiler to use during import.By default, the processor's default compiler is used.
- Parameters:
cspec- TheCompilerSpecto use during import. Anullvalue will result in the language's default compiler being used.- Returns:
- This
ProgramLoader.Builder
-
log
Sets thelogto use during import.By default, no log is used.
- Parameters:
messageLog- Thelogto use during import. Anullvalue will result in not logging.- Returns:
- This
ProgramLoader.Builder
-
monitor
Sets theTaskMonitorto use during import.By default,
TaskMonitor.DUMMYis used.- Parameters:
mon- TheTaskMonitorto use during import. Anullvalue will result inTaskMonitor.DUMMYbeing used.- Returns:
- This
ProgramLoader.Builder
-
load
public LoadResults<Program> load() throws IOException, LanguageNotFoundException, CancelledException, VersionException, LoadExceptionLoads the specifiedsourcewith thisProgramLoader.Builder's current configuration- Returns:
- The
LoadResultswhich contains one or moreLoadedPrograms (created but not saved) - Throws:
IOException- if there was an IO-related problem loadingLanguageNotFoundException- if there was a problem getting the languageCancelledException- if the operation was cancelledVersionException- if there was an issue with database versions, probably due to a failed language upgradeLoadException- if there was a problem loading
-