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 protectedPrimaryDataFile()Default constructor create aPrimaryDataFilePrimaryDataFile(PrimaryDataDirectory path, java.lang.String name)Construct aPrimaryDataFileand set the file version to the latest one
-
Method Summary
Modifier and Type Method Description protected abstract booleanexistData()Abstract function to check if the currentPrimaryDataEntityVersionof thisPrimaryDataFilehas stored data.voidread(java.io.OutputStream dataOutputStream)Load the data of the latestPrimaryDataEntityVersionof thisPrimaryDataFileas stream.protected abstract voidreadImpl(java.io.OutputStream dataOutputStream)Abstract function for implementation theread(OutputStream)function.voidsetMetaData(MetaData newMetadata)Setter for theMetaDataobject of thisPrimaryDataEntityobject.voidstore(java.io.InputStream dataInputStream)Store data and generate a newPrimaryDataEntityVersionfor thisPrimaryDataFile.protected abstract voidstoreImpl(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 aPrimaryDataFileand 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 parentPrimaryDataDirectoryis found.MetaDataException- if theMetaDataobject of the parentPrimaryDataDirectoryis not clone-able.
-
-
Method Detail
-
existData
protected abstract boolean existData()
Abstract function to check if the currentPrimaryDataEntityVersionof thisPrimaryDataFilehas stored data.- Returns:
trueif the currentPrimaryDataEntityVersionhas stored data;falseotherwise.
-
read
public void read(java.io.OutputStream dataOutputStream) throws PrimaryDataFileExceptionLoad the data of the latestPrimaryDataEntityVersionof thisPrimaryDataFileas stream.- Parameters:
dataOutputStream- the loaded data.- Throws:
PrimaryDataFileException- if no data is stored.
-
readImpl
protected abstract void readImpl(java.io.OutputStream dataOutputStream) throws PrimaryDataFileExceptionAbstract 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 theMetaDataobject of thisPrimaryDataEntityobject. Create a newPrimaryDataEntityVersionwith a newMetaDataset.Check before if the
EnumDublinCoreElements.TYPEis not aMetaData.DIRECTORYobject.- Overrides:
setMetaDatain classPrimaryDataEntity- Parameters:
newMetadata- the newMetaDataobject to set.- Throws:
PrimaryDataEntityVersionException- if unable to storePrimaryDataEntityVersion.MetaDataException- if there are non valid value for element in theMetaDataobject.
-
store
public void store(java.io.InputStream dataInputStream) throws PrimaryDataFileException, PrimaryDataEntityVersionExceptionStore data and generate a newPrimaryDataEntityVersionfor 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 PrimaryDataFileExceptionAbstract function for implementation thestore(InputStream)function.- Parameters:
dataInputStream- the data to store in thisPrimaryDataEntityVersionnewFileVersion- the newPrimaryDataEntityVersionto store- Throws:
PrimaryDataFileException- if storing of data fails
-
-