|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.feedparser.locate.blogservice.BlogService
public abstract class BlogService
Models the different kinds of blog services that are available. This is needed for two reasons. First, sometimes it is useful to simply know what provider a given weblog is being hosted by, such as Blogger or PMachine, in order to use special, non-standard capabilities. Second, many services have "quirks" that don't follow the standards, such as supporting autodiscovery or supporting it in an incorrect way, and we therefore need to know what service we are dealing with so that we can find its feed. The BlogService object encapsulates how to determine if a given weblog is of that type and how to find its feeds. Concrete subclasses, such as org.apache.commons.feedparser.locate.blogservice.Blogger, fill in this class and provide the actual way to determine these things for each blog service type.
Field Summary | |
---|---|
protected static List |
blogServices
|
protected static Pattern |
metaTagsPattern
Locates all the generator meta tags (i.e. |
protected static Pattern |
patternToStrip
A regex to find any trailing filename and strip it |
Constructor Summary | |
---|---|
BlogService()
|
Method Summary | |
---|---|
protected boolean |
containsDomain(String resource,
String domain)
Determines if the given resource contains the given domain name fragment. |
boolean |
equals(Object obj)
|
abstract boolean |
followRedirects()
Returns whether we should follow HTTP redirects for this blog service. |
String |
getBaseFeedPath(String resource)
This method takes a resource, such as "http://www.codinginparadise.org/myweblog.php", and gets the path necessary to build up a feed, such as "http://www.codinginparadise.org/". |
static BlogService[] |
getBlogServices()
Gets an array of all of the available BlogService implementations. |
abstract FeedReference[] |
getFeedLocations(String resource,
String content)
Returns an array of FeedReferences that contains information on the usual locations this blog service contains its feed. |
protected boolean |
hasGenerator(String content,
String generatorType)
Determines if the given content was generated by the given generator. |
int |
hashCode()
|
abstract boolean |
hasValidAutoDiscovery()
Returns whether we can trust the results of this blog service's autodiscovery links. |
protected static void |
initializeBlogServices()
|
boolean |
isThisService(String resource)
Determines if the weblog at the given resource is this blog service. |
abstract boolean |
isThisService(String resource,
String content)
Determines if the weblog at the given resource and with the given content is this blog service. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static List blogServices
protected static Pattern metaTagsPattern
protected static Pattern patternToStrip
Constructor Detail |
---|
public BlogService()
Method Detail |
---|
public abstract boolean hasValidAutoDiscovery()
public abstract boolean followRedirects()
public abstract boolean isThisService(String resource, String content) throws FeedParserException
resource
- A full URI to this resource, such as
"http://www.codinginparadise.org".content
- The full HTML content at the resource's URL.
FeedParserException
- Thrown if an error occurs while
determining the type of this weblog.public abstract FeedReference[] getFeedLocations(String resource, String content) throws FeedParserException
resource
- A URL to the given weblog that might be used to build
up where feeds are usually located.content
- The full content of the resource URL, which might
be useful to determine where feeds are usually located. This can be
null.
FeedParserException
- Thrown if an error occurs while trying
to determine the usual locations of feeds for this service.public boolean isThisService(String resource) throws FeedParserException
resource
- A full URI to this resource, such as
"http://www.codinginparadise.org".
FeedParserException
- Thrown if an error occurs while
determining the type of this weblog.public String getBaseFeedPath(String resource)
MalformedURLException
- Thrown if the given resource's URL is
incorrectly formatted.public String toString()
toString
in class Object
public boolean equals(Object obj)
equals
in class Object
public int hashCode()
hashCode
in class Object
public static BlogService[] getBlogServices()
protected boolean containsDomain(String resource, String domain)
protected boolean hasGenerator(String content, String generatorType)
protected static void initializeBlogServices()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |