Package ghidra.framework.store.local
Class LocalDatabaseItem
java.lang.Object
ghidra.framework.store.local.LocalFolderItem
ghidra.framework.store.local.LocalDatabaseItem
- All Implemented Interfaces:
DatabaseItem,FolderItem
LocalDatabaseItem provides a FolderItem implementation
for a local database. This item wraps an underlying VersionedDatabase
if the file-system is versioned, otherwise a PrivateDatabase is wrapped.
This item utilizes a data directory for storing all files relating to the database as well as history and checkout data files if this item is versioned.
-
Field Summary
Fields inherited from interface ghidra.framework.store.FolderItem
DATABASE_FILE_TYPE, DATAFILE_FILE_TYPE, DEFAULT_CHECKOUT_ID, LATEST_VERSION, UNKNOWN_FILE_TYPE -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns true if unsaved file changes can be recovered.voidClears the checkout data associated with this non-shared file.intReturn the latest/current version.intlongReturn The time that this item was last modified.longlength()Returns the length of this domain file.open()Open the current version of the stored database for non-update use.open(int version) Open a specific version of the stored database for non-update use.open(int version, int minChangeDataVer) Open a specific version of the stored database for non-update use.openForUpdate(long checkoutId) Open the latest database version for update.voidoutput(File outputFile, int version, TaskMonitor monitor) Serialize (i.e., pack) this item into the specified outputFile.refresh()Returns this instance after refresh or null if item no longer existsvoidupdateCheckout(FolderItem versionedFolderItem, boolean updateItem, TaskMonitor monitor) Update this non-versioned item with the latest version of the specified versioned item.voidupdateCheckout(FolderItem item, int checkoutVersion) Update this non-versioned item with the contents of the specified item which must be within the same non-versioned fileSystem.Methods inherited from class ghidra.framework.store.local.LocalFolderItem
checkout, delete, equals, getCheckout, getCheckoutId, getCheckouts, getCheckoutVersion, getContentType, getContentTypeVersion, getFileID, getLocalCheckoutVersion, getName, getParentPath, getPathName, getVersions, hasCheckouts, isCheckedOut, isCheckedOutExclusive, isCheckinActive, isReadOnly, isVersioned, resetFileID, setCheckout, setContentTypeVersion, setReadOnly, terminateCheckout, updateCheckoutVersionMethods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ghidra.framework.store.FolderItem
checkout, delete, getCheckout, getCheckoutId, getCheckouts, getCheckoutVersion, getContentType, getContentTypeVersion, getFileID, getLocalCheckoutVersion, getName, getParentPath, getPathName, getVersions, hasCheckouts, isCheckedOut, isCheckedOutExclusive, isCheckinActive, isReadOnly, isVersioned, resetFileID, setCheckout, setContentTypeVersion, setReadOnly, terminateCheckout, updateCheckoutVersion
-
Method Details
-
length
Description copied from interface:FolderItemReturns the length of this domain file. This size is the minimum disk space used for storing this file, but does not account for additional storage space used to tracks changes, etc.- Specified by:
lengthin interfaceFolderItem- Returns:
- file length
- Throws:
IOException- thrown if IO or access error occurs
-
getCurrentVersion
public int getCurrentVersion()Description copied from interface:FolderItemReturn the latest/current version.- Specified by:
getCurrentVersionin interfaceFolderItem
-
getMinimumVersion
- Throws:
IOException
-
clearCheckout
Description copied from interface:FolderItemClears the checkout data associated with this non-shared file. NOTE: This method is only valid for a local non-versioned file-system.- Specified by:
clearCheckoutin interfaceFolderItem- Overrides:
clearCheckoutin classLocalFolderItem- Throws:
IOException
-
open
Description copied from interface:DatabaseItemOpen a specific version of the stored database for non-update use. Historical change data from minChangeDataVer through version is available. The returned BufferFile does not support the BufferMgr's Save operation.- Specified by:
openin interfaceDatabaseItem- Parameters:
version- database versionminChangeDataVer- indicates the oldest change data version to be included in change set. A -1 indicates only the last change data buffer file is applicable.- Returns:
- buffer file
- Throws:
IOException- thrown if IO error occurs.- See Also:
-
open
Description copied from interface:DatabaseItemOpen a specific version of the stored database for non-update use. Change data will not be available. The returned BufferFile does not support the BufferMgr's Save operation.- Specified by:
openin interfaceDatabaseItem- Parameters:
version- database version- Returns:
- buffer file
- Throws:
IOException- thrown if IO error occurs.
-
open
Description copied from interface:DatabaseItemOpen the current version of the stored database for non-update use. Change data will not be available. The returned BufferFile does not support the BufferMgr's Save operation.- Specified by:
openin interfaceDatabaseItem- Throws:
IOException- thrown if IO error occurs.
-
openForUpdate
Open the latest database version for update.- Specified by:
openForUpdatein interfaceDatabaseItem- Parameters:
checkoutId- reqiured for update to a versioned item, otherwise set to -1 for a non-versioned private database.- Returns:
- open database handle
- Throws:
IOException
-
canRecover
public boolean canRecover()Description copied from interface:FolderItemReturns true if unsaved file changes can be recovered.- Specified by:
canRecoverin interfaceFolderItem- See Also:
-
output
public void output(File outputFile, int version, TaskMonitor monitor) throws CancelledException, IOException Description copied from interface:FolderItemSerialize (i.e., pack) this item into the specified outputFile.- Specified by:
outputin interfaceFolderItem- Parameters:
outputFile- packed output file to be createdversion- if this item is versioned, specifies the version to be output, otherwise -1 should be specified.monitor- progress monitor- Throws:
CancelledException- if monitor cancels operationIOException
-
updateCheckout
public void updateCheckout(FolderItem versionedFolderItem, boolean updateItem, TaskMonitor monitor) throws IOException, CancelledException Description copied from class:LocalFolderItemUpdate this non-versioned item with the latest version of the specified versioned item.- Specified by:
updateCheckoutin classLocalFolderItem- Parameters:
versionedFolderItem- versioned item which corresponds to this non-versioned item.updateItem- if true this items content is updated using the versionedFolderItemmonitor- progress monitor for update- Throws:
IOException- if this file is not a checked-out non-versioned file or an IO error occurs.CancelledException- if monitor cancels operation
-
updateCheckout
Description copied from class:LocalFolderItemUpdate this non-versioned item with the contents of the specified item which must be within the same non-versioned fileSystem. If successful, the specified item will be removed after its content has been moved into this item.- Specified by:
updateCheckoutin classLocalFolderItem- Parameters:
item-checkoutVersion-- Throws:
IOException- if this file is not a checked-out non-versioned file or an IO error occurs.
-
lastModified
public long lastModified()Description copied from interface:FolderItemReturn The time that this item was last modified.- Specified by:
lastModifiedin interfaceFolderItem- Overrides:
lastModifiedin classLocalFolderItem- See Also:
-
refresh
Description copied from interface:FolderItemReturns this instance after refresh or null if item no longer exists- Specified by:
refreshin interfaceFolderItem- Overrides:
refreshin classLocalFolderItem- Throws:
IOException
-