X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fnet%2Fpterodactylus%2Ffcp%2Fhighlevel%2FFcpClient.java;h=f90ab771862c4191ad541341f3a1e61861adbbd3;hb=807741b54ef70dcaf80b8da7a280124998c89f18;hp=bcbc21dddd3ba7bed83ae0f4657a9de2de40bf25;hpb=1c2b138872a5388fbe25f7e3b6ad33ae79742db5;p=jFCPlib.git diff --git a/src/net/pterodactylus/fcp/highlevel/FcpClient.java b/src/net/pterodactylus/fcp/highlevel/FcpClient.java index bcbc21d..f90ab77 100644 --- a/src/net/pterodactylus/fcp/highlevel/FcpClient.java +++ b/src/net/pterodactylus/fcp/highlevel/FcpClient.java @@ -60,6 +60,8 @@ import net.pterodactylus.fcp.RemovePeer; import net.pterodactylus.fcp.SSKKeypair; import net.pterodactylus.fcp.SimpleProgress; import net.pterodactylus.fcp.WatchGlobal; +import net.pterodactylus.util.filter.Filter; +import net.pterodactylus.util.filter.Filters; import net.pterodactylus.util.thread.ObjectWrapper; /** @@ -637,9 +639,55 @@ public class FcpClient { * if an FCP error occurs */ public Collection getGetRequests(final boolean global) throws IOException, FcpException { - return getRequests(global); + return Filters.filteredCollection(getRequests(global), new Filter() { + + /** + * {@inheritDoc} + */ + public boolean filterObject(Request request) { + return request instanceof GetRequest; + } + }); + } + + /** + * Returns all currently visible persistent put requests. + * + * @param global + * true to return put requests from the global + * queue, false to only show requests from the + * client-local queue + * @return All put requests + * @throws IOException + * if an I/O error occurs + * @throws FcpException + * if an FCP error occurs + */ + public Collection getPutRequests(final boolean global) throws IOException, FcpException { + return Filters.filteredCollection(getRequests(global), new Filter() { + + /** + * {@inheritDoc} + */ + public boolean filterObject(Request request) { + return request instanceof PutRequest; + } + }); } + /** + * Returns all currently visible persistent requests. + * + * @param global + * true to return requests from the global queue, + * false to only show requests from the client-local + * queue + * @return All requests + * @throws IOException + * if an I/O error occurs + * @throws FcpException + * if an FCP error occurs + */ public Collection getRequests(final boolean global) throws IOException, FcpException { final Map requests = Collections.synchronizedMap(new HashMap()); new ExtendedFcpAdapter() {