kom.gateway
Class NewsNotifier

java.lang.Object
  |
  +--kom.gateway.DBLow
        |
        +--kom.gateway.DBHigh
              |
              +--kom.gateway.KOMutil
                    |
                    +--kom.gateway.Form
                          |
                          +--kom.gateway.Chat
                                |
                                +--kom.gateway.Grade
                                      |
                                      +--kom.gateway.News
                                            |
                                            +--kom.gateway.Build
                                                  |
                                                  +--kom.gateway.SendMail
                                                        |
                                                        +--kom.gateway.Action
                                                              |
                                                              +--kom.gateway.NewsNotifier

public class NewsNotifier
extends Action
implements java.lang.Runnable

Class for sending news notifications to some email addresses. Runs as a periodic thread.


Inner classes inherited from class kom.gateway.Build
Build.KOMactivity, Build.KOMcategory, Build.KOMhome, Build.KOMmsg, Build.KOMmt, Build.KOMquery, Build.KOMsub, Build.KOMthr, Build.KOMuser
 
Inner classes inherited from class kom.gateway.KOMutil
KOMutil.LookupTables, KOMutil.UFtable
 
Field Summary
(package private)  ServerConfig config
           
(package private)  long mailNotificationInterval
          Notification interval (ms)
(package private)  boolean sleeping
           
(package private)  boolean stopped
           
protected  java.lang.Thread thread
           
 
Fields inherited from class kom.gateway.Action
CR, CRLF, LF, ovwt, parser
 
Fields inherited from class kom.gateway.Build
curract, kBalt, kBalt2, kBintro, kBintro2, kBrespondents, kBscale, kBscale2, kCnameq, kCnameq2, kCnewlocname, kCnewmembermail, khead, kPlogin, kPloginpw, kPnewloccat, kPnewlocshort, kPopenness, kPsecret, kPsecret2, kstephead, ksteptail, ktail, modified, qrytable, SM
 
Fields inherited from class kom.gateway.News
format, HTML, limit, NEWSLIMIT, PLAIN, REGULAR, userObject
 
Fields inherited from class kom.gateway.Chat
oldbody, oldpres, reverseChat
 
Fields inherited from class kom.gateway.Form
acceptform, added, bodytext, curform, formcodes, isHTML, isVote, kBase, kBbody, kCname, kCuser, kDColor, kFBase, KFC, kHColor, kIcons, kKFC, kLColor, kPboard, kPcomm, kPdate, kPhtml, kPhtmldef, kPinterval, kPnotif, kPshort, kPtype, kServer, kTarea, oldOutput, outputText, submitted, substkey
 
Fields inherited from class kom.gateway.KOMutil
ACT, anyAccess, arglist, argsep, argtab, attachments, BOK, BOUNDARYSTART, CAT, CHA, cidTable, CLO, config, curNgd, DIC, environment, gateway, gavePassword, GEN, GRA, GRP, inlineCurr, inlines, INT, LINE_CUTOFF, LINE_FUDGE, LIS, lt, MAILIT, messageRecipientTypeCode, MIM, MOD, N_RECTY, N_RECTYPECODE, newsclient, newsClients, newsData, nntpAuth, NWS, NWSART, objCache, oCurr, oldnews, POSTIT, RAT, REC_BCC, REC_CC, REC_TO, recTypeCode, REP, response, rLoc, savednews, sCursor, servletBase, session, THR, userData, USR, VOT
 
Fields inherited from class kom.gateway.DBHigh
AdminURL, cache, HomeURL, UsersURL
 
Fields inherited from class kom.gateway.DBLow
absCDBpath, config, fSep, fSeparator, msgAuth, msgParts
 
Constructor Summary
NewsNotifier(ServerConfig conf, HTTPResponse response, Gateway gateway)
          Constructor.
 
Method Summary
(package private)  long getInterval(KomData user)
          Gets value of desired news checking interval.
(package private)  java.lang.String getNotif(java.lang.String userref, long limit, int format)
          Gets a notice text for a "user" in String form.
 void notifyUsers()
          For all users, sends a notification message if the user has requested notifications, and there is any news, and the last notification was not sent too recently.
 void run()
          The Thread.run method.
 void stop()
          Causes the thread to be stopped.
 
Methods inherited from class kom.gateway.Action
Accept, addAddress, addBatchOfEntries, addBatchOfUsers, AddChat, AddGen, AddGrades, addm, AddMemb, addOneEntry, addOneUser, AddRec, addReceiver, addtype, addUser, authData, CastVote, CheckMsgPwd, checkNews, Create, create1, CreateForm, createForum, createObject, creUser, deleteObj, display, display, distribute, emailCheck, findDraftObject, findRef, getAddress, getAllRecs, getBoard, getEmail, getRecs, getShort, getType, getUser, getXrecs, Login, makeAddress, process, queryinvite, Register, resetUpdate, setPartHeaders, SnetLogin
 
Methods inherited from class kom.gateway.SendMail
addmailaddr, addRecipients, addReferences, closed, disconnected, getFrom, getSender, inetAddr, makeCid, makeContent, makeMime, messageDelivered, messageNotDelivered, messagePartiallyDelivered, mkIadd, opened, post, reduceRecipients, sameAddr, sendEmail
 
Methods inherited from class kom.gateway.Build
addParts, addrecs, build, buildReferences, checkCDB, contentHeaders, copyParts, delete, dispdelete, dispexcl, disphelp, dispinfo, displogin, dispmain, dispnormal, dispparent, disppreview, disprecs, dispreg, doLogin, expunge, getAct, getHier, getKOMmsg, getKOMmsg, getMessageId, getMimeRef, getMt, getNewsClient, getNewsGroupData, getObj, getRecop, getThreads, getUserNews, handleOverviews, history, logout, makeBodyPart, makecont, makeform, makehtml, makeoper, makerec, makerec, makerec, makeRelatedPart, makeSimpleHTMLpart, menufoot, menuhead, messageid, messageid, mimeChange, mkmbox, mkmbox, moderate, modifytype, newMimeBodyPart, nntpServer, outpreview, page, setDefault, setDefaults, setUserValue, showatts, special, store, xform, xform, xform, xform
 
Methods inherited from class kom.gateway.News
addMem, bookmarks, checkNewMemb, checkUnseen, countmod, dispActNews, dispBook, dispCatNews, dispForumNews, dispLetterNews, dispModNews, dispMods, dispPersNews, dispSavedNews, dispSavedQueries, getRead, makeNews, markCat, markPres, markrecs, markSeen, newVote, nextUnread, putShort, storeNews, threadno
 
Methods inherited from class kom.gateway.Grade
catover, cretab, fetchGrade, fetchRate, getEvaluation, getgrade, isTeacher, listover, newGrade, printRatings, showcat, showgrades, shownumbers, showover, showstud, showuser
 
Methods inherited from class kom.gateway.Chat
addChat, chat, chatFetch, chatHeader, chatIndex, chatInput, chatList, chatOut, chatOutput, chatStore, checkEnter, enter, isActive, leave, leaveChat, pres, qchat, setUser, transform
 
Methods inherited from class kom.gateway.Form
, add, addBody, addv, checkHTML, checkHTTP, checkTag, checkVote, complete, contains, dispauth, dispbody, dispcheck, dispname, dispselect, disptype, form, form, form, form, formsegment, getAreaResult, getForm, getHTML, getOutputText, getQryValues, getResultBox, getResultText, getSelect1, getSelect2, getSelectResult, getTag, getVote, getVoteArea, getVoteCheck, getVoteSelect, getVoteSubmit, getVoteTag, getVoteText, insertSelect, makeHTML, nextmatching, normalize, restoreOutput, saveOutput, textareaSubst, transform, translate, trbody
 
Methods inherited from class kom.gateway.KOMutil
a, accessCont, accessCont, accessObj, addInfoData, addrToLocal, changeEnvironment, cidReplace, contType, decodeText, deleted, dispMailMessage, doAction, equal, excluded, fetchNews, findId, findId, findlocal, findLogin, findOwner, findUser, getActId, getcont, getcont, getcontV, getcontV, getCurNgd, getmemb, getMsgParts, getMsgText, getNews, getNewsAuth, getobj, getobject, getold, getParent, getPart, getSimpleFileName, getSimpleFileName, getStream, getTail, getTextPart, getVal, getVal, isAllowed, isarg, isMember, isOrganizer, isOrganizer, ispunct, isType, isValidEmailAddress, loggedIn, mailDate, mailDate, mimeMessage, mimeMessageStream, mkdate, mkdate, noQuote, parseArglist, parseArgs, setCids, setNewsAuth, setValidMsgPwd, showBody, showHeader, showHeader, showHeaders, showInputStream, showMailMessage, showMessage, showMultipart, toString, transbody, urlexpand, userGavePassword, userGavePassword, wrap
 
Methods inherited from class kom.gateway.DBHigh
addContent, addContent, addDraft, addInfo, addLast, addMember, addNews, addObj, addObj, addObject, addObject, addQuery, cleanDrafts, contentCount, createNews, depth, expungeRef, findContent, findDraft, findDraftData, findInfo, findMemb, findNews, findObject, findObject, findQuery, getFormContents, getQryDefault, getQueries, getseq, getStringValues, getValues, invalidateCount, isEmpty, isStandard, listDraft, makeArea, modObject, msgExists, nextDraft, queryExists, ref2path, refExists, removeDraft, removeQuery, replaceObject, Stream2String, String2Stream, StringBuffer2Stream, updateCount, updCount, updref, updseq
 
Methods inherited from class kom.gateway.DBLow
accessPart, addFile, areaExists, basedRef, createArea, debugLog, errorLog, expungeFile, File2Stream, File2String, findPart, getFile, getFileContents, getFileStream, getPath, getStandard, isMailSpool, lastModified, length, listFiles, makePart, msgPartStream, partfile, partpath, printStackTrace, readObject, removeFile, replaceMime, updseq1, validate, validate, writeObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

thread

protected java.lang.Thread thread

stopped

boolean stopped

sleeping

boolean sleeping

mailNotificationInterval

long mailNotificationInterval
Notification interval (ms)

config

ServerConfig config
Constructor Detail

NewsNotifier

public NewsNotifier(ServerConfig conf,
                    HTTPResponse response,
                    Gateway gateway)
Constructor.
Parameters:
conf - Configuration data
response - Used by super
gateway - Used by super
Method Detail

stop

public void stop()
Causes the thread to be stopped. If thread is dormant, interrupts its sleep.

notifyUsers

public void notifyUsers()
For all users, sends a notification message if the user has requested notifications, and there is any news, and the last notification was not sent too recently. News older than two weeks is not included.

getInterval

long getInterval(KomData user)
Gets value of desired news checking interval.
Parameters:
user - Id of user to be checked.
Returns:
Value from keword or numeric choice.

getNotif

java.lang.String getNotif(java.lang.String userref,
                          long limit,
                          int format)
Gets a notice text for a "user" in String form.
Parameters:
userref - Internal ref to user.
limit - Don't consider news older than this.
format - Desired text format code (News.HTML or News.PLAIN)
Returns:
the text of the notice.

run

public void run()
The Thread.run method. Runs every mailNotificationInterval milliseconds, sleeps in between. When awakened, it runs the notifyUsers method.
Specified by:
run in interface java.lang.Runnable