net.sourceforge.pebble.domain
Class AbstractBlog

java.lang.Object
  extended by net.sourceforge.pebble.domain.TimePeriod
      extended by net.sourceforge.pebble.domain.AbstractBlog
Direct Known Subclasses:
Blog, MultiBlog

public abstract class AbstractBlog
extends TimePeriod


Field Summary
static java.lang.String AUTHOR_KEY
           
static java.lang.String BLOG_PROPERTIES_FILE
          the name of the file containing blog properties
static java.lang.String CHARACTER_ENCODING_KEY
           
static java.lang.String COUNTRY_KEY
           
static java.lang.String DESCRIPTION_KEY
           
protected static java.lang.String FALSE
           
static java.lang.String IMAGE_KEY
           
static java.lang.String LANGUAGE_KEY
           
static java.lang.String NAME_KEY
           
protected  java.util.Properties properties
          the properties for this blog
static java.lang.String RECENT_BLOG_ENTRIES_ON_HOME_PAGE_KEY
           
static java.lang.String RECENT_RESPONSES_ON_HOME_PAGE_KEY
           
static java.lang.String THEME_KEY
           
static java.lang.String TIMEZONE_KEY
           
protected static java.lang.String TRUE
           
 
Constructor Summary
AbstractBlog(java.lang.String root)
          Creates a new Blog instance, based at the specified location.
 
Method Summary
 void clearMessages()
           
 void error(java.lang.String message)
           
 java.lang.String getAuthor()
          Gets the author of this blog.
 java.util.Calendar getCalendar()
          Gets a Calendar instance representing the current moment in time, with the timezone and locale set to be the same as that specified for this blog.
 java.lang.String getCharacterEncoding()
          Gets the character encoding in use by this blog.
 java.lang.String getContext()
          Gets the context where Pebble is deployed.
 java.lang.String getCountry()
          Gets string instance representing the country for the blog.
protected abstract  java.util.Properties getDefaultProperties()
          Gets the default properties for a blog.
 java.lang.String getDescription()
          Gets the description of this blog.
 java.lang.String getDomainName()
          Gets the domain name where this blog is deployed.
abstract  java.lang.String getId()
          Gets the ID of this blog.
 java.lang.String getImage()
          Gets the image for this blog.
 java.lang.String getImagesDirectory()
          Gets the location where the blog images are stored.
 java.lang.String getIndexesDirectory()
          Gets the location where the blog search indexes are stored.
 java.lang.String getLanguage()
          Gets string instance representing the language for the blog.
abstract  java.util.Date getLastModified()
          Gets the date that this blog was last updated.
 java.util.Locale getLocale()
          Gets the Locale instance for the blog.
 java.lang.String getLogsDirectory()
          Gets the location where the blog logs are stored.
 java.util.List<Message> getMessages()
           
 java.lang.String getName()
          Gets the name of this blog.
 int getNumberOfMessages()
           
 java.util.Properties getProperties()
          Gets the properties associated with this blog.
 java.lang.String getProperty(java.lang.String key)
          Gets a named property for this blog.
 java.lang.String getProtocol()
          Gets the protocol where this blog is deployed.
 java.util.List getRecentBlogEntries()
          Gets the most recent blog entries, the number of which is taken from the recentBlogEntriesOnHomePage property.
abstract  java.util.List getRecentBlogEntries(int numberOfEntries)
          Gets the most recent blog entries, the number of which is specified.
 int getRecentBlogEntriesOnHomePage()
          Gets the number of recent blog entries that are displayed on the home page.
 int getRecentResponsesOnHomePage()
          Gets the number of recent comments that are displayed on the home page.
abstract  java.lang.String getRelativeUrl()
          Gets the relative URL where this blog is deployed.
 java.lang.String getRoot()
          Gets the filesystem root for this blog.
 java.lang.String getSearchIndexDirectory()
          Gets the location where the blog search indexes are stored.
 java.lang.String getTheme()
          Gets the theme being used.
 java.util.TimeZone getTimeZone()
          Gets the TimeZone instance representing the timezone for the blog.
 java.lang.String getTimeZoneId()
          Gets the ID of the time zone for the blog.
abstract  java.lang.String getUrl()
          Gets the URL where this blog is deployed.
 void info(java.lang.String message)
           
protected  void init()
           
 boolean isConfigured()
           
protected  void loadProperties()
          Loads the properties for this blog, from the blog.properties file in the root directory.
abstract  void log(HttpServletRequest request, int status)
          Logs this request for blog.
 void removeProperty(java.lang.String key)
          Removes a named property for this blog.
 void setProperty(java.lang.String key, java.lang.String value)
          Sets a named property for this blog.
 void setRecentBlogEntries(java.util.List entries)
          Setter method for the recentBlogEntries property - this is here so that the property complies with the JavaBeans standard.
protected  void setRoot(java.lang.String root)
          Sets the filesystem root for this blog.
 void storeProperties()
          Stores the properties associated with this blog.
 java.lang.String toString()
          Gets a string representation of this object.
 void warn(java.lang.String message)
           
 
Methods inherited from class net.sourceforge.pebble.domain.TimePeriod
getBlog, getDate, setDate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BLOG_PROPERTIES_FILE

public static final java.lang.String BLOG_PROPERTIES_FILE
the name of the file containing blog properties

See Also:
Constant Field Values

FALSE

protected static final java.lang.String FALSE
See Also:
Constant Field Values

TRUE

protected static final java.lang.String TRUE
See Also:
Constant Field Values

NAME_KEY

public static final java.lang.String NAME_KEY
See Also:
Constant Field Values

AUTHOR_KEY

public static final java.lang.String AUTHOR_KEY
See Also:
Constant Field Values

DESCRIPTION_KEY

public static final java.lang.String DESCRIPTION_KEY
See Also:
Constant Field Values

IMAGE_KEY

public static final java.lang.String IMAGE_KEY
See Also:
Constant Field Values

TIMEZONE_KEY

public static final java.lang.String TIMEZONE_KEY
See Also:
Constant Field Values

RECENT_BLOG_ENTRIES_ON_HOME_PAGE_KEY

public static final java.lang.String RECENT_BLOG_ENTRIES_ON_HOME_PAGE_KEY
See Also:
Constant Field Values

RECENT_RESPONSES_ON_HOME_PAGE_KEY

public static final java.lang.String RECENT_RESPONSES_ON_HOME_PAGE_KEY
See Also:
Constant Field Values

LANGUAGE_KEY

public static final java.lang.String LANGUAGE_KEY
See Also:
Constant Field Values

COUNTRY_KEY

public static final java.lang.String COUNTRY_KEY
See Also:
Constant Field Values

CHARACTER_ENCODING_KEY

public static final java.lang.String CHARACTER_ENCODING_KEY
See Also:
Constant Field Values

THEME_KEY

public static final java.lang.String THEME_KEY
See Also:
Constant Field Values

properties

protected java.util.Properties properties
the properties for this blog

Constructor Detail

AbstractBlog

public AbstractBlog(java.lang.String root)
Creates a new Blog instance, based at the specified location.

Parameters:
root - an absolute path pointing to the root directory of the blog
Method Detail

init

protected void init()

loadProperties

protected void loadProperties()
Loads the properties for this blog, from the blog.properties file in the root directory.


isConfigured

public boolean isConfigured()

getDefaultProperties

protected abstract java.util.Properties getDefaultProperties()
Gets the default properties for a blog.

Returns:
a Properties instance

getId

public abstract java.lang.String getId()
Gets the ID of this blog.

Returns:
the ID as a String

getRoot

public java.lang.String getRoot()
Gets the filesystem root for this blog.

Returns:
a String representing an absolute path

setRoot

protected void setRoot(java.lang.String root)
Sets the filesystem root for this blog.

Parameters:
root - a String representing the absolute path

getProperties

public java.util.Properties getProperties()
Gets the properties associated with this blog.

Returns:
a java.util.Properties object

getProperty

public java.lang.String getProperty(java.lang.String key)
Gets a named property for this blog.

Parameters:
key - the property name/key

setProperty

public void setProperty(java.lang.String key,
                        java.lang.String value)
Sets a named property for this blog.

Parameters:
key - the property name/key
value - the property value

removeProperty

public void removeProperty(java.lang.String key)
Removes a named property for this blog.

Parameters:
key - the property name/key

storeProperties

public void storeProperties()
                     throws BlogServiceException
Stores the properties associated with this blog.

Throws:
BlogServiceException - if the properties can't be stored

getName

public java.lang.String getName()
Gets the name of this blog.

Returns:
the name

getAuthor

public java.lang.String getAuthor()
Gets the author of this blog.

Returns:
the author

getDescription

public java.lang.String getDescription()
Gets the description of this blog.

Returns:
the description

getImage

public java.lang.String getImage()
Gets the image for this blog.

Returns:
a URL pointing to an image

getUrl

public abstract java.lang.String getUrl()
Gets the URL where this blog is deployed.

Returns:
a URL as a String

getRelativeUrl

public abstract java.lang.String getRelativeUrl()
Gets the relative URL where this blog is deployed.

Returns:
a URL as a String

getDomainName

public java.lang.String getDomainName()
Gets the domain name where this blog is deployed.

Returns:
a domain name as a String

getProtocol

public java.lang.String getProtocol()
Gets the protocol where this blog is deployed.

Returns:
a protocol as a String

getContext

public java.lang.String getContext()
Gets the context where Pebble is deployed.

Returns:
the webapp context

getTimeZoneId

public java.lang.String getTimeZoneId()
Gets the ID of the time zone for the blog.

Returns:
a String (Europe/London by default)

getTimeZone

public java.util.TimeZone getTimeZone()
Gets the TimeZone instance representing the timezone for the blog.

Returns:
a TimeZone instance

getCalendar

public java.util.Calendar getCalendar()
Gets a Calendar instance representing the current moment in time, with the timezone and locale set to be the same as that specified for this blog.

Returns:
a Calendar instance

getRecentBlogEntriesOnHomePage

public int getRecentBlogEntriesOnHomePage()
Gets the number of recent blog entries that are displayed on the home page.

Returns:
an int (3 by default)

getRecentResponsesOnHomePage

public int getRecentResponsesOnHomePage()
Gets the number of recent comments that are displayed on the home page.

Returns:
an int (0 by default)

getCharacterEncoding

public java.lang.String getCharacterEncoding()
Gets the character encoding in use by this blog.

Returns:
the character encoding as an IANA registered character set code

getLanguage

public java.lang.String getLanguage()
Gets string instance representing the language for the blog.

Returns:
a two-letter ISO language code (en by default)

getCountry

public java.lang.String getCountry()
Gets string instance representing the country for the blog.

Returns:
a two-letter ISO country code (GB by default)

getLocale

public java.util.Locale getLocale()
Gets the Locale instance for the blog.

Returns:
a Locale instance based upon the language and country.

getTheme

public java.lang.String getTheme()
Gets the theme being used.

Returns:
a theme name as a String

getImagesDirectory

public java.lang.String getImagesDirectory()
Gets the location where the blog images are stored.

Returns:
an absolute, local path on the filing system

getIndexesDirectory

public java.lang.String getIndexesDirectory()
Gets the location where the blog search indexes are stored.

Returns:
an absolute, local path on the filing system

getSearchIndexDirectory

public java.lang.String getSearchIndexDirectory()
Gets the location where the blog search indexes are stored.

Returns:
an absolute, local path on the filing system

getLogsDirectory

public java.lang.String getLogsDirectory()
Gets the location where the blog logs are stored.

Returns:
an absolute, local path on the filing system

getRecentBlogEntries

public abstract java.util.List getRecentBlogEntries(int numberOfEntries)
Gets the most recent blog entries, the number of which is specified.

Parameters:
numberOfEntries - the number of entries to get
Returns:
a List containing the most recent blog entries

getRecentBlogEntries

public java.util.List getRecentBlogEntries()
Gets the most recent blog entries, the number of which is taken from the recentBlogEntriesOnHomePage property.

Returns:
a List containing the most recent blog entries

setRecentBlogEntries

public void setRecentBlogEntries(java.util.List entries)
Setter method for the recentBlogEntries property - this is here so that the property complies with the JavaBeans standard.

Parameters:
entries -

getLastModified

public abstract java.util.Date getLastModified()
Gets the date that this blog was last updated.

Returns:
a Date instance representing the time of the most recent entry

toString

public java.lang.String toString()
Gets a string representation of this object.

Overrides:
toString in class java.lang.Object
Returns:
a String

info

public void info(java.lang.String message)

warn

public void warn(java.lang.String message)

error

public void error(java.lang.String message)

clearMessages

public void clearMessages()

getMessages

public java.util.List<Message> getMessages()

getNumberOfMessages

public int getNumberOfMessages()

log

public abstract void log(HttpServletRequest request,
                         int status)
Logs this request for blog.

Parameters:
request - the HttpServletRequest instance for this request


Copyright © 2003-2006, Simon Brown. All Rights Reserved.