From 52f29c032eb637965d5342d3bd45843774d926b5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 14 May 2008 20:18:27 +0000 Subject: [PATCH] set type of request git-svn-id: http://trooper/svn/projects/jSite/trunk@884 c3eda9e8-030b-0410-8277-bc7414b0a119 --- src/net/pterodactylus/jsite/core/RequestManager.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/net/pterodactylus/jsite/core/RequestManager.java b/src/net/pterodactylus/jsite/core/RequestManager.java index 3b98dc2..d2b1bde 100644 --- a/src/net/pterodactylus/jsite/core/RequestManager.java +++ b/src/net/pterodactylus/jsite/core/RequestManager.java @@ -28,13 +28,17 @@ import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; +import net.pterodactylus.fcp.highlevel.GetRequestResult; import net.pterodactylus.fcp.highlevel.HighLevelCallback; import net.pterodactylus.fcp.highlevel.HighLevelCallbackListener; import net.pterodactylus.fcp.highlevel.HighLevelClient; import net.pterodactylus.fcp.highlevel.HighLevelProgress; import net.pterodactylus.fcp.highlevel.HighLevelProgressListener; +import net.pterodactylus.fcp.highlevel.PutDirRequestResult; +import net.pterodactylus.fcp.highlevel.PutRequestResult; import net.pterodactylus.fcp.highlevel.RequestListResult; import net.pterodactylus.fcp.highlevel.RequestResult; +import net.pterodactylus.jsite.core.Request.Type; import net.pterodactylus.util.logging.Logging; /** @@ -175,12 +179,23 @@ public class RequestManager implements NodeListener, HighLevelProgressListener { for (RequestResult requestResult: requestListResult) { String identifier = requestResult.getIdentifier(); logger.log(Level.FINER, "got identifier: " + identifier); + Request request = identifierRequests.get(identifier); + if (request == null) { + request = new Request(node, identifier); + } + if (request.getType() == null) { + if (requestResult instanceof GetRequestResult) { + request.setType(Type.get); + } else if (requestResult instanceof PutRequestResult) { + request.setType(Type.put); + } else if (requestResult instanceof PutDirRequestResult) { + request.setType(Type.putDir); + } + } if (identifierRequests.containsKey(identifier)) { continue; } - Request request = new Request(node, identifier); identifierRequests.put(requestResult.getIdentifier(), request); - /* TODO - fill request */ fireRequestAdded(request); } } -- 2.7.4