Class DSBitStoreService

  • All Implemented Interfaces:
    BitStoreService

    public class DSBitStoreService
    extends BaseBitStoreService
    Native DSpace (or "Directory Scatter" if you prefer) asset store. Implements a directory 'scatter' algorithm to avoid OS limits on files per directory.
    Author:
    Peter Breton, Robert Tansley, Richard Rodgers, Peter Dietz
    • Constructor Detail

      • DSBitStoreService

        public DSBitStoreService()
    • Method Detail

      • init

        public void init()
        Initialize the asset store
      • generateId

        public String generateId()
        Return an identifier unique to this asset store instance
        Returns:
        a unique ID
      • get

        public InputStream get​(Bitstream bitstream)
                        throws IOException
        Retrieve the bits for the asset with ID. If the asset does not exist, returns null.
        Parameters:
        bitstream - The ID of the asset to retrieve
        Returns:
        The stream of bits, or null
        Throws:
        IOException - If a problem occurs while retrieving the bits
      • put

        public void put​(Bitstream bitstream,
                        InputStream in)
                 throws IOException
        Store a stream of bits.

        If this method returns successfully, the bits have been stored. If an exception is thrown, the bits have not been stored.

        Parameters:
        in - The stream of bits to store
        bitstream - The bitstream object
        Throws:
        IOException - If a problem occurs while storing the bits
      • about

        public Map<String,​Object> about​(Bitstream bitstream,
                                              List<String> attrs)
                                       throws IOException
        Obtain technical metadata about an asset in the asset store.
        Parameters:
        bitstream - The asset to describe
        attrs - A List of desired metadata fields
        Returns:
        attrs A Map with key/value pairs of desired metadata
        Throws:
        IOException - If a problem occurs while obtaining metadata
      • remove

        public void remove​(Bitstream bitstream)
                    throws IOException
        Remove an asset from the asset store. An irreversible operation.
        Parameters:
        bitstream - The asset to delete
        Throws:
        IOException - If a problem occurs while removing the asset
      • getFile

        protected File getFile​(Bitstream bitstream)
                        throws IOException
        Return the file corresponding to a bitstream. It's safe to pass in null.
        Parameters:
        bitstream - the database table row for the bitstream. Can be null
        Returns:
        The corresponding file in the file system, or null
        Throws:
        IOException - If a problem occurs while determining the file
      • isRegisteredBitstream

        public boolean isRegisteredBitstream​(String internalId)
      • getBaseDir

        public File getBaseDir()
      • setBaseDir

        public void setBaseDir​(File baseDir)