2 * jSite-remote - ClientGet.java -
3 * Copyright © 2008 David Roden
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 package de.todesbaum.util.freenet.fcp2;
22 import java.io.IOException;
23 import java.io.Writer;
26 * Implementation of the “ClientGet” command.
28 * @author David ‘BombeB Roden <bombe@freenetproject.org>
30 public class ClientGet extends Command {
32 private boolean ignoreDataStore;
33 private boolean dataStoreOnly;
35 private Verbosity verbosity = Verbosity.NONE;
36 private long maxSize = -1;
37 private long maxTempSize = -1;
38 private int maxRetries = -1;
39 private PriorityClass priorityClass = PriorityClass.INTERACTIVE;
40 private Persistence persistence = Persistence.CONNECTION;
41 private String clientToken;
42 private boolean global = false;
43 private ReturnType returnType = ReturnType.direct;
44 private boolean binaryBlob = false;
45 private String allowedMimeTypes = null;
46 private String filename = null;
47 private String tempFilename = null;
50 *Creates a new ClientGet command with the given request identifier.
53 * The request identifier
55 public ClientGet(String identifier) {
56 super("ClientGet", identifier);
64 public boolean isIgnoreDataStore() {
65 return ignoreDataStore;
71 * @param ignoreDataStore
73 public void setIgnoreDataStore(boolean ignoreDataStore) {
74 this.ignoreDataStore = ignoreDataStore;
82 public boolean isDataStoreOnly() {
89 * @param dataStoreOnly
91 public void setDataStoreOnly(boolean dataStoreOnly) {
92 this.dataStoreOnly = dataStoreOnly;
100 public String getUri() {
109 public void setUri(String uri) {
118 public Verbosity getVerbosity() {
127 public void setVerbosity(Verbosity verbosity) {
128 this.verbosity = verbosity;
136 public long getMaxSize() {
145 public void setMaxSize(long maxSize) {
146 this.maxSize = maxSize;
154 public long getMaxTempSize() {
163 public void setMaxTempSize(long maxTempSize) {
164 this.maxTempSize = maxTempSize;
172 public int getMaxRetries() {
181 public void setMaxRetries(int maxRetries) {
182 this.maxRetries = maxRetries;
190 public PriorityClass getPriorityClass() {
191 return priorityClass;
197 * @param priorityClass
199 public void setPriorityClass(PriorityClass priorityClass) {
200 this.priorityClass = priorityClass;
208 public Persistence getPersistence() {
217 public void setPersistence(Persistence persistence) {
218 this.persistence = persistence;
226 public String getClientToken() {
235 public void setClientToken(String clientToken) {
236 this.clientToken = clientToken;
244 public boolean isGlobal() {
253 public void setGlobal(boolean global) {
254 this.global = global;
262 public ReturnType getReturnType() {
271 public void setReturnType(ReturnType returnType) {
272 this.returnType = returnType;
280 public boolean isBinaryBlob() {
289 public void setBinaryBlob(boolean binaryBlob) {
290 this.binaryBlob = binaryBlob;
298 public String getAllowedMimeTypes() {
299 return allowedMimeTypes;
305 * @param allowedMimeTypes
307 public void setAllowedMimeTypes(String allowedMimeTypes) {
308 this.allowedMimeTypes = allowedMimeTypes;
316 public String getFilename() {
325 public void setFilename(String filename) {
326 this.filename = filename;
334 public String getTempFilename() {
341 * @param tempFilename
343 public void setTempFilename(String tempFilename) {
344 this.tempFilename = tempFilename;
351 protected void write(Writer writer) throws IOException {
353 writer.write("IgnoreDS=" + ignoreDataStore + LINEFEED);
354 writer.write("DSonly=" + dataStoreOnly + LINEFEED);
355 writer.write("URI=" + uri + LINEFEED);
356 writer.write("Verbosity=" + verbosity.getValue() + LINEFEED);
358 writer.write("MaxSize=" + maxSize + LINEFEED);
360 if (maxTempSize > -1) {
361 writer.write("MaxTempSize=" + maxTempSize + LINEFEED);
363 if (maxRetries >= -1) {
364 writer.write("MaxRetries=" + maxRetries + LINEFEED);
366 writer.write("PriorityClass=" + priorityClass.getValue() + LINEFEED);
367 writer.write("Persistence=" + persistence.getName() + LINEFEED);
368 if (clientToken != null) {
369 writer.write("ClientToken=" + clientToken + LINEFEED);
371 writer.write("Global=" + global + LINEFEED);
372 writer.write("BinaryBlob=" + binaryBlob + LINEFEED);
373 if (allowedMimeTypes != null) {
374 writer.write("AllowedMIMETypes=" + allowedMimeTypes + LINEFEED);
376 if (returnType == ReturnType.disk) {
377 writer.write("Filename=" + filename + LINEFEED);
378 if (tempFilename != null) {
379 writer.write("TempFilename=" + tempFilename + LINEFEED);