You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by sn...@apache.org on 2005/08/08 16:43:03 UTC

svn commit: r230810 [3/6] - in /incubator/roller/branches/roller_2.0: ./ contrib/plugins/src/org/roller/presentation/velocity/plugins/acronyms/ contrib/plugins/src/org/roller/presentation/velocity/plugins/convertbreaks/ contrib/plugins/src/org/roller/p...

Modified: incubator/roller/branches/roller_2.0/src/org/roller/pojos/WeblogEntryData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/pojos/WeblogEntryData.java?rev=230810&r1=230809&r2=230810&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/pojos/WeblogEntryData.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/pojos/WeblogEntryData.java Mon Aug  8 07:41:04 2005
@@ -29,7 +29,6 @@
 import org.roller.util.DateUtil;
 import org.roller.util.Utilities;
 
-
 /**
  * Represents a Weblog Entry.
  * 
@@ -141,6 +140,7 @@
     //------------------------------------------------------ Simple properties
     
     /** 
+     * @roller.wrapPojoMethod type="simple"
      * @ejb:persistent-field 
      * @hibernate.id column="id" type="string"
      *  generator-class="uuid.hex" unsaved-value="null"
@@ -157,6 +157,7 @@
     }
 
     /** 
+     * @roller.wrapPojoMethod type="pojo"
      * @ejb:persistent-field 
      * @hibernate.many-to-one column="categoryid" cascade="none" not-null="true"
      */
@@ -182,6 +183,7 @@
     }
 
     /** 
+     * @roller.wrapPojoMethod type="pojo"
      * @ejb:persistent-field 
      * @hibernate.many-to-one column="websiteid" cascade="none" not-null="true"
      */
@@ -197,6 +199,7 @@
     }
 
     /** 
+     * @roller.wrapPojoMethod type="simple"
      * @ejb:persistent-field 
      * @hibernate.many-to-one column="userid" cascade="none" not-null="true"
      */
@@ -227,6 +230,7 @@
     }
 
     /** 
+     * @roller.wrapPojoMethod type="simple"
      * @ejb:persistent-field 
      * @hibernate.property column="text" non-null="true" unique="false"
      */
@@ -242,6 +246,7 @@
     }
 
     /** 
+     * @roller.wrapPojoMethod type="simple"
      * @ejb:persistent-field 
      * @hibernate.property column="anchor" non-null="true" unique="false"
      */
@@ -258,7 +263,9 @@
 
     //-------------------------------------------------------------------------
     /** 
-     * Map attributes as set because XDoclet 1.2b4 map support is broken. 
+     * Map attributes as set because XDoclet 1.2b4 map support is broken.
+     *
+     * @roller.wrapPojoMethod type="pojo-collection" class="org.roller.pojos.EntryAttributeData"
      * @ejb:persistent-field
      * @hibernate.set lazy="true" order-by="name" inverse="true" cascade="all" 
      * @hibernate.collection-key column="entryid" type="String"
@@ -291,12 +298,20 @@
             this.attMap = new HashMap();
         }
     }
-    /** Would be named getEntryAttribute, but that would set off XDoclet */
+    
+    
+    /** 
+     * Would be named getEntryAttribute, but that would set off XDoclet
+     *
+     * @roller.wrapPojoMethod type="simple"
+     */
     public String findEntryAttribute(String name)
     {
         EntryAttributeData att = ((EntryAttributeData)attMap.get(name));
         return (att != null) ? att.getValue() : null;
     }
+    
+    
     public void putEntryAttribute(String name, String value) throws Exception
     {
         EntryAttributeData att = (EntryAttributeData)attMap.get(name);
@@ -337,6 +352,7 @@
      * <p>NOTE: Times are stored using the SQL TIMESTAMP datatype, which on 
      * MySQL has only a one-second resolution.</p>
      *
+     * @roller.wrapPojoMethod type="simple"
      * @ejb:persistent-field 
      * @hibernate.property column="pubtime" non-null="true" unique="false"
      */
@@ -362,6 +378,7 @@
      * <p>NOTE: Times are stored using the SQL TIMESTAMP datatype, which on 
      * MySQL has only a one-second resolution.</p>
      *
+     * @roller.wrapPojoMethod type="simple"
      * @ejb:persistent-field 
      * @hibernate.property column="updatetime" non-null="true" unique="false"
      */
@@ -377,6 +394,7 @@
     }
 
     /** 
+     * @roller.wrapPojoMethod type="simple"
      * @ejb:persistent-field 
      * @hibernate.property column="status" non-null="true" unique="false"
      */
@@ -395,6 +413,7 @@
      * Some weblog entries are about one specific link.
      * @return Returns the link.
      *
+     * @roller.wrapPojoMethod type="simple"
      * @ejb:persistent-field 
      * @hibernate.property column="link" non-null="false" unique="false"
      */
@@ -414,6 +433,8 @@
 
     /**
      * Comma-delimited list of this entry's Plugins.
+     *
+     * @roller.wrapPojoMethod type="simple"
      * @ejb:persistent-field
      * @hibernate.property column="plugins" non-null="false" unique="false"
      */
@@ -429,58 +450,65 @@
     }
 
     
-	/**
-	 * True if comments are allowed on this weblog entry.
-     * @ejb:persistent-field 
+    /**
+     * True if comments are allowed on this weblog entry.
+     *
+     * @roller.wrapPojoMethod type="simple"
+     * @ejb:persistent-field
      * @hibernate.property column="allowcomments" non-null="true" unique="false"
-	 */
-	public Boolean getAllowComments() {
-		return allowComments;
-	}
-	/**
-	 * True if comments are allowed on this weblog entry.
-     * @ejb:persistent-field 
-	 */
-	public void setAllowComments(Boolean allowComments) {
-		this.allowComments = allowComments;
-	}
-	
-	/**
-	 * Number of days after pubTime that comments should be allowed, or 0 for no limit.
-     * @ejb:persistent-field 
+     */
+    public Boolean getAllowComments() {
+        return allowComments;
+    }
+    /**
+     * True if comments are allowed on this weblog entry.
+     * @ejb:persistent-field
+     */
+    public void setAllowComments(Boolean allowComments) {
+        this.allowComments = allowComments;
+    }
+    
+    /**
+     * Number of days after pubTime that comments should be allowed, or 0 for no limit.
+     *
+     * @roller.wrapPojoMethod type="simple"
+     * @ejb:persistent-field
      * @hibernate.property column="commentdays" non-null="true" unique="false"
-	 */
-	public Integer getCommentDays() {
-		return commentDays;
-	}
-	/**
-	 * Number of days after pubTime that comments should be allowed, or 0 for no limit.
-     * @ejb:persistent-field 
-	 */
-	public void setCommentDays(Integer commentDays) {
-		this.commentDays = commentDays;
-	}
-	
-	/**
-	 * True if this entry should be rendered right to left.
-     * @ejb:persistent-field 
+     */
+    public Integer getCommentDays() {
+        return commentDays;
+    }
+    /**
+     * Number of days after pubTime that comments should be allowed, or 0 for no limit.
+     * @ejb:persistent-field
+     */
+    public void setCommentDays(Integer commentDays) {
+        this.commentDays = commentDays;
+    }
+    
+    /**
+     * True if this entry should be rendered right to left.
+     *
+     * @roller.wrapPojoMethod type="simple"
+     * @ejb:persistent-field
      * @hibernate.property column="righttoleft" non-null="true" unique="false"
-	 */
-	public Boolean getRightToLeft() {
-		return rightToLeft;
-	}
-	/**
-	 * True if this entry should be rendered right to left.
-     * @ejb:persistent-field 
-	 */
-	public void setRightToLeft(Boolean rightToLeft) {
-		this.rightToLeft = rightToLeft;
-	}
+     */
+    public Boolean getRightToLeft() {
+        return rightToLeft;
+    }
+    /**
+     * True if this entry should be rendered right to left.
+     * @ejb:persistent-field
+     */
+    public void setRightToLeft(Boolean rightToLeft) {
+        this.rightToLeft = rightToLeft;
+    }
 
     /**
      * True if story should be pinned to the top of the Roller site main blog.
      * @return Returns the pinned.
      * 
+     * @roller.wrapPojoMethod type="simple"
      * @ejb:persistent-field 
      * @hibernate.property column="pinnedtomain" non-null="true" unique="false"
      */
@@ -524,7 +552,9 @@
     
     /** 
      * True if comments are still allowed on this entry considering the 
-     * allowComments and commentDays fields. 
+     * allowComments and commentDays fields.
+     *
+     * @roller.wrapPojoMethod type="simple"
      */
     public boolean getCommentsStillAllowed() 
     {
@@ -537,7 +567,8 @@
     			}
     			else 
     			{
-    				Calendar expireCal = Calendar.getInstance(getWebsite().getLocaleInstance());
+    				Calendar expireCal = Calendar.getInstance(
+                            getWebsite().getLocaleInstance());
     				expireCal.setTime(getPubTime());
     				expireCal.add(Calendar.DATE, getCommentDays().intValue());
     				Date expireDay = expireCal.getTime();
@@ -560,6 +591,8 @@
     /** 
      * Format the publish time of this weblog entry using the specified pattern.
      * See java.text.SimpleDateFormat for more information on this format.
+     *
+     * @roller.wrapPojoMethod type="simple"
      * @see java.text.SimpleDateFormat
      * @return Publish time formatted according to pattern.
      */
@@ -585,6 +618,8 @@
     /** 
      * Format the update time of this weblog entry using the specified pattern.
      * See java.text.SimpleDateFormat for more information on this format.
+     *
+     * @roller.wrapPojoMethod type="simple"
      * @see java.text.SimpleDateFormat
      * @return Update time formatted according to pattern.
      */
@@ -606,11 +641,17 @@
 
     //------------------------------------------------------------------------
     
+    /**
+     * @roller.wrapPojoMethod type="pojo-collection" class="org.roller.pojos.CommentData"
+     */
     public List getComments()
     {
         return getComments(true);
     }
     
+    /**
+     * @roller.wrapPojoMethod type="pojo-collection" class="org.roller.pojos.CommentData"
+     */
     public List getComments(boolean ignoreSpam)
     {
         List list = new ArrayList();
@@ -624,6 +665,9 @@
 
     //------------------------------------------------------------------------
     
+    /**
+     * @roller.wrapPojoMethod type="pojo-collection" class="org.roller.pojos.RefererData"
+     */
     public List getReferers()
     {
         List referers = null;
@@ -644,6 +688,7 @@
      * @param excerpt
      * @param blogName
      */
+    /* moved to trackback servlet -- Allen G
     public void addTrackback(
         String url, String title, String excerpt, String blogName) 
         throws RollerException
@@ -680,10 +725,13 @@
         //ref.setDateString(formatPubTime("yyyyMMdd"));        
         //mRoller.getRefererManager().storeReferer(ref);
     }
+    */
     
     /**
      * Convenience method for getPermalink(category)
      * where no category is necessary.
+     * 
+     * @roller.wrapPojoMethod type="simple"
      * @return
      */
     public String getPermaLink()
@@ -701,7 +749,7 @@
         
         WebsiteData website = this.getWebsite();
         String plink = "/page/" + website.getHandle() + 
-                "?anchor=" + lAnchor;
+                "?entry=" + lAnchor;
         
         return plink;
     }
@@ -711,6 +759,8 @@
      * require prepending the baseURL (either the full root 
      * [http://server.com/context] or at least the context
      * [/context]) in order to generate a functional link.
+     *
+     * @roller.wrapPojoMethod type="simple"
      * @param category The category name to insert into the permalink.
      * @return String
      */
@@ -721,7 +771,10 @@
         
         return this.getPermaLink();
     }
-        
+    
+    /**
+     * @roller.wrapPojoMethod type="simple"
+     */
     public String getCommentsLink()
     {
         String dayString = DateUtil.format8chars(this.getPubTime());
@@ -744,6 +797,7 @@
      * Return the Title of this post, or the first 255 characters of the
      * entry's text.
      * 
+     * @roller.wrapPojoMethod type="simple"
      * @return String
      */
     public String getDisplayTitle()
@@ -915,13 +969,21 @@
         return result;
     }
     
-    /** Return RSS 09x style description (escaped HTML version of entry text) */
+    /**
+     * Return RSS 09x style description (escaped HTML version of entry text)
+     *
+     * @roller.wrapPojoMethod type="simple"
+     */
     public String getRss09xDescription()
     {
         return getRss09xDescription(-1);
     }
     
-    /** Return RSS 09x style description (escaped HTML version of entry text) */
+    /** 
+     * Return RSS 09x style description (escaped HTML version of entry text)
+     *
+     * @roller.wrapPojoMethod type="simple"
+     */
     public String getRss09xDescription(int maxLength)
     {
         String ret = Utilities.escapeHTML(text);
@@ -1012,6 +1074,8 @@
     
     /**
      * Convenience method to transform mPlugins to a List
+     *
+     * @roller.wrapPojoMethod type="simple"
      * @return
      */
     public List getPluginsList()

Copied: incubator/roller/branches/roller_2.0/src/org/roller/pojos/WeblogTemplate.java (from r225818, incubator/roller/trunk/src/org/roller/pojos/WeblogTemplate.java)
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/pojos/WeblogTemplate.java?p2=incubator/roller/branches/roller_2.0/src/org/roller/pojos/WeblogTemplate.java&p1=incubator/roller/trunk/src/org/roller/pojos/WeblogTemplate.java&r1=225818&r2=230810&rev=230810&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/pojos/WeblogTemplate.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/pojos/WeblogTemplate.java Mon Aug  8 07:41:04 2005
@@ -5,7 +5,7 @@
 import org.roller.RollerException;
 import org.roller.model.Roller;
 import org.roller.model.RollerFactory;
-import org.roller.pojos.Template;
+
 
 
 /**
@@ -301,7 +301,7 @@
        {
            return true;
        }
-       if (roller.getUser().equals(getWebsite().getUser()))
+       if (getWebsite().hasUserPermissions(roller.getUser(), PermissionsData.ADMIN))
        {
            return true;
        }

Modified: incubator/roller/branches/roller_2.0/src/org/roller/pojos/WebsiteData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/pojos/WebsiteData.java?rev=230810&r1=230809&r2=230810&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/pojos/WebsiteData.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/pojos/WebsiteData.java Mon Aug  8 07:41:04 2005
@@ -1,19 +1,24 @@
 package org.roller.pojos;
 
-
-
 import java.util.ArrayList;
 import java.util.Date;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
+import java.util.Map;
 import java.util.TimeZone;
-
 import org.apache.commons.lang.StringUtils;
 import org.roller.RollerException;
 import org.roller.model.Roller;
 import org.roller.model.RollerFactory;
 import org.roller.util.PojoUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.roller.ThemeNotFoundException;
+import org.roller.model.ThemeManager;
+import org.roller.model.UserManager;
+
 
 /**
  * Website has many-to-many association with users. Website has one-to-many and 
@@ -33,6 +38,9 @@
 {
     static final long serialVersionUID = 206437645033737127L;
     
+    private static Log mLogger = 
+        LogFactory.getFactory().getInstance(WebsiteData.class);
+    
     // Simple properties
     protected String  id;
     protected String  handle;
@@ -132,7 +140,218 @@
     }
     
     /**
+     * Lookup the default page for this website.
+     */
+    public Template getDefaultPage() throws RollerException {
+        
+        Template template = null;
+        
+        // first check if this user has selected a theme
+        // if so then return the themes Weblog template
+        if(this.editorTheme != null && !this.editorTheme.equals(Theme.CUSTOM)) {
+            try {
+                ThemeManager themeMgr = RollerFactory.getRoller().getThemeManager();
+                Theme usersTheme = themeMgr.getTheme(this.editorTheme);
+                
+                // this is a bit iffy :/
+                // we assume that all theme use "Weblog" for a default template
+                template = usersTheme.getTemplate("Weblog");
+                
+            } catch(ThemeNotFoundException tnfe) {
+                // i sure hope not!
+                mLogger.error(tnfe);
+            }
+        }
+        
+        // if we didn't get the Template from a theme then look in the db
+        if(template == null) {
+            UserManager userMgr = RollerFactory.getRoller().getUserManager();
+            template = userMgr.retrievePage(this.defaultPageId);
+        }
+        
+        if(template != null)
+            mLogger.debug("returning default template id ["+template.getId()+"]");
+        
+        return template;
+    }
+    
+    
+    /**
+     * Lookup a Template for this website by id.
+     */
+    public Template getPageById(String id) throws RollerException {
+        
+        if(id == null)
+            return null;
+        
+        Template template = null;
+        
+        // first check if this user has selected a theme
+        // if so then return the proper theme template
+        if(this.editorTheme != null && !this.editorTheme.equals(Theme.CUSTOM)) {
+            
+            // we don't actually expect to get lookups for theme pages by id
+            // but we have to be thorough and check anyways
+            String[] split = id.split(":",  2);
+            
+            // only continue if this looks like a theme id
+            // and the theme name matches this users current theme
+            if(split.length == 2 && split[0].equals(this.editorTheme)) {
+                try {
+                    ThemeManager themeMgr = RollerFactory.getRoller().getThemeManager();
+                    Theme usersTheme = themeMgr.getTheme(this.editorTheme);
+                    template = usersTheme.getTemplate(split[1]);
+                    
+                } catch(ThemeNotFoundException tnfe) {
+                    // i sure hope not!
+                    mLogger.error(tnfe);
+                }
+            }
+            
+        }
+        
+        // if we didn't get the Template from a theme then look in the db
+        if(template == null) {
+            UserManager userMgr = RollerFactory.getRoller().getUserManager();
+            template = userMgr.getPageByName(this, name);
+        }
+        
+        return template;
+    }
+    
+    
+    /**
+     * Lookup a Template for this website by name.
+     */
+    public Template getPageByName(String name) throws RollerException {
+        
+        if(name == null)
+            return null;
+        
+        mLogger.debug("looking up template ["+name+"]");
+        
+        Template template = null;
+        
+        // first check if this user has selected a theme
+        // if so then return the proper theme template
+        if(this.editorTheme != null && !this.editorTheme.equals(Theme.CUSTOM)) {
+            
+            try {
+                ThemeManager themeMgr = RollerFactory.getRoller().getThemeManager();
+                Theme usersTheme = themeMgr.getTheme(this.editorTheme);
+                template = usersTheme.getTemplate(name);
+
+            } catch(ThemeNotFoundException tnfe) {
+                // i sure hope not!
+                mLogger.error(tnfe);
+            }
+            
+        }
+        
+        // if we didn't get the Template from a theme then look in the db
+        if(template == null) {
+            UserManager userMgr = RollerFactory.getRoller().getUserManager();
+            template = userMgr.getPageByName(this, name);
+        }
+        
+        if(template != null)
+            mLogger.debug("returning template ["+template.getId()+"]");
+        
+        return template;
+    }
+    
+    
+    /**
+     * Lookup a template for this website by link.
+     */
+    public Template getPageByLink(String link) throws RollerException {
+        
+        if(link == null)
+            return null;
+        
+        mLogger.debug("looking up template ["+link+"]");
+        
+        Template template = null;
+        
+        // first check if this user has selected a theme
+        // if so then return the proper theme template
+        if(this.editorTheme != null && !this.editorTheme.equals(Theme.CUSTOM)) {
+            
+            try {
+                ThemeManager themeMgr = RollerFactory.getRoller().getThemeManager();
+                Theme usersTheme = themeMgr.getTheme(this.editorTheme);
+                template = usersTheme.getTemplateByLink(link);
+
+            } catch(ThemeNotFoundException tnfe) {
+                // i sure hope not!
+                mLogger.error(tnfe);
+            }
+            
+        }
+        
+        // if we didn't get the Template from a theme then look in the db
+        if(template == null) {
+            UserManager userMgr = RollerFactory.getRoller().getUserManager();
+            template = userMgr.getPageByLink(this, link);
+        }
+        
+        if(template != null)
+            mLogger.debug("returning template ["+template.getId()+"]");
+        
+        return template;
+    }
+    
+    
+    /**
+     * Get a list of all pages that are part of this website.
+     */
+    public List getPages() {
+        
+        Map pages = new HashMap();
+        
+        // first get the pages from the db
+        try {
+            Template template = null;
+            UserManager userMgr = RollerFactory.getRoller().getUserManager();
+            Iterator dbPages = userMgr.getPages(this).iterator();
+            while(dbPages.hasNext()) {
+                template = (Template) dbPages.next();
+                pages.put(template.getName(), template);
+            }
+        } catch(Exception e) {
+            // db error
+            mLogger.error(e);
+        }
+        
+            
+        // now get theme pages if needed and put them in place of db pages
+        if(this.editorTheme != null && !this.editorTheme.equals(Theme.CUSTOM)) {
+            try {
+                Template template = null;
+                ThemeManager themeMgr = RollerFactory.getRoller().getThemeManager();
+                Theme usersTheme = themeMgr.getTheme(this.editorTheme);
+                Iterator themePages = usersTheme.getTemplates().iterator();
+                while(themePages.hasNext()) {
+                    template = (Template) themePages.next();
+                    
+                    // note that this will put theme pages over custom
+                    // pages in the pages list, which is what we want
+                    pages.put(template.getName(), template);
+                }
+            } catch(Exception e) {
+                // how??
+                mLogger.error(e);
+            }
+        }
+        
+        return new ArrayList(pages.values());
+    }
+    
+    
+    /**
      * Id of the Website.
+     *
+     * @roller.wrapPojoMethod type="simple"
      * @ejb:persistent-field
      * @hibernate.id column="id" type="string"
      *  generator-class="uuid.hex" unsaved-value="null"
@@ -166,6 +385,8 @@
 
     /**
      * Name of the Website.
+     *
+     * @roller.wrapPojoMethod type="simple"
      * @ejb:persistent-field
      * @hibernate.property column="name" non-null="true" unique="false"
      */
@@ -182,6 +403,8 @@
 
     /**
      * Description
+     *
+     * @roller.wrapPojoMethod type="simple"
      * @ejb:persistent-field
      * @hibernate.property column="description" non-null="true" unique="false"
      */
@@ -198,6 +421,8 @@
 
     /**
      * Original creator of website
+     *
+     * @roller.wrapPojoMethod type="pojo"
      * @ejb:persistent-field
      * @hibernate.many-to-one column="userid" cascade="none" not-null="true"
      */
@@ -213,6 +438,7 @@
     }
 
     /**
+     * @roller.wrapPojoMethod type="simple"
      * @ejb:persistent-field
      * @hibernate.property column="defaultpageid" non-null="true" unique="false"
      */
@@ -230,6 +456,7 @@
     }
 
     /**
+     * @roller.wrapPojoMethod type="simple"
      * @deprecated
      * @ejb:persistent-field
      * @hibernate.property column="weblogdayid" non-null="true" unique="false"
@@ -249,6 +476,7 @@
     }
 
     /**
+     * @roller.wrapPojoMethod type="simple"
      * @ejb:persistent-field
      * @hibernate.property column="enablebloggerapi" non-null="true" unique="false"
      */
@@ -264,8 +492,8 @@
     }
 
     /**
+     * @roller.wrapPojoMethod type="simple"
      * @ejb:persistent-field
-     * 
      * @hibernate.many-to-one column="bloggercatid" non-null="false"
      */
     public WeblogCategoryData getBloggerCategory()
@@ -284,8 +512,8 @@
      * work with the top level categories that are immediately under the root.
      * Setting a different default category allows you to partition your weblog.
      * 
+     * @roller.wrapPojoMethod type="pojo"
      * @ejb:persistent-field
-     * 
      * @hibernate.many-to-one column="defaultcatid" non-null="false"
      */
     public WeblogCategoryData getDefaultCategory() 
@@ -300,6 +528,7 @@
     }
 
     /**
+     * @roller.wrapPojoMethod type="simple"
      * @ejb:persistent-field
      * @hibernate.property column="editorpage" non-null="true" unique="false"
      */
@@ -315,6 +544,7 @@
     }
 
     /**
+     * @roller.wrapPojoMethod type="simple"
      * @ejb:persistent-field
      * @hibernate.property column="ignorewords" non-null="true" unique="false"
      */
@@ -330,6 +560,7 @@
     }
 
     /**
+     * @roller.wrapPojoMethod type="simple"
      * @ejb:persistent-field
      * @hibernate.property column="allowcomments" non-null="true" unique="false"
      */
@@ -345,6 +576,7 @@
     }
 
     /**
+     * @roller.wrapPojoMethod type="simple"
      * @ejb:persistent-field
      * @hibernate.property column="emailcomments" non-null="true" unique="false"
      */
@@ -360,6 +592,7 @@
     }
     
     /**
+     * @roller.wrapPojoMethod type="simple"
      * @ejb:persistent-field
      * @hibernate.property column="emailfromaddress" non-null="true" unique="false"
      */
@@ -376,6 +609,7 @@
     
     /**
      * @ejb:persistent-field
+     * @roller.wrapPojoMethod type="simple"
      * @hibernate.property column="emailaddress" non-null="true" unique="false"
      */
     public String getEmailAddress()
@@ -391,6 +625,8 @@
     
     /**
      * EditorTheme of the Website.
+     *
+     * @roller.wrapPojoMethod type="simple"
      * @ejb:persistent-field
      * @hibernate.property column="editortheme" non-null="true" unique="false"
      */
@@ -407,6 +643,8 @@
 
     /**
      * Locale of the Website.
+     *
+     * @roller.wrapPojoMethod type="simple"
      * @ejb:persistent-field
      * @hibernate.property column="locale" non-null="true" unique="false"
      */
@@ -423,6 +661,8 @@
 
     /**
      * Timezone of the Website.
+     *
+     * @roller.wrapPojoMethod type="simple"
      * @ejb:persistent-field
      * @hibernate.property column="timeZone" non-null="true" unique="false"
      */
@@ -467,6 +707,8 @@
 
     /**
      * Comma-delimited list of user's default Plugins.
+     *
+     * @roller.wrapPojoMethod type="simple"
      * @ejb:persistent-field
      * @hibernate.property column="defaultplugins" non-null="false" unique="false"
      */
@@ -482,6 +724,7 @@
     }
 
     /**
+     * @roller.wrapPojoMethod type="simple"
      * @ejb:persistent-field
      * @hibernate.property column="isenabled" non-null="true" unique="false"
      */
@@ -635,6 +878,8 @@
     /**
      * Parse locale value and instantiate a Locale object,
      * otherwise return default Locale.
+     *
+     * @roller.wrapPojoMethod type="simple"
      * @return Locale
      */
     public Locale getLocaleInstance()
@@ -667,6 +912,8 @@
     /**
      * Return TimeZone instance for value of timeZone,
      * otherwise return system default instance.
+     *
+     * @roller.wrapPojoMethod type="simple"
      * @return TimeZone
      */
     public TimeZone getTimeZoneInstance()

Modified: incubator/roller/branches/roller_2.0/src/org/roller/pojos/package.html
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/pojos/package.html?rev=230810&r1=230809&r2=230810&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/pojos/package.html (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/pojos/package.html Mon Aug  8 07:41:04 2005
@@ -4,7 +4,21 @@
   <title></title>
 </head>
 <body>
-Persistent objects and supporting classes. Source for XDoclet generation of Hibernate mappings,
-Struts form beans, and Struts validation configuration file.<br>
+Persistent objects stored/retrieved by business layer.
+
+<p>At this level we avoid dependance on specific persistence engines 
+(e.g. Hibernate). We do this by using an interface named 
+{@link org.roller.business.PersistenceStrategy PersistenceStrategy} 
+to store, retrieve and remove 
+{@link org.roller.pojos.PersistentObject PersistentObjects}.</p>
+
+<img src="../business/roller-persistence.png" 
+    alt="diagram of Roller persistent object and strategy" />
+
+<p>The diagram below shows the objects in the Roller data model and the
+relationships between them.</p>
+
+<img src="roller-datamodel.png" alt="diagram of Roller data model" />
+
 </body>
 </html>

Propchange: incubator/roller/branches/roller_2.0/src/org/roller/pojos/roller-datamodel.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: incubator/roller/branches/roller_2.0/src/org/roller/presentation/ResourceServlet.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/presentation/ResourceServlet.java?rev=230810&r1=230809&r2=230810&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/presentation/ResourceServlet.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/presentation/ResourceServlet.java Mon Aug  8 07:41:04 2005
@@ -102,6 +102,10 @@
         InputStream resource_file = new FileInputStream(resource);
         while((length = resource_file.read(buf)) > 0)
             out.write(buf, 0, length);
+        
+        // cleanup
+        out.close();
+        resource_file.close();
     }
     
     

Modified: incubator/roller/branches/roller_2.0/src/org/roller/presentation/RollerContext.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/presentation/RollerContext.java?rev=230810&r1=230809&r2=230810&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/presentation/RollerContext.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/presentation/RollerContext.java Mon Aug  8 07:41:04 2005
@@ -1,17 +1,12 @@
 package org.roller.presentation;
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.FilenameFilter;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.sql.Connection;
 import java.sql.SQLException;
-import java.util.HashMap;
 import java.util.Properties;
 import java.util.TimerTask;
 
@@ -43,12 +38,13 @@
 import org.roller.presentation.velocity.CommentAuthenticator;
 import org.roller.presentation.velocity.ContextLoader;
 import org.roller.presentation.velocity.DefaultCommentAuthenticator;
-import org.roller.presentation.website.ThemeCache;
-import org.roller.util.DateUtil;
 import org.roller.util.StringUtils;
 import org.roller.util.Utilities;
-
 import EDU.oswego.cs.dl.util.concurrent.SynchronizedInt;
+import org.roller.business.utils.UpgradeDatabase;
+import org.roller.config.RollerRuntimeConfig;
+import org.roller.config.PingConfig;
+
 
 //////////////////////////////////////////////////////////////////////////////
 /**
@@ -168,14 +164,23 @@
             // is set to ${webapp.context}
             RollerConfig.setUploadsDir(ctxPath);
             
+            // set the roller context real path in RollerConfig
+            // NOTE: it seems that a few backend classes do actually need
+            //       to know what the real path to the roller context is,
+            //       so we set this property to give them the info they need.
+            //
+            //       this is really not a best practice and we should try to
+            //       remove these dependencies on the webapp context if possible
+            RollerConfig.setContextPath(mContext.getRealPath("/"));
             
-            Roller roller = RollerFactory.getRoller();
+            // always upgrade database first
+            upgradeDatabaseIfNeeded();
             
+            Roller roller = RollerFactory.getRoller();
             roller.begin(UserData.SYSTEM_USER);
             
-            //setupRollerConfig();
             setupRollerProperties();
-            upgradeDatabaseIfNeeded();
+            roller.getThemeManager();
             setupSpellChecker();
             setupPagePlugins();
             setupIndexManager(roller);
@@ -296,7 +301,7 @@
             InitialContext ic = new InitialContext();
             DataSource ds = (DataSource)ic.lookup("java:comp/env/jdbc/rollerdb");
             Connection con = ds.getConnection();
-            RollerFactory.getRoller().upgradeDatabase(con);
+            UpgradeDatabase.upgradeDatabase(con, mVersion);
             con.close();
         }
         catch (NamingException e)
@@ -428,31 +433,7 @@
         return mAuthenticator;
     }
 
-    //-----------------------------------------------------------------------
-    /**
-     * Returns RollerConfig object. Changed so that it always tries
-     * to fetch from the database first. If it should error, return
-     * the stored copy.
-     */
-    /* not available anymore ... use the new config classes instead -- Allen G
-    public RollerConfigData getRollerConfig()
-    {
-        if (mConfig == null)
-        {
-            try 
-            {
-    			    mConfig = getRoller(null).getConfigManager().getRollerConfig();
-    		    } 
-            catch (RollerException e) 
-            {
-    			mLogger.error("Unable to get RollerConfig from database");
-    		    }
-        }
-        return mConfig;
-    }
-    */
 
-    //-----------------------------------------------------------------------
     /**
      *  Gets the hard-drive location of the upload directory.
      */
@@ -469,7 +450,7 @@
         return uploaddir;
     }
 
-    //-----------------------------------------------------------------------
+
     /**
      * Gets the base url for the upload directory.
      */
@@ -601,68 +582,17 @@
             {
                 baseUrl = getContextUrl(request);
             }
-
-            String dayString = DateUtil.format8chars(entry.getPubTime());
-
-            link =
-                Utilities.escapeHTML(
-                    baseUrl
-                        + "/page/"
-                        + entry.getWebsite().getHandle()
-                        + "/"
-                        + dayString
-                        + "#"
-                        + entry.getAnchor());
+            link = Utilities.escapeHTML(baseUrl + entry.getPermaLink());
         }
         catch (Exception e)
         {
             mLogger.error("Unexpected exception", e);
         }
+        
         return link;
     }
 
-    //-----------------------------------------------------------------------
-    /**
-     * Return the real filepath to the theme.
-     *
-     * @param theme
-     * @return String
-     */
-    public String getThemePath(String theme)
-    {
-        String themespath = RollerRuntimeConfig.getProperty("users.themes.path");
-
-        // Figure path to new user theme
-        return mContext.getRealPath(
-            "/" + themespath + "/" + theme);
-    }
-
-    //-----------------------------------------------------------------------
-    /**
-     * Get the list of Theme names.  This consists
-     * of the directories under the /themes directory.
-     *
-     * @return String[]
-     */
-    public String[] getThemeNames()
-    {
-        String themespath = RollerRuntimeConfig.getProperty("users.themes.path");
-        
-        String themesPath =
-            mContext.getRealPath("/" + themespath);
-        File themeDir = new File(themesPath);
-        return themeDir.list(new FilenameFilter()
-        {
-            public boolean accept(File dir, String name)
-            {
-                File file =
-                    new File(dir.getAbsolutePath() + File.separator + name);
-                return file.isDirectory();
-            }
-        });
-    }
 
-    //-----------------------------------------------------------------------
     /**
      * Returns the mContext.
      * @return ServletContext
@@ -672,94 +602,7 @@
         return mContext;
     }
 
-    //-----------------------------------------------------------------------
-    /**
-     * Reads the Theme files from harddisk (if necessary) and places them into a
-     * ThemeCache.  If the requested Theme's pages are already in the cache,
-     * return them instead.
-     *
-     * @param themeName
-     * @return HashMap
-     * @throws FileNotFoundException
-     * @throws IOException
-     */
-    public HashMap readThemeMacros(String themeName)
-        throws FileNotFoundException, IOException
-    {
-        if (mLogger.isDebugEnabled())
-        {
-            mLogger.debug("themeName=" + themeName);
-        }
-
-        // Load all Velocity templates from root directory of the theme
-        String pageName = null;
-        String themeDir = this.getThemePath(themeName);
-        String[] children = getThemeFilenames(themeDir);
-        HashMap pages = new HashMap();
-        ThemeCache themeCache = ThemeCache.getInstance();
-        for (int i = 0; i < children.length; i++)
-        {
-            pageName = children[i].substring(0, children[i].length() - 3);
-
-            if (themeCache.getFromCache(themeName, pageName) != null)
-            {
-                pages.put(
-                    pageName,
-                    themeCache.getFromCache(themeName, pageName));
-            }
-            else
-            {
-                BufferedReader rdr = null;
-                try
-                {
-                    rdr = new BufferedReader(
-                        new FileReader(
-                            themeDir + File.separator + children[i]));
-                    String line = null;
-                    StringBuffer sb = new StringBuffer();
-                    while (null != (line = rdr.readLine()))
-                    {
-                        sb.append(line);
-                        sb.append("\n");
-                    }
     
-                    pages.put(pageName, sb.toString());
-                    themeCache.putIntoCache(themeName, pageName, sb.toString());
-                }
-                finally 
-                {
-                    if (rdr != null) rdr.close();
-                }
-            }
-        }
-        return pages;
-    }
-
-    //-----------------------------------------------------------------------
-
-    public static String[] getThemeFilenames(String themeDir)
-    {
-        ThemeCache themeCache = ThemeCache.getInstance();
-        if (themeCache.getFileList(themeDir) != null)
-        {
-            return themeCache.getFileList(themeDir);
-        }
-
-        File dir = new File(themeDir);
-        FilenameFilter filter = new FilenameFilter()
-        {
-            public boolean accept(File dir, String name)
-            {
-                return name.endsWith(".vm");
-            }
-        };
-        String[] children = dir.list(filter);
-        themeCache.setFileList(themeDir, children);
-        return children;
-    }
-
-    //-----------------------------------------------------------------------
-
     /** Roller version */
     public String getRollerVersion()
     {

Modified: incubator/roller/branches/roller_2.0/src/org/roller/presentation/RollerRequest.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/presentation/RollerRequest.java?rev=230810&r1=230809&r2=230810&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/presentation/RollerRequest.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/presentation/RollerRequest.java Mon Aug  8 07:41:04 2005
@@ -18,11 +18,12 @@
 import org.roller.config.RollerRuntimeConfig;
 import org.roller.model.ParsedRequest;
 import org.roller.model.RollerFactory;
+import org.roller.model.RollerFactory;
+import org.roller.pojos.Template;
 import org.roller.model.UserManager;
 import org.roller.model.WeblogManager;
 import org.roller.pojos.BookmarkData;
 import org.roller.pojos.FolderData;
-import org.roller.pojos.PageData;
 import org.roller.pojos.UserData;
 import org.roller.pojos.WeblogCategoryData;
 import org.roller.pojos.WeblogEntryData;
@@ -64,7 +65,7 @@
     private String             mDateString = null;
     private String             mPathInfo = null; 
     private String             mPageLink = null;
-    private PageData           mPage;
+    private Template           mPage;
     private PageContext        mPageContext = null;
     private HttpServletRequest mRequest = null;
     private WebsiteData        mWebsite;
@@ -74,7 +75,8 @@
         
     private static ThreadLocal mRollerRequestTLS = new ThreadLocal();
     
-    public static final String ANCHOR_KEY             = "anchor";
+    public static final String ANCHOR_KEY             = "entry";
+    public static final String ANCHOR_KEY_OLD         = "anchor";
     public static final String USERNAME_KEY           = "username";
     public static final String WEBSITEHANDLE_KEY      = "blog";
     public static final String WEBSITEID_KEY          = "websiteid";
@@ -148,7 +150,7 @@
             UserData currentUser = userMgr.getUser(userName);
             RollerFactory.getRoller().setUser(currentUser);
         }
-
+        
         // path info may be null, (e.g. on JSP error page)
         mPathInfo = mRequest.getPathInfo();
         mPathInfo = (mPathInfo!=null) ? mPathInfo : "";            
@@ -211,7 +213,7 @@
                     // we have the /username form of URL
                     mDate = getDate(true);
                     mDateString = DateUtil.format8chars(mDate);
-                    mPage = userMgr.retrievePage(mWebsite.getDefaultPageId());
+                    mPage = mWebsite.getDefaultPage();
                 }
                 else if ( pathInfo.length == 2 )
                 {
@@ -222,20 +224,20 @@
                         mDate = getDate(true);
                         mDateString = DateUtil.format8chars(mDate);
                         mPageLink = pathInfo[1];
-                        mPage = userMgr.getPageByLink(mWebsite, pathInfo[1]);
+                        mPage = mWebsite.getPageByLink(pathInfo[1]);
                     }
                     else
                     {
                         // we have the /username/datestring form of URL
                         mDateString = pathInfo[1];
-                        mPage = userMgr.retrievePage(mWebsite.getDefaultPageId());
+                        mPage = mWebsite.getDefaultPage();
                         mIsDateSpecified = true;
                     }               
                 }
                 else if ( pathInfo.length == 3 )
                 {
                     mPageLink = pathInfo[1];
-                    mPage = userMgr.getPageByLink(mWebsite, pathInfo[1]);
+                    mPage = mWebsite.getPageByLink(pathInfo[1]);
                     
                     mDate = parseDate(pathInfo[2]);
                     if ( mDate == null ) // pre-jdk1.4 --> || mDate.getYear() <= 70 )
@@ -266,7 +268,7 @@
                 {
                     // we have the /username/pagelink/datestring/anchor form of URL
                     mPageLink = pathInfo[1];
-                    mPage = userMgr.getPageByLink(mWebsite, pathInfo[1]);
+                    mPage = mWebsite.getPageByLink(pathInfo[1]);
                     
                     mDate = parseDate(pathInfo[2]);
                     mDateString = pathInfo[2];
@@ -314,16 +316,17 @@
             if ( pageId != null )
             {
                 mPage = userMgr.retrievePage(pageId);
-                
+                /*
                 // We can use page to find the user, if we don't have one yet
                 if ( mWebsite == null )
                 {
                     mWebsite = mPage.getWebsite();
-                }                    
+                }
+                 */                    
             }
             else if (mWebsite != null) 
             {
-                mPage = userMgr.retrievePage( mWebsite.getDefaultPageId() );
+                mPage = mWebsite.getDefaultPage();
             }
                                        
             // Look for day in request params 
@@ -669,10 +672,10 @@
 
     //------------------------------------------------------------------------
     /**
-     * Gets the PageData specified by the request, or null.
-     * @return PageData
+     * Gets the WeblogTemplate specified by the request, or null.
+     * @return WeblogTemplate
      */
-    public PageData getPage()
+    public Template getPage()
     {
         if (mPage == null)
         {
@@ -696,7 +699,7 @@
     /**
      * Allow comment servlet to inject page that it has chosen.
      */
-    public void setPage(PageData page) 
+    public void setPage(org.roller.pojos.Template page) 
     {
         mPage = page;
     }
@@ -756,6 +759,7 @@
         {        
             // Look for anchor or entry ID that identifies a specific entry 
             String anchor = mRequest.getParameter(ANCHOR_KEY);
+            if (anchor == null) anchor = mRequest.getParameter(ANCHOR_KEY_OLD);
             String entryid = mRequest.getParameter(WEBLOGENTRYID_KEY);
             if (entryid == null) 
             {

Modified: incubator/roller/branches/roller_2.0/src/org/roller/presentation/bookmarks/actions/ImportBookmarksFormAction.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/presentation/bookmarks/actions/ImportBookmarksFormAction.java?rev=230810&r1=230809&r2=230810&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/presentation/bookmarks/actions/ImportBookmarksFormAction.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/presentation/bookmarks/actions/ImportBookmarksFormAction.java Mon Aug  8 07:41:04 2005
@@ -23,6 +23,8 @@
 import org.roller.presentation.RollerRequest;
 import org.roller.presentation.bookmarks.formbeans.FolderFormEx;
 
+import java.text.SimpleDateFormat;
+import java.util.Date;
 
 /////////////////////////////////////////////////////////////////////////////
 /**
@@ -95,12 +97,17 @@
                         }
                         data = new String(baos.toByteArray());
 
+                        SimpleDateFormat formatter = 
+                                new SimpleDateFormat("yyyyMMddHHmmss");
+                        Date now = new Date();
+                        String folderName = "imported-" + formatter.format(now);
+                        
                         // Use Roller BookmarkManager to import bookmarks
                         RollerRequest rreq = 
                             RollerRequest.getRollerRequest(request);
                         BookmarkManager bm = 
                             RollerFactory.getRoller().getBookmarkManager();    
-                        bm.importBookmarks(rreq.getWebsite(), "unfiled", data);
+                        bm.importBookmarks(rreq.getWebsite(), folderName, data);
                         
                         RollerFactory.getRoller().commit();
                     }

Modified: incubator/roller/branches/roller_2.0/src/org/roller/presentation/bookmarks/actions/package.html
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/presentation/bookmarks/actions/package.html?rev=230810&r1=230809&r2=230810&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/presentation/bookmarks/actions/package.html (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/presentation/bookmarks/actions/package.html Mon Aug  8 07:41:04 2005
@@ -4,6 +4,7 @@
   <title></title>
 </head>
 <body>
-Actions for bookmarks forms.<br>
+Struts actions for bookmarks and folders.
+
 </body>
 </html>

Modified: incubator/roller/branches/roller_2.0/src/org/roller/presentation/bookmarks/formbeans/package.html
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/presentation/bookmarks/formbeans/package.html?rev=230810&r1=230809&r2=230810&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/presentation/bookmarks/formbeans/package.html (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/presentation/bookmarks/formbeans/package.html Mon Aug  8 07:41:04 2005
@@ -4,6 +4,7 @@
   <title></title>
 </head>
 <body>
-Form beans for bookmarks forms.<br>
+Extended form beans needed for bookmarks and folders.
+
 </body>
 </html>

Propchange: incubator/roller/branches/roller_2.0/src/org/roller/presentation/filters/CharEncodingFilter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/roller/branches/roller_2.0/src/org/roller/presentation/filters/RequestFilter.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/presentation/filters/RequestFilter.java?rev=230810&r1=230809&r2=230810&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/presentation/filters/RequestFilter.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/presentation/filters/RequestFilter.java Mon Aug  8 07:41:04 2005
@@ -50,40 +50,15 @@
     }
 
     /**
-     * As the first and last filter in the chain, it is necessary that
-     * RequestFilter releases its Roller resources before it returns.
+     * Request filter.
      */
     public void doFilter(
         ServletRequest req, ServletResponse res, FilterChain chain)
         throws IOException, ServletException
     {
-        try
-        {
-            // insure that incoming data is parsed as UTF-8
-            req.setCharacterEncoding("UTF-8");
-        }
-        catch (UnsupportedEncodingException e)
-        {
-            throw new ServletException("Can't set incoming encoding to UTF-8");
-        }
-
-        // keep JSTL and Struts Locale's in sync
+        // NOTE: Setting character encoding and JSTL/Struts locale sync has been moved to
+        // CharEncodingFilter, which is mapped for all URIs in the context.
         HttpSession session = ((HttpServletRequest)req).getSession();
-        if (null != session)
-        {
-            Locale locale = (Locale)session.getAttribute(Globals.LOCALE_KEY);
-            if (locale == null)
-            {
-                locale = req.getLocale();
-            }
-            if (req.getParameter("locale") != null)
-            {
-                locale = new Locale(req.getParameter("locale"));
-            }
-            session.setAttribute(Globals.LOCALE_KEY, locale);
-            Config.set(session, Config.FMT_LOCALE, locale);
-        }
-
         HttpServletRequest request = (HttpServletRequest)req;
         HttpServletResponse response = (HttpServletResponse)res;
         Roller roller = RollerContext.getRoller( request );

Modified: incubator/roller/branches/roller_2.0/src/org/roller/presentation/filters/package.html
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/presentation/filters/package.html?rev=230810&r1=230809&r2=230810&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/presentation/filters/package.html (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/presentation/filters/package.html Mon Aug  8 07:41:04 2005
@@ -4,6 +4,7 @@
   <title></title>
 </head>
 <body>
-Servlet filters<br>
+Servlet filters for persistence, conditional get, compression, referers.
+
 </body>
 </html>

Modified: incubator/roller/branches/roller_2.0/src/org/roller/presentation/forms/package.html
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/presentation/forms/package.html?rev=230810&r1=230809&r2=230810&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/presentation/forms/package.html (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/presentation/forms/package.html Mon Aug  8 07:41:04 2005
@@ -4,6 +4,7 @@
   <title></title>
 </head>
 <body>
-XDoclet generated form classes, one for each Roller bean.<br>
+XDoclet-generated forms for each of the POJOS
+
 </body>
 </html>

Modified: incubator/roller/branches/roller_2.0/src/org/roller/presentation/newsfeeds/package.html
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/presentation/newsfeeds/package.html?rev=230810&r1=230809&r2=230810&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/presentation/newsfeeds/package.html (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/presentation/newsfeeds/package.html Mon Aug  8 07:41:04 2005
@@ -4,6 +4,7 @@
   <title></title>
 </head>
 <body>
-Newsfeed parser and cache.<br>
+Cache used by deprecated #showNewsfeed() macros.
+
 </body>
 </html>

Modified: incubator/roller/branches/roller_2.0/src/org/roller/presentation/package.html
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/presentation/package.html?rev=230810&r1=230809&r2=230810&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/presentation/package.html (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/presentation/package.html Mon Aug  8 07:41:04 2005
@@ -4,26 +4,9 @@
   <title></title>
 </head>
 <body>
-
-<p>
-The org.roller.presentation package and the packages under it comprise the 
-<b>Presentation Layer</b> - the web-based Roller user interface.
- 
-The code in the packages depend on Web APIs including the Servlet API, JSP API, 
-Struts, Velocity and the like. 
-</p>
-
-<p>
-These packages are also the home of Roller's Web Services interfaces -
-both the XML-RPC based Blogger/MetaWeblog APIs and the REST based Atom API
-Web Service interfaces are suppported.
-
-Generally speaking, the code in these packages implements presentation logic
-and presentation logic only.
-
-Wherever possible, application logic that can be made independent of Web APIs
-is implemented inside the Business Layer
-</p>
+Top-level presentation layer classes: context, session, request, etc.
+<p />
+<img src="roller-ui.png" alt="diagram of Roller UI packages" />
 
 </body>
 </html>

Modified: incubator/roller/branches/roller_2.0/src/org/roller/presentation/pagecache/package.html
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/presentation/pagecache/package.html?rev=230810&r1=230809&r2=230810&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/presentation/pagecache/package.html (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/presentation/pagecache/package.html Mon Aug  8 07:41:04 2005
@@ -4,6 +4,17 @@
   <title></title>
 </head>
 <body>
-Roller's custom OSCache Servlet filter.<br>
+<p>
+{@link org.roller.presentation.pagecache.PageCacheFilter PageCacheFilter} 
+with pluggable caching implementation. To plugin your own cache, implement the 
+{@link org.roller.presentation.pagecache.FilterHandler FilterHandler} interface.
+Currently, we have only one implementation: 
+{@link org.roller.presentation.pagecache.LRUCacheHandler2 LRUCacheHandler2}.</p>
+
+<p>The diagram below illustrates the different levels of caching in Roller
+request handling.</p>
+
+<img src="roller-caching.png" alt="sequence diagram of Roller caching" />
+
 </body>
 </html>

Propchange: incubator/roller/branches/roller_2.0/src/org/roller/presentation/pagecache/roller-caching.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: incubator/roller/branches/roller_2.0/src/org/roller/presentation/planet/PlanetAction.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/presentation/planet/PlanetAction.java?rev=230810&r1=230809&r2=230810&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/presentation/planet/PlanetAction.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/presentation/planet/PlanetAction.java Mon Aug  8 07:41:04 2005
@@ -2,6 +2,7 @@
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.ResourceBundle;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -16,9 +17,10 @@
 import org.roller.config.RollerRuntimeConfig;
 import org.roller.model.Roller;
 import org.roller.model.RollerFactory;
+import org.roller.pojos.PlanetConfigData;
 import org.roller.pojos.PlanetGroupData;
 import org.roller.presentation.RollerContext;
-import org.roller.presentation.RollerRequest;
+
 
 /**
  * Main page action for Roller Planet.
@@ -29,7 +31,9 @@
 {
     private static Log mLogger = 
         LogFactory.getFactory().getInstance(PlanetAction.class);
-        
+    private static ResourceBundle bundle = 
+        ResourceBundle.getBundle("ApplicationResources");  
+    
 	/**
 	 * Loads model and forwards to planet.page.
          */
@@ -45,7 +49,7 @@
         req.setAttribute("data", new PlanetPageData(req));
         
         boolean allowNewUsers = 
-                    RollerRuntimeConfig.getBooleanProperty("users.registration.enabled");
+           RollerRuntimeConfig.getBooleanProperty("users.registration.enabled");
 
         java.security.Principal prince = req.getUserPrincipal();
         if (prince != null) 
@@ -68,10 +72,24 @@
     public static class PlanetPageData 
     {
         private HttpServletRequest mRequest = null;
+        private String mTitle = 
+                bundle.getString("planet.title.unconfigured");
+        private String mDescription = 
+                bundle.getString("planet.description.unconfigured");
+        
+        public String getTitle() {return mTitle;}
+        public String getDescription() {return mDescription;}
         
-        public PlanetPageData(HttpServletRequest req) 
+        public PlanetPageData(HttpServletRequest req) throws RollerException
         {
-            mRequest = req;
+           mRequest = req;
+           Roller roller = RollerFactory.getRoller(); 
+           PlanetConfigData cfg = roller.getPlanetManager().getConfiguration();
+           if (cfg != null)
+           {
+               mTitle = cfg.getTitle();
+               mDescription = cfg.getDescription();
+           }
         }
         
         /** 

Modified: incubator/roller/branches/roller_2.0/src/org/roller/presentation/planet/SyncWebsitesTask.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/presentation/planet/SyncWebsitesTask.java?rev=230810&r1=230809&r2=230810&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/presentation/planet/SyncWebsitesTask.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/presentation/planet/SyncWebsitesTask.java Mon Aug  8 07:41:04 2005
@@ -10,6 +10,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.roller.RollerException;
+import org.roller.config.RollerRuntimeConfig;
 import org.roller.model.PlanetManager;
 import org.roller.model.Roller;
 import org.roller.model.RollerFactory;
@@ -59,8 +60,7 @@
         try
         {
             List liveUserFeeds = new ArrayList();            
-            String baseURL = 
-                roller.getConfigManager().getRollerConfig().getAbsoluteURL();
+            String baseURL = RollerRuntimeConfig.getProperty("site.absoluteurl");
             if (baseURL == null || baseURL.trim().length()==0)
             {
                 logger.error("ERROR: cannot sync websites with Planet Roller - "

Propchange: incubator/roller/branches/roller_2.0/src/org/roller/presentation/roller-ui.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: incubator/roller/branches/roller_2.0/src/org/roller/presentation/tags/calendar/package.html
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/presentation/tags/calendar/package.html?rev=230810&r1=230809&r2=230810&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/presentation/tags/calendar/package.html (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/presentation/tags/calendar/package.html Mon Aug  8 07:41:04 2005
@@ -4,6 +4,7 @@
   <title></title>
 </head>
 <body>
-JSP Calendar tag.<br>
+JSP CalendarTag and CalendarModel
+
 </body>
 </html>

Modified: incubator/roller/branches/roller_2.0/src/org/roller/presentation/tags/menu/BaseRollerMenu.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/presentation/tags/menu/BaseRollerMenu.java?rev=230810&r1=230809&r2=230810&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/presentation/tags/menu/BaseRollerMenu.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/presentation/tags/menu/BaseRollerMenu.java Mon Aug  8 07:41:04 2005
@@ -158,5 +158,4 @@
         }
         return ret;
     }
-
 }

Modified: incubator/roller/branches/roller_2.0/src/org/roller/presentation/tags/menu/MenuImpl.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/presentation/tags/menu/MenuImpl.java?rev=230810&r1=230809&r2=230810&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/presentation/tags/menu/MenuImpl.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/presentation/tags/menu/MenuImpl.java Mon Aug  8 07:41:04 2005
@@ -46,8 +46,10 @@
 		return getSelectedMenuItem( req, true ) ;
 	}
 
-	/** Get currently selected menu item in this menu 
-	 * @throws RollerException*/
+	/** 
+     * Get currently selected menu item in this menu 
+	 * @throws RollerException
+     */
 	public MenuItem getSelectedMenuItem( HttpServletRequest req, 
 			boolean returnDefault ) throws RollerException
 	{
@@ -61,6 +63,7 @@
 				selected = item;
 				break;
 			}
+		    // Set first permitted and enabled menu item in each menu as default
 			if ( item.isPermitted(req) && def == null)
 			{
 				def = item;
@@ -79,9 +82,32 @@
 			return null;
 		}
 	}
+    
+	/** 
+     * Get default menu item (first one that is permitted)
+	 * @throws RollerException
+     */
+	public MenuItem getDefaultMenuItem( HttpServletRequest req ) 
+        throws RollerException
+	{
+		MenuItemImpl def = null;
+		MenuItemImpl selected = null;
+		for ( int i=0; i<mMenuItems.size(); i++ ) 
+		{
+		    // Set first permitted and enabled menu item in each menu as default
+			MenuItemImpl item = (MenuItemImpl)mMenuItems.elementAt(i);
+			if (item.isPermitted(req) && def == null)
+			{
+				def = item;
+			}
+		}
+		return def;
+	}
 
-	/** Is this menu selected? 
-	 * @throws RollerException*/ 
+	/** 
+     * Is this menu selected? 
+	 * @throws RollerException
+     */ 
 	public boolean isSelected( HttpServletRequest req ) throws RollerException
 	{
         boolean selected = false;
@@ -124,7 +150,7 @@
 		try 
 		{
 			HttpServletRequest req = (HttpServletRequest)pctx.getRequest();
-			String surl = getSelectedMenuItem( req ).getUrl( pctx ); 
+			String surl = getDefaultMenuItem( req ).getUrl( pctx ); 
 			StringBuffer sb = new StringBuffer( surl ); 
 			if ( surl.indexOf("?") == -1 )
 			{

Modified: incubator/roller/branches/roller_2.0/src/org/roller/presentation/tags/menu/MenuItem.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/presentation/tags/menu/MenuItem.java?rev=230810&r1=230809&r2=230810&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/presentation/tags/menu/MenuItem.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/presentation/tags/menu/MenuItem.java Mon Aug  8 07:41:04 2005
@@ -11,13 +11,10 @@
 	/** Url to be displayed in menu */ 
 	public String getUrl( javax.servlet.jsp.PageContext pctx );
 
-	/** Determine if this menu item is selected based on request */
+	/** Determine if this menu item is selected */
 	public boolean isSelected( HttpServletRequest req );
     
     /** Name of true/false configuration property that enables this menu */ 
     public void setEnabledProperty( String enabledProperty );
-    
-    /** Name of true/false configuration property that disables this menu */ 
-    public void setDisabledProperty( String disabledProperty );
 }
 

Modified: incubator/roller/branches/roller_2.0/src/org/roller/presentation/tags/menu/RollerMenuModel.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/presentation/tags/menu/RollerMenuModel.java?rev=230810&r1=230809&r2=230810&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/presentation/tags/menu/RollerMenuModel.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/presentation/tags/menu/RollerMenuModel.java Mon Aug  8 07:41:04 2005
@@ -75,7 +75,6 @@
 
 				if ( getMenus() != null )
 				{
-					// Set first menu item in each menu as default
 					Vector menus = getMenus();
 					for (int i=0; i<menus.size(); i++)
 					{

Modified: incubator/roller/branches/roller_2.0/src/org/roller/presentation/tags/menu/package.html
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/presentation/tags/menu/package.html?rev=230810&r1=230809&r2=230810&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/presentation/tags/menu/package.html (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/presentation/tags/menu/package.html Mon Aug  8 07:41:04 2005
@@ -4,6 +4,7 @@
   <title></title>
 </head>
 <body>
-Roller tabbed-menu and navigation bar JSP tags<br>
+Roller's tabbed menu implementation (menu's defined by XML)
+
 </body>
 </html>

Modified: incubator/roller/branches/roller_2.0/src/org/roller/presentation/tags/package.html
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/presentation/tags/package.html?rev=230810&r1=230809&r2=230810&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/presentation/tags/package.html (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/presentation/tags/package.html Mon Aug  8 07:41:04 2005
@@ -4,6 +4,7 @@
   <title></title>
 </head>
 <body>
-General purposes Roller JSP tags.<br>
+JSP tags used in Roller UI.
+
 </body>
 </html>

Modified: incubator/roller/branches/roller_2.0/src/org/roller/presentation/velocity/BasePageServlet.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/presentation/velocity/BasePageServlet.java?rev=230810&r1=230809&r2=230810&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/presentation/velocity/BasePageServlet.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/presentation/velocity/BasePageServlet.java Mon Aug  8 07:41:04 2005
@@ -16,13 +16,11 @@
 import org.apache.velocity.Template;
 import org.apache.velocity.VelocityContext;
 import org.apache.velocity.context.Context;
-import org.apache.velocity.exception.ParseErrorException;
 import org.apache.velocity.exception.ResourceNotFoundException;
 import org.apache.velocity.servlet.VelocityServlet;
-import org.roller.RollerException;
 import org.roller.model.RollerFactory;
 import org.roller.model.UserManager;
-import org.roller.pojos.PageData;
+import org.roller.pojos.UserData;
 import org.roller.pojos.WebsiteData;
 import org.roller.presentation.RollerRequest;
 
@@ -33,212 +31,167 @@
  *
  * @author llavandowska
  * @author David M Johnson
+ * @author Allen Gilliland
  */
-public abstract class BasePageServlet extends VelocityServlet
-{
+public abstract class BasePageServlet extends VelocityServlet {
+    
     private static Log mLogger =
-        LogFactory.getFactory().getInstance(BasePageServlet.class);
-	/**
-	 *  <p>Sets servletContext for WebappResourceLoader.</p>
-	 *
-	 * @param config servlet configuation
-	 */
-	public void init( ServletConfig config )
-		throws ServletException
-	{
-		super.init( config );
-		WebappResourceLoader.setServletContext( getServletContext() );
-	}
+            LogFactory.getFactory().getInstance(BasePageServlet.class);
+    
+    
+    /**
+     * Sets servletContext for WebappResourceLoader.
+     */
+    public void init( ServletConfig config )
+        throws ServletException {
+        
+        super.init( config );
+        WebappResourceLoader.setServletContext( getServletContext() );
+    }
+    
+    
     public Template handleRequest( HttpServletRequest request,
-                                   HttpServletResponse response,
-                                   Context ctx ) throws Exception
-    {
-        String pid = null;
+            HttpServletResponse response,
+            Context ctx ) throws Exception {
+        
         Template outty = null;
         Exception pageException = null;
         
-        try
-        {
+        try {
             PageContext pageContext =
-                JspFactory.getDefaultFactory().getPageContext(
+                    JspFactory.getDefaultFactory().getPageContext(
                     this, request, response,"", true, 8192, true);
             // Needed to init request attributes, etc.
             RollerRequest rreq = RollerRequest.getRollerRequest(pageContext);
             UserManager userMgr = RollerFactory.getRoller().getUserManager();
             
-            WebsiteData wd = null;
+            WebsiteData website = null;
             if (request.getAttribute(RollerRequest.OWNING_WEBSITE) != null) {
-                wd = (WebsiteData)
+                website = (WebsiteData)
                     request.getAttribute(RollerRequest.OWNING_WEBSITE);
+            } else {
+                website = rreq.getWebsite();
             }
-            else
-            {
-                wd = rreq.getWebsite();
-            }
+            
+            org.roller.pojos.Template page = null;
             
             // If request specified the page, then go with that
-            PageData pd = null;
-            if (rreq.getPage() != null // RollerRequest does too much guess work
-                    && request.getAttribute(RollerRequest.OWNING_WEBSITE) == null)
-            {
-                pd = rreq.getPage();
-                pid = pd.getId();
-            }
-            // If page not available from request, then use website's default
-            else if (wd != null)
-            {
-                pd = userMgr.retrievePage(wd.getDefaultPageId());
-                pid = pd.getId();
-                rreq.setPage(pd); 
+            if (rreq.getPage() != null &&
+                    rreq.getRequest().getAttribute(RollerRequest.OWNING_WEBSITE) == null) {
+                page = rreq.getPage();
+                
+                // If page not available from request, then use website's default
+            } else if (website != null) {
+                page = website.getDefaultPage();
+                rreq.setPage(page);
             }
+            
             // Still no page ID, then we have a problem
-            if ( pid == null )
-            {
+            if ( page == null ) {
                 throw new ResourceNotFoundException("Page not found");
             }
+
+            // this sets up the page we want to render
+            outty = prepareForPageExecution(ctx, rreq, response, page);
             
-            outty = prepareForPageExecution(ctx, rreq, response, pd);
-        }
-        catch( Exception e )
-        {
-	        pageException = e;
+            // if there is a decorator template then apply it
+            if (website != null) {
+                // parse/merge Page template
+                StringWriter sw = new StringWriter();
+                outty.merge(ctx, sw);
+                ctx.put("decorator_body", sw.toString());
+                
+                // replace outty with decorator Template
+                outty = findDecorator(website, (String) ctx.get("decorator"));
+            }
+            
+        } catch( Exception e ) {
+            pageException = e;
             response.setStatus( HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
         }
-        if (pageException != null)
-        {
+        
+        if (pageException != null) {
             mLogger.error("EXCEPTION: in RollerServlet", pageException);
             request.setAttribute("DisplayException", pageException);
         }
+        
         return outty;
     }
-
-    //------------------------------------------------------------------------
+    
+    
+    /**
+     * Prepare the requested page for execution by setting content type
+     * and populating velocity context.
+     */
+    protected Template prepareForPageExecution(Context ctx,
+            RollerRequest rreq,
+            HttpServletResponse response,
+            org.roller.pojos.Template page) throws Exception {
+        
+        Template outty = null;
+        
+        // if page has an extension - use that to set the contentType
+        String pageLink = page.getLink();
+        String mimeType = getServletConfig().getServletContext().getMimeType(pageLink);
+        if(mimeType != null) {
+            // we found a match ... set the content type
+            response.setContentType(mimeType);
+        }
+        
+        // Made it this far, populate the Context
+        ContextLoader.setupContext( ctx, rreq, response );
+        
+        return getTemplate( page.getId(), "UTF-8" );
+    }
+    
+    
     /**
-     * Try to load user-specified Decorator (if specified).  Failing that
-     * see if user has a _decorator Page, if not check for a _decorator
-     * in the Preview resource loader.  Finally, if none of those can
-     * be found fall back to the no-op decorator.
-     * @param object
-     * @return
+     * Load the decorator template and apply it.  If there is no user specified
+     * decorator then the default decorator is applied.
      */
-    private Template findDecorator(String decoratorName, UserManager userMgr, WebsiteData wd) 
-        throws ResourceNotFoundException, ParseErrorException, RollerException, Exception
-    {
+    protected Template findDecorator(WebsiteData website, String decorator_name)
+        throws Exception {
+        
         Template decorator = null;
-        PageData decoratorPage = null;
-        String decoratorId = null;
+        org.roller.pojos.Template decorator_template = null;
         
         // check for user-specified decorator
-        if (decoratorName != null)
-        {    
-            decoratorPage = userMgr.getPageByName(wd, decoratorName);
-            if (decoratorPage != null) 
-            {
-                decoratorId = decoratorPage.getId();
-            }
+        if (decorator_name != null) {
+            decorator_template = website.getPageByName(decorator_name);
         }
         
         // if no user-specified decorator try default page-name
-        if (decoratorPage == null)
-        {
-            decoratorPage = userMgr.getPageByName(wd, "_decorator");
-            if (decoratorPage != null) 
-            {
-                decoratorId = decoratorPage.getId();
-            }
-            else
-            {
-                // could be in PreviewResourceLoader
-                decoratorId = "_decorator";
-            }
+        if (decorator_template == null) {
+            decorator_template = website.getPageByName("_decorator");
         }
-
+        
         // try loading Template
-        if (decoratorId != null) 
-        {
-            try
-            {
-                decorator = getTemplate(decoratorId, "UTF-8");
-            }
-            catch (Exception e)
-            {
+        if (decorator_template != null) {
+            try {
+                decorator = getTemplate(decorator_template.getId(), "UTF-8");
+            } catch (Exception e) {
                 // it may not exist, so this is okay
             }
         }
         
         // couldn't find Template, load default "no-op" decorator
-        if (decorator == null) 
-        {
+        if (decorator == null) {
             decorator = getTemplate("/themes/noop_decorator.vm", "UTF-8");
         }
+        
         return decorator;
     }
-
-    /** 
-     * Prepare for page execution be setting content type, populating context,
-     * and processing the page decorator if needed.
-     */
-    protected Template prepareForPageExecution(Context ctx, RollerRequest rreq, 
-        HttpServletResponse response, PageData pd) throws Exception
-    {                    
-        Template outty = null;
-        UserManager userMgr = RollerFactory.getRoller().getUserManager();
-        WebsiteData wd = pd.getWebsite();
-        
-        // if page has an extension - use that to set the contentType
-        String pageLink = pd.getLink();
-        String mimeType = getServletConfig().getServletContext().getMimeType(pageLink);
-        if(mimeType != null) {
-            // we found a match ... set the content type
-            response.setContentType(mimeType);
-        }
-        
-        /* old way ... not as flexible -- Allen G
-        int period = pd.getLink().indexOf('.');
-        if (period > -1) 
-        {
-            String extension = pd.getLink().substring(period+1);
-            if ("js".equals(extension)) 
-            {
-                extension = "javascript";
-            }
-            response.setContentType("text/" + extension);
-        }
-        */
     
-        // Made it this far, populate the Context
-        ContextLoader.setupContext( ctx, rreq, response );
-
-        // Get the page
-        outty =  getTemplate( pd.getId(), "UTF-8" );
-
-        /**
-         * User can define a Decorator Template.
-         */
-        if (wd != null)
-        {
-            // parse/merge Page template
-            StringWriter sw = new StringWriter();
-            outty.merge(ctx, sw);
-            ctx.put("decorator_body", sw.toString());
-
-            // replace outty with decorator Template
-            outty = findDecorator((String)ctx.get("decorator"), userMgr, wd);                
-        }
-        return outty;
-    }
     
-    //------------------------------------------------------------------------
     /**
      * Handle error in Velocity processing.
      */
     protected void error( HttpServletRequest req, HttpServletResponse res,
-        Exception e) throws ServletException, IOException
-    {
+            Exception e) throws ServletException, IOException {
         mLogger.warn("ERROR in VelocityServlet",e);
     }
-   
-    /** 
+    
+    /**
      * Override to prevent Velocity from putting "req" and "res" into the context.
      * Allowing users access to the underlying Servlet objects is a security risk.
      * If need access to request parameters, use $requestParameters.
@@ -254,19 +207,15 @@
     }
     
     /** Provide access to request params only, not actual request */
-    public static class RequestWrapper
-    {
+    public static class RequestWrapper {
         Map params = null;
-        public RequestWrapper(Map params) 
-        {
+        public RequestWrapper(Map params) {
             this.params = params;
         }
-        public String getParameter(String key)
-        {
+        public String getParameter(String key) {
             String ret = null;
             String[] array = (String[])params.get(key);
-            if (array != null && array.length > 0)
-            {
+            if (array != null && array.length > 0) {
                 ret = array[0];
             }
             return ret;

Modified: incubator/roller/branches/roller_2.0/src/org/roller/presentation/velocity/CommentServlet.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/presentation/velocity/CommentServlet.java?rev=230810&r1=230809&r2=230810&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/presentation/velocity/CommentServlet.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/presentation/velocity/CommentServlet.java Mon Aug  8 07:41:04 2005
@@ -33,7 +33,7 @@
 import org.roller.model.UserManager;
 import org.roller.model.WeblogManager;
 import org.roller.pojos.CommentData;
-import org.roller.pojos.PageData;
+import org.roller.pojos.WeblogTemplate;
 import org.roller.pojos.WeblogEntryData;
 import org.roller.pojos.WebsiteData;
 import org.roller.presentation.LanguageUtil;
@@ -110,12 +110,12 @@
             WebsiteData website = rreq.getWebsite();
                 
             // Request specifies popup
-            PageData page = null;
+            org.roller.pojos.Template page = null;
             Exception pageException = null;
             try 
             {
                 // Does user have a popupcomments page?
-                page = userMgr.getPageByName(website, "_popupcomments");
+                page = website.getPageByName("_popupcomments");
             }
             catch(Exception e )
             {
@@ -130,7 +130,7 @@
             // User doesn't have one so return the default
             if (page == null) 
             {
-                page = new PageData("/popupcomments.vm", website, "Comments", 
+                page = new WeblogTemplate("/popupcomments.vm", website, "Comments", 
                     "Comments", "dummy_link", "dummy_template", new Date());
             }
             rreq.setPage(page);
@@ -360,6 +360,8 @@
                 "users.comments.emailnotify");
         if (notify && site.getEmailComments().booleanValue())
         {
+            mLogger.debug("Comment notification enabled ... preparing email");
+            
             // Determine message and addressing options from init parameters
             boolean separateMessages = 
                     RollerConfig.getBooleanProperty(
@@ -454,10 +456,10 @@
             commentURL.append("/comments/");
             commentURL.append(site.getHandle());
             
-            PageData page = rreq.getPage();
+            org.roller.pojos.Template page = rreq.getPage();
             if (page == null)
             {
-                commentURL.append("?anchor=");
+                commentURL.append("?entry=");
             }
             else
             {
@@ -560,6 +562,8 @@
                 }
             }
 
+            mLogger.debug("Done sending email message");
+            
         } // if email enabled
     }