use of org.jcryptool.crypto.flexiprovider.operations.xml.OperationsViewEntryRootElement in project core by jcryptool.
the class OperationsManager method saveXML.
public void saveXML() {
FileOutputStream fos;
try {
root = new OperationsViewEntryRootElement();
Iterator<IFlexiProviderOperation> it = newOperations.values().iterator();
while (it.hasNext()) {
root.addEntry(it.next());
}
document = new Document(root);
fos = new FileOutputStream(operationsFile);
new XMLOutputter(Format.getPrettyFormat()).output(document, fos);
} catch (FileNotFoundException e) {
LogUtil.logError(FlexiProviderOperationsPlugin.PLUGIN_ID, "FileNotFoundException while attempting to write the operations.xml file", e, true);
} catch (IOException e) {
LogUtil.logError(FlexiProviderOperationsPlugin.PLUGIN_ID, "IOException while attempting to write the operations.xml file", e, true);
}
}
use of org.jcryptool.crypto.flexiprovider.operations.xml.OperationsViewEntryRootElement in project core by jcryptool.
the class OperationsManager method loadOperations.
private static void loadOperations() {
File flexiprovider = new File(DirectoryService.getWorkspaceDir(), FLEXIPROVIDER_FOLDER);
if (!flexiprovider.exists()) {
flexiprovider.mkdir();
}
operationsFile = new File(flexiprovider, OPERATIONS_FILE_NAME);
if (operationsFile != null && operationsFile.exists() && !loaded) {
// ensure FlexiProvider is initialized
ProviderManager2.getInstance();
// load xml structure
document = loadXML();
if (document != null) {
root = new OperationsViewEntryRootElement(document.getRootElement());
Iterator<EntryNode> it = root.getEntryNodes().iterator();
while (it.hasNext()) {
IFlexiProviderOperation current = it.next();
newOperations.put(current.getTimestamp(), current);
}
loaded = true;
}
}
}
Aggregations