|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.unikassel.android.sdcframework.transmission.FileManager
public class FileManager
A file management component for the transmission service.
Does provide the functionality to create a device information XML file as
well as a temporary file directory. In addition it does manage the archive
creation.
Field Summary | |
---|---|
static String |
ARCHIVE_FILE
The filename for the archive without extension |
private String |
archiveFileName
The file path and base name without extension for archive files |
private String |
currentArchive
The file to store a new created archive in |
private String |
deviceFile
The file to store permanent device info in |
private FileEncryptionStrategy |
encryptionStrategy
The file encryption used to create archives |
private FileCompressor |
fileCompressor
The file compressor used to create archives |
private String |
sampleFile
The temporary file to store serialized samples in |
static String |
TEMP_DIR_NAME
The name of the temporary sub directory for files |
Constructor Summary | |
---|---|
FileManager(Context applicationContext,
TransmissionConfiguration config,
UUID uuid)
Constructor |
Method Summary | |
---|---|
boolean |
createArchive(SampleCollection samples)
Does create a new archive containing the device description file and the XML file with the serialized sample collection |
private String |
createArchiveWithFiles(List<String> files)
Method to create an archive from files |
private void |
createDeviceInformation(UUID uuid)
Does create the device information file to be added to the sample collection archive file ( if it does not exist ) |
private void |
createTmpDirectory(String dir)
Does create the temporary directory if it does not exist |
private void |
deleteFile(String fileName)
Does cleanup any temporary files stored |
void |
doCleanUp(boolean deleteArchive)
Does cleanup any temporary files stored |
private String |
encryptArchive(String sArchive)
Method to encrypt the archive if configured |
String |
getCurrentArchive()
Getter for the current archive file name |
String |
getDeviceFile()
Getter for the device file name |
FileCompressor |
getFileCompressor()
Getter for the fileCompressor |
protected PublicKey |
getPubKeyFromAssetFolder(Context context)
Does load the public key file from the asset folder. |
protected PublicKey |
getPubKeyFromFilesFolder(Context context)
Does load the public key file from the private files folder. |
String |
getSampleFile()
Getter for the current sample file name |
boolean |
hasArchive()
Test method for existing archives |
private void |
testForExistingArchive(String dir)
Does check for an existing archive file |
void |
updateConfiguration(Context context,
TransmissionConfiguration config)
Method to update the component by a configuration |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String TEMP_DIR_NAME
public static final String ARCHIVE_FILE
private final String sampleFile
private final String deviceFile
private final String archiveFileName
private String currentArchive
private final FileCompressor fileCompressor
private FileEncryptionStrategy encryptionStrategy
Constructor Detail |
---|
public FileManager(Context applicationContext, TransmissionConfiguration config, UUID uuid)
applicationContext
- the application contextconfig
- the transmission configurationuuid
- the unique device identifier created by the serviceMethod Detail |
---|
public final String getSampleFile()
public final String getCurrentArchive()
public final String getDeviceFile()
public final FileCompressor getFileCompressor()
private void createTmpDirectory(String dir)
dir
- the absolute temporary directory filenameprivate void createDeviceInformation(UUID uuid)
uuid
- the unique device identifier created by the servicepublic boolean createArchive(SampleCollection samples)
samples
- the sample collection
private String encryptArchive(String sArchive)
sArchive
- the archive to encrypt
private String createArchiveWithFiles(List<String> files)
files
- the files to add
public boolean hasArchive()
private void testForExistingArchive(String dir)
dir
- the absolute temporary directory filenamepublic void doCleanUp(boolean deleteArchive)
deleteArchive
- flag if archive file shall be deleted as wellprivate void deleteFile(String fileName)
public void updateConfiguration(Context context, TransmissionConfiguration config)
UpdatableTransmissionComponent
updateConfiguration
in interface UpdatableTransmissionComponent<TransmissionConfiguration>
context
- the application contextconfig
- the configuration to update fromprotected PublicKey getPubKeyFromFilesFolder(Context context)
context
- the context
IOException
protected PublicKey getPubKeyFromAssetFolder(Context context)
context
- the context
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |