implement getting list of persistent requests
[jFCPlib.git] / src / net / pterodactylus / fcp / highlevel / PutDirRequestResult.java
1 /*
2  * jFCPlib-high-level-client - PutDirRequestResult.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.PersistentPutDir;
23 import net.pterodactylus.fcp.Priority;
24 import net.pterodactylus.fcp.UploadFrom;
25 import net.pterodactylus.fcp.Verbosity;
26
27 /**
28  * A PutDir request result is generated by {@link HighLevelClient#getRequests()}.
29  * 
30  * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
31  * @version $Id$
32  */
33 public class PutDirRequestResult extends RequestResult {
34
35         /** The wrapped PersistentPutDir FCP message. */
36         private final PersistentPutDir persistentPutDir;
37
38         /**
39          * Creates a new PutDir request result.
40          * 
41          * @param persistentPutDir
42          *            The PersistentPutDir FCP message to wrap
43          */
44         public PutDirRequestResult(PersistentPutDir persistentPutDir) {
45                 super(persistentPutDir.getIdentifier());
46                 this.persistentPutDir = persistentPutDir;
47         }
48
49         /**
50          * Returns the number of files in the request.
51          * 
52          * @return The number of files
53          * @see net.pterodactylus.fcp.PersistentPutDir#getFileCount()
54          */
55         public int getFileCount() {
56                 return persistentPutDir.getFileCount();
57         }
58
59         /**
60          * Returns the length of the file at the given index.
61          * 
62          * @param fileIndex
63          *            The index of the file
64          * @return The length of the file
65          * @see net.pterodactylus.fcp.PersistentPutDir#getFileDataLength(int)
66          */
67         public long getFileDataLength(int fileIndex) {
68                 return persistentPutDir.getFileDataLength(fileIndex);
69         }
70
71         /**
72          * Returns the name of the file at the given index.
73          * 
74          * @param fileIndex
75          *            The index of the file
76          * @return The name of the file
77          * @see net.pterodactylus.fcp.PersistentPutDir#getFileFilename(int)
78          */
79         public String getFileFilename(int fileIndex) {
80                 return persistentPutDir.getFileFilename(fileIndex);
81         }
82
83         /**
84          * Returns the content type of the file at the given index.
85          * 
86          * @param fileIndex
87          *            The index of the file
88          * @return The content type of the file
89          * @see net.pterodactylus.fcp.PersistentPutDir#getFileMetadataContentType(int)
90          */
91         public String getFileMetadataContentType(int fileIndex) {
92                 return persistentPutDir.getFileMetadataContentType(fileIndex);
93         }
94
95         /**
96          * Returns the name of the file at the given index.
97          * 
98          * @param fileIndex
99          *            The index of the file
100          * @return The name of the file
101          * @see net.pterodactylus.fcp.PersistentPutDir#getFileName(int)
102          */
103         public String getFileName(int fileIndex) {
104                 return persistentPutDir.getFileName(fileIndex);
105         }
106
107         /**
108          * Returns the upload source of the file at the given index.
109          * 
110          * @param fileIndex
111          *            The index of the file
112          * @return The upload source of the file
113          * @see net.pterodactylus.fcp.PersistentPutDir#getFileUploadFrom(int)
114          */
115         public UploadFrom getFileUploadFrom(int fileIndex) {
116                 return persistentPutDir.getFileUploadFrom(fileIndex);
117         }
118
119         /**
120          * Returns the maximum number of retries for failed blocks.
121          * 
122          * @return The maximum number of retries
123          * @see net.pterodactylus.fcp.PersistentPutDir#getMaxRetries()
124          */
125         public int getMaxRetries() {
126                 return persistentPutDir.getMaxRetries();
127         }
128
129         /**
130          * Returns the priority of the request.
131          * 
132          * @return The priority
133          * @see net.pterodactylus.fcp.PersistentPutDir#getPriority()
134          */
135         public Priority getPriority() {
136                 return persistentPutDir.getPriority();
137         }
138
139         /**
140          * Returns the URI of the request.
141          * 
142          * @return The URI of the request
143          * @see net.pterodactylus.fcp.PersistentPutDir#getURI()
144          */
145         public String getURI() {
146                 return persistentPutDir.getURI();
147         }
148
149         /**
150          * Returns the verbosity of the request.
151          * 
152          * @return The verbosity
153          * @see net.pterodactylus.fcp.PersistentPutDir#getVerbosity()
154          */
155         public Verbosity getVerbosity() {
156                 return persistentPutDir.getVerbosity();
157         }
158
159         /**
160          * Returns whether the request is on the global queue.
161          * 
162          * @return <code>true</code> if the request is on the global queue,
163          *         <code>false</code> if it is on the client-local queue
164          * @see net.pterodactylus.fcp.PersistentPutDir#isGlobal()
165          */
166         public boolean isGlobal() {
167                 return persistentPutDir.isGlobal();
168         }
169
170 }