Class AbstractLibrarySupportLoader

    • Constructor Detail

      • AbstractLibrarySupportLoader

        public AbstractLibrarySupportLoader()
    • Method Detail

      • load

        protected abstract void load​(ByteProvider provider,
                                     LoadSpec loadSpec,
                                     java.util.List<Option> options,
                                     Program program,
                                     MemoryConflictHandler handler,
                                     TaskMonitor monitor,
                                     MessageLog log)
                              throws CancelledException,
                                     java.io.IOException
        Loads bytes in a particular format into the given Program.
        Parameters:
        provider - The bytes to load.
        loadSpec - The LoadSpec to use during load.
        options - The load options.
        program - The Program to load into.
        handler - How to handle memory conflicts that occur during the load.
        monitor - A cancelable task monitor.
        log - The message log.
        Throws:
        java.io.IOException - if there was an IO-related problem loading.
        CancelledException - if the user cancelled the load.
      • loadProgram

        protected java.util.List<Program> loadProgram​(ByteProvider provider,
                                                      java.lang.String programName,
                                                      DomainFolder programFolder,
                                                      LoadSpec loadSpec,
                                                      java.util.List<Option> options,
                                                      MessageLog log,
                                                      java.lang.Object consumer,
                                                      TaskMonitor monitor)
                                               throws CancelledException,
                                                      java.io.IOException
        Description copied from class: AbstractProgramLoader
        Loads program bytes in a particular format as a new Program. Multiple Programs may end up getting created, depending on the nature of the format.
        Specified by:
        loadProgram in class AbstractProgramLoader
        Parameters:
        provider - The bytes to load.
        programName - The name of the Program that's being loaded.
        programFolder - The DomainFolder where the loaded thing should be saved. Could be null if the thing should not be pre-saved.
        loadSpec - The LoadSpec to use during load.
        options - The load options.
        log - The message log.
        consumer - A consumer object for Programs generated.
        monitor - A cancelable task monitor.
        Returns:
        A list of loaded Programs (element 0 corresponds to primary loaded Program).
        Throws:
        CancelledException - if the user cancelled the load.
        java.io.IOException - if there was an IO-related problem loading.
      • loadProgramInto

        protected boolean loadProgramInto​(ByteProvider provider,
                                          LoadSpec loadSpec,
                                          java.util.List<Option> options,
                                          MessageLog log,
                                          Program program,
                                          TaskMonitor monitor,
                                          MemoryConflictHandler memoryConflictHandler)
                                   throws CancelledException,
                                          java.io.IOException
        Description copied from class: AbstractProgramLoader
        Loads program bytes into the specified Program. This method will not create any new Programs. It is only for adding to an existing Program.

        NOTE: The loading that occurs in this method will automatically be done in a transaction.

        Specified by:
        loadProgramInto in class AbstractProgramLoader
        Parameters:
        provider - The bytes to load into the Program.
        loadSpec - The LoadSpec to use during load.
        options - The load options.
        log - The message log.
        program - The Program to load into.
        monitor - A cancelable task monitor.
        memoryConflictHandler - How to handle memory conflicts that occur during the load.
        Returns:
        True if the file was successfully loaded; otherwise, false.
        Throws:
        CancelledException - if the user cancelled the load.
        java.io.IOException - if there was an IO-related problem loading.
      • validateOptions

        public java.lang.String validateOptions​(ByteProvider provider,
                                                LoadSpec loadSpec,
                                                java.util.List<Option> options)
        Description copied from interface: Loader
        Validates the Loader's options and returns null if all options are valid; otherwise, an error message describing the problem is returned.
        Specified by:
        validateOptions in interface Loader
        Overrides:
        validateOptions in class AbstractProgramLoader
        Parameters:
        provider - The bytes of the thing being loaded.
        loadSpec - The proposed LoadSpec.
        options - The list of Options to validate.
        Returns:
        null if all Options are valid; otherwise, an error message describing the problem is returned.
      • getTier

        public LoaderTier getTier()
        Description copied from interface: Loader
        For ordering purposes; lower tier numbers are more important (and listed first).
        Returns:
        the tier of the loader
      • getTierPriority

        public int getTierPriority()
        Description copied from interface: Loader
        For ordering purposes; lower numbers are more important (and listed first, within its tier).
        Returns:
        the ordering of the loader within its tier
      • postLoadProgramFixups

        protected void postLoadProgramFixups​(java.util.List<Program> loadedPrograms,
                                             DomainFolder folder,
                                             java.util.List<Option> options,
                                             MessageLog messageLog,
                                             TaskMonitor monitor)
                                      throws CancelledException,
                                             java.io.IOException
        Description copied from class: AbstractProgramLoader
        This gets called after the given list of s is finished loading. It provides subclasses an opportunity to do follow-on actions to the load.
        Overrides:
        postLoadProgramFixups in class AbstractProgramLoader
        Parameters:
        loadedPrograms - The Programs that got loaded.
        folder - The folder the programs were loaded to.
        options - The load options.
        messageLog - The message log.
        monitor - A cancelable task monitor.
        Throws:
        CancelledException - if the user cancelled the load.
        java.io.IOException - if there was an IO-related problem loading.
      • isCaseInsensitiveLibraryFilenames

        protected boolean isCaseInsensitiveLibraryFilenames()
        Specifies if the library filenames specified by this loader should be exact case match or case-insensitive.

        Derived loader classes should override this method and specify if the OS that normally handles this type of binary is case-insensitive.

        Returns:
        - true if case-insensitive or false if case-sensitive.
      • findAlreadyImportedLibrary

        protected DomainFile findAlreadyImportedLibrary​(java.lang.String libPathFilename,
                                                        DomainFolder domainFolder)
        Find the libPathFilename within the specified importFolder. This method will handle relative path normalization.

        If libPathFilename is a simple name without any path separators, only the importFolder folder will be searched.

        If libPathFilename has a path, it will be treated as a relative path under importFolder and if found that DomainFile will be returned.

        If libPathFilename has a path and it wasn't found under importFolder, the filename part of libPathFilename will be used to search the importFolder for matches.

        Parameters:
        libPathFilename - String path with filename of the library to find
        domainFolder - DomainFolder folder within which imported libraries will be searched. If null this method will return null.
        Returns:
        found DomainFile or null if not found