X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fde%2Ftodesbaum%2Fjsite%2Fmain%2FConfiguration.java;h=3c65d9763a3d7be2d6ec35feb91e41d5673dfb0c;hb=2186af0239fdfe89512d09f1c2cbf491da6247b7;hp=90cb40aa2f823bad30e42dfc3086db2b7b12cd05;hpb=4a8decbd175ff792f715a4816258b1af94c7027d;p=jSite.git diff --git a/src/de/todesbaum/jsite/main/Configuration.java b/src/de/todesbaum/jsite/main/Configuration.java index 90cb40a..3c65d97 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,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.PriorityClass; import de.todesbaum.util.io.Closer; import de.todesbaum.util.io.StreamCopier; import de.todesbaum.util.xml.SimpleXML; @@ -337,18 +338,20 @@ public class Configuration { } /* load last insert hashes. */ + Map fileOptions = new HashMap(); SimpleXML lastInsertHashesNode = projectNode.getNode("last-insert-hashes"); if (lastInsertHashesNode != null) { for (SimpleXML fileNode : lastInsertHashesNode.getNodes("file")) { String filename = fileNode.getNode("filename").getValue(); String lastInsertHash = fileNode.getNode("last-insert-hash").getValue(); int lastInsertEdition = Integer.valueOf(fileNode.getNode("last-insert-edition").getValue()); - project.getFileOption(filename).setLastInsertHash(lastInsertHash).setLastInsertEdition(lastInsertEdition); + FileOption fileOption = project.getFileOption(filename); + fileOption.setLastInsertHash(lastInsertHash).setLastInsertEdition(lastInsertEdition); + fileOptions.put(filename, fileOption); } } SimpleXML fileOptionsNode = projectNode.getNode("file-options"); - Map fileOptions = new HashMap(); if (fileOptionsNode != null) { SimpleXML[] fileOptionNodes = fileOptionsNode.getNodes("file-option"); for (SimpleXML fileOptionNode : fileOptionNodes) { @@ -568,4 +571,48 @@ 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; + } + }