Package org.dspace.storage.bitstore
Class DSBitStoreService
- java.lang.Object
-
- org.dspace.storage.bitstore.BaseBitStoreService
-
- org.dspace.storage.bitstore.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
-
-
Field Summary
Fields Modifier and Type Field Description protected StringREGISTERED_FLAG-
Fields inherited from class org.dspace.storage.bitstore.BaseBitStoreService
CHECKSUM, CHECKSUM_ALGORITHM, CSA, digitsPerLevel, directoryLevels, initialized, MODIFIED, SIZE_BYTES
-
-
Constructor Summary
Constructors Constructor Description DSBitStoreService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,Object>about(Bitstream bitstream, List<String> attrs)Obtain technical metadata about an asset in the asset store.StringgenerateId()Return an identifier unique to this asset store instanceInputStreamget(Bitstream bitstream)Retrieve the bits for the asset with ID.FilegetBaseDir()protected FilegetFile(Bitstream bitstream)Return the file corresponding to a bitstream.voidinit()Initialize the asset storebooleanisRegisteredBitstream(String internalId)voidput(Bitstream bitstream, InputStream in)Store a stream of bits.voidremove(Bitstream bitstream)Remove an asset from the asset store.voidsetBaseDir(File baseDir)-
Methods inherited from class org.dspace.storage.bitstore.BaseBitStoreService
about, appendSeparator, endsWithSeparator, extractSubstringFrom, getIntermediatePath, isInitialized, isLonger, populatePathSplittingId, putValueIfExistsKey, sanitizeIdentifier
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.dspace.storage.bitstore.BitStoreService
isEnabled
-
-
-
-
Field Detail
-
REGISTERED_FLAG
protected final String REGISTERED_FLAG
- See Also:
- Constant Field Values
-
-
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 storebitstream- 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 describeattrs- 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 innull.- Parameters:
bitstream- the database table row for the bitstream. Can benull- 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)
-
-