3a8b3402281c127a550b09b8227052db74cc84d2
[jFCPlib.git] / src / net / pterodactylus / fcp / highlevel / GetRequestResult.java
1 /*
2  * jFCPlib-high-level-client - GetRequestResult.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.PersistentGet;
24 import net.pterodactylus.fcp.Priority;
25 import net.pterodactylus.fcp.ReturnType;
26 import net.pterodactylus.fcp.Verbosity;
27
28 /**
29  * A Get result result is generated by {@link HighLevelClient#getRequests()}.
30  * 
31  * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
32  */
33 public class GetRequestResult extends RequestResult {
34
35         /** The PersistentGet FCP message. */
36         private final PersistentGet persistentGet;
37
38         /**
39          * Creates a new Get request result.
40          * 
41          * @param persistentGet
42          *            The PersistentGet message wrapped by this result
43          */
44         public GetRequestResult(PersistentGet persistentGet) {
45                 super(persistentGet.getIdentifier());
46                 this.persistentGet = persistentGet;
47         }
48
49         /**
50          * Returns the client token associated with the request.
51          * 
52          * @return The client token
53          * @see net.pterodactylus.fcp.PersistentGet#getClientToken()
54          */
55         public String getClientToken() {
56                 return persistentGet.getClientToken();
57         }
58
59         /**
60          * Returns the filename of the request.
61          * 
62          * @return The filename
63          * @see net.pterodactylus.fcp.PersistentGet#getFilename()
64          */
65         public String getFilename() {
66                 return persistentGet.getFilename();
67         }
68
69         /**
70          * Returns the maximum number of retries for the request.
71          * 
72          * @return The maximum number of retries
73          * @see net.pterodactylus.fcp.PersistentGet#getMaxRetries()
74          */
75         public int getMaxRetries() {
76                 return persistentGet.getMaxRetries();
77         }
78
79         /**
80          * Returns the persistence level of the request
81          * 
82          * @return The persistence level
83          * @see net.pterodactylus.fcp.PersistentGet#getPersistence()
84          */
85         public Persistence getPersistence() {
86                 return persistentGet.getPersistence();
87         }
88
89         /**
90          * Returns the priority of the request.
91          * 
92          * @return The priority
93          * @see net.pterodactylus.fcp.PersistentGet#getPriority()
94          */
95         public Priority getPriority() {
96                 return persistentGet.getPriority();
97         }
98
99         /**
100          * Returns the return type of the request.
101          * 
102          * @return The return type of the request
103          * @see net.pterodactylus.fcp.PersistentGet#getReturnType()
104          */
105         public ReturnType getReturnType() {
106                 return persistentGet.getReturnType();
107         }
108
109         /**
110          * Returns the temporary filename of the request.
111          * 
112          * @return The temporary filename
113          * @see net.pterodactylus.fcp.PersistentGet#getTempFilename()
114          */
115         public String getTempFilename() {
116                 return persistentGet.getTempFilename();
117         }
118
119         /**
120          * Returns the URI of the request.
121          * 
122          * @return The URI of the request
123          * @see net.pterodactylus.fcp.PersistentGet#getURI()
124          */
125         public String getURI() {
126                 return persistentGet.getURI();
127         }
128
129         /**
130          * Returns the verbosity of the request.
131          * 
132          * @return The verbosity of the request
133          * @see net.pterodactylus.fcp.PersistentGet#getVerbosity()
134          */
135         public Verbosity getVerbosity() {
136                 return persistentGet.getVerbosity();
137         }
138
139         /**
140          * Returns whether this request is on the global queue.
141          * 
142          * @return <code>true</code> if the request is on the global queue,
143          *         <code>false</code> if it is on the client-local queue
144          * @see net.pterodactylus.fcp.PersistentGet#isGlobal()
145          */
146         public boolean isGlobal() {
147                 return persistentGet.isGlobal();
148         }
149
150 }