| 
geekblog 0.0.1-dev | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--geekblog.JDBCDataManager
Expects a database looking something like the following:
CREATE TABLE entries (ID long identity, posted datetime, title varchar, text varchar) CREATE TABLE articles (entryID long) CREATE TABLE comments (entryID long, name varchar, email varchar, comment varchar) CREATE TABLE links (linkID long identity, linkText varchar, linkURL varchar)
TODO: put close() calls around any open ResultSets
| Field Summary | |
protected  java.sql.Connection | 
conn
 | 
protected  java.util.Map | 
statements
 | 
| Fields inherited from interface geekblog.DataManager | 
KEY | 
| Constructor Summary | |
JDBCDataManager()
Constructor placeholder; all real work done in init()  | 
|
| Method Summary | |
 void | 
destroy(javax.servlet.ServletContext context)
Shut everything down.  | 
 java.util.Collection | 
findEntries(java.lang.String text)
Find all entries containing some text expression  | 
 java.util.Collection | 
getAllEntries()
Retrieve every single last one.  | 
 java.util.Collection | 
getArticleEntries()
Retrieve a list of all the entries marked as articles.  | 
 int | 
getCommentCountForEntry(long entryID)
Retrieve the list of comments for a given entry.  | 
 java.util.Collection | 
getCommentsForEntry(long entryID)
Retrieve the list of comments for a given entry.  | 
 java.sql.Connection | 
getConnection()
Return the JDBC Connection used by this DataManager.  | 
 java.util.Collection | 
getEntriesForDate(java.util.Date date)
Retrieve a list of entries for a given date.  | 
 java.util.Collection | 
getEntriesForMonth(java.util.Date date)
Retrieve a list of entries for a given month/year.  | 
 BlogEntry | 
getEntry(long entryID)
Retrieve an entry by ID.  | 
 int | 
getEntryCountForDate(java.util.Date date)
Retrieve a count of the entries for a given date.  | 
 int | 
getEntryCountForMonth(java.util.Date date)
Retrieve a count of the entries for a given month.  | 
 java.util.Collection | 
getLastNEntries(int n)
Retrieve the last "n" entries.  | 
 void | 
init(javax.servlet.ServletContext context)
Initializer.  | 
 void | 
markAsArticle(BlogEntry entry)
Mark an entry as an article.  | 
 void | 
postComment(long entryID,
            BlogComment comment)
Post a comment to an entry.  | 
 void | 
postEntry(BlogEntry entry)
Post an entry (either new or edited).  | 
 void | 
removeEntry(long entryID)
Remove an entry.  | 
| Methods inherited from class java.lang.Object | 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
protected java.sql.Connection conn
protected java.util.Map statements
| Constructor Detail | 
public JDBCDataManager()
| Method Detail | 
public void init(javax.servlet.ServletContext context)
init in interface DataManagerpublic void destroy(javax.servlet.ServletContext context)
destroy in interface DataManagerpublic java.sql.Connection getConnection()
public BlogEntry getEntry(long entryID)
getEntry in interface DataManagerpublic java.util.Collection getAllEntries()
getAllEntries in interface DataManagerpublic java.util.Collection getLastNEntries(int n)
getLastNEntries in interface DataManagerpublic java.util.Collection getEntriesForDate(java.util.Date date)
getEntriesForDate in interface DataManagerdate - Day/month/year tuple to find entries for.
             Ignores hour, minutes, seconds.public java.util.Collection getEntriesForMonth(java.util.Date date)
getEntriesForMonth in interface DataManagerdate - Month/year tuple to find entries for.
             Ignores day, hour, minutes, seconds.public int getEntryCountForDate(java.util.Date date)
getEntryCountForDate in interface DataManagerdate - Day/month/year to find count of entries for. 
             Ignores hour, minutes, seconds.public int getEntryCountForMonth(java.util.Date date)
getEntryCountForMonth in interface DataManagerdate - Month and year to find count of entries for. 
             Ignores day, hour, minutes, seconds.public void markAsArticle(BlogEntry entry)
markAsArticle in interface DataManagerpublic java.util.Collection getArticleEntries()
getArticleEntries in interface DataManagerpublic java.util.Collection findEntries(java.lang.String text)
findEntries in interface DataManagerpublic void postEntry(BlogEntry entry)
postEntry in interface DataManagerentry - The BlogEntry to mark as an article.public void removeEntry(long entryID)
removeEntry in interface DataManagerentryID - The ID of the entry to remove.public int getCommentCountForEntry(long entryID)
getCommentCountForEntry in interface DataManagerpublic java.util.Collection getCommentsForEntry(long entryID)
getCommentsForEntry in interface DataManager
public void postComment(long entryID,
                        BlogComment comment)
postComment in interface DataManager
  | 
geekblog 0.0.1-dev | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||