|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.blojsom.fetcher.database.DatabaseFetcher
Database fetcher
| Field Summary | |
protected java.util.Properties |
_blojsomProperties
|
protected EventBroadcaster |
_eventBroadcaster
|
protected org.apache.commons.logging.Log |
_logger
|
protected javax.servlet.ServletConfig |
_servletConfig
|
protected org.hibernate.SessionFactory |
_sessionFactory
|
| Constructor Summary | |
DatabaseFetcher()
Create a new instance of the database fetcher |
|
| Method Summary | |
java.lang.Integer |
countEntries(Blog blog)
Count the number of entries for a blog |
java.lang.Integer |
countEntriesForCategory(Blog blog,
Category category)
Count the number of entries for a blog category |
protected java.lang.String |
createPostSlug(Blog blog,
Entry entry)
Create a unique post slug |
void |
deleteBlog(Blog blog)
Delete a blog |
void |
deleteCategory(Blog blog,
Category category)
Delete a given Category |
void |
deleteComment(Blog blog,
Comment comment)
Delete a given Comment |
void |
deleteEntry(Blog blog,
Entry entry)
Delete a given Entry |
void |
deletePingback(Blog blog,
Pingback pingback)
Delete a given Pingback |
void |
deleteTrackback(Blog blog,
Trackback trackback)
Delete a given Trackback |
void |
deleteUser(Blog blog,
java.lang.Integer userID)
Delete a given user from a blog |
void |
destroy()
Called when BlojsomServlet is taken out of service |
Category[] |
fetchCategories(javax.servlet.http.HttpServletRequest httpServletRequest,
javax.servlet.http.HttpServletResponse httpServletResponse,
Blog blog,
java.lang.String flavor,
java.util.Map context)
Fetch a set of Category objects |
Entry[] |
fetchEntries(javax.servlet.http.HttpServletRequest httpServletRequest,
javax.servlet.http.HttpServletResponse httpServletResponse,
Blog blog,
java.lang.String flavor,
java.util.Map context)
Fetch a set of Entry objects. |
Entry[] |
findEntries(Blog blog,
java.lang.String query)
Find entries which have the search query in their title or description |
Entry[] |
findEntriesBetweenDates(Blog blog,
java.util.Date startDate,
java.util.Date endDate)
Find entries between a start and end date |
Entry[] |
findEntriesByMetadataKeyValue(Blog blog,
java.lang.String metadataKey,
java.lang.String metadataValue,
boolean pre,
boolean post)
Find entries by a metadata key/value pair |
Entry[] |
findEntriesWithMetadataKey(Blog blog,
java.lang.String metadataKey)
Find entries with a given metadata key |
java.util.List |
findResponsesByQuery(Blog blog,
java.lang.String query)
Find the responses (comments, trackbacks, pingbacks) for a given Blog matching some query |
java.util.List |
findResponsesByStatus(Blog blog,
java.lang.String[] status)
Load the responses (comments, trackbacks, pingbacks) for a given Blog matching one of a set of status codes |
protected java.lang.String |
getBlogCategory(Blog blog,
javax.servlet.http.HttpServletRequest httpServletRequest)
Determine the blog category based on the request |
User[] |
getUsers(Blog blog)
Retrieve the users for a given blog |
void |
handleEvent(Event event)
Handle an event broadcast from another component |
void |
init()
Initialize this fetcher. |
Category[] |
loadAllCategories(Blog blog)
Load each Category for a given blog |
Entry[] |
loadAllEntriesForCategory(Blog blog,
java.lang.Integer categoryId)
Load all the entries for a given category |
Blog |
loadBlog(java.lang.Integer id)
Load the Blog given the ID |
Blog |
loadBlog(java.lang.String blogId)
Load the Blog given the blog ID |
java.lang.String[] |
loadBlogIDs()
Load the blog IDs |
void |
loadCategory(Blog blog,
Category category)
Load a given Category |
Category |
loadCategory(Blog blog,
java.lang.Integer categoryId)
Load the Category for a given category ID |
Category |
loadCategory(Blog blog,
java.lang.String name)
Load the Category for a given category name |
void |
loadComment(Blog blog,
Comment comment)
Load a given Comment |
Entry[] |
loadEntries(Blog blog,
int pageSize,
int page)
Load a set of entries using a given page size and page in which to retrieve the entries |
Entry[] |
loadEntries(int pageSize,
int page,
Category specificCategory,
Category[] defaultCategories)
Load a set of entries using a given page size and page in which to retrieve the entries |
Entry[] |
loadEntriesForCategory(Blog blog,
java.lang.Integer categoryId,
java.lang.Integer limit)
Load all the entries for a given category |
void |
loadEntry(Blog blog,
Entry entry)
Load a given Entry |
Entry |
loadEntry(Blog blog,
java.lang.Integer entryId)
Load an Entry for a given entry ID |
Entry |
loadEntry(Blog blog,
java.lang.String postSlug)
Load an Entry given a post slug |
void |
loadPingback(Blog blog,
Pingback pingback)
Load a given Pingback |
Pingback |
loadPingback(Blog blog,
java.lang.String sourceURI,
java.lang.String targetURI)
Load a pingback given the source URI and target URI |
Entry[] |
loadPreviousEntries(Blog blog,
Entry entry,
int numPreviousEntries)
Loads the previous entries of a specified entry |
java.util.List |
loadRecentComments(Blog blog)
Load the recent comments for a blog |
java.util.List |
loadRecentPingbacks(Blog blog)
Load the recent pingbacks for a blog |
java.util.List |
loadRecentTrackbacks(Blog blog)
Load the recent trackbacks for a blog |
void |
loadTrackback(Blog blog,
Trackback trackback)
Load a given Trackback |
User |
loadUser(Blog blog,
java.lang.Integer userID)
Load a given User from a blog given their ID |
User |
loadUser(Blog blog,
java.lang.String userLogin)
Load a User from a blog |
Blog |
newBlog()
Return a new Blog instance |
Category |
newCategory()
Return a new Category instance |
Comment |
newComment()
Return a new Comment instance |
Entry |
newEntry()
Return a new Entry instance |
Pingback |
newPingback()
Return a new Pingback instance |
Trackback |
newTrackback()
Return a new Trackback instance |
User |
newUser()
Return a new User instance |
void |
processEvent(Event event)
Process an event from another component |
void |
saveBlog(Blog blog)
Save a Blog |
void |
saveCategory(Blog blog,
Category category)
Save a given Category |
void |
saveComment(Blog blog,
Comment comment)
Save a given Comment |
void |
saveEntry(Blog blog,
Entry entry)
Save a given Entry |
void |
savePingback(Blog blog,
Pingback pingback)
Save a given Pingback |
void |
saveTrackback(Blog blog,
Trackback trackback)
Save a given Trackback |
User |
saveUser(Blog blog,
User user)
Save a given User to the blog |
void |
setBlojsomProperties(java.util.Properties blojsomProperties)
Set the default blojsom properties |
void |
setEventBroadcaster(EventBroadcaster eventBroadcaster)
Set the EventBroadcaster event broadcaster |
void |
setServletConfig(javax.servlet.ServletConfig servletConfig)
Set the ServletConfig for the fetcher to grab initialization parameters |
void |
setSessionFactory(org.hibernate.SessionFactory sessionFactory)
Set the SessionFactory |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected org.apache.commons.logging.Log _logger
protected javax.servlet.ServletConfig _servletConfig
protected EventBroadcaster _eventBroadcaster
protected org.hibernate.SessionFactory _sessionFactory
protected java.util.Properties _blojsomProperties
| Constructor Detail |
public DatabaseFetcher()
| Method Detail |
public void setServletConfig(javax.servlet.ServletConfig servletConfig)
ServletConfig for the fetcher to grab initialization parameters
servletConfig - ServletConfigpublic void setEventBroadcaster(EventBroadcaster eventBroadcaster)
EventBroadcaster event broadcaster
eventBroadcaster - EventBroadcasterpublic void setSessionFactory(org.hibernate.SessionFactory sessionFactory)
SessionFactory
sessionFactory - SessionFactorypublic void setBlojsomProperties(java.util.Properties blojsomProperties)
blojsomProperties - Default blojsom properties
public void init()
throws FetcherException
init in interface FetcherFetcherException - If there is an error initializing the fetcherpublic Entry newEntry()
Entry instance
newEntry in interface Fetcherpublic Comment newComment()
Comment instance
newComment in interface FetcherComment objectpublic Trackback newTrackback()
Trackback instance
newTrackback in interface FetcherTrackback objectpublic Pingback newPingback()
Pingback instance
newPingback in interface FetcherPingback objectpublic Category newCategory()
Category instance
newCategory in interface FetcherCategory objectpublic Blog newBlog()
Blog instance
newBlog in interface FetcherBlog objectpublic User newUser()
User instance
newUser in interface FetcherUser object
public Blog loadBlog(java.lang.String blogId)
throws FetcherException
Blog given the blog ID
loadBlog in interface FetcherblogId - Blog ID
Blog object
FetcherException - If there is an error loading the blog
public Blog loadBlog(java.lang.Integer id)
throws FetcherException
Blog given the ID
loadBlog in interface Fetcherid - ID
Blog blog
FetcherException - If there is an error loading the blog
public void saveBlog(Blog blog)
throws FetcherException
Blog
saveBlog in interface Fetcherblog - Blog
FetcherException - If there is an error saving the blog
public void deleteBlog(Blog blog)
throws FetcherException
deleteBlog in interface Fetcherblog - Blog
FetcherException - If there is an error deleting the blog
public java.lang.String[] loadBlogIDs()
throws FetcherException
loadBlogIDs in interface FetcherFetcherException - If there is an error loading the blog IDs
public Entry[] fetchEntries(javax.servlet.http.HttpServletRequest httpServletRequest,
javax.servlet.http.HttpServletResponse httpServletResponse,
Blog blog,
java.lang.String flavor,
java.util.Map context)
throws FetcherException
Entry objects.
fetchEntries in interface FetcherhttpServletRequest - RequesthttpServletResponse - Responseblog - Blog instanceflavor - Flavorcontext - Context
FetcherException - If there is an error retrieving the blog entries for the request
public Entry[] loadAllEntriesForCategory(Blog blog,
java.lang.Integer categoryId)
throws FetcherException
loadAllEntriesForCategory in interface Fetcherblog - BlogcategoryId - Category ID
FetcherException - If there is an error loading the entries
public Entry[] loadEntriesForCategory(Blog blog,
java.lang.Integer categoryId,
java.lang.Integer limit)
throws FetcherException
loadEntriesForCategory in interface Fetcherblog - BlogcategoryId - Category IDlimit - Limit on number of entries to return
FetcherException - If there is an error loading the entries
public Entry[] loadEntries(Blog blog,
int pageSize,
int page)
throws FetcherException
loadEntries in interface Fetcherblog - BlogpageSize - Page sizepage - Page
FetcherException - If there is an error loading the entries
public Entry[] loadEntries(int pageSize,
int page,
Category specificCategory,
Category[] defaultCategories)
throws FetcherException
loadEntries in interface FetcherpageSize - Page sizepage - PagespecificCategory - CategorydefaultCategories - Default categories to use for requesting entries from the blogs
FetcherException - If there is an error loading the entries
public Entry[] findEntries(Blog blog,
java.lang.String query)
throws FetcherException
findEntries in interface Fetcherblog - Blogquery - Search query
FetcherException - If there is an error searching through entries
public Entry[] findEntriesByMetadataKeyValue(Blog blog,
java.lang.String metadataKey,
java.lang.String metadataValue,
boolean pre,
boolean post)
throws FetcherException
findEntriesByMetadataKeyValue in interface Fetcherblog - BlogmetadataKey - Metadata keymetadataValue - Metadata valuepre - If the search should use % before the metadata value (match anything before)post - If the search should use % after the metadata value (match antthing after)
FetcherException - If there is an error searching through entries
public Entry[] findEntriesWithMetadataKey(Blog blog,
java.lang.String metadataKey)
throws FetcherException
findEntriesWithMetadataKey in interface Fetcherblog - BlogmetadataKey - Metadata key
FetcherException - If there is an error searching through entries
public Entry[] findEntriesBetweenDates(Blog blog,
java.util.Date startDate,
java.util.Date endDate)
throws FetcherException
findEntriesBetweenDates in interface Fetcherblog - BlogstartDate - Start dateendDate - End date
FetcherException - If there is an error searching for entries between the dates
public Entry[] loadPreviousEntries(Blog blog,
Entry entry,
int numPreviousEntries)
throws FetcherException
loadPreviousEntries in interface Fetcherblog - Blogentry - EntrynumPreviousEntries - Number of previous entries to retrieve
FetcherException - If there is an error retrieving previous entries
public java.lang.Integer countEntries(Blog blog)
throws FetcherException
countEntries in interface Fetcherblog - Blog
FetcherException - If there is an error counting the blog entries
public java.lang.Integer countEntriesForCategory(Blog blog,
Category category)
throws FetcherException
countEntriesForCategory in interface Fetcherblog - Blogcategory - Category
FetcherException - If there is an error counting the blog entries in the category
public Entry loadEntry(Blog blog,
java.lang.Integer entryId)
throws FetcherException
Entry for a given entry ID
loadEntry in interface Fetcherblog - BlogentryId - Entry ID
Entry object
FetcherException - If there is an error loading the entry
public Entry loadEntry(Blog blog,
java.lang.String postSlug)
throws FetcherException
Entry given a post slug
loadEntry in interface Fetcherblog - BlogpostSlug - Post slug
Entry for the given post slug
FetcherException - If an entry for the blog and post slug cannot be found
protected java.lang.String getBlogCategory(Blog blog,
javax.servlet.http.HttpServletRequest httpServletRequest)
blog - BloghttpServletRequest - Request
Category of the requested category
public Category[] fetchCategories(javax.servlet.http.HttpServletRequest httpServletRequest,
javax.servlet.http.HttpServletResponse httpServletResponse,
Blog blog,
java.lang.String flavor,
java.util.Map context)
throws FetcherException
Category objects
fetchCategories in interface FetcherhttpServletRequest - RequesthttpServletResponse - Responseblog - Blog instanceflavor - Flavorcontext - Context
FetcherException - If there is an error retrieving the blog categories for the request
public Category[] loadAllCategories(Blog blog)
throws FetcherException
Category for a given blog
loadAllCategories in interface Fetcherblog - Blog
Category list for the blog
FetcherException - If there is an error loading the categories
public Category loadCategory(Blog blog,
java.lang.Integer categoryId)
throws FetcherException
Category for a given category ID
loadCategory in interface Fetcherblog - BlogcategoryId - Category ID
Category for the given category ID
FetcherException - If there is an error loading the category
public Category loadCategory(Blog blog,
java.lang.String name)
throws FetcherException
Category for a given category name
loadCategory in interface Fetcherblog - Blogname - Category name
Category for the given category name
FetcherException - If there is an error loading the category
protected java.lang.String createPostSlug(Blog blog,
Entry entry)
blog - Blogentry - Entry
public void saveEntry(Blog blog,
Entry entry)
throws FetcherException
Entry
saveEntry in interface Fetcherblog - Blogentry - Entry to save
FetcherException - If there is an error saving the entry
public void loadEntry(Blog blog,
Entry entry)
throws FetcherException
Entry
loadEntry in interface Fetcherblog - Blogentry - Entry to load
FetcherException - If there is an error loading the entry
public void deleteEntry(Blog blog,
Entry entry)
throws FetcherException
Entry
deleteEntry in interface Fetcherblog - Blogentry - Entry to delete
FetcherException - If there is an error deleting the entry
public void saveCategory(Blog blog,
Category category)
throws FetcherException
Category
saveCategory in interface Fetcherblog - Blogcategory - Category to save
FetcherException - If there is an error saving the category
public void loadCategory(Blog blog,
Category category)
throws FetcherException
Category
loadCategory in interface Fetcherblog - Blogcategory - Category to load
FetcherException - If there is an loading saving the category
public void deleteCategory(Blog blog,
Category category)
throws FetcherException
Category
deleteCategory in interface Fetcherblog - Blogcategory - Category to delete
FetcherException - If there is an error deleting the category
public void saveComment(Blog blog,
Comment comment)
throws FetcherException
Comment
saveComment in interface Fetcherblog - Blogcomment - Comment to save
FetcherException - If there is an error saving the comment
public void loadComment(Blog blog,
Comment comment)
throws FetcherException
Comment
loadComment in interface Fetcherblog - Blogcomment - Comment to load
FetcherException - If there is an error loading the comment
public void deleteComment(Blog blog,
Comment comment)
throws FetcherException
Comment
deleteComment in interface Fetcherblog - Blogcomment - Comment to delete
FetcherException - If there is an error deleting the comment
public java.util.List loadRecentComments(Blog blog)
throws FetcherException
loadRecentComments in interface Fetcherblog - Blog
FetcherException - If there is an error retrieving the recent comments
public void saveTrackback(Blog blog,
Trackback trackback)
throws FetcherException
Trackback
saveTrackback in interface Fetcherblog - Blogtrackback - Trackback to save
FetcherException - If there is an error saving the trackback
public void loadTrackback(Blog blog,
Trackback trackback)
throws FetcherException
Trackback
loadTrackback in interface Fetcherblog - Blogtrackback - Trackback to load
FetcherException - If there is an error loading the trackback
public void deleteTrackback(Blog blog,
Trackback trackback)
throws FetcherException
Trackback
deleteTrackback in interface Fetcherblog - Blogtrackback - Trackback to delete
FetcherException - If there is an error deleting the trackback
public java.util.List loadRecentTrackbacks(Blog blog)
throws FetcherException
loadRecentTrackbacks in interface Fetcherblog - Blog
FetcherException - If there is an error retrieving the recent trackbacks
public void savePingback(Blog blog,
Pingback pingback)
throws FetcherException
Pingback
savePingback in interface Fetcherblog - Blogpingback - Pingback to save
FetcherException - If there is an error saving the pingback
public void loadPingback(Blog blog,
Pingback pingback)
throws FetcherException
Pingback
loadPingback in interface Fetcherblog - Blogpingback - Pingback to load
FetcherException - If there is an error loading the pingback
public Pingback loadPingback(Blog blog,
java.lang.String sourceURI,
java.lang.String targetURI)
throws FetcherException
loadPingback in interface Fetcherblog - BlogsourceURI - Source URItargetURI - Target URI
Pingback given the source and target URIs or null if not found
FetcherException - If there was an erorr loading the pingback
public void deletePingback(Blog blog,
Pingback pingback)
throws FetcherException
Pingback
deletePingback in interface Fetcherblog - Blogpingback - Pingback to delete
FetcherException - If there is an error deleting the pingback
public java.util.List loadRecentPingbacks(Blog blog)
throws FetcherException
loadRecentPingbacks in interface Fetcherblog - Blog
FetcherException - If there is an error retrieving the recent pingbacks
public User loadUser(Blog blog,
java.lang.String userLogin)
throws FetcherException
User from a blog
loadUser in interface Fetcherblog - BloguserLogin - Login ID
User user
FetcherException - If there is an error loading the User from the blogpublic User[] getUsers(Blog blog)
getUsers in interface Fetcherblog - Blog
Users for a blog
public User loadUser(Blog blog,
java.lang.Integer userID)
throws FetcherException
User from a blog given their ID
loadUser in interface Fetcherblog - BloguserID - User ID
User object
FetcherException - If there is an error loading the user
public User saveUser(Blog blog,
User user)
throws FetcherException
User to the blog
saveUser in interface Fetcherblog - Bloguser - User
User object
FetcherException - If there is an error saving the user to the blog
public void deleteUser(Blog blog,
java.lang.Integer userID)
throws FetcherException
deleteUser in interface Fetcherblog - BloguserID - User ID
FetcherException - If there is an error deleting the user from the blog
public java.util.List findResponsesByStatus(Blog blog,
java.lang.String[] status)
throws FetcherException
Blog matching one of a set of status codes
findResponsesByStatus in interface Fetcherblog - Blogstatus - List of status codes to load
FetcherException - If there is an error loading the responses
public java.util.List findResponsesByQuery(Blog blog,
java.lang.String query)
throws FetcherException
Blog matching some query
findResponsesByQuery in interface Fetcherblog - Blogquery - Query which will match on various items such as commenter name, e-mail, IP address, etc.
FetcherException - If there is an error loading the responsespublic void handleEvent(Event event)
handleEvent in interface Listenerevent - Event to be handledpublic void processEvent(Event event)
processEvent in interface Listenerevent - Event to be handled
public void destroy()
throws FetcherException
BlojsomServlet is taken out of service
destroy in interface FetcherFetcherException - If there is an error in finalizing this fetcher
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||