1bd2e781394360a4e7d3367a243d29d0ae80466a
[jFCPlib.git] / src / net / pterodactylus / fcp / highlevel / PutRequestResult.java
1 /*
2  * jFCPlib-high-level-client - PutRequestResult.java -
3  * Copyright © 2008 David Roden
4  *
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.
9  *
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.
14  *
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.
18  */
19
20 package net.pterodactylus.fcp.highlevel;
21
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;
27
28 /**
29  * A put request result will be contained in a {@link RequestListResult}.
30  * 
31  * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
32  */
33 public class PutRequestResult extends RequestResult {
34
35         /** The wrapped PersistentPut FCP message. */
36         private final PersistentPut persistentPut;
37
38         /**
39          * Creates a new put request result.
40          * 
41          * @param persistentPut
42          *            The PersistentPut FCP message to wrap
43          */
44         public PutRequestResult(PersistentPut persistentPut) {
45                 super(persistentPut.getIdentifier());
46                 this.persistentPut = persistentPut;
47         }
48
49         /**
50          * Returns the client token associated with the request.
51          * 
52          * @return The client token
53          * @see net.pterodactylus.fcp.PersistentPut#getClientToken()
54          */
55         public String getClientToken() {
56                 return persistentPut.getClientToken();
57         }
58
59         /**
60          * Returns the length of the data to be inserted.
61          * 
62          * @return The length of the data
63          * @see net.pterodactylus.fcp.PersistentPut#getDataLength()
64          */
65         public long getDataLength() {
66                 return persistentPut.getDataLength();
67         }
68
69         /**
70          * Returns the maximum number of retries for failed blocks.
71          * 
72          * @return The maximum number of retries
73          * @see net.pterodactylus.fcp.PersistentPut#getMaxRetries()
74          */
75         public int getMaxRetries() {
76                 return persistentPut.getMaxRetries();
77         }
78
79         /**
80          * Returns the content type of the data.
81          * 
82          * @return The content type of the data
83          * @see net.pterodactylus.fcp.PersistentPut#getMetadataContentType()
84          */
85         public String getMetadataContentType() {
86                 return persistentPut.getMetadataContentType();
87         }
88
89         /**
90          * Returns the persistence level of the request.
91          * 
92          * @return The persistence level
93          * @see net.pterodactylus.fcp.PersistentPut#getPersistence()
94          */
95         public Persistence getPersistence() {
96                 return persistentPut.getPersistence();
97         }
98
99         /**
100          * Returns the priority of the request.
101          * 
102          * @return The priority
103          * @see net.pterodactylus.fcp.PersistentPut#getPriority()
104          */
105         public Priority getPriority() {
106                 return persistentPut.getPriority();
107         }
108
109         /**
110          * Returns the target filename of the request
111          * 
112          * @return The target filename
113          * @see net.pterodactylus.fcp.PersistentPut#getTargetFilename()
114          */
115         public String getTargetFilename() {
116                 return persistentPut.getTargetFilename();
117         }
118
119         /**
120          * Returns the upload source of the request.
121          * 
122          * @return The upload source
123          * @see net.pterodactylus.fcp.PersistentPut#getUploadFrom()
124          */
125         public UploadFrom getUploadFrom() {
126                 return persistentPut.getUploadFrom();
127         }
128
129         /**
130          * Returns the URI of the request.
131          * 
132          * @return The URI
133          * @see net.pterodactylus.fcp.PersistentPut#getURI()
134          */
135         public String getURI() {
136                 return persistentPut.getURI();
137         }
138
139         /**
140          * Returns the verbosity of the request.
141          * 
142          * @return The verbosity
143          * @see net.pterodactylus.fcp.PersistentPut#getVerbosity()
144          */
145         public Verbosity getVerbosity() {
146                 return persistentPut.getVerbosity();
147         }
148
149         /**
150          * Returns whether the request is on the global queue.
151          * 
152          * @return <code>true</code> if the request is on the global queue,
153          *         <code>false</code> if it is on the client-local queue
154          * @see net.pterodactylus.fcp.PersistentPut#isGlobal()
155          */
156         public boolean isGlobal() {
157                 return persistentPut.isGlobal();
158         }
159
160         /**
161          * Returns whether the request has already started.
162          * 
163          * @return <code>true</code> if the request has started,
164          *         <code>false</code> otherwise
165          * @see net.pterodactylus.fcp.PersistentPut#isStarted()
166          */
167         public boolean isStarted() {
168                 return persistentPut.isStarted();
169         }
170
171 }