use of de.schlichtherle.truezip.file.TFileOutputStream in project alfresco-repository by Alfresco.
the class InstalledFiles method save.
/**
* Saves the current modification details into the WAR
*/
public void save() {
try {
TFile file = new TFile(getFileLocation());
if (file.exists() == false) {
file.createNewFile();
}
TFileOutputStream os = new TFileOutputStream(file);
try {
for (String add : this.adds) {
String output = MOD_ADD_FILE + DELIMITER + add + "\n";
os.write(output.getBytes());
}
for (Map.Entry<String, String> update : this.updates.entrySet()) {
String output = MOD_UPDATE_FILE + DELIMITER + update.getKey() + DELIMITER + update.getValue() + "\n";
os.write(output.getBytes());
}
for (String mkdir : this.mkdirs) {
String output = MOD_MK_DIR + DELIMITER + mkdir + "\n";
os.write(output.getBytes());
}
} finally {
os.close();
}
} catch (IOException exception) {
throw new ModuleManagementToolException("Error whilst saving modifications file.", exception);
}
}
use of de.schlichtherle.truezip.file.TFileOutputStream in project alfresco-repository by Alfresco.
the class ModuleDetailsHelper method saveModuleDetails.
/**
* Saves the module details to the war in the correct location based on the module id
*
* @param warLocation the war location
* @param moduleDetails the module id
*/
public static void saveModuleDetails(String warLocation, ModuleDetails moduleDetails) {
// Ensure that it is a valid set of properties
String moduleId = moduleDetails.getId();
try {
String modulePropertiesFileLocation = getModulePropertiesFileLocation(warLocation, moduleId);
TFile file = new TFile(modulePropertiesFileLocation);
if (file.exists() == false) {
file.createNewFile();
}
// Get all the module properties
Properties moduleProperties = moduleDetails.getProperties();
OutputStream os = new TFileOutputStream(file);
try {
moduleProperties.store(os, null);
} finally {
os.close();
}
} catch (IOException exception) {
throw new ModuleManagementToolException("Unable to save module details into WAR file: \n" + " Module: " + moduleDetails.getId() + "\n" + " Properties: " + moduleDetails.getProperties(), exception);
}
}
Aggregations