Package ghidra.framework.data
Interface ContentHandler
-
- All Superinterfaces:
ExtensionPoint
- All Known Implementing Classes:
DataTypeArchiveContentHandler
,DBContentHandler
,ProgramContentHandler
public interface ContentHandler extends ExtensionPoint
NOTE: ALL ContentHandler CLASSES MUST END IN "ContentHandler". If not, the ClassSearcher will not find them.ContentHandler
defines an application interface for converting between a specific domain object implementation and folder item storage. This interface also defines a method which provides an appropriate icon corresponding to the content.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
MISSING_CONTENT
static java.lang.String
UNKNOWN_CONTENT
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description long
createFile(FileSystem fs, FileSystem userfs, java.lang.String path, java.lang.String name, DomainObject domainObject, TaskMonitor monitor)
Creates a new folder item within a specified file-system.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.java.lang.String
getContentType()
Returns list of unique content-types supported.java.lang.String
getContentTypeDisplayString()
A string that is meant to be presented to the user.java.lang.String
getDefaultToolName()
Returns the name of the default tool that should be used to open this content typeDomainObjectAdapter
getDomainObject(FolderItem item, FileSystem userfs, long checkoutId, boolean okToUpgrade, boolean okToRecover, java.lang.Object consumer, TaskMonitor monitor)
Open a folder item for update.java.lang.Class<? extends DomainObject>
getDomainObjectClass()
Returns domain object implementation class supported.javax.swing.Icon
getIcon()
Returns the Icon associated with this handlers content type.DomainObjectAdapter
getImmutableObject(FolderItem item, java.lang.Object consumer, int version, int minChangeVersion, TaskMonitor monitor)
Open a folder item for immutable use.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.DomainObjectAdapter
getReadOnlyObject(FolderItem item, int version, boolean okToUpgrade, java.lang.Object consumer, TaskMonitor monitor)
Open a folder item for read-only use.boolean
isPrivateContentType()
Returns true if the content type is always private (i.e., can not be added to the versioned filesystem).void
removeUserDataFile(FolderItem item, FileSystem userFilesystem)
Remove user data file associated with an existing folder item.void
saveUserDataFile(DomainObject associatedDomainObj, DBHandle userDbh, FileSystem userfs, TaskMonitor monitor)
Create user data file associated with existing content.
-
-
-
Field Detail
-
UNKNOWN_CONTENT
static final java.lang.String UNKNOWN_CONTENT
- See Also:
- Constant Field Values
-
MISSING_CONTENT
static final java.lang.String MISSING_CONTENT
- See Also:
- Constant Field Values
-
-
Method Detail
-
createFile
long createFile(FileSystem fs, FileSystem userfs, java.lang.String path, java.lang.String name, DomainObject domainObject, TaskMonitor monitor) throws java.io.IOException, InvalidNameException, CancelledException
Creates a new folder item within a specified file-system. If fs is versioned, the resulting item is marked as checked-out within the versioned file-system. The specified domainObj will become associated with the newly created database.- Parameters:
fs
- the file system in which to create the folder itemuserfs
- file system which contains associated user datapath
- the path of the folder itemname
- the name of the new folder itemdomainObject
- the domain object to store in the newly created folder itemmonitor
- the monitor that allows the user to cancel- Returns:
- checkout ID for new item
- Throws:
java.io.IOException
- if an i/o error occursInvalidNameException
- if the specified name contains invalid charactersCancelledException
- if the user cancels
-
getImmutableObject
DomainObjectAdapter getImmutableObject(FolderItem item, java.lang.Object consumer, int version, int minChangeVersion, TaskMonitor monitor) throws java.io.IOException, CancelledException, VersionException
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:
java.io.IOException
- if a 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.
-
getReadOnlyObject
DomainObjectAdapter getReadOnlyObject(FolderItem item, int version, boolean okToUpgrade, java.lang.Object consumer, TaskMonitor monitor) throws java.io.IOException, VersionException, CancelledException
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:
java.io.IOException
- if a 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
DomainObjectAdapter getDomainObject(FolderItem item, FileSystem userfs, long checkoutId, boolean okToUpgrade, boolean okToRecover, java.lang.Object consumer, TaskMonitor monitor) throws java.io.IOException, CancelledException, VersionException
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:
java.io.IOException
- if a 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
ChangeSet getChangeSet(FolderItem versionedFolderItem, int olderVersion, int newerVersion) throws VersionException, java.io.IOException
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.java.io.IOException
- if a folder item access error occurs or change set was produced by newer version of software and can not be read
-
getMergeManager
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.- 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
boolean isPrivateContentType()
Returns true if the content type is always private (i.e., can not be added to the versioned filesystem).
-
getContentType
java.lang.String getContentType()
Returns list of unique content-types supported. A minimum of one content-type will be returned. If more than one is returned, these are considered equivalent aliases.
-
getContentTypeDisplayString
java.lang.String getContentTypeDisplayString()
A string that is meant to be presented to the user.
-
getIcon
javax.swing.Icon getIcon()
Returns the Icon associated with this handlers content type.
-
getDefaultToolName
java.lang.String getDefaultToolName()
Returns the name of the default tool that should be used to open this content type
-
getDomainObjectClass
java.lang.Class<? extends DomainObject> getDomainObjectClass()
Returns domain object implementation class supported.
-
saveUserDataFile
void saveUserDataFile(DomainObject associatedDomainObj, DBHandle userDbh, FileSystem userfs, TaskMonitor monitor) throws CancelledException, java.io.IOException
Create user data file associated with existing content. This facilitates the lazy creation of the user data file.- Parameters:
associatedDomainObj
- associated domain object corresponding to this content handleruserDbh
- user data handleuserfs
- private user data filesystemmonitor
- task monitor- Throws:
java.io.IOException
- if an access error occursCancelledException
- if operation is cancelled by user
-
removeUserDataFile
void removeUserDataFile(FolderItem item, FileSystem userFilesystem) throws java.io.IOException
Remove user data file associated with an existing folder item.- Parameters:
item
- folder itemuserFilesystem
-- Throws:
java.io.IOException
- if an access error occurs
-
-