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