org.blojsom.fetcher.database
Class DatabaseFetcher

java.lang.Object
  extended byorg.blojsom.fetcher.database.DatabaseFetcher
All Implemented Interfaces:
Fetcher, Listener

public class DatabaseFetcher
extends java.lang.Object
implements Fetcher, Listener

Database fetcher

Since:
blojsom 3.0
Version:
$Id: DatabaseFetcher.java,v 1.37 2007/04/03 16:41:00 czarneckid Exp $
Author:
David Czarnecki

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

_logger

protected org.apache.commons.logging.Log _logger

_servletConfig

protected javax.servlet.ServletConfig _servletConfig

_eventBroadcaster

protected EventBroadcaster _eventBroadcaster

_sessionFactory

protected org.hibernate.SessionFactory _sessionFactory

_blojsomProperties

protected java.util.Properties _blojsomProperties
Constructor Detail

DatabaseFetcher

public DatabaseFetcher()
Create a new instance of the database fetcher

Method Detail

setServletConfig

public void setServletConfig(javax.servlet.ServletConfig servletConfig)
Set the ServletConfig for the fetcher to grab initialization parameters

Parameters:
servletConfig - ServletConfig

setEventBroadcaster

public void setEventBroadcaster(EventBroadcaster eventBroadcaster)
Set the EventBroadcaster event broadcaster

Parameters:
eventBroadcaster - EventBroadcaster

setSessionFactory

public void setSessionFactory(org.hibernate.SessionFactory sessionFactory)
Set the SessionFactory

Parameters:
sessionFactory - SessionFactory

setBlojsomProperties

public void setBlojsomProperties(java.util.Properties blojsomProperties)
Set the default blojsom properties

Parameters:
blojsomProperties - Default blojsom properties

init

public void init()
          throws FetcherException
Initialize this fetcher. This method only called when the fetcher is instantiated.

Specified by:
init in interface Fetcher
Throws:
FetcherException - If there is an error initializing the fetcher

newEntry

public Entry newEntry()
Return a new Entry instance

Specified by:
newEntry in interface Fetcher
Returns:
Blog entry instance

newComment

public Comment newComment()
Return a new Comment instance

Specified by:
newComment in interface Fetcher
Returns:
Comment object

newTrackback

public Trackback newTrackback()
Return a new Trackback instance

Specified by:
newTrackback in interface Fetcher
Returns:
Trackback object

newPingback

public Pingback newPingback()
Return a new Pingback instance

Specified by:
newPingback in interface Fetcher
Returns:
Pingback object

newCategory

public Category newCategory()
Return a new Category instance

Specified by:
newCategory in interface Fetcher
Returns:
Category object

newBlog

public Blog newBlog()
Return a new Blog instance

Specified by:
newBlog in interface Fetcher
Returns:
Blog object

newUser

public User newUser()
Return a new User instance

Specified by:
newUser in interface Fetcher
Returns:
User object

loadBlog

public Blog loadBlog(java.lang.String blogId)
              throws FetcherException
Load the Blog given the blog ID

Specified by:
loadBlog in interface Fetcher
Parameters:
blogId - Blog ID
Returns:
Blog object
Throws:
FetcherException - If there is an error loading the blog

loadBlog

public Blog loadBlog(java.lang.Integer id)
              throws FetcherException
Load the Blog given the ID

Specified by:
loadBlog in interface Fetcher
Parameters:
id - ID
Returns:
Blog blog
Throws:
FetcherException - If there is an error loading the blog

saveBlog

public void saveBlog(Blog blog)
              throws FetcherException
Save a Blog

Specified by:
saveBlog in interface Fetcher
Parameters:
blog - Blog
Throws:
FetcherException - If there is an error saving the blog

deleteBlog

public void deleteBlog(Blog blog)
                throws FetcherException
Delete a blog

Specified by:
deleteBlog in interface Fetcher
Parameters:
blog - Blog
Throws:
FetcherException - If there is an error deleting the blog

loadBlogIDs

public java.lang.String[] loadBlogIDs()
                               throws FetcherException
Load the blog IDs

Specified by:
loadBlogIDs in interface Fetcher
Returns:
List of blog IDs
Throws:
FetcherException - If there is an error loading the blog IDs

fetchEntries

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
Fetch a set of Entry objects.

Specified by:
fetchEntries in interface Fetcher
Parameters:
httpServletRequest - Request
httpServletResponse - Response
blog - Blog instance
flavor - Flavor
context - Context
Returns:
Blog entries retrieved for the particular request
Throws:
FetcherException - If there is an error retrieving the blog entries for the request

loadAllEntriesForCategory

public Entry[] loadAllEntriesForCategory(Blog blog,
                                         java.lang.Integer categoryId)
                                  throws FetcherException
Load all the entries for a given category

Specified by:
loadAllEntriesForCategory in interface Fetcher
Parameters:
blog - Blog
categoryId - Category ID
Returns:
Blog entries for a given category
Throws:
FetcherException - If there is an error loading the entries

loadEntriesForCategory

public Entry[] loadEntriesForCategory(Blog blog,
                                      java.lang.Integer categoryId,
                                      java.lang.Integer limit)
                               throws FetcherException
Load all the entries for a given category

Specified by:
loadEntriesForCategory in interface Fetcher
Parameters:
blog - Blog
categoryId - Category ID
limit - Limit on number of entries to return
Returns:
Blog entries for a given category
Throws:
FetcherException - If there is an error loading the entries

loadEntries

public Entry[] loadEntries(Blog blog,
                           int pageSize,
                           int page)
                    throws FetcherException
Load a set of entries using a given page size and page in which to retrieve the entries

Specified by:
loadEntries in interface Fetcher
Parameters:
blog - Blog
pageSize - Page size
page - Page
Returns:
Blog entries
Throws:
FetcherException - If there is an error loading the entries

loadEntries

public Entry[] loadEntries(int pageSize,
                           int page,
                           Category specificCategory,
                           Category[] defaultCategories)
                    throws FetcherException
Load a set of entries using a given page size and page in which to retrieve the entries

Specified by:
loadEntries in interface Fetcher
Parameters:
pageSize - Page size
page - Page
specificCategory - Category
defaultCategories - Default categories to use for requesting entries from the blogs
Returns:
Blog entries
Throws:
FetcherException - If there is an error loading the entries

findEntries

public Entry[] findEntries(Blog blog,
                           java.lang.String query)
                    throws FetcherException
Find entries which have the search query in their title or description

Specified by:
findEntries in interface Fetcher
Parameters:
blog - Blog
query - Search query
Returns:
Blog entries which have the search query in their title or descirption
Throws:
FetcherException - If there is an error searching through entries

findEntriesByMetadataKeyValue

public Entry[] findEntriesByMetadataKeyValue(Blog blog,
                                             java.lang.String metadataKey,
                                             java.lang.String metadataValue,
                                             boolean pre,
                                             boolean post)
                                      throws FetcherException
Find entries by a metadata key/value pair

Specified by:
findEntriesByMetadataKeyValue in interface Fetcher
Parameters:
blog - Blog
metadataKey - Metadata key
metadataValue - Metadata value
pre - 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)
Returns:
Entries matching metadata key and value using LIKE syntax for metadata value
Throws:
FetcherException - If there is an error searching through entries

findEntriesWithMetadataKey

public Entry[] findEntriesWithMetadataKey(Blog blog,
                                          java.lang.String metadataKey)
                                   throws FetcherException
Find entries with a given metadata key

Specified by:
findEntriesWithMetadataKey in interface Fetcher
Parameters:
blog - Blog
metadataKey - Metadata key
Returns:
Entries with the given metadata key
Throws:
FetcherException - If there is an error searching through entries

findEntriesBetweenDates

public Entry[] findEntriesBetweenDates(Blog blog,
                                       java.util.Date startDate,
                                       java.util.Date endDate)
                                throws FetcherException
Find entries between a start and end date

Specified by:
findEntriesBetweenDates in interface Fetcher
Parameters:
blog - Blog
startDate - Start date
endDate - End date
Returns:
Entries between a start and end date
Throws:
FetcherException - If there is an error searching for entries between the dates

loadPreviousEntries

public Entry[] loadPreviousEntries(Blog blog,
                                   Entry entry,
                                   int numPreviousEntries)
                            throws FetcherException
Loads the previous entries of a specified entry

Specified by:
loadPreviousEntries in interface Fetcher
Parameters:
blog - Blog
entry - Entry
numPreviousEntries - Number of previous entries to retrieve
Returns:
Array of entries before the given entry
Throws:
FetcherException - If there is an error retrieving previous entries

countEntries

public java.lang.Integer countEntries(Blog blog)
                               throws FetcherException
Count the number of entries for a blog

Specified by:
countEntries in interface Fetcher
Parameters:
blog - Blog
Returns:
Number of entries
Throws:
FetcherException - If there is an error counting the blog entries

countEntriesForCategory

public java.lang.Integer countEntriesForCategory(Blog blog,
                                                 Category category)
                                          throws FetcherException
Count the number of entries for a blog category

Specified by:
countEntriesForCategory in interface Fetcher
Parameters:
blog - Blog
category - Category
Returns:
Number of entries
Throws:
FetcherException - If there is an error counting the blog entries in the category

loadEntry

public Entry loadEntry(Blog blog,
                       java.lang.Integer entryId)
                throws FetcherException
Load an Entry for a given entry ID

Specified by:
loadEntry in interface Fetcher
Parameters:
blog - Blog
entryId - Entry ID
Returns:
Entry object
Throws:
FetcherException - If there is an error loading the entry

loadEntry

public Entry loadEntry(Blog blog,
                       java.lang.String postSlug)
                throws FetcherException
Load an Entry given a post slug

Specified by:
loadEntry in interface Fetcher
Parameters:
blog - Blog
postSlug - Post slug
Returns:
Entry for the given post slug
Throws:
FetcherException - If an entry for the blog and post slug cannot be found

getBlogCategory

protected java.lang.String getBlogCategory(Blog blog,
                                           javax.servlet.http.HttpServletRequest httpServletRequest)
Determine the blog category based on the request

Parameters:
blog - Blog
httpServletRequest - Request
Returns:
Category of the requested category

fetchCategories

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
Fetch a set of Category objects

Specified by:
fetchCategories in interface Fetcher
Parameters:
httpServletRequest - Request
httpServletResponse - Response
blog - Blog instance
flavor - Flavor
context - Context
Returns:
Blog categories retrieved for the particular request
Throws:
FetcherException - If there is an error retrieving the blog categories for the request

loadAllCategories

public Category[] loadAllCategories(Blog blog)
                             throws FetcherException
Load each Category for a given blog

Specified by:
loadAllCategories in interface Fetcher
Parameters:
blog - Blog
Returns:
Category list for the blog
Throws:
FetcherException - If there is an error loading the categories

loadCategory

public Category loadCategory(Blog blog,
                             java.lang.Integer categoryId)
                      throws FetcherException
Load the Category for a given category ID

Specified by:
loadCategory in interface Fetcher
Parameters:
blog - Blog
categoryId - Category ID
Returns:
Category for the given category ID
Throws:
FetcherException - If there is an error loading the category

loadCategory

public Category loadCategory(Blog blog,
                             java.lang.String name)
                      throws FetcherException
Load the Category for a given category name

Specified by:
loadCategory in interface Fetcher
Parameters:
blog - Blog
name - Category name
Returns:
Category for the given category name
Throws:
FetcherException - If there is an error loading the category

createPostSlug

protected java.lang.String createPostSlug(Blog blog,
                                          Entry entry)
Create a unique post slug

Parameters:
blog - Blog
entry - Entry
Returns:
Unique post slug

saveEntry

public void saveEntry(Blog blog,
                      Entry entry)
               throws FetcherException
Save a given Entry

Specified by:
saveEntry in interface Fetcher
Parameters:
blog - Blog
entry - Entry to save
Throws:
FetcherException - If there is an error saving the entry

loadEntry

public void loadEntry(Blog blog,
                      Entry entry)
               throws FetcherException
Load a given Entry

Specified by:
loadEntry in interface Fetcher
Parameters:
blog - Blog
entry - Entry to load
Throws:
FetcherException - If there is an error loading the entry

deleteEntry

public void deleteEntry(Blog blog,
                        Entry entry)
                 throws FetcherException
Delete a given Entry

Specified by:
deleteEntry in interface Fetcher
Parameters:
blog - Blog
entry - Entry to delete
Throws:
FetcherException - If there is an error deleting the entry

saveCategory

public void saveCategory(Blog blog,
                         Category category)
                  throws FetcherException
Save a given Category

Specified by:
saveCategory in interface Fetcher
Parameters:
blog - Blog
category - Category to save
Throws:
FetcherException - If there is an error saving the category

loadCategory

public void loadCategory(Blog blog,
                         Category category)
                  throws FetcherException
Load a given Category

Specified by:
loadCategory in interface Fetcher
Parameters:
blog - Blog
category - Category to load
Throws:
FetcherException - If there is an loading saving the category

deleteCategory

public void deleteCategory(Blog blog,
                           Category category)
                    throws FetcherException
Delete a given Category

Specified by:
deleteCategory in interface Fetcher
Parameters:
blog - Blog
category - Category to delete
Throws:
FetcherException - If there is an error deleting the category

saveComment

public void saveComment(Blog blog,
                        Comment comment)
                 throws FetcherException
Save a given Comment

Specified by:
saveComment in interface Fetcher
Parameters:
blog - Blog
comment - Comment to save
Throws:
FetcherException - If there is an error saving the comment

loadComment

public void loadComment(Blog blog,
                        Comment comment)
                 throws FetcherException
Load a given Comment

Specified by:
loadComment in interface Fetcher
Parameters:
blog - Blog
comment - Comment to load
Throws:
FetcherException - If there is an error loading the comment

deleteComment

public void deleteComment(Blog blog,
                          Comment comment)
                   throws FetcherException
Delete a given Comment

Specified by:
deleteComment in interface Fetcher
Parameters:
blog - Blog
comment - Comment to delete
Throws:
FetcherException - If there is an error deleting the comment

loadRecentComments

public java.util.List loadRecentComments(Blog blog)
                                  throws FetcherException
Load the recent comments for a blog

Specified by:
loadRecentComments in interface Fetcher
Parameters:
blog - Blog
Returns:
List of recent comment
Throws:
FetcherException - If there is an error retrieving the recent comments

saveTrackback

public void saveTrackback(Blog blog,
                          Trackback trackback)
                   throws FetcherException
Save a given Trackback

Specified by:
saveTrackback in interface Fetcher
Parameters:
blog - Blog
trackback - Trackback to save
Throws:
FetcherException - If there is an error saving the trackback

loadTrackback

public void loadTrackback(Blog blog,
                          Trackback trackback)
                   throws FetcherException
Load a given Trackback

Specified by:
loadTrackback in interface Fetcher
Parameters:
blog - Blog
trackback - Trackback to load
Throws:
FetcherException - If there is an error loading the trackback

deleteTrackback

public void deleteTrackback(Blog blog,
                            Trackback trackback)
                     throws FetcherException
Delete a given Trackback

Specified by:
deleteTrackback in interface Fetcher
Parameters:
blog - Blog
trackback - Trackback to delete
Throws:
FetcherException - If there is an error deleting the trackback

loadRecentTrackbacks

public java.util.List loadRecentTrackbacks(Blog blog)
                                    throws FetcherException
Load the recent trackbacks for a blog

Specified by:
loadRecentTrackbacks in interface Fetcher
Parameters:
blog - Blog
Returns:
List of recent trackbacks
Throws:
FetcherException - If there is an error retrieving the recent trackbacks

savePingback

public void savePingback(Blog blog,
                         Pingback pingback)
                  throws FetcherException
Save a given Pingback

Specified by:
savePingback in interface Fetcher
Parameters:
blog - Blog
pingback - Pingback to save
Throws:
FetcherException - If there is an error saving the pingback

loadPingback

public void loadPingback(Blog blog,
                         Pingback pingback)
                  throws FetcherException
Load a given Pingback

Specified by:
loadPingback in interface Fetcher
Parameters:
blog - Blog
pingback - Pingback to load
Throws:
FetcherException - If there is an error loading the pingback

loadPingback

public Pingback loadPingback(Blog blog,
                             java.lang.String sourceURI,
                             java.lang.String targetURI)
                      throws FetcherException
Load a pingback given the source URI and target URI

Specified by:
loadPingback in interface Fetcher
Parameters:
blog - Blog
sourceURI - Source URI
targetURI - Target URI
Returns:
Pingback given the source and target URIs or null if not found
Throws:
FetcherException - If there was an erorr loading the pingback

deletePingback

public void deletePingback(Blog blog,
                           Pingback pingback)
                    throws FetcherException
Delete a given Pingback

Specified by:
deletePingback in interface Fetcher
Parameters:
blog - Blog
pingback - Pingback to delete
Throws:
FetcherException - If there is an error deleting the pingback

loadRecentPingbacks

public java.util.List loadRecentPingbacks(Blog blog)
                                   throws FetcherException
Load the recent pingbacks for a blog

Specified by:
loadRecentPingbacks in interface Fetcher
Parameters:
blog - Blog
Returns:
List of recent pingbacks
Throws:
FetcherException - If there is an error retrieving the recent pingbacks

loadUser

public User loadUser(Blog blog,
                     java.lang.String userLogin)
              throws FetcherException
Load a User from a blog

Specified by:
loadUser in interface Fetcher
Parameters:
blog - Blog
userLogin - Login ID
Returns:
User user
Throws:
FetcherException - If there is an error loading the User from the blog

getUsers

public User[] getUsers(Blog blog)
Retrieve the users for a given blog

Specified by:
getUsers in interface Fetcher
Parameters:
blog - Blog
Returns:
List of Users for a blog

loadUser

public User loadUser(Blog blog,
                     java.lang.Integer userID)
              throws FetcherException
Load a given User from a blog given their ID

Specified by:
loadUser in interface Fetcher
Parameters:
blog - Blog
userID - User ID
Returns:
User object
Throws:
FetcherException - If there is an error loading the user

saveUser

public User saveUser(Blog blog,
                     User user)
              throws FetcherException
Save a given User to the blog

Specified by:
saveUser in interface Fetcher
Parameters:
blog - Blog
user - User
Returns:
User object
Throws:
FetcherException - If there is an error saving the user to the blog

deleteUser

public void deleteUser(Blog blog,
                       java.lang.Integer userID)
                throws FetcherException
Delete a given user from a blog

Specified by:
deleteUser in interface Fetcher
Parameters:
blog - Blog
userID - User ID
Throws:
FetcherException - If there is an error deleting the user from the blog

findResponsesByStatus

public java.util.List findResponsesByStatus(Blog blog,
                                            java.lang.String[] status)
                                     throws FetcherException
Load the responses (comments, trackbacks, pingbacks) for a given Blog matching one of a set of status codes

Specified by:
findResponsesByStatus in interface Fetcher
Parameters:
blog - Blog
status - List of status codes to load
Returns:
List of responses (comments, trackbacks, pingbacks) matching one of a set of status codes
Throws:
FetcherException - If there is an error loading the responses

findResponsesByQuery

public java.util.List findResponsesByQuery(Blog blog,
                                           java.lang.String query)
                                    throws FetcherException
Find the responses (comments, trackbacks, pingbacks) for a given Blog matching some query

Specified by:
findResponsesByQuery in interface Fetcher
Parameters:
blog - Blog
query - Query which will match on various items such as commenter name, e-mail, IP address, etc.
Returns:
List of responses (comments, trackbacks, pingbacks) matching query
Throws:
FetcherException - If there is an error loading the responses

handleEvent

public void handleEvent(Event event)
Handle an event broadcast from another component

Specified by:
handleEvent in interface Listener
Parameters:
event - Event to be handled

processEvent

public void processEvent(Event event)
Process an event from another component

Specified by:
processEvent in interface Listener
Parameters:
event - Event to be handled

destroy

public void destroy()
             throws FetcherException
Called when BlojsomServlet is taken out of service

Specified by:
destroy in interface Fetcher
Throws:
FetcherException - If there is an error in finalizing this fetcher