Package ghidra.framework.data
Class LinkHandler<T extends DomainObjectAdapterDB>
java.lang.Object
ghidra.framework.data.DBContentHandler<T>
ghidra.framework.data.LinkHandler<T>
- Type Parameters:
T
-URLLinkObject
implementation class
- All Implemented Interfaces:
ContentHandler<T>
,ExtensionPoint
- Direct Known Subclasses:
DataTypeArchiveLinkContentHandler
,FolderLinkContentHandler
,ProgramLinkContentHandler
NOTE: ALL ContentHandler implementations MUST END IN "ContentHandler". If not,
the ClassSearcher will not find them.
LinkHandler
defines an application interface for handling domain files which are
shortcut links to another supported content type.-
Field Summary
Fields inherited from interface ghidra.framework.data.ContentHandler
MISSING_CONTENT, UNKNOWN_CONTENT
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected final void
createLink
(URL ghidraUrl, LocalFileSystem fs, String folderPath, String linkFilename) Create a link file using the specified URLfinal ChangeSet
getChangeSet
(FolderItem versionedFolderItem, int olderVersion, int newerVersion) Returns the object change data which includes changes made to the specified olderVersion through to the specified newerVersion.final T
getDomainObject
(FolderItem item, FileSystem userfs, long checkoutId, boolean okToUpgrade, boolean okToRecover, Object consumer, TaskMonitor monitor) Open a folder item for update.abstract Icon
getIcon()
Get the base icon for this link-file which does not include the link overlay icon.getImmutableObject
(FolderItem item, Object consumer, int version, int minChangeVersion, TaskMonitor monitor) Open a folder item for immutable use.final DomainObjectMergeManager
getMergeManager
(DomainObject resultsObj, DomainObject sourceObj, DomainObject originalObj, DomainObject latestObj) Get an instance of a suitable merge manager to be used during the merge of a Versioned object which has been modified by another user since it was last merged or checked-out.final T
getReadOnlyObject
(FolderItem item, int version, boolean okToUpgrade, Object consumer, TaskMonitor monitor) Open a folder item for read-only use.static URL
getURL
(DomainFile linkFile) Get the link URL which corresponds to the specified link file.final boolean
Returns true if the content type is always private (i.e., can not be added to the versioned filesystem).Methods inherited from class ghidra.framework.data.DBContentHandler
abortCreate, createFile
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface ghidra.framework.data.ContentHandler
canResetDBSourceFile, createFile, getContentType, getContentTypeDisplayString, getDefaultToolName, getDomainObjectClass, getLinkHandler, resetDBSourceFile
-
Field Details
-
URL_METADATA_KEY
- See Also:
-
LINK_ICON
-
-
Constructor Details
-
LinkHandler
public LinkHandler()
-
-
Method Details
-
createLink
protected final void createLink(URL ghidraUrl, LocalFileSystem fs, String folderPath, String linkFilename) throws IOException, InvalidNameException Create a link file using the specified URL- Parameters:
ghidraUrl
- link URL (must be a Ghidra URL - seeGhidraURL
).fs
- filesystem where link file should be createdfolderPath
- folder path which should contain link filelinkFilename
- link filename- Throws:
IOException
- if an IO error occursInvalidNameException
- if invalid folderPath or linkFilename specified
-
getReadOnlyObject
public final T getReadOnlyObject(FolderItem item, int version, boolean okToUpgrade, Object consumer, TaskMonitor monitor) throws IOException, VersionException, CancelledException Description copied from interface:ContentHandler
Open a folder item for read-only use. While changes are permitted on the returned object, the original folder item may not be overwritten / updated.- Parameters:
item
- stored folder itemversion
- version of the stored folder item to be opened. DomainFile.DEFAULT_VERSION should be specified when not opening a specific file version.okToUpgrade
- if true a version upgrade to the content will be done if necessary.consumer
- consumer of the returned objectmonitor
- the monitor that allows the user to cancel- Returns:
- read-only domain object
- Throws:
IOException
- if an IO or folder item access error occursVersionException
- if unable to handle file content due to version difference which could not be handled.CancelledException
- if operation is cancelled by user
-
getImmutableObject
public T getImmutableObject(FolderItem item, Object consumer, int version, int minChangeVersion, TaskMonitor monitor) throws IOException, CancelledException, VersionException Description copied from interface:ContentHandler
Open a folder item for immutable use. If any changes are attempted on the returned object, an IllegalStateException state exception may be thrown.- Parameters:
item
- stored folder itemconsumer
- consumer of the returned objectversion
- version of the stored folder item to be opened. DomainFile.DEFAULT_VERSION (-1) should be specified when not opening a specific file version.minChangeVersion
- the minimum version which should be included in the change set for the returned object. A value of -1 indicates the default change set.monitor
- the monitor that allows the user to cancel- Returns:
- immutable domain object
- Throws:
IOException
- if an IO or folder item access error occursCancelledException
- if operation is cancelled by userVersionException
- if unable to handle file content due to version difference which could not be handled.
-
getDomainObject
public final T getDomainObject(FolderItem item, FileSystem userfs, long checkoutId, boolean okToUpgrade, boolean okToRecover, Object consumer, TaskMonitor monitor) throws IOException, CancelledException, VersionException Description copied from interface:ContentHandler
Open a folder item for update. Changes made to the returned object may be saved to the original folder item.- Parameters:
item
- stored folder itemuserfs
- file system which contains associated user datacheckoutId
- an appropriate checout ID required to update the specified folder item.okToUpgrade
- if true a version upgrade to the content will be done if necessary.okToRecover
- if true an attempt to recover any unsaved changes resulting from a crash will be attempted.consumer
- consumer of the returned objectmonitor
- cancelable task monitor- Returns:
- updateable domain object
- Throws:
IOException
- if an IO or folder item access error occursCancelledException
- if operation is cancelled by userVersionException
- if unable to handle file content due to version difference which could not be handled.
-
getChangeSet
public final ChangeSet getChangeSet(FolderItem versionedFolderItem, int olderVersion, int newerVersion) throws VersionException, IOException Description copied from interface:ContentHandler
Returns the object change data which includes changes made to the specified olderVersion through to the specified newerVersion.- Parameters:
versionedFolderItem
- versioned folder itemolderVersion
- the older version numbernewerVersion
- the newer version number- Returns:
- the set of changes that were made
- Throws:
VersionException
- if a database version change prevents reading of data.IOException
- if an IO or folder item access error occurs or change set was produced by newer version of software and can not be read
-
getMergeManager
public final DomainObjectMergeManager getMergeManager(DomainObject resultsObj, DomainObject sourceObj, DomainObject originalObj, DomainObject latestObj) Description copied from interface:ContentHandler
Get an instance of a suitable merge manager to be used during the merge of a Versioned object which has been modified by another user since it was last merged or checked-out.- Parameters:
resultsObj
- object to which merge results should be writtensourceObj
- object which contains user's changes to be mergedoriginalObj
- object which corresponds to checked-out version statelatestObj
- object which corresponds to latest version with which the sourceObj must be merged.- Returns:
- merge manager
-
isPrivateContentType
public final boolean isPrivateContentType()Description copied from interface:ContentHandler
Returns true if the content type is always private (i.e., can not be added to the versioned filesystem).- Returns:
- true if private content type, else false
-
getURL
Get the link URL which corresponds to the specified link file. SeeDomainFile.isLinkFile()
.- Parameters:
linkFile
- link-file domain file- Returns:
- link URL
- Throws:
MalformedURLException
- if link is bad or unsupported.IOException
- if IO error or supported link file not specified
-
getIcon
Get the base icon for this link-file which does not include the link overlay icon.- Returns:
- base icon to be used for a
DomainFile
with the associated content type.
-