Package ghidra.util.extensions
Class ExtensionDetails
java.lang.Object
ghidra.util.extensions.ExtensionDetails
- All Implemented Interfaces:
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
A companion method formarkForUninstall()
that allows extensions marked for cleanup to be restored to the installed state.int
compareTo
(ExtensionDetails other) boolean
Returns the location where the extension archive is located.Returns the location where this extension is installed.Returns URLs for all jar files living in the {extension dir}/lib directory for an installed extension.getName()
int
hashCode()
boolean
boolean
An extension is known to be installed if it has a valid installation path AND that path contains a Module.manifest file.boolean
Returns true if this extension is installed under an installation folder or inside of a source control repository folder.boolean
Returns true if this extension is marked to be uninstalled.boolean
Converts the module manifest and extension properties file that are in an installed state to an uninstalled state.void
setArchivePath
(String path) void
void
setCreatedOn
(String date) void
setDescription
(String description) void
setInstallDir
(File installDir) void
void
setVersion
(String version) toString()
-
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 nulldescription
- brief explanation of what the extension does; can be nullauthor
- creator of the extension; can be nullcreatedOn
- creation date of the extension, can be nullversion
- the extension version
-
-
Method Details
-
hashCode
public int hashCode() -
equals
-
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
-
setInstallDir
-
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
-
isFromArchive
public boolean isFromArchive() -
getName
-
setName
-
getDescription
-
setDescription
-
getAuthor
-
setAuthor
-
getCreatedOn
-
setCreatedOn
-
getVersion
-
setVersion
-
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 areisPendingUninstall()
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 formarkForUninstall()
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
- Specified by:
compareTo
in interfaceComparable<ExtensionDetails>
-
toString
-