Package db.buffers

Class ManagedBufferFileAdapter

java.lang.Object
db.buffers.BufferFileAdapter
db.buffers.ManagedBufferFileAdapter
All Implemented Interfaces:
BufferFile, ManagedBufferFile

public class ManagedBufferFileAdapter extends BufferFileAdapter implements ManagedBufferFile
ManagedBufferFileAdapter provides a ManagedBufferFile implementation which wraps a ManagedBufferFileHandle.
  • Constructor Details

    • ManagedBufferFileAdapter

      public ManagedBufferFileAdapter(ManagedBufferFileHandle remoteManagedBufferFile)
      Constructor.
      Parameters:
      remoteManagedBufferFile - remote buffer file handle
  • Method Details

    • getSaveFile

      public ManagedBufferFile getSaveFile() throws IOException
      Description copied from interface: ManagedBufferFile
      Returns a Save file if available. Returns null if a save can not be performed. This method may block for an extended period of time if the pre-save process has not already completed. This method does not accept a monitor since a remote TaskMonitor does not yet exist.
      Specified by:
      getSaveFile in interface ManagedBufferFile
      Throws:
      IOException - if an I/O error occurs
    • saveCompleted

      public void saveCompleted(boolean commit) throws IOException
      Description copied from interface: ManagedBufferFile
      After getting the save file, this method must be invoked to terminate the save.
      Specified by:
      saveCompleted in interface ManagedBufferFile
      Parameters:
      commit - if true the save file will be reopened as read-only for update. If false, the save file will be deleted and the object will become invalid.
      Throws:
      IOException
    • canSave

      public boolean canSave() throws IOException
      Description copied from interface: ManagedBufferFile
      Returns true if a save file is provided for creating a new version of this buffer file.
      Specified by:
      canSave in interface ManagedBufferFile
      Throws:
      IOException - if an I/O error occurs
      See Also:
    • setVersionComment

      public void setVersionComment(String comment) throws IOException
      Description copied from interface: ManagedBufferFile
      Set the comment which will be associated with this buffer file if saved. The comment must be set prior to invoking close or setReadOnly.
      Specified by:
      setVersionComment in interface ManagedBufferFile
      Parameters:
      comment - comment text
      Throws:
      IOException - if an I/O error occurs
    • getNextChangeDataFile

      public BufferFile getNextChangeDataFile(boolean getFirst) throws IOException
      Description copied from interface: ManagedBufferFile
      Get the next change data file which corresponds to this buffer file. This method acts like an iterator which each successive invocation returning the next available file. Null is returned when no more files are available. The invoker is responsible for closing each file returned. It is highly recommended that each file be closed prior to requesting the next file.
      Specified by:
      getNextChangeDataFile in interface ManagedBufferFile
      Parameters:
      getFirst - causes the iterator to reset and return the first available file.
      Throws:
      IOException - if an I/O error occurs
    • getSaveChangeDataFile

      public BufferFile getSaveChangeDataFile() throws IOException
      Description copied from interface: ManagedBufferFile
      Returns a temporary change data buffer file which should be used to store a application-level ChangeSet associated with this new buffer file version. The getSaveFile method must be successfully invoked prior to invoking this method.
      Specified by:
      getSaveChangeDataFile in interface ManagedBufferFile
      Returns:
      change data file or null if one is not available.
      Throws:
      IOException - if an I/O error occurs
    • getCheckinID

      public long getCheckinID() throws IOException
      Description copied from interface: ManagedBufferFile
      Returns the checkin ID corresponding to this buffer file. The returned value is only valid if this buffer file has an associated buffer file manager and is either being created (see isReadOnly) or is intended for update (see canSave).
      Specified by:
      getCheckinID in interface ManagedBufferFile
      Throws:
      IOException - if an I/O error occurs
    • getForwardModMapData

      public byte[] getForwardModMapData(int oldVersion) throws IOException
      Description copied from interface: ManagedBufferFile
      Returns a bit map corresponding to all buffers modified since oldVersion. This identifies all buffers contained within the oldVersion which have been modified during any revision up until this file version. Buffers added since oldVersion are not identified NOTE: The bit mask may identify empty/free buffers within this file version.
      Specified by:
      getForwardModMapData in interface ManagedBufferFile
      Parameters:
      oldVersion - indicates the older version of this file for which a change map will be returned. This method may only be invoked if this file is at version 2 or higher, has an associated BufferFileManager and the oldVersion related files still exist.
      Returns:
      ModMap buffer change map data
      Throws:
      IOException - if an I/O error occurs