Package ghidra.framework.store.db
Class PackedDBHandle
- java.lang.Object
-
- db.DBHandle
-
- ghidra.framework.store.db.PackedDBHandle
-
public class PackedDBHandle extends DBHandle
DBHandle
provides access to a PackedDatabase.
-
-
Constructor Summary
Constructors Constructor Description PackedDBHandle(java.lang.String contentType)
Constructs a temporary packed database handle.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Close the database and dispose of the underlying buffer manager.java.lang.String
getContentType()
Returns user defined content type associated with this handle.PackedDatabase
getPackedDatabase()
Returns PackedDatabase associated with this handle, or null if this is a temporary handle which has not yet been saved to a PackedDatabase using saveAs.void
save(TaskMonitor monitor)
Saves the open database to the corresponding PackedDatabase file.void
save(java.lang.String comment, DBChangeSet changeSet, TaskMonitor monitor)
Save this database to a new version.void
saveAs(BufferFile outFile, boolean associateWithNewFile, TaskMonitor monitor)
Save the database to the specified buffer file.protected void
saveAs(BufferFile outFile, java.lang.Long newDatabaseId, TaskMonitor monitor)
Save the database to the specified buffer file and a newDatabaseId.PackedDatabase
saveAs(java.lang.String itemName, java.io.File dir, java.lang.String packedFileName, TaskMonitor monitor)
Save open database to a new packed database.PackedDatabase
saveAs(java.lang.String itemName, java.io.File dir, java.lang.String packedFileName, java.lang.Long newDatabaseId, TaskMonitor monitor)
Save open database to a new packed database with a specified newDatabaseId.-
Methods inherited from class db.DBHandle
addListener, canRedo, canUndo, canUpdate, checkTransaction, close, closeScratchPad, createBuffer, createBuffer, createTable, createTable, deleteTable, enablePreCache, endTransaction, finalize, getAvailableRedoCount, getAvailableUndoCount, getBuffer, getBuffer, getBufferSize, getCacheHits, getCacheMisses, getDatabaseId, getLowBufferCount, getRecoveryChangeSetFile, getScratchPad, getTable, getTableCount, getTables, hasUncommittedChanges, isChanged, isClosed, isConsistent, isTransactionActive, rebuild, redo, resetDatabaseId, saveAs, setMaxUndos, setTableName, startTransaction, takeRecoverySnapshot, terminateTransaction, undo
-
-
-
-
Method Detail
-
save
public void save(java.lang.String comment, DBChangeSet changeSet, TaskMonitor monitor) throws java.io.IOException, CancelledException
Description copied from class:DBHandle
Save this database to a new version.- Overrides:
save
in classDBHandle
- Parameters:
comment
- if version history is maintained, this comment will be associated with the new version.changeSet
- an optional database-backed change set which reflects changes made since the last version.monitor
- progress monitor- Throws:
java.io.IOException
- thrown if an IO error occurs.CancelledException
- if task monitor cancelled operation.
-
save
public void save(TaskMonitor monitor) throws java.io.IOException, CancelledException
Saves the open database to the corresponding PackedDatabase file.- Parameters:
monitor
-- Throws:
java.io.IOException
CancelledException
-
saveAs
protected void saveAs(BufferFile outFile, java.lang.Long newDatabaseId, TaskMonitor monitor) throws java.io.IOException, CancelledException
Description copied from class:DBHandle
Save the database to the specified buffer file and a newDatabaseId. Open handle will always be associated with the new file. NOTE: This method is intended for use in transforming one database to match another existing database.- Overrides:
saveAs
in classDBHandle
- Parameters:
outFile
- buffer file open for writingnewDatabaseId
- database ID to be forced for new database or null to generate new database IDmonitor
- progress monitor- Throws:
java.io.IOException
- if IO error occursCancelledException
- if monitor cancels operation
-
saveAs
public void saveAs(BufferFile outFile, boolean associateWithNewFile, TaskMonitor monitor) throws java.io.IOException, CancelledException
Description copied from class:DBHandle
Save the database to the specified buffer file.- Overrides:
saveAs
in classDBHandle
- Parameters:
outFile
- buffer file open for writingassociateWithNewFile
- if true the outFile will be associated with this DBHandle as the current source file, if false no change will be made to this DBHandle's state and the outFile will be written and set as read-only. The caller is responsbile for disposing the outFile if this parameter is false.monitor
- progress monitor- Throws:
java.io.IOException
- if IO error occursCancelledException
- if monitor cancels operation
-
close
public void close()
Description copied from class:DBHandle
Close the database and dispose of the underlying buffer manager. Any existing recovery data will be discarded.
-
saveAs
public PackedDatabase saveAs(java.lang.String itemName, java.io.File dir, java.lang.String packedFileName, TaskMonitor monitor) throws java.io.IOException, DuplicateFileException, CancelledException
Save open database to a new packed database. If another PackedDatabase was associated with this handle prior to this invocation it should be disposed to that the underlying database resources can be cleaned-up.- Parameters:
itemName
-dir
-packedFileName
-monitor
-- Returns:
- new packed Database object now associated with this handle.
- Throws:
CancelledException
- if task monitor cancelled operation.java.io.IOException
DuplicateFileException
- See Also:
db.DBHandle#saveAs(java.io.File, java.lang.String, ghidra.util.task.TaskMonitor)
-
saveAs
public PackedDatabase saveAs(java.lang.String itemName, java.io.File dir, java.lang.String packedFileName, java.lang.Long newDatabaseId, TaskMonitor monitor) throws java.io.IOException, DuplicateFileException, CancelledException
Save open database to a new packed database with a specified newDatabaseId. If another PackedDatabase was associated with this handle prior to this invocation it should be disposed to that the underlying database resources can be cleaned-up. NOTE: This method is intended for use in transforming one database to match another existing database.- Parameters:
itemName
-dir
-packedFileName
-newDatabaseId
- database ID to be forced for new database or null to generate new database IDmonitor
-- Returns:
- new packed Database object now associated with this handle.
- Throws:
CancelledException
- if task monitor cancelled operation.java.io.IOException
DuplicateFileException
- See Also:
db.DBHandle#saveAs(java.io.File, java.lang.String, ghidra.util.task.TaskMonitor)
-
getContentType
public java.lang.String getContentType()
Returns user defined content type associated with this handle.
-
getPackedDatabase
public PackedDatabase getPackedDatabase()
Returns PackedDatabase associated with this handle, or null if this is a temporary handle which has not yet been saved to a PackedDatabase using saveAs.
-
-