X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fde%2Ftodesbaum%2Fjsite%2Fmain%2FConfiguration.java;h=f5001b0b002ec88b790d5c122d970f74d5061dae;hb=3cfa7d22f64e8792d35c6640e2d4da0f4f6fe1ae;hp=53bfb4daa54320632d2295c7d04df782f0955beb;hpb=e813a9b8c976b7c24af33df253ce40ee1ec4c1d5;p=jSite.git diff --git a/src/de/todesbaum/jsite/main/Configuration.java b/src/de/todesbaum/jsite/main/Configuration.java index 53bfb4d..f5001b0 100644 --- a/src/de/todesbaum/jsite/main/Configuration.java +++ b/src/de/todesbaum/jsite/main/Configuration.java @@ -1,5 +1,5 @@ /* - * jSite - Configuration.java - Copyright © 2006–2011 David Roden + * jSite - Configuration.java - Copyright © 2006–2012 David Roden * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -39,6 +39,8 @@ 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; import de.todesbaum.util.xml.SimpleXML; @@ -344,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); } } @@ -408,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"); @@ -570,4 +577,69 @@ public class Configuration { } } + /** + * Returns whether to use the “early encode“ flag for the insert. + * + * @return {@code true} to set the “early encode” flag for the insert, + * {@code false} otherwise + */ + public boolean useEarlyEncode() { + return getNodeBooleanValue(new String[] { "use-early-encode" }, false); + } + + /** + * Sets whether to use the “early encode“ flag for the insert. + * + * @param useEarlyEncode + * {@code true} to set the “early encode” flag for the insert, + * {@code false} otherwise + * @return This configuration + */ + public Configuration setUseEarlyEncode(boolean useEarlyEncode) { + rootNode.replace("use-early-encode", String.valueOf(useEarlyEncode)); + return this; + } + + /** + * Returns the insert priority. + * + * @return The insert priority + */ + public PriorityClass getPriority() { + return PriorityClass.valueOf(getNodeValue(new String[] { "insert-priority" }, "interactive")); + } + + /** + * Sets the insert priority. + * + * @param priority + * The insert priority + * @return This configuration + */ + public Configuration setPriority(PriorityClass priority) { + rootNode.replace("insert-priority", priority.toString()); + 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; + } + }