Class BaseBitStoreService

    • Constructor Detail

      • BaseBitStoreService

        public BaseBitStoreService()
    • Method Detail

      • getIntermediatePath

        protected String getIntermediatePath​(String internalId)
        Return the intermediate path derived from the internal_id. This method splits the id into groups which become subdirectories.
        Parameters:
        internalId - The internal_id
        Returns:
        The path based on the id without leading or trailing separators
      • sanitizeIdentifier

        protected String sanitizeIdentifier​(String sInternalId)
        Sanity Check: If the internal ID contains a pathname separator, it's probably an attempt to make a path traversal attack, so ignore the path prefix. The internal-ID is supposed to be just a filename, so this will not affect normal operation.
        Parameters:
        sInternalId -
        Returns:
        Sanitized id
      • appendSeparator

        protected void appendSeparator​(StringBuilder path)
        Append separator to target StringBuilder
        Parameters:
        path -
      • endsWithSeparator

        protected boolean endsWithSeparator​(StringBuilder bufFilename)
        Utility that checks string ending with separator
        Parameters:
        bufFilename -
        Returns:
      • populatePathSplittingId

        protected void populatePathSplittingId​(String internalId,
                                               StringBuilder path)
        Splits internalId into several subpaths using digitsPerLevel that indicates the folder name length, and direcoryLevels that indicates the maximum number of subfolders.
        Parameters:
        internalId - bitStream identifier
        path -
      • extractSubstringFrom

        protected String extractSubstringFrom​(String internalId,
                                              int startIndex,
                                              int endIndex)
        Extract substring if is in range, otherwise will truncate to length
        Parameters:
        internalId -
        startIndex -
        endIndex -
        Returns:
      • isLonger

        protected boolean isLonger​(String internalId,
                                   int endIndex)
        Checks if the String is longer than endIndex
        Parameters:
        internalId -
        endIndex -
        Returns:
      • about

        public Map<String,​Object> about​(File file,
                                              List<String> attrs)
                                       throws IOException
        Retrieves a map of useful metadata about the File (size, checksum, modified)
        Parameters:
        file - The File to analyze
        attrs - The list of requested metadata values
        Returns:
        Map of updated metadatas / attrs
        Throws:
        IOException
      • isInitialized

        public boolean isInitialized()
        Description copied from interface: BitStoreService
        Determines if a store has been initialized
        Specified by:
        isInitialized in interface BitStoreService
        Returns:
        boolean true if initialized, false otherwise