Class ProjectFileStore

java.lang.Object
com.pnfsoftware.jeb.core.dao.impl.ProjectFileStore
All Implemented Interfaces:
IFileDatabase

public class ProjectFileStore extends Object implements IFileDatabase
Simple IFileDatabase implementation delegating blob storage operations to an IFileStore.
  • Constructor Details

    • ProjectFileStore

      public ProjectFileStore(IFileStore fstore)
      Create a project database delegating entry storage to a file store.
      Parameters:
      fstore - backing file store
  • Method Details

    • hasFile

      public boolean hasFile(String key)
      Description copied from interface: IFileDatabase
      Determine if the database contains the given file (the file must exist).
      Specified by:
      hasFile in interface IFileDatabase
      Parameters:
      key - file key
      Returns:
      presence indicator
    • saveFile

      public boolean saveFile(String key, byte[] data)
      Description copied from interface: IFileDatabase
      Store the contents of a file.
      Specified by:
      saveFile in interface IFileDatabase
      Parameters:
      key - file key
      data - file data
      Returns:
      success indicator
    • loadFile

      public byte[] loadFile(String key)
      Description copied from interface: IFileDatabase
      Retrieve the contents of a file.
      Specified by:
      loadFile in interface IFileDatabase
      Parameters:
      key - file key
      Returns:
      file data, null on error
    • deleteFile

      public boolean deleteFile(String key)
      Description copied from interface: IFileDatabase
      Delete a file.
      Specified by:
      deleteFile in interface IFileDatabase
      Parameters:
      key - file key
      Returns:
      success indicator
    • getFileObject

      public File getFileObject(String key)
      Description copied from interface: IFileDatabase
      Attempt to get the filesystem object backing this db file entry.

      This method may not be implemented (e.g. if this database is not backed by on-disk files), in which case the implementation may throw an UnsupportedOperationException.

      Specified by:
      getFileObject in interface IFileDatabase
      Parameters:
      key - file key
      Returns:
      the backing file object for the entry
    • getFileWriter

      public OutputStream getFileWriter(String key) throws IOException
      Description copied from interface: IFileDatabase
      Get an output stream reader for low-level writing to a file. The client is responsible for closing the stream after usage.

      This method may not be implemented, in which case the implementation may throw an UnsupportedOperationException.

      Specified by:
      getFileWriter in interface IFileDatabase
      Parameters:
      key - file key
      Returns:
      an output stream writing to the entry contents
      Throws:
      IOException - if the writer could not be created
    • getFileReader

      public InputStream getFileReader(String key) throws IOException
      Description copied from interface: IFileDatabase
      Get an input stream reader for low-level reading from a file. The client is responsible for closing the stream after usage.

      This method may not be implemented, in which case the implementation may throw an UnsupportedOperationException.

      Specified by:
      getFileReader in interface IFileDatabase
      Parameters:
      key - file key
      Returns:
      an input stream reading the entry contents
      Throws:
      IOException - if the reader could not be created
    • getDatabaseWriter

      public IFileDatabaseWriter getDatabaseWriter(String key) throws IOException
      Description copied from interface: IFileDatabase
      Get a database record writer.

      This method may not be implemented, in which case the implementation may throw an UnsupportedOperationException.

      Specified by:
      getDatabaseWriter in interface IFileDatabase
      Parameters:
      key - file key
      Returns:
      a structured database writer for the entry
      Throws:
      IOException - if the writer could not be created
    • getDatabaseReader

      public IFileDatabaseReader getDatabaseReader(String key) throws IOException
      Description copied from interface: IFileDatabase
      Get a database record reader.

      This method may not be implemented, in which case the implementation may throw an UnsupportedOperationException.

      Specified by:
      getDatabaseReader in interface IFileDatabase
      Parameters:
      key - file key
      Returns:
      a structured database reader for the entry
      Throws:
      IOException - if the reader could not be created