|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.blojsom.fetcher.StandardFetcher
StandardFetcher
Field Summary | |
protected BlojsomConfiguration |
_blojsomConfiguration
|
protected java.lang.String |
_ignoreFlavors
|
protected org.apache.commons.logging.Log |
_logger
|
protected static java.lang.String |
DEFAULT_IGNORE_FLAVORS
|
protected static java.lang.String |
DEPTH_PARAM
|
protected static java.lang.String |
IGNORE_FLAVORS_PARAM
|
protected static java.lang.String |
STANDARD_FETCHER_CATEGORY
|
protected static java.lang.String |
STANDARD_FETCHER_DEPTH
|
Fields inherited from interface org.blojsom.fetcher.BlojsomFetcher |
FETCHER_CATEGORY, FETCHER_FLAVOR, FETCHER_NUM_POSTS_INTEGER, FETCHER_PERMALINK |
Constructor Summary | |
StandardFetcher()
Default constructor |
Method Summary | |
void |
destroy()
Called when BlojsomServlet is taken out of service |
BlogCategory[] |
fetchCategories(javax.servlet.http.HttpServletRequest httpServletRequest,
javax.servlet.http.HttpServletResponse httpServletResponse,
BlogUser user,
java.lang.String flavor,
java.util.Map context)
Fetch a set of BlogCategory objects |
BlogCategory[] |
fetchCategories(java.util.Map fetchParameters,
BlogUser user)
Fetch a set of BlogCategory objects. |
BlogEntry[] |
fetchEntries(javax.servlet.http.HttpServletRequest httpServletRequest,
javax.servlet.http.HttpServletResponse httpServletResponse,
BlogUser user,
java.lang.String flavor,
java.util.Map context)
Fetch a set of BlogEntry objects. |
BlogEntry[] |
fetchEntries(java.util.Map fetchParameters,
BlogUser user)
Fetch a set of BlogEntry objects. |
protected BlogCategory[] |
getBlogCategories(BlogUser blogUser,
int blogDirectoryDepth)
Return a list of categories for the blog that are appropriate in a hyperlink |
protected BlogCategory |
getBlogCategory(BlogUser user,
javax.servlet.http.HttpServletRequest httpServletRequest)
Determine the blog category based on the request |
protected BlogCategory[] |
getBlogCategoryHierarchy(BlogUser blogUser,
BlogCategory currentCategory,
int blogDirectoryDepth)
Return a list of categories up the category hierarchy from the current category. |
protected BlogEntry[] |
getEntriesAllCategories(BlogUser user,
java.lang.String[] categoryFilter,
java.lang.String[] categoryExclusionFilter,
int maxBlogEntries,
int blogDirectoryDepth)
Retrieve entries for all the categories in the blog. |
protected BlogEntry[] |
getEntriesAllCategories(BlogUser user,
java.lang.String flavor,
int maxBlogEntries,
int blogDirectoryDepth)
Retrive entries for the categories, using the values set for the default category mapping and the configured number of blog entries to retrieve from each category |
protected BlogEntry[] |
getEntriesForCategory(BlogUser user,
BlogCategory requestedCategory,
int maxBlogEntries)
Retrieve all of the entries for a requested category |
protected BlogEntry[] |
getPermalinkEntry(BlogUser blogUser,
BlogCategory requestedCategory,
java.lang.String permalink)
Retrieve a permalink entry from the entries for a given category |
void |
init(javax.servlet.ServletConfig servletConfig,
BlojsomConfiguration blojsomConfiguration)
Initialize this fetcher. |
BlogCategory |
newBlogCategory()
Return a new blog category instance |
BlogComment |
newBlogComment()
Return a new BlogComment instance |
BlogEntry |
newBlogEntry()
Return a new blog entry instance. |
Pingback |
newPingback()
Return a new Pingback instance |
Trackback |
newTrackback()
Return a new Trackback instance |
protected void |
recursiveCategoryBuilder(BlogUser blogUser,
int blogDepth,
int blogDirectoryDepth,
java.lang.String blogDirectory,
java.util.ArrayList categoryList)
Build a list of blog categories recursively |
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 static final java.lang.String DEPTH_PARAM
protected static final java.lang.String IGNORE_FLAVORS_PARAM
protected static final java.lang.String DEFAULT_IGNORE_FLAVORS
protected static final java.lang.String STANDARD_FETCHER_CATEGORY
protected static final java.lang.String STANDARD_FETCHER_DEPTH
protected java.lang.String _ignoreFlavors
protected BlojsomConfiguration _blojsomConfiguration
Constructor Detail |
public StandardFetcher()
Method Detail |
public void init(javax.servlet.ServletConfig servletConfig, BlojsomConfiguration blojsomConfiguration) throws BlojsomFetcherException
init
in interface BlojsomFetcher
servletConfig
- Servlet config object for the plugin to retrieve any initialization parametersblojsomConfiguration
- blojsom configuration information
BlojsomFetcherException
- If there is an error initializing the fetcherpublic BlogEntry newBlogEntry()
FileBackedBlogEntry
.
newBlogEntry
in interface BlojsomFetcher
public BlogCategory newBlogCategory()
newBlogCategory
in interface BlojsomFetcher
public BlogComment newBlogComment()
BlogComment
instance
newBlogComment
in interface BlojsomFetcher
BlogComment
public Trackback newTrackback()
Trackback
instance
newTrackback
in interface BlojsomFetcher
Trackback
public Pingback newPingback()
Pingback
instance
newPingback
in interface BlojsomFetcher
Pingback
protected BlogEntry[] getPermalinkEntry(BlogUser blogUser, BlogCategory requestedCategory, java.lang.String permalink)
blogUser
- Blog informationrequestedCategory
- Requested categorypermalink
- Permalink entry requested
BlogEntry[0]
if the permalink entry was not foundprotected BlogEntry[] getEntriesForCategory(BlogUser user, BlogCategory requestedCategory, int maxBlogEntries)
requestedCategory
- Requested categorymaxBlogEntries
- Maximum number of blog entries to retrieve from a blog category
BlogEntry[0]
if there are no entries for the categoryprotected BlogEntry[] getEntriesAllCategories(BlogUser user, java.lang.String flavor, int maxBlogEntries, int blogDirectoryDepth)
flavor
- Requested flavormaxBlogEntries
- Maximum number of entries to retrieve per categoryblogDirectoryDepth
- Depth to which the fetcher should stop looking for categories
BlogEntry[0]
if there are no entriesprotected BlogEntry[] getEntriesAllCategories(BlogUser user, java.lang.String[] categoryFilter, java.lang.String[] categoryExclusionFilter, int maxBlogEntries, int blogDirectoryDepth)
maxBlogEntries
to limit the entries it retrieves from each of the categories.
Entries from the categories are sorted based on file time.
categoryFilter
- If null
, a list of all the categories is retrieved, otherwise only
the categories in the list will be used to search for entriescategoryExclusionFilter
- If not null the categories in the list will be excluded from the entries' searchmaxBlogEntries
- Maximum number of blog entries to retrieve from each categoryblogDirectoryDepth
- Depth to which the fetcher should stop looking for categories
- Returns:
- Blog entry array containing the list of blog entries for the categories
or
BlogEntry[0]
if there are no entries
protected BlogCategory getBlogCategory(BlogUser user, javax.servlet.http.HttpServletRequest httpServletRequest)
httpServletRequest
- Request
BlogCategory
of the requested categorypublic BlogEntry[] fetchEntries(javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse, BlogUser user, java.lang.String flavor, java.util.Map context) throws BlojsomFetcherException
BlogEntry
objects.
fetchEntries
in interface BlojsomFetcher
httpServletRequest
- RequesthttpServletResponse
- Responseuser
- BlogUser
instanceflavor
- Flavorcontext
- Context
BlojsomFetcherException
- If there is an error retrieving the blog entries for the requestpublic BlogEntry[] fetchEntries(java.util.Map fetchParameters, BlogUser user) throws BlojsomFetcherException
BlogEntry
objects. This method is intended to be used for other
components such as the XML-RPC handlers that cannot generate servlet request and
response objects, but still need to be able to fetch entries. Implementations of this
method must be explicit about the exact parameter names and types that are
expected to return an appropriate set of BlogEntry
objects. The following
table describes the parameters accepted by this method and their return value. The value
for fetchParameters
may represent the keys and data types that should be
present in the fetchParameters
map to return the proper data.
fetchParameters value | Return value |
---|---|
"FETCHER_CATEGORY" (BlogCategory ) and "FETCHER_PERMALINK" (String ) | return a single BlogEntry for the requested permalink |
"FETCHER_CATEGORY" (BlogCategory ) and "FETCHER_NUM_POSTS_INTEGER" (Integer ) | return entries for the requested category up to the value indicated by the number of entries |
"FETCHER_FLAVOR" (String ) and "FETCHER_NUM_POSTS_INTEGER" (Integer ) | return all entries for the default category ("/") for the requested flavor up to the value indicated by the number of entries |
fetchEntries
in interface BlojsomFetcher
fetchParameters
- Parameters which will be used to retrieve blog entriesuser
- BlogUser
instance
BlojsomFetcherException
- If there is an error retrieving the blog entries for the requestprotected void recursiveCategoryBuilder(BlogUser blogUser, int blogDepth, int blogDirectoryDepth, java.lang.String blogDirectory, java.util.ArrayList categoryList)
blogUser
- BlogUser
blogDepth
- Depth at which the current iteration is runningblogDirectoryDepth
- Depth to which the fetcher should stop looking for categoriesblogDirectory
- Directory in which the current iteration is runningcategoryList
- Dynamic list of categories that gets added to as it explores directoriesprotected BlogCategory[] getBlogCategories(BlogUser blogUser, int blogDirectoryDepth)
blogUser
- BlogUser
blogDirectoryDepth
- Depth to which the fetcher should stop looking for categories
protected BlogCategory[] getBlogCategoryHierarchy(BlogUser blogUser, BlogCategory currentCategory, int blogDirectoryDepth)
null
is returned. Up the hierarchy, only
the parent categories are returned. Down the hierarchy from the current category, all
children are returned while obeying the blog-directory-depth
parameter.
blogUser
- BlogUser
currentCategory
- Current category in the blog category hierarchyblogDirectoryDepth
- Depth to which the fetcher should stop looking for categories
null
if "/" category is requested or there
are no sub-categoriespublic BlogCategory[] fetchCategories(javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse, BlogUser user, java.lang.String flavor, java.util.Map context) throws BlojsomFetcherException
BlogCategory
objects
fetchCategories
in interface BlojsomFetcher
httpServletRequest
- RequesthttpServletResponse
- Responseuser
- BlogUser
instanceflavor
- Flavorcontext
- Context
BlojsomFetcherException
- If there is an error retrieving the blog categories for the requestpublic BlogCategory[] fetchCategories(java.util.Map fetchParameters, BlogUser user) throws BlojsomFetcherException
BlogCategory
objects. This method is intended to be used for other
components such as the XML-RPC handlers that cannot generate servlet request and
response objects, but still need to be able to fetch categories. Implementations of this
method must be explicit about the exact parameter names and types that are
expected to return an appropriate set of BlogCategory
objects. The following
table describes the parameters accepted by this method and their return value. The value
for fetchParameters
may represent the keys and data types that should be
present in the fetchParameters
map to return the proper data.
fetchParameters value | Return value |
---|---|
null | return all categories |
"FETCHER_CATEGORY" (BlogCategory ) | Up the hierarchy, only
the parent categories are returned. Down the hierarchy from the current category, all
children are returned while obeying the blog-directory-depth parameter. |
fetchCategories
in interface BlojsomFetcher
fetchParameters
- Parameters which will be used to retrieve blog entriesuser
- BlogUser
instance
BlojsomFetcherException
- If there is an error retrieving the blog categories for the requestpublic void destroy() throws BlojsomFetcherException
BlojsomServlet
is taken out of service
destroy
in interface BlojsomFetcher
BlojsomFetcherException
- 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 |