Store and load last insert filename.
[jSite.git] / src / de / todesbaum / jsite / main / Configuration.java
index 3c65d97..f5001b0 100644 (file)
@@ -39,6 +39,7 @@ import de.todesbaum.jsite.application.FileOption;
 import de.todesbaum.jsite.application.Node;
 import de.todesbaum.jsite.application.Project;
 import de.todesbaum.jsite.main.ConfigurationLocator.ConfigurationLocation;
+import de.todesbaum.util.freenet.fcp2.ClientPutDir.ManifestPutter;
 import de.todesbaum.util.freenet.fcp2.PriorityClass;
 import de.todesbaum.util.io.Closer;
 import de.todesbaum.util.io.StreamCopier;
@@ -345,8 +346,12 @@ public class Configuration {
                                                        String filename = fileNode.getNode("filename").getValue();
                                                        String lastInsertHash = fileNode.getNode("last-insert-hash").getValue();
                                                        int lastInsertEdition = Integer.valueOf(fileNode.getNode("last-insert-edition").getValue());
+                                                       String lastInsertFilename = filename;
+                                                       if (fileNode.getNode("last-insert-filename") != null) {
+                                                               lastInsertFilename = fileNode.getNode("last-insert-filename").getValue();
+                                                       }
                                                        FileOption fileOption = project.getFileOption(filename);
-                                                       fileOption.setLastInsertHash(lastInsertHash).setLastInsertEdition(lastInsertEdition);
+                                                       fileOption.setLastInsertHash(lastInsertHash).setLastInsertEdition(lastInsertEdition).setLastInsertFilename(lastInsertFilename);
                                                        fileOptions.put(filename, fileOption);
                                                }
                                        }
@@ -409,6 +414,7 @@ public class Configuration {
                                fileNode.append("filename", fileOption.getKey());
                                fileNode.append("last-insert-hash", fileOption.getValue().getLastInsertHash());
                                fileNode.append("last-insert-edition", String.valueOf(fileOption.getValue().getLastInsertEdition()));
+                               fileNode.append("last-insert-filename", fileOption.getValue().getLastInsertFilename());
                        }
 
                        SimpleXML fileOptionsNode = projectNode.append("file-options");
@@ -615,4 +621,25 @@ public class Configuration {
                return this;
        }
 
+       /**
+        * Returns the manifest putter.
+        *
+        * @return The manifest putter
+        */
+       public ManifestPutter getManifestPutter() {
+               return ManifestPutter.valueOf(getNodeValue(new String[] { "manifest-putter" }, "simple").toUpperCase());
+       }
+
+       /**
+        * Sets the manifest putter.
+        *
+        * @param manifestPutter
+        *            The manifest putter
+        * @return This configuration
+        */
+       public Configuration setManifestPutter(ManifestPutter manifestPutter) {
+               rootNode.replace("manifest-putter", manifestPutter.name().toLowerCase());
+               return this;
+       }
+
 }