|
||||||||||
| 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
public class 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.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
| 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 java.lang.String |
PARAM_CLIENT
Tell that RSSOwl querrys AmphetaRate |
private static java.lang.String |
PARAM_HTML
Tell that the recommendation articles should not be formatted with HTML |
private static java.lang.String |
PARAM_LINKINDESC
Tell that we dont want the feed link in the description |
static java.lang.String |
PARAM_LIST
Complete list of parameters as we want AmphetaRate to behave |
private static java.lang.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 java.util.Hashtable |
ratedNews
Store the news that have been rated in this session |
private static java.util.Hashtable |
ratings
Holds all not yet submitted ratings |
private static java.lang.String |
STATUS_ERROR
Server status code for an erroneous submission of a rating |
static java.lang.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 java.util.Hashtable |
getRatings()
Get all ratings |
static java.lang.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 java.lang.String |
register(java.lang.String user,
java.lang.String password,
java.lang.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(java.lang.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, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, 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 java.util.Hashtable ratedNews
public static final java.lang.String STATUS_OK
private static final java.lang.String PARAM_CLIENT
private static final java.lang.String PARAM_HTML
private static final java.lang.String PARAM_LINKINDESC
private static final java.lang.String PARAM_ORIGURL
public static final java.lang.String PARAM_LIST
private static final java.util.Hashtable ratings
private static final java.lang.String STATUS_ERROR
private static final int SUBMIT_INTERVAL
private boolean isSubmitting
private boolean keepRunning
| Constructor Detail |
|---|
public AmphetaRateThread()
| Method Detail |
|---|
public static java.util.Hashtable getRatings()
public static java.lang.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 java.lang.String register(java.lang.String user,
java.lang.String password,
java.lang.String oldId)
throws java.io.IOException
user - Desired usernamepassword - Desired passwordoldId - Optional oldId
java.io.IOException - if an error occurs
private static boolean submitRating(java.lang.String url)
throws java.io.IOException
url - The rating-URL consists of title, newsfeed XML URL, description,
newsitem link and the user id.
java.io.IOException - If an error occurspublic void run()
run in interface java.lang.Runnablerun in class java.lang.Threadpublic void stopThread()
public void wakeUp()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||