Class LocalDatabaseItem

java.lang.Object
ghidra.framework.store.local.LocalFolderItem
ghidra.framework.store.local.LocalDatabaseItem
All Implemented Interfaces:
DatabaseItem, FolderItem

public class LocalDatabaseItem extends LocalFolderItem implements DatabaseItem
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.

  • Method Details

    • length

      public long length() throws IOException
      Description copied from interface: FolderItem
      Returns 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:
      length in interface FolderItem
      Returns:
      file length
      Throws:
      IOException - thrown if IO or access error occurs
    • getCurrentVersion

      public int getCurrentVersion()
      Description copied from interface: FolderItem
      Return the latest/current version.
      Specified by:
      getCurrentVersion in interface FolderItem
    • getMinimumVersion

      public int getMinimumVersion() throws IOException
      Throws:
      IOException
    • clearCheckout

      public void clearCheckout() throws IOException
      Description copied from interface: FolderItem
      Clears the checkout data associated with this non-shared file. NOTE: This method is only valid for a local non-versioned file-system.
      Specified by:
      clearCheckout in interface FolderItem
      Overrides:
      clearCheckout in class LocalFolderItem
      Throws:
      IOException
    • open

      public LocalManagedBufferFile open(int version, int minChangeDataVer) throws IOException
      Description copied from interface: DatabaseItem
      Open 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:
      open in interface DatabaseItem
      Parameters:
      version - database version
      minChangeDataVer - 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

      public LocalManagedBufferFile open(int version) throws IOException
      Description copied from interface: DatabaseItem
      Open 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:
      open in interface DatabaseItem
      Parameters:
      version - database version
      Returns:
      buffer file
      Throws:
      IOException - thrown if IO error occurs.
    • open

      public LocalManagedBufferFile open() throws IOException
      Description copied from interface: DatabaseItem
      Open 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:
      open in interface DatabaseItem
      Throws:
      IOException - thrown if IO error occurs.
    • openForUpdate

      public LocalManagedBufferFile openForUpdate(long checkoutId) throws IOException
      Open the latest database version for update.
      Specified by:
      openForUpdate in interface DatabaseItem
      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: FolderItem
      Returns true if unsaved file changes can be recovered.
      Specified by:
      canRecover in interface FolderItem
      See Also:
    • output

      public void output(File outputFile, int version, TaskMonitor monitor) throws CancelledException, IOException
      Description copied from interface: FolderItem
      Serialize (i.e., pack) this item into the specified outputFile.
      Specified by:
      output in interface FolderItem
      Parameters:
      outputFile - packed output file to be created
      version - if this item is versioned, specifies the version to be output, otherwise -1 should be specified.
      monitor - progress monitor
      Throws:
      CancelledException - if monitor cancels operation
      IOException
    • updateCheckout

      public void updateCheckout(FolderItem versionedFolderItem, boolean updateItem, TaskMonitor monitor) throws IOException, CancelledException
      Description copied from class: LocalFolderItem
      Update this non-versioned item with the latest version of the specified versioned item.
      Specified by:
      updateCheckout in class LocalFolderItem
      Parameters:
      versionedFolderItem - versioned item which corresponds to this non-versioned item.
      updateItem - if true this items content is updated using the versionedFolderItem
      monitor - 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

      public void updateCheckout(FolderItem item, int checkoutVersion) throws IOException
      Description copied from class: LocalFolderItem
      Update 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:
      updateCheckout in class LocalFolderItem
      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: FolderItem
      Return The time that this item was last modified.
      Specified by:
      lastModified in interface FolderItem
      Overrides:
      lastModified in class LocalFolderItem
      See Also:
    • refresh

      public LocalFolderItem refresh() throws IOException
      Description copied from interface: FolderItem
      Returns this instance after refresh or null if item no longer exists
      Specified by:
      refresh in interface FolderItem
      Overrides:
      refresh in class LocalFolderItem
      Throws:
      IOException