Class PrimaryDataFile
- java.lang.Object
-
- de.ipk_gatersleben.bit.bi.edal.primary_data.file.PrimaryDataEntity
-
- de.ipk_gatersleben.bit.bi.edal.primary_data.file.PrimaryDataFile
-
- All Implemented Interfaces:
java.lang.Comparable<PrimaryDataEntity>
- Direct Known Subclasses:
PrimaryDataFileImplementation
public abstract class PrimaryDataFile extends PrimaryDataEntity
Abstract PrimaryDataFile class.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
PrimaryDataFile()
Default constructor create aPrimaryDataFile
PrimaryDataFile(PrimaryDataDirectory path, java.lang.String name)
Construct aPrimaryDataFile
and set the file version to the latest one
-
Method Summary
Modifier and Type Method Description protected abstract boolean
existData()
Abstract function to check if the currentPrimaryDataEntityVersion
of thisPrimaryDataFile
has stored data.void
read(java.io.OutputStream dataOutputStream)
Load the data of the latestPrimaryDataEntityVersion
of thisPrimaryDataFile
as stream.protected abstract void
readImpl(java.io.OutputStream dataOutputStream)
Abstract function for implementation theread(OutputStream)
function.void
setMetaData(MetaData newMetadata)
Setter for theMetaData
object of thisPrimaryDataEntity
object.void
store(java.io.InputStream dataInputStream)
Store data and generate a newPrimaryDataEntityVersion
for thisPrimaryDataFile
.protected abstract void
storeImpl(java.io.InputStream dataInputStream, PrimaryDataEntityVersion newFileVersion)
Abstract function for implementation thestore(InputStream)
function.-
Methods inherited from class de.ipk_gatersleben.bit.bi.edal.primary_data.file.PrimaryDataEntity
addPublicReference, commitVersion, compareTo, delete, equals, getCurrentVersion, getID, getImplementationProvider, getMetaData, getName, getParentDirectory, getPath, getPermissions, getPermissionsImpl, getPublicReferences, getSubject, getVersionByDate, getVersionByRevisionNumber, getVersions, getVersionsImpl, grantPermission, hashCode, isDirectory, move, moveImpl, reloadOldDataType, rename, revokePermission, setCurrentVersion, setDefaultPermissions, setID, setParentDirectory, storeVersion, switchCurrentVersion, toString
-
-
-
-
Constructor Detail
-
PrimaryDataFile
protected PrimaryDataFile()
Default constructor create aPrimaryDataFile
-
PrimaryDataFile
public PrimaryDataFile(PrimaryDataDirectory path, java.lang.String name) throws PrimaryDataFileException, PrimaryDataEntityVersionException, PrimaryDataDirectoryException, MetaDataException
Construct aPrimaryDataFile
and set the file version to the latest one- Parameters:
path
- the directory of the filename
- the file name- Throws:
PrimaryDataFileException
- if unable to set data type.PrimaryDataEntityVersionException
- if unable to store initial version.PrimaryDataDirectoryException
- if no parentPrimaryDataDirectory
is found.MetaDataException
- if theMetaData
object of the parentPrimaryDataDirectory
is not clone-able.
-
-
Method Detail
-
existData
protected abstract boolean existData()
Abstract function to check if the currentPrimaryDataEntityVersion
of thisPrimaryDataFile
has stored data.- Returns:
true
if the currentPrimaryDataEntityVersion
has stored data;false
otherwise.
-
read
public void read(java.io.OutputStream dataOutputStream) throws PrimaryDataFileException
Load the data of the latestPrimaryDataEntityVersion
of thisPrimaryDataFile
as stream.- Parameters:
dataOutputStream
- the loaded data.- Throws:
PrimaryDataFileException
- if no data is stored.
-
readImpl
protected abstract void readImpl(java.io.OutputStream dataOutputStream) throws PrimaryDataFileException
Abstract function for implementation theread(OutputStream)
function.- Parameters:
dataOutputStream
- the loaded data.- Throws:
PrimaryDataFileException
- if no data is stored.
-
setMetaData
public void setMetaData(MetaData newMetadata) throws PrimaryDataEntityVersionException, MetaDataException
Setter for theMetaData
object of thisPrimaryDataEntity
object. Create a newPrimaryDataEntityVersion
with a newMetaData
set.Check before if the
EnumDublinCoreElements.TYPE
is not aMetaData.DIRECTORY
object.- Overrides:
setMetaData
in classPrimaryDataEntity
- Parameters:
newMetadata
- the newMetaData
object to set.- Throws:
PrimaryDataEntityVersionException
- if unable to storePrimaryDataEntityVersion
.MetaDataException
- if there are non valid value for element in theMetaData
object.
-
store
public void store(java.io.InputStream dataInputStream) throws PrimaryDataFileException, PrimaryDataEntityVersionException
Store data and generate a newPrimaryDataEntityVersion
for thisPrimaryDataFile
.- Parameters:
dataInputStream
- the date to store in thisPrimaryDataEntityVersion
.- Throws:
PrimaryDataFileException
- if storing of data fails.PrimaryDataEntityVersionException
- if provided version conflicts with existing versions.
-
storeImpl
protected abstract void storeImpl(java.io.InputStream dataInputStream, PrimaryDataEntityVersion newFileVersion) throws PrimaryDataFileException
Abstract function for implementation thestore(InputStream)
function.- Parameters:
dataInputStream
- the data to store in thisPrimaryDataEntityVersion
newFileVersion
- the newPrimaryDataEntityVersion
to store- Throws:
PrimaryDataFileException
- if storing of data fails
-
-