Search in sources :

Example 6 with BackupFileExtractor

use of org.openforis.collect.io.BackupFileExtractor in project collect by openforis.

the class BackupDataExtractor method init.

public void init() throws ZipException, IOException {
    this.fileExtractor = new BackupFileExtractor(zipFile);
    this.oldFormat = this.fileExtractor.isOldFormat();
    this.dataUnmarshaller = new DataUnmarshaller(survey);
    this.zipEntries = zipFile.entries();
    this.initialized = true;
}
Also used : DataUnmarshaller(org.openforis.collect.persistence.xml.DataUnmarshaller) BackupFileExtractor(org.openforis.collect.io.BackupFileExtractor)

Example 7 with BackupFileExtractor

use of org.openforis.collect.io.BackupFileExtractor in project collect by openforis.

the class SurveyBackupVerifierTask method execute.

@Override
protected void execute() throws Throwable {
    BackupFileExtractor fileExtractor = new BackupFileExtractor(zipFile);
    checkEntryExists(fileExtractor, SurveyBackupJob.INFO_FILE_NAME);
    checkEntryExists(fileExtractor, SurveyBackupJob.SURVEY_XML_ENTRY_NAME);
}
Also used : BackupFileExtractor(org.openforis.collect.io.BackupFileExtractor)

Example 8 with BackupFileExtractor

use of org.openforis.collect.io.BackupFileExtractor in project collect by openforis.

the class DataRestoreController method extractSurveyUri.

private String extractSurveyUri(File tempFile) throws ZipException, IOException, FileNotFoundException {
    BackupFileExtractor backupFileExtractor = null;
    try {
        backupFileExtractor = new BackupFileExtractor(tempFile);
        File infoFile = backupFileExtractor.extractInfoFile();
        SurveyBackupInfo backupInfo = SurveyBackupInfo.parse(new FileInputStream(infoFile));
        String surveyUri = backupInfo.getSurveyUri();
        return surveyUri;
    } finally {
        IOUtils.closeQuietly(backupFileExtractor);
    }
}
Also used : SurveyBackupInfo(org.openforis.collect.io.SurveyBackupInfo) BackupFileExtractor(org.openforis.collect.io.BackupFileExtractor) File(java.io.File) MultipartFile(org.springframework.web.multipart.MultipartFile) FileInputStream(java.io.FileInputStream)

Aggregations

BackupFileExtractor (org.openforis.collect.io.BackupFileExtractor)8 SurveyBackupInfo (org.openforis.collect.io.SurveyBackupInfo)4 File (java.io.File)3 FileInputStream (java.io.FileInputStream)3 FileOutputStream (java.io.FileOutputStream)1 ZipEntry (java.util.zip.ZipEntry)1 ZipOutputStream (java.util.zip.ZipOutputStream)1 CollectSurvey (org.openforis.collect.model.CollectSurvey)1 DataUnmarshaller (org.openforis.collect.persistence.xml.DataUnmarshaller)1 MultipartFile (org.springframework.web.multipart.MultipartFile)1