edu.iu.iv.core.persistence
Interface FileResourceDescriptor

All Superinterfaces:
ResourceDescriptor
All Known Implementing Classes:
BasicFileResourceDescriptor

public interface FileResourceDescriptor
extends ResourceDescriptor

A descriptor for a data resource represented as a file on disk. This descriptor holds all information necessary to persist to and restore from a file on disk. Implementations must make sure that all information necessary for persistence using files is contained in this descriptor.

Author:
Team IVC

Method Summary
 java.io.File getFile()
          Gets the file represented by this resource descriptor.
 java.lang.String getFileExtension()
          Gets the extension of the file represented by this resource descriptor.
 java.lang.String getFileName()
          Gets the name of the file.
 java.lang.String getFilePath()
          Returns the path to the file.
 boolean isCompressionEnabled()
          Checks to see if the file represented by this resource descriptor is to be compressed or not.
 void setCompression(boolean compress)
          Sets the compression to be enabled or disabled.
 void setFile(java.io.File file)
          Sets the properties of this file based on the File object passed in.
 

Method Detail

getFileName

public java.lang.String getFileName()
Gets the name of the file.

Returns:
The name of the file. if it hasn't been set.
See Also:
File.getName()

getFilePath

public java.lang.String getFilePath()
Returns the path to the file.

Returns:
The file path ending with the separator character or null if it hasn't been set.
See Also:
File.separator, File.getPath()

setFile

public void setFile(java.io.File file)
Sets the properties of this file based on the File object passed in.

Parameters:
file - The file whose properties this resource descriptor should imbibe.

getFile

public java.io.File getFile()
Gets the file represented by this resource descriptor.

Returns:
The file represented by this file resource descriptor or null if no file has been set.

getFileExtension

public java.lang.String getFileExtension()
Gets the extension of the file represented by this resource descriptor. The extension of the file must start with a period. Hence a file with the name, "example.mat" would have the extension ".mat".

Returns:
The extension of this file.

isCompressionEnabled

public boolean isCompressionEnabled()
Checks to see if the file represented by this resource descriptor is to be compressed or not.

Returns:
true if the file should be compressed after being persisted or decompressed when restored.

setCompression

public void setCompression(boolean compress)
Sets the compression to be enabled or disabled. Certain file types such as XML files occupy an obnoxious amount of disk space and implementations are encouraged to use compression for these file types. Whether a resource descriptor is to be compressed is or not can be checked using compressionEnabled(). Each persister obviously also needs to check for whether a particular file is compressed or not and respond accordingly as to whether or not it can persist or restore from the resource.

Parameters:
compress - true if the file should be compressed or decompressed. false if the file shouldn't be compressed.
See Also:
edu.iu.iv.core.persistence.FileResourceDescriptor#compressionEnabled()