|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
net.sourceforge.rssowl.controller.thread.AmphetaRateThread
This class is used to implement AmphetaRate functionality to RSSOwl. A running thread submits ratings (connects to an URL for each rating) every 15 minutes. The ratings are stored in a Hashtable. The user may rate each news from a newsfeed. Possible ratings are given throught the constants Wow!, Good and Crap.
Field Summary | |
private boolean |
isSubmitting
Flag indicates that the thread is currently submitting ratings |
private boolean |
keepRunning
Flag indicates that the thread was not stopped yet |
private static String |
PARAM_CLIENT
Tell that RSSOwl querrys AmphetaRate |
private static String |
PARAM_HTML
Tell that the recommendation articles should not be formatted with HTML |
private static String |
PARAM_LINKINDESC
Tell that we dont want the feed link in the description |
static String |
PARAM_LIST
Complete list of parameters as we want AmphetaRate to behave |
private static String |
PARAM_ORIGURL
Tell that we need the origurl-tag in the recommendations |
static int |
RATE_BAD
Rate-level: Bad |
static int |
RATE_FANTASTIC
Rate-level: Fantastic |
static int |
RATE_GOOD
Rate-level: Good |
static int |
RATE_MODERATE
Rate-level: Moderate |
static int |
RATE_VERY_BAD
Rate-level: Very Bad |
static Hashtable |
ratedNews
Store the news that have been rated in this session |
private static Hashtable |
ratings
Holds all not yet submitted ratings |
private static String |
STATUS_ERROR
Server status code for an erroneous submission of a rating |
static String |
STATUS_OK
Server status code for a successfull submission of a rating |
private static int |
SUBMIT_INTERVAL
Interval for the thread to submit the collected ratings |
Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
AmphetaRateThread()
Instantiate a new AmphetaRateThread |
Method Summary | |
static Hashtable |
getRatings()
Get all ratings |
static String |
getTranslatedRatingLevel(int rateLevel)
Get the translated rating level for the giving level |
static boolean |
isOldUser()
Get if the user is an old one using the AmphetaRate user id and not the new username alias and password |
static boolean |
rate(NewsItem rssNewsItem,
int rating)
Rate a newsitem from a newschannel |
static String |
register(String user,
String password,
String oldId)
Register to AmphetaRate |
void |
run()
Will check the ratings Hashtable every 15 minutes and connect to all URLs that are int (= perform the rating). |
void |
stopThread()
Stop this Thread |
private static boolean |
submitRating(String url)
Submits a rating from with connecting to the given URL. |
void |
wakeUp()
Wake up submit thread |
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int RATE_BAD
public static final int RATE_FANTASTIC
public static final int RATE_GOOD
public static final int RATE_MODERATE
public static final int RATE_VERY_BAD
public static Hashtable ratedNews
public static final String STATUS_OK
private static final String PARAM_CLIENT
private static final String PARAM_HTML
private static final String PARAM_LINKINDESC
private static final String PARAM_ORIGURL
public static final String PARAM_LIST
private static final Hashtable ratings
private static final String STATUS_ERROR
private static final int SUBMIT_INTERVAL
private boolean isSubmitting
private boolean keepRunning
Constructor Detail |
public AmphetaRateThread()
Method Detail |
public static Hashtable getRatings()
public static String getTranslatedRatingLevel(int rateLevel)
rateLevel
- The level of the rating
public static boolean isOldUser()
public static boolean rate(NewsItem rssNewsItem, int rating)
rssNewsItem
- Selected newsitemrating
- either fantastic, good, moderate, bad or very bad
public static String register(String user, String password, String oldId) throws IOException
user
- Desired usernamepassword
- Desired passwordoldId
- Optional oldId
IOException
- if an error occursprivate static boolean submitRating(String url) throws IOException
url
- The rating-URL consists of title, newsfeed XML URL, description,
newsitem link and the user id.
IOException
- If an error occurspublic void run()
public void stopThread()
public void wakeUp()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |