Make the insert priority configurable.
authorDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Sun, 18 Mar 2012 01:13:50 +0000 (02:13 +0100)
committerDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Sun, 18 Mar 2012 01:13:50 +0000 (02:13 +0100)
src/de/todesbaum/jsite/application/ProjectInserter.java

index 7c7c89c..70b485e 100644 (file)
@@ -43,6 +43,7 @@ import de.todesbaum.util.freenet.fcp2.Connection;
 import de.todesbaum.util.freenet.fcp2.DirectFileEntry;
 import de.todesbaum.util.freenet.fcp2.FileEntry;
 import de.todesbaum.util.freenet.fcp2.Message;
+import de.todesbaum.util.freenet.fcp2.PriorityClass;
 import de.todesbaum.util.freenet.fcp2.RedirectFileEntry;
 import de.todesbaum.util.freenet.fcp2.Verbosity;
 import de.todesbaum.util.io.StreamCopier.ProgressListener;
@@ -93,6 +94,9 @@ public class ProjectInserter implements FileScannerListener, Runnable {
        /** Whether to use “early encode.” */
        private boolean useEarlyEncode;
 
+       /** The insert priority. */
+       private PriorityClass priority;
+
        /**
         * Adds a listener to the list of registered listeners.
         *
@@ -230,6 +234,16 @@ public class ProjectInserter implements FileScannerListener, Runnable {
        }
 
        /**
+        * Sets the insert priority.
+        *
+        * @param priority
+        *            The insert priority
+        */
+       public void setPriority(PriorityClass priority) {
+               this.priority = priority;
+       }
+
+       /**
         * Starts the insert.
         *
         * @param progressListener
@@ -420,6 +434,7 @@ public class ProjectInserter implements FileScannerListener, Runnable {
                putDir.setVerbosity(Verbosity.ALL);
                putDir.setMaxRetries(-1);
                putDir.setEarlyEncode(useEarlyEncode);
+               putDir.setPriorityClass(priority);
                putDir.setManifestPutter(ManifestPutter.DEFAULT);
                for (ScannedFile file : files) {
                        FileEntry fileEntry = createFileEntry(file, edition);