import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.pterodactylus.fcp.highlevel.FcpClient;
import net.pterodactylus.fcp.highlevel.FcpException;
-import net.pterodactylus.fcp.highlevel.Request;
import net.pterodactylus.jsite.util.IdGenerator;
import net.pterodactylus.util.number.Hex;
return true;
}
+ /**
+ * Wraps the requests of the FCP API into jSite requests.
+ *
+ * @param requests
+ * The requests to wrap
+ * @return The wrapped requests
+ */
+ private Collection<Request> wrapRequests(Collection<net.pterodactylus.fcp.highlevel.Request> requests) {
+ Collection<Request> wrappedRequests = new HashSet<Request>();
+ for (net.pterodactylus.fcp.highlevel.Request request : requests) {
+ Request wrappedRequest = new Request(request.getIdentifier());
+ wrappedRequest.setClientToken(request.getClientToken());
+ wrappedRequests.add(wrappedRequest);
+ }
+ return wrappedRequests;
+ }
+
//
// INTERFACE NodeListener
//
return;
}
try {
- Collection<Request> requests = fcpClient.getRequests(true);
+ Collection<Request> requests = wrapRequests(fcpClient.getRequests(true));
for (Request request : requests) {
String clientToken = request.getClientToken();
if ((clientToken == null) || (clientToken.trim().length() == 0)) {