From f894a67b52aaaeba19ebfa8a9e8cb2441093b375 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sun, 28 Sep 2008 16:51:21 +0000 Subject: Client: Completed steps 12, 13 and 14 Closes #69 --- .../instadisc/DownloadItem/PullMode.java | 26 +++++++++++++++++----- .../src/com/fourisland/instadisc/Item/Item.java | 2 +- 2 files changed, 21 insertions(+), 7 deletions(-) (limited to 'client') diff --git a/client/trunk/src/com/fourisland/instadisc/DownloadItem/PullMode.java b/client/trunk/src/com/fourisland/instadisc/DownloadItem/PullMode.java index a14ef1c..be9c09a 100644 --- a/client/trunk/src/com/fourisland/instadisc/DownloadItem/PullMode.java +++ b/client/trunk/src/com/fourisland/instadisc/DownloadItem/PullMode.java @@ -1,28 +1,42 @@ package com.fourisland.instadisc.DownloadItem; +import com.fourisland.instadisc.Item.Item; +import com.fourisland.instadisc.XmlRpc; + public class PullMode implements DownloadItemMode { public void modeInitalize() { - throw new UnsupportedOperationException("Not supported yet."); } public void modeDeinitalize() { - throw new UnsupportedOperationException("Not supported yet."); } public void requestRetained() { - throw new UnsupportedOperationException("Not supported yet."); + XmlRpc xmlrpc = new XmlRpc("requestRetained"); + Item item = new Item((String) xmlrpc.execute()); + item.start(); + + while (item.headerMap.containsKey("More")) + { + xmlrpc = new XmlRpc("sendItem"); + xmlrpc.addParam(Integer.decode(item.headerMap.get("More"))); + item = new Item((String) xmlrpc.execute()); + item.start(); + } } public void resendItem(int id) { - throw new UnsupportedOperationException("Not supported yet."); + XmlRpc xmlrpc = new XmlRpc("resendItem"); + xmlrpc.addParam(id); + Item item = new Item((String) xmlrpc.execute()); + item.start(); } public int setTimer() { - throw new UnsupportedOperationException("Not supported yet."); + return (60 * 5); // 5 minutes } public void timerTick() { - throw new UnsupportedOperationException("Not supported yet."); + requestRetained(); } } \ No newline at end of file diff --git a/client/trunk/src/com/fourisland/instadisc/Item/Item.java b/client/trunk/src/com/fourisland/instadisc/Item/Item.java index 272ce2d..49a2c75 100644 --- a/client/trunk/src/com/fourisland/instadisc/Item/Item.java +++ b/client/trunk/src/com/fourisland/instadisc/Item/Item.java @@ -19,7 +19,7 @@ import java.util.HashMap; */ public class Item { - HashMap headerMap; + public HashMap headerMap; public Item(String result) { String[] headers = result.toString().split("\n"); -- cgit 1.4.1