Class ExtensionDetails

java.lang.Object
ghidra.util.extensions.ExtensionDetails
All Implemented Interfaces:
Comparable<ExtensionDetails>

public class ExtensionDetails extends Object implements Comparable<ExtensionDetails>
Representation of a Ghidra extension. This class encapsulates all information required to uniquely identify an extension and where (or if) it has been installed.

Note that hashCode and equals have been implemented for this. Two extension descriptions are considered equal if they have the same name attribute; all other fields are unimportant except for display purposes.

  • Constructor Details

    • ExtensionDetails

      public ExtensionDetails(String name, String description, String author, String createdOn, String version)
      Constructor.
      Parameters:
      name - unique name of the extension; cannot be null
      description - brief explanation of what the extension does; can be null
      author - creator of the extension; can be null
      createdOn - creation date of the extension, can be null
      version - the extension version
  • Method Details

    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • getInstallPath

      public String getInstallPath()
      Returns the location where this extension is installed. If the extension is not installed this will be null.
      Returns:
      the extension path, or null
    • getInstallDir

      public File getInstallDir()
    • setInstallDir

      public void setInstallDir(File installDir)
    • getArchivePath

      public String getArchivePath()
      Returns the location where the extension archive is located. The extension archive concept is not used for all extensions, but is used for delivering extensions as part of a distribution.
      Returns:
      the archive path, or null
      See Also:
    • setArchivePath

      public void setArchivePath(String path)
    • isFromArchive

      public boolean isFromArchive()
    • getName

      public String getName()
    • setName

      public void setName(String name)
    • getDescription

      public String getDescription()
    • setDescription

      public void setDescription(String description)
    • getAuthor

      public String getAuthor()
    • setAuthor

      public void setAuthor(String author)
    • getCreatedOn

      public String getCreatedOn()
    • setCreatedOn

      public void setCreatedOn(String date)
    • getVersion

      public String getVersion()
    • setVersion

      public void setVersion(String version)
    • getLibraries

      public Set<URL> getLibraries()
      Returns URLs for all jar files living in the {extension dir}/lib directory for an installed extension.
      Returns:
      the URLs
    • isInstalled

      public boolean isInstalled()
      An extension is known to be installed if it has a valid installation path AND that path contains a Module.manifest file. Extensions that are isPendingUninstall() are still on the filesystem, may be in use by the tool, but will be removed upon restart.

      Note: The module manifest file is a marker that indicates several things; one of which is the installation status of an extension. When a user marks an extension to be uninstalled via the UI, the only thing that is done is to remove this manifest file, which tells the tool to remove the entire extension directory on the next launch.

      Returns:
      true if the extension is installed.
    • isPendingUninstall

      public boolean isPendingUninstall()
      Returns true if this extension is marked to be uninstalled. The contents of the extension still exist and the tool may still be using the extension, but on restart, the extension will be removed.
      Returns:
      true if marked for uninstall
    • isInstalledInInstallationFolder

      public boolean isInstalledInInstallationFolder()
      Returns true if this extension is installed under an installation folder or inside of a source control repository folder.
      Returns:
      true if this extension is installed under an installation folder or inside of a source control repository folder.
    • markForUninstall

      public boolean markForUninstall()
      Converts the module manifest and extension properties file that are in an installed state to an uninstalled state. Specifically, the following will be renamed:
      • Module.manifest to Module.manifest.uninstalled
      • extension.properties = extension.properties.uninstalled
      Returns:
      false if any renames fail
    • clearMarkForUninstall

      public boolean clearMarkForUninstall()
      A companion method for markForUninstall() that allows extensions marked for cleanup to be restored to the installed state.

      Specifically, the following will be renamed:

      • Module.manifest.uninstalled to Module.manifest
      • extension.properties.uninstalled to extension.properties
      Returns:
      true if successful
    • compareTo

      public int compareTo(ExtensionDetails other)
      Specified by:
      compareTo in interface Comparable<ExtensionDetails>
    • toString

      public String toString()
      Overrides:
      toString in class Object