From 6388bc8c2306bb70b2e211beb7f7f9ce1a2496d6 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sun, 28 Sep 2008 15:59:06 +0000 Subject: Client: Worked more on step 2 Refs #69 --- .../com/fourisland/instadisc/DownloadItem/DownloadItemMode.java | 3 +-- .../src/com/fourisland/instadisc/DownloadItem/ModeControl.java | 7 +++++-- .../trunk/src/com/fourisland/instadisc/DownloadItem/PullMode.java | 4 ++++ .../trunk/src/com/fourisland/instadisc/DownloadItem/PushMode.java | 6 ++++++ client/trunk/src/com/fourisland/instadisc/Item/WellFormedItem.java | 7 ++----- 5 files changed, 18 insertions(+), 9 deletions(-) (limited to 'client/trunk') diff --git a/client/trunk/src/com/fourisland/instadisc/DownloadItem/DownloadItemMode.java b/client/trunk/src/com/fourisland/instadisc/DownloadItem/DownloadItemMode.java index 157a62a..9d7efc0 100644 --- a/client/trunk/src/com/fourisland/instadisc/DownloadItem/DownloadItemMode.java +++ b/client/trunk/src/com/fourisland/instadisc/DownloadItem/DownloadItemMode.java @@ -1,13 +1,12 @@ package com.fourisland.instadisc.DownloadItem; -import java.util.Timer; - public interface DownloadItemMode { public void modeInitalize(); public void modeDeinitalize(); public void requestRetained(); + public void sendItem(int id); public int setTimer(); public void timerTick(); diff --git a/client/trunk/src/com/fourisland/instadisc/DownloadItem/ModeControl.java b/client/trunk/src/com/fourisland/instadisc/DownloadItem/ModeControl.java index 73b48c8..9801b74 100644 --- a/client/trunk/src/com/fourisland/instadisc/DownloadItem/ModeControl.java +++ b/client/trunk/src/com/fourisland/instadisc/DownloadItem/ModeControl.java @@ -31,10 +31,13 @@ public class ModeControl implements DownloadItemMode dim.modeDeinitalize(); } - public void requestRetained() - { + public void requestRetained() { dim.requestRetained(); } + + public void sendItem(int id) { + dim.sendItem(id); + } public int setTimer() { return dim.setTimer(); diff --git a/client/trunk/src/com/fourisland/instadisc/DownloadItem/PullMode.java b/client/trunk/src/com/fourisland/instadisc/DownloadItem/PullMode.java index 8e54542..46f71a5 100644 --- a/client/trunk/src/com/fourisland/instadisc/DownloadItem/PullMode.java +++ b/client/trunk/src/com/fourisland/instadisc/DownloadItem/PullMode.java @@ -13,6 +13,10 @@ public class PullMode implements DownloadItemMode public void requestRetained() { throw new UnsupportedOperationException("Not supported yet."); } + + public void sendItem(int id) { + throw new UnsupportedOperationException("Not supported yet."); + } public int setTimer() { throw new UnsupportedOperationException("Not supported yet."); diff --git a/client/trunk/src/com/fourisland/instadisc/DownloadItem/PushMode.java b/client/trunk/src/com/fourisland/instadisc/DownloadItem/PushMode.java index 2e5a6ca..7fb7a4b 100644 --- a/client/trunk/src/com/fourisland/instadisc/DownloadItem/PushMode.java +++ b/client/trunk/src/com/fourisland/instadisc/DownloadItem/PushMode.java @@ -37,6 +37,12 @@ public class PushMode implements DownloadItemMode XmlRpc xmlrpc = new XmlRpc("requestRetained"); xmlrpc.execute(); } + + public void sendItem(int id) { + XmlRpc xmlrpc = new XmlRpc("sendItem"); + xmlrpc.addParam(id); + xmlrpc.execute(); + } public int setTimer() { int delay = (1000 * 60 * 60); diff --git a/client/trunk/src/com/fourisland/instadisc/Item/WellFormedItem.java b/client/trunk/src/com/fourisland/instadisc/Item/WellFormedItem.java index 05b5378..9cc644d 100644 --- a/client/trunk/src/com/fourisland/instadisc/Item/WellFormedItem.java +++ b/client/trunk/src/com/fourisland/instadisc/Item/WellFormedItem.java @@ -7,6 +7,7 @@ package com.fourisland.instadisc.Item; import com.fourisland.instadisc.Database.Filter; import com.fourisland.instadisc.Database.Subscription; import com.fourisland.instadisc.Database.Wrapper; +import com.fourisland.instadisc.DownloadItem.ModeControl; import com.fourisland.instadisc.Functions; import com.fourisland.instadisc.Item.Categories.Category; import com.fourisland.instadisc.XmlRpc; @@ -182,11 +183,7 @@ public class WellFormedItem { Verification ver = new Verification(ivid); good = aThis.headerMap.get("Verification").equals(ver.getHash()); } catch (VerificationIDReusedException ex) { - XmlRpc xmlrpc = new XmlRpc("resendItem"); - String id = aThis.headerMap.get("ID"); - int iid = Integer.decode(id); - xmlrpc.addParam(iid); - xmlrpc.execute(); + ModeControl.INSTANCE.sendItem(Integer.decode(aThis.headerMap.get("ID"))); } catch (Exception ex) { Logger.getLogger(WellFormedItem.class.getName()).log(Level.SEVERE, null, ex); } -- cgit 1.4.1