2 * jFCPlib-high-level-client - PutRequestResult.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 net.pterodactylus.fcp.highlevel;
22 import net.pterodactylus.fcp.Persistence;
23 import net.pterodactylus.fcp.PersistentPut;
24 import net.pterodactylus.fcp.Priority;
25 import net.pterodactylus.fcp.UploadFrom;
26 import net.pterodactylus.fcp.Verbosity;
29 * A put request result will be contained in a {@link RequestListResult}.
31 * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
34 public class PutRequestResult extends RequestResult {
36 /** The wrapped PersistentPut FCP message. */
37 private final PersistentPut persistentPut;
40 * Creates a new put request result.
42 * @param persistentPut
43 * The PersistentPut FCP message to wrap
45 public PutRequestResult(PersistentPut persistentPut) {
46 super(persistentPut.getIdentifier());
47 this.persistentPut = persistentPut;
51 * Returns the client token associated with the request.
53 * @return The client token
54 * @see net.pterodactylus.fcp.PersistentPut#getClientToken()
56 public String getClientToken() {
57 return persistentPut.getClientToken();
61 * Returns the length of the data to be inserted.
63 * @return The length of the data
64 * @see net.pterodactylus.fcp.PersistentPut#getDataLength()
66 public long getDataLength() {
67 return persistentPut.getDataLength();
71 * Returns the maximum number of retries for failed blocks.
73 * @return The maximum number of retries
74 * @see net.pterodactylus.fcp.PersistentPut#getMaxRetries()
76 public int getMaxRetries() {
77 return persistentPut.getMaxRetries();
81 * Returns the content type of the data.
83 * @return The content type of the data
84 * @see net.pterodactylus.fcp.PersistentPut#getMetadataContentType()
86 public String getMetadataContentType() {
87 return persistentPut.getMetadataContentType();
91 * Returns the persistence level of the request.
93 * @return The persistence level
94 * @see net.pterodactylus.fcp.PersistentPut#getPersistence()
96 public Persistence getPersistence() {
97 return persistentPut.getPersistence();
101 * Returns the priority of the request.
103 * @return The priority
104 * @see net.pterodactylus.fcp.PersistentPut#getPriority()
106 public Priority getPriority() {
107 return persistentPut.getPriority();
111 * Returns the target filename of the request
113 * @return The target filename
114 * @see net.pterodactylus.fcp.PersistentPut#getTargetFilename()
116 public String getTargetFilename() {
117 return persistentPut.getTargetFilename();
121 * Returns the upload source of the request.
123 * @return The upload source
124 * @see net.pterodactylus.fcp.PersistentPut#getUploadFrom()
126 public UploadFrom getUploadFrom() {
127 return persistentPut.getUploadFrom();
131 * Returns the URI of the request.
134 * @see net.pterodactylus.fcp.PersistentPut#getURI()
136 public String getURI() {
137 return persistentPut.getURI();
141 * Returns the verbosity of the request.
143 * @return The verbosity
144 * @see net.pterodactylus.fcp.PersistentPut#getVerbosity()
146 public Verbosity getVerbosity() {
147 return persistentPut.getVerbosity();
151 * Returns whether the request is on the global queue.
153 * @return <code>true</code> if the request is on the global queue,
154 * <code>false</code> if it is on the client-local queue
155 * @see net.pterodactylus.fcp.PersistentPut#isGlobal()
157 public boolean isGlobal() {
158 return persistentPut.isGlobal();
162 * Returns whether the request has already started.
164 * @return <code>true</code> if the request has started,
165 * <code>false</code> otherwise
166 * @see net.pterodactylus.fcp.PersistentPut#isStarted()
168 public boolean isStarted() {
169 return persistentPut.isStarted();