2 * jFCPlib - ClientPutDiskDir.java - Copyright © 2008–2016 David Roden
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 package net.pterodactylus.fcp;
21 * The “ClientPutDiskDir” message is used to insert a complete directory from
22 * the disk to a single key.
24 * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
26 public class ClientPutDiskDir extends FcpMessage {
29 * Creates a new “ClientPutDiskDir” message.
32 * The URI to insert the file to
34 * The identifier of the request
36 * The name of the directory to insert
38 public ClientPutDiskDir(String uri, String identifier, String directory) {
39 super("ClientPutDiskDir");
41 setField("Identifier", identifier);
42 setField("Filename", directory);
46 * The verbosity of the request. Depending on this parameter you will
47 * received only the bare minimum of messages for the request (i.e. “it
48 * completed”) or a whole lot more.
52 * The verbosity of the request
54 public void setVerbosity(Verbosity verbosity) {
55 setField("Verbosity", String.valueOf(verbosity));
59 * The number of retries for a request if the initial try failed.
62 * The maximum number of retries after failure, or
63 * <code>-1</code> to retry forever.
65 public void setMaxRetries(int maxRetries) {
66 setField("MaxRetries", String.valueOf(maxRetries));
70 * Sets the priority of the request.
73 * The priority of the request
75 public void setPriority(Priority priority) {
76 setField("PriorityClass", String.valueOf(priority));
80 * Determines whether the node should really insert the data or generate
84 * <code>true</code> to generate the final CHK only,
85 * <code>false</code> to really insert the data
87 public void setGetCHKOnly(boolean getCHKOnly) {
88 setField("GetCHKOnly", String.valueOf(getCHKOnly));
92 * Sets whether an insert request should be forked when it is cached.
94 * @param forkOnCacheable
95 * {@code true} to fork the insert when it is cached,
96 * {@code false} otherwise
98 public void setForkOnCacheable(boolean forkOnCacheable) {
99 setField("ForkOnCacheable", String.valueOf(forkOnCacheable));
103 * Sets the number of additional inserts of single blocks.
105 * @param extraInsertsSingleBlock
106 * The number of additional inserts
108 public void setExtraInsertsSingleBlock(int extraInsertsSingleBlock) {
109 setField("ExtraInsertsSingleBlock", String.valueOf(extraInsertsSingleBlock));
113 * Sets the number of additional inserts of splitfile header blocks.
115 * @param extraInsertsSplitfileHeaderBlock
116 * The number of additional inserts
118 public void setExtraInsertsSplitfileHeaderBlock(int extraInsertsSplitfileHeaderBlock) {
119 setField("ExtraInsertsSplitfileHeaderBlock", String.valueOf(extraInsertsSplitfileHeaderBlock));
123 * Determines whether this request appears on the global queue.
126 * <code>true</code> to put the request on the global queue,
127 * <code>false</code> for the client-local queue.
129 public void setGlobal(boolean global) {
130 setField("Global", String.valueOf(global));
134 * Determines whether the node should skip compression because the file has
135 * already been compressed.
137 * @param dontCompress
138 * <code>true</code> to skip compression of the data in the
139 * node, <code>false</code> to allow compression
141 public void setDontCompress(boolean dontCompress) {
142 setField("DontCompress", String.valueOf(dontCompress));
146 * Sets an optional client token. This client token is mentioned in
147 * progress and other request-related messages and can be used to identify
153 public void setClientToken(String clientToken) {
154 setField("ClientToken", clientToken);
158 * Sets the persistence of this request.
161 * The persistence of this request
163 public void setPersistence(Persistence persistence) {
164 setField("Persistence", String.valueOf(persistence));
168 * Sets the name of the default file. The default file is shown when the
169 * key is requested with an additional name.
172 * The name of the default file
174 public void setDefaultName(String defaultName) {
175 setField("DefaultName", defaultName);
179 * Sets whether unreadable files allow the insert to continue.
181 * @param allowUnreadableFiles
182 * <code>true</code> to just ignore unreadable files,
183 * <code>false</code> to let the insert fail when an unreadable
184 * file is encountered
186 public void setAllowUnreadableFiles(boolean allowUnreadableFiles) {
187 setField("AllowUnreadableFiles", String.valueOf(allowUnreadableFiles));