Class DataStorage
- java.lang.Object
-
- fr.ens.biologie.genomique.aozan.aozan3.DataStorage
-
public class DataStorage extends Object
This class define a data storage.- Since:
- 3.0
- Author:
- Laurent Jourdren
-
-
Constructor Summary
Constructors Constructor Description DataStorage(String machine, String path)
Constructor.DataStorage(String machine, String path, SequencerSource source)
Constructor.DataStorage(String machine, Path path)
Constructor.DataStorage(String machine, Path path, SequencerSource source)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkIfEnoughSpace(long size)
Check if there is enough space on the storage for a required amount of disk space.void
checkIfEnoughSpace(long size, String errorMessage)
Check if there is enough space on the storage for a required amount of disk space.static DataStorage
deSerializeFromJson(String json)
Deserialize a DataStorage from JSON.String
getMachine()
Get the machine of the storagePath
getPath()
Get the path of the storage.SequencerSource
getSequencerSource()
long
getTotalSpace()
Get the total space of the storage.long
getUnallocatedSpace()
Get the unallocated space of the storage.long
getUsableSpace()
Get the usable space of the storage.boolean
isEnoughSpace(long size)
Test if there is enough space on the storage for a required amount of disk space.boolean
isWritable()
Returns if the storage is writable.DataLocation
newDataLocation(String name)
Create a data location.String
toJson()
Serialize the object into a JSON stringString
toString()
-
-
-
Constructor Detail
-
DataStorage
public DataStorage(String machine, String path)
Constructor.- Parameters:
machine
- machine of the data storagepath
- path of the data storage
-
DataStorage
public DataStorage(String machine, String path, SequencerSource source)
Constructor.- Parameters:
machine
- machine of the data storagepath
- path of the data storagesource
- sequencer source
-
DataStorage
public DataStorage(String machine, Path path)
Constructor.- Parameters:
machine
- machine of the data storagepath
- path of the data storage
-
DataStorage
public DataStorage(String machine, Path path, SequencerSource source)
Constructor.- Parameters:
machine
- machine of the data storagepath
- path of the data storagesource
- sequencer source
-
-
Method Detail
-
getMachine
public String getMachine()
Get the machine of the storage- Returns:
- the machine of the storage
-
getPath
public Path getPath()
Get the path of the storage.- Returns:
- the path of the storage
-
getSequencerSource
public SequencerSource getSequencerSource()
-
isWritable
public boolean isWritable()
Returns if the storage is writable.- Returns:
- true if the storage is writable
-
getTotalSpace
public long getTotalSpace() throws IOException
Get the total space of the storage.- Returns:
- the total space in bytes of the storage
- Throws:
IOException
- if an error occurs while getting the information
-
getUsableSpace
public long getUsableSpace() throws IOException
Get the usable space of the storage.- Returns:
- the usable space in bytes of the storage
- Throws:
IOException
- if an error occurs while getting the information
-
getUnallocatedSpace
public long getUnallocatedSpace() throws IOException
Get the unallocated space of the storage.- Returns:
- the unallocated space in bytes of the storage
- Throws:
IOException
- if an error occurs while getting the information
-
isEnoughSpace
public boolean isEnoughSpace(long size) throws IOException
Test if there is enough space on the storage for a required amount of disk space.- Parameters:
size
- the required amount of disk space- Returns:
- true if there is enough space on the storage for the required amount of disk space
- Throws:
IOException
- if an error occurs while getting disk space information
-
checkIfEnoughSpace
public void checkIfEnoughSpace(long size, String errorMessage) throws IOException
Check if there is enough space on the storage for a required amount of disk space.- Parameters:
size
- the required amount of disk spaceerrorMessage
- error message- Throws:
IOException
- if there is enough space on the storage for the required amount of disk space
-
checkIfEnoughSpace
public void checkIfEnoughSpace(long size) throws IOException
Check if there is enough space on the storage for a required amount of disk space.- Parameters:
size
- the required amount of disk space- Throws:
IOException
- if there is enough space on the storage for the required amount of disk space
-
newDataLocation
public DataLocation newDataLocation(String name)
Create a data location.- Parameters:
name
- name of the data location- Returns:
- a data location
-
deSerializeFromJson
public static DataStorage deSerializeFromJson(String json)
Deserialize a DataStorage from JSON.- Parameters:
json
- JSON string- Returns:
- a new DataStorage
-
toJson
public String toJson()
Serialize the object into a JSON string- Returns:
-
-