Class ExternalManagerDB

    • Constructor Detail

      • ExternalManagerDB

        public ExternalManagerDB​(DBHandle handle,
                                 AddressMap addrMap,
                                 int openMode,
                                 Lock lock,
                                 TaskMonitor monitor)
                          throws CancelledException,
                                 java.io.IOException,
                                 VersionException
        Constructs a new ExternalManagerDB
        Parameters:
        handle - the open database handle
        addrMap - the address map
        openMode - the program open mode.
        lock - the program synchronization lock
        monitor - the progress monitor used when upgrading
        Throws:
        CancelledException - if the user cancelled while an upgrade was occurring
        java.io.IOException - if a database io error occurs.
        VersionException - if the database version does not match the expected version
    • Method Detail

      • setProgram

        public void setProgram​(ProgramDB program)
        Description copied from interface: ManagerDB
        Callback from program used to indicate all manager have been created. When this method is invoked, all managers have been instantiated but may not be fully initialized.
        Specified by:
        setProgram in interface ManagerDB
        Parameters:
        program - the program is set when all the initializations have been completed.
      • programReady

        public void programReady​(int openMode,
                                 int currentRevision,
                                 TaskMonitor monitor)
                          throws java.io.IOException,
                                 CancelledException
        Description copied from interface: ManagerDB
        Callback from program made to each manager after the program has completed initialization. This method may be used by managers to perform additional upgrading which may have been deferred.
        Specified by:
        programReady in interface ManagerDB
        Parameters:
        openMode - the mode that the program is being opened.
        currentRevision - current program revision. If openMode is UPGRADE, this value reflects the pre-upgrade value.
        monitor - the task monitor to use in any upgrade operations.
        Throws:
        java.io.IOException - if a database io error occurs.
        CancelledException - if the user cancelled the operation via the task monitor.
      • invalidateCache

        public void invalidateCache​(boolean all)
                             throws java.io.IOException
        Description copied from interface: ManagerDB
        Clears all data caches.
        Specified by:
        invalidateCache in interface ManagerDB
        Parameters:
        all - if false, some managers may not need to update their cache if they can tell that its not necessary. If this flag is true, then all managers should clear their cache no matter what.
        Throws:
        java.io.IOException - if a database io error occurs.
      • deleteAddressRange

        public void deleteAddressRange​(Address startAddr,
                                       Address endAddr,
                                       TaskMonitor monitor)
                                throws CancelledException
        Description copied from interface: ManagerDB
        Delete all objects which have been applied to the address range startAddr to endAddr and update the database accordingly.
        Specified by:
        deleteAddressRange in interface ManagerDB
        Parameters:
        startAddr - the first address in the range.
        endAddr - the last address in the range.
        monitor - the task monitor to use in any upgrade operations.
        Throws:
        CancelledException - if the user cancelled the operation via the task monitor.
      • moveAddressRange

        public void moveAddressRange​(Address fromAddr,
                                     Address toAddr,
                                     long length,
                                     TaskMonitor monitor)
                              throws CancelledException
        Description copied from interface: ManagerDB
        Move all objects within an address range to a new location.
        Specified by:
        moveAddressRange in interface ManagerDB
        Parameters:
        fromAddr - the first address of the range to be moved.
        toAddr - the address where to the range is to be moved.
        length - the number of addresses to move.
        monitor - the task monitor to use in any upgrade operations.
        Throws:
        CancelledException - if the user cancelled the operation via the task monitor.
      • addExtLocation

        public ExternalLocation addExtLocation​(Namespace extParentNamespace,
                                               java.lang.String extLabel,
                                               Address extAddr,
                                               SourceType sourceType,
                                               boolean reuseExisting)
                                        throws InvalidInputException
        Description copied from interface: ExternalManager
        Get or create an external location in the indicated parent namespace with the specified name.
        Specified by:
        addExtLocation in interface ExternalManager
        Parameters:
        extParentNamespace - the external namespace
        extLabel - the external label
        extAddr - the external address
        sourceType - the source type of this external library's symbol
        reuseExisting - if true, this will return an existing matching external location instead of creating a new one.
        Returns:
        external location
        Throws:
        InvalidInputException
      • addExtFunction

        public ExternalLocation addExtFunction​(Namespace extParentNamespace,
                                               java.lang.String extLabel,
                                               Address extAddr,
                                               SourceType sourceType)
                                        throws InvalidInputException
        Description copied from interface: ExternalManager
        Get or create an external function location associated with an library/file named extName and the label within that file specified by extLabel
        Specified by:
        addExtFunction in interface ExternalManager
        Parameters:
        extParentNamespace - the external namespace
        extLabel - the external label
        extAddr - the external address
        sourceType - the source type of this external library's symbol
        Returns:
        external location
        Throws:
        InvalidInputException
      • addExtFunction

        public ExternalLocation addExtFunction​(Namespace extNamespace,
                                               java.lang.String extLabel,
                                               Address extAddr,
                                               SourceType sourceType,
                                               boolean reuseExisting)
                                        throws InvalidInputException
        Description copied from interface: ExternalManager
        Get or create an external function location associated with an library/file named extName and the label within that file specified by extLabel
        Specified by:
        addExtFunction in interface ExternalManager
        Parameters:
        extNamespace - the external namespace
        extLabel - the external label
        sourceType - the source type of this external library's symbol
        reuseExisting - if true, will return any existing matching location instead of creating a new one. If false, will prefer to create a new one as long as the specified address is not null and not used in an existing location.
        Returns:
        external location
        Throws:
        InvalidInputException
      • getExternalLocations

        public java.util.List<ExternalLocation> getExternalLocations​(Namespace libScope,
                                                                     java.lang.String extLabel)
        Description copied from interface: ExternalManager
        Returns a list of External Locations matching the given label name in the given Namespace.
        Specified by:
        getExternalLocations in interface ExternalManager
        Parameters:
        libScope - the Namespace to search
        extLabel - the name of the labels to search for.
        Returns:
        a list of External Locations matching the given label name in the given Namespace.
      • getExternalLocations

        public java.util.List<ExternalLocation> getExternalLocations​(java.lang.String libraryName,
                                                                     java.lang.String label)
        Description copied from interface: ExternalManager
        Returns a list of External Locations matching the given label name in the given Library.
        Specified by:
        getExternalLocations in interface ExternalManager
        Parameters:
        libraryName - the name of the library
        label - the name of the label
        Returns:
        a list of External Locations matching the given label name in the given Library.
      • getUniqueExternalLocation

        public ExternalLocation getUniqueExternalLocation​(Namespace namespace,
                                                          java.lang.String label)
        Description copied from interface: ExternalManager
        Returns the unique external location associated with the given namespace and label
        Specified by:
        getUniqueExternalLocation in interface ExternalManager
        Parameters:
        namespace - the namespace
        label - the label of the external location
        Returns:
        the unique external location or null
      • getUniqueExternalLocation

        public ExternalLocation getUniqueExternalLocation​(java.lang.String libraryName,
                                                          java.lang.String label)
        Description copied from interface: ExternalManager
        Returns the unique external location associated with the given library name and label
        Specified by:
        getUniqueExternalLocation in interface ExternalManager
        Parameters:
        libraryName - the library name
        label - the label of the external location
        Returns:
        the unique external location or null
      • getExternalLocation

        public ExternalLocation getExternalLocation​(java.lang.String extName,
                                                    java.lang.String extLabel)
        Description copied from interface: ExternalManager
        Get an external location.
        Specified by:
        getExternalLocation in interface ExternalManager
        Parameters:
        extName - the name of the library for which to get an external location
        extLabel - the name of the external location.
        Returns:
        first matching external location
      • getExternalLocation

        public ExternalLocation getExternalLocation​(Namespace extNamespace,
                                                    java.lang.String extLabel)
        Description copied from interface: ExternalManager
        Get an external location.
        Specified by:
        getExternalLocation in interface ExternalManager
        Parameters:
        extNamespace - the namespace containing the external label.
        extLabel - the name of the external location.
        Returns:
        first matching external location
      • getDefaultExternalName

        public static java.lang.String getDefaultExternalName​(SymbolDB sym)
        Get the default name for an external function or code symbol
        Parameters:
        sym -
        Returns:
        default name
      • getExtLocation

        public ExternalLocation getExtLocation​(Address externalAddr)
        Returns the external location associated with the given external address
        Parameters:
        externalAddr - the external address.
      • getExternalLocation

        public ExternalLocation getExternalLocation​(Symbol symbol)
        Description copied from interface: ExternalManager
        Returns the external location associated with the given external symbol
        Specified by:
        getExternalLocation in interface ExternalManager
        Parameters:
        symbol - the external symbol.
        Returns:
        the external location or null
      • removeExternalLocation

        public boolean removeExternalLocation​(Address externalAddr)
        Removes the external location at the given external address
        Parameters:
        externalAddr - the address at which to remove the external location.
      • removeExternalLibrary

        public boolean removeExternalLibrary​(java.lang.String name)
        Description copied from interface: ExternalManager
        Removes external name if no associated ExternalLocation's exist
        Specified by:
        removeExternalLibrary in interface ExternalManager
        Parameters:
        name - external library name
        Returns:
        true if removed, false if unable to due to associated locations/references
      • contains

        public boolean contains​(java.lang.String libraryName)
        Description copied from interface: ExternalManager
        Determines if the indicated external library name is being managed (exists).
        Specified by:
        contains in interface ExternalManager
        Parameters:
        libraryName - the external library name
        Returns:
        true if the name is defined (whether it has a path or not).
      • getExternalLibraryNames

        public java.lang.String[] getExternalLibraryNames()
        Description copied from interface: ExternalManager
        Returns an array of all external names for which locations have been defined.
        Specified by:
        getExternalLibraryNames in interface ExternalManager
        Returns:
        array of external names
      • getExternalLibrary

        public Library getExternalLibrary​(java.lang.String name)
        Description copied from interface: ExternalManager
        Get the Library which corresponds to the specified name
        Specified by:
        getExternalLibrary in interface ExternalManager
        Parameters:
        name - name of library
        Returns:
        library or null if not found
      • getExternalLibraryPath

        public java.lang.String getExternalLibraryPath​(java.lang.String externalName)
        Description copied from interface: ExternalManager
        Returns the file pathname associated with an external name. Null is returned if either the external name does not exist or a pathname has not been set.
        Specified by:
        getExternalLibraryPath in interface ExternalManager
        Parameters:
        externalName - external name
        Returns:
        project file pathname or null
      • setExternalPath

        public void setExternalPath​(java.lang.String externalName,
                                    java.lang.String externalPath,
                                    boolean userDefined)
                             throws InvalidInputException
        Description copied from interface: ExternalManager
        Sets the file pathname associated with an existing external name.
        Specified by:
        setExternalPath in interface ExternalManager
        Parameters:
        externalName - the name of the library to associate with a file.
        externalPath - the path to the program to be associated with the library name.
        userDefined - true if the external path is being specified by the user
        Throws:
        InvalidInputException
      • getExternalLocations

        public ExternalLocationIterator getExternalLocations​(java.lang.String externalName)
        Description copied from interface: ExternalManager
        Get an iterator over all external locations associated with the specified externalName.
        Specified by:
        getExternalLocations in interface ExternalManager
        Parameters:
        externalName - the name of the library to get locations for
        Returns:
        external location iterator