Search in sources :

Example 1 with TFileReader

use of de.schlichtherle.truezip.file.TFileReader in project alfresco-repository by Alfresco.

the class InstalledFiles method load.

/**
 * Loads the exisiting information about the installed files from the WAR
 */
public void load() {
    TFile file = new TFile(getFileLocation());
    if (file.exists() == true) {
        try {
            BufferedReader reader = new BufferedReader(new TFileReader(file));
            try {
                String line = reader.readLine();
                while (line != null) {
                    String[] modification = line.split("\\" + DELIMITER);
                    String mod = modification[0];
                    String location = modification[1];
                    if (mod.equals(MOD_ADD_FILE) == true) {
                        this.adds.add(location);
                    } else if (mod.equals(MOD_MK_DIR) == true) {
                        this.mkdirs.add(location);
                    } else if (mod.equals(MOD_UPDATE_FILE) == true) {
                        this.updates.put(location, modification[2]);
                    }
                    line = reader.readLine();
                }
            } finally {
                reader.close();
            }
        } catch (FileNotFoundException exception) {
            throw new ModuleManagementToolException("The module file install file '" + getFileLocation() + "' does not exist", exception);
        } catch (IOException exception) {
            throw new ModuleManagementToolException("Error whilst reading file '" + getFileLocation(), exception);
        }
    } else {
        throw new ModuleManagementToolException("Invalid module.  The installation file does not exist for module: " + moduleId);
    }
}
Also used : TFile(de.schlichtherle.truezip.file.TFile) BufferedReader(java.io.BufferedReader) FileNotFoundException(java.io.FileNotFoundException) IOException(java.io.IOException) TFileReader(de.schlichtherle.truezip.file.TFileReader)

Aggregations

TFile (de.schlichtherle.truezip.file.TFile)1 TFileReader (de.schlichtherle.truezip.file.TFileReader)1 BufferedReader (java.io.BufferedReader)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1