roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r349595 [1/2] - in /incubator/roller/trunk: contrib/plugins/src/org/roller/presentation/velocity/plugins/acronyms/ contrib/plugins/src/org/roller/presentation/velocity/plugins/bookmarks/ contrib/plugins/src/org/roller/presentation/velocity/...
Date Tue, 29 Nov 2005 02:45:09 GMT
Author: snoopdave
Date: Mon Nov 28 18:44:45 2005
New Revision: 349595

URL: http://svn.apache.org/viewcvs?rev=349595&view=rev
Log:
Local feed fetching in plant aggregator

Added:
    incubator/roller/trunk/src/org/roller/business/PagePluginManagerImpl.java
    incubator/roller/trunk/src/org/roller/model/PagePlugin.java
    incubator/roller/trunk/src/org/roller/model/PagePluginManager.java
    incubator/roller/trunk/src/org/roller/util/SpamChecker.java
    incubator/roller/trunk/tests/org/roller/business/PlanetManagerLocalTest.java
Removed:
    incubator/roller/trunk/src/org/roller/presentation/velocity/PagePlugin.java
    incubator/roller/trunk/src/org/roller/util/CommentSpamChecker.java
Modified:
    incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/acronyms/AcronymsPlugin.java
    incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/bookmarks/BookmarkPlugin.java
    incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/convertbreaks/ConvertLineBreaksPlugin.java
    incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/email/ObfuscateEmailPlugin.java
    incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/jspwiki/WikiPlugin.java
    incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/radeox/WikiPlugin.java
    incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/readmore/ReadMorePlugin.java
    incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/smileys/SmileysPlugin.java
    incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/textile/TextilePlugin.java
    incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/topictag/TopicTagPlugin.java
    incubator/roller/trunk/src/org/roller/business/PlanetManagerImpl.java
    incubator/roller/trunk/src/org/roller/business/RollerImpl.java
    incubator/roller/trunk/src/org/roller/business/UserManagerImpl.java
    incubator/roller/trunk/src/org/roller/business/hibernate/HibernatePlanetManagerImpl.java
    incubator/roller/trunk/src/org/roller/config/RollerConfig.java
    incubator/roller/trunk/src/org/roller/model/Roller.java
    incubator/roller/trunk/src/org/roller/pojos/PlanetEntryData.java
    incubator/roller/trunk/src/org/roller/pojos/RefererData.java
    incubator/roller/trunk/src/org/roller/pojos/WebsiteData.java
    incubator/roller/trunk/src/org/roller/presentation/RollerContext.java
    incubator/roller/trunk/src/org/roller/presentation/planet/SyncWebsitesTask.java
    incubator/roller/trunk/src/org/roller/presentation/velocity/ContextLoader.java
    incubator/roller/trunk/src/org/roller/presentation/velocity/ExportRss.java
    incubator/roller/trunk/src/org/roller/presentation/velocity/PageHelper.java
    incubator/roller/trunk/src/org/roller/presentation/velocity/PlanetFeedServlet.java
    incubator/roller/trunk/src/org/roller/presentation/weblog/actions/WeblogEntryFormAction.java
    incubator/roller/trunk/src/org/roller/presentation/weblog/actions/WeblogEntryPageModel.java
    incubator/roller/trunk/src/org/roller/presentation/weblog/tags/ApplyPluginsTag.java
    incubator/roller/trunk/src/org/roller/util/Blacklist.java
    incubator/roller/trunk/tests/org/roller/RollerTestBase.java
    incubator/roller/trunk/tests/org/roller/business/TestAll.java
    incubator/roller/trunk/tests/org/roller/presentation/velocity/plugins/textile/TextileTest.java

Modified: incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/acronyms/AcronymsPlugin.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/acronyms/AcronymsPlugin.java?rev=349595&r1=349594&r2=349595&view=diff
==============================================================================
--- incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/acronyms/AcronymsPlugin.java (original)
+++ incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/acronyms/AcronymsPlugin.java Mon Nov 28 18:44:45 2005
@@ -15,8 +15,7 @@
 import org.roller.pojos.WeblogTemplate;
 import org.roller.pojos.WeblogEntryData;
 import org.roller.pojos.WebsiteData;
-import org.roller.presentation.RollerRequest;
-import org.roller.presentation.velocity.PagePlugin;
+import org.roller.model.PagePlugin;
 
 import java.util.Iterator;
 import java.util.Properties;
@@ -61,10 +60,14 @@
 	/**
 	 * @see org.roller.presentation.velocity.PagePlugin#init(org.roller.presentation.RollerRequest, org.apache.velocity.context.Context)
 	 */
-	public void init(RollerRequest rreq, Context ctx) throws RollerException
+	public void init(
+            WebsiteData website,
+            Object config,
+            String baseURL,
+            Context ctx) throws RollerException
 	{
 		if (mLogger.isDebugEnabled()) {
-			mLogger.debug("init( rreq = "+rreq+", ctx = "+ctx+" )");
+			mLogger.debug("init(ctx = "+ctx+" )");
 		}
 	}
     

Modified: incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/bookmarks/BookmarkPlugin.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/bookmarks/BookmarkPlugin.java?rev=349595&r1=349594&r2=349595&view=diff
==============================================================================
--- incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/bookmarks/BookmarkPlugin.java (original)
+++ incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/bookmarks/BookmarkPlugin.java Mon Nov 28 18:44:45 2005
@@ -14,13 +14,13 @@
 import org.roller.pojos.BookmarkData;
 import org.roller.pojos.FolderData;
 import org.roller.pojos.WeblogEntryData;
-import org.roller.presentation.RollerRequest;
-import org.roller.presentation.velocity.PagePlugin;
+import org.roller.model.PagePlugin;
 import java.util.regex.PatternSyntaxException;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.Collection;
 import java.util.Iterator;
+import org.roller.pojos.WebsiteData;
 
 /**
  * @author lance
@@ -46,7 +46,11 @@
     /* (non-Javadoc)
      * @see org.roller.presentation.velocity.PagePlugin#init(org.roller.presentation.RollerRequest, org.apache.velocity.context.Context)
      */
-    public void init(RollerRequest rreq, Context ctx) throws RollerException
+    public void init(
+            WebsiteData website,
+            Object config,
+            String baseURL,
+            Context ctx) throws RollerException
     {
     }
 

Modified: incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/convertbreaks/ConvertLineBreaksPlugin.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/convertbreaks/ConvertLineBreaksPlugin.java?rev=349595&r1=349594&r2=349595&view=diff
==============================================================================
--- incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/convertbreaks/ConvertLineBreaksPlugin.java (original)
+++ incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/convertbreaks/ConvertLineBreaksPlugin.java Mon Nov 28 18:44:45 2005
@@ -1,8 +1,4 @@
-/*
- * ConvertLineBreaksPlugin.java
- *
- * Created on July 10, 2005, 3:17 PM
- */
+/* Created on July 10, 2005, 3:17 PM */
 
 package org.roller.presentation.velocity.plugins.convertbreaks;
 
@@ -13,8 +9,8 @@
 import org.apache.velocity.context.Context;
 import org.roller.RollerException;
 import org.roller.pojos.WeblogEntryData;
-import org.roller.presentation.RollerRequest;
-import org.roller.presentation.velocity.PagePlugin;
+import org.roller.pojos.WebsiteData;
+import org.roller.model.PagePlugin;
 
 /**
  * Simple page plugin that converts paragraphs of plain text into html paragraphs.
@@ -54,7 +50,11 @@
         return description;
     }
     
-    public void init(RollerRequest rreq, Context ctx) throws RollerException {
+    public void init(
+            WebsiteData website,
+            Object config,
+            String baseURL,
+            Context ctx) throws RollerException {
         // we don't need to do any init.
         mLogger.debug("initing");
     }

Modified: incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/email/ObfuscateEmailPlugin.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/email/ObfuscateEmailPlugin.java?rev=349595&r1=349594&r2=349595&view=diff
==============================================================================
--- incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/email/ObfuscateEmailPlugin.java (original)
+++ incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/email/ObfuscateEmailPlugin.java Mon Nov 28 18:44:45 2005
@@ -9,8 +9,8 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.velocity.context.Context;
 import org.roller.pojos.WeblogEntryData;
-import org.roller.presentation.RollerRequest;
-import org.roller.presentation.velocity.PagePlugin;
+import org.roller.model.PagePlugin;
+import org.roller.pojos.WebsiteData;
 import org.roller.util.RegexUtil;
 
 /**
@@ -36,7 +36,11 @@
 	/* (non-Javadoc)
 	 * @see org.roller.presentation.velocity.PagePlugin#init(org.roller.presentation.RollerRequest, org.apache.velocity.context.Context)
 	 */
-	public void init(RollerRequest rreq, Context ctx)
+	public void init(
+            WebsiteData website,
+            Object config,
+            String baseURL,
+            Context ctx)
 	{
 	}
 

Modified: incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/jspwiki/WikiPlugin.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/jspwiki/WikiPlugin.java?rev=349595&r1=349594&r2=349595&view=diff
==============================================================================
--- incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/jspwiki/WikiPlugin.java (original)
+++ incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/jspwiki/WikiPlugin.java Mon Nov 28 18:44:45 2005
@@ -1,3 +1 @@
-package org.roller.presentation.velocity.plugins.jspwiki;
-import com.ecyrd.jspwiki.FileUtil;
import com.ecyrd.jspwiki.TranslatorReader;
import com.ecyrd.jspwiki.WikiContext;
import com.ecyrd.jspwiki.WikiEngine;
import com.ecyrd.jspwiki.WikiPage;

import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.velocity.context.Context;
import org.roller.pojos.WeblogEntryData;
import org.roller.presentation.RollerRequest;
import org.roller.presentation.velocity.PagePlugin;

import java.io.StringReader;
import java.util.StringTokenizer;

/**
 * Wiki plugin using the JSPWiki WikiEngine. If you want Wiki links to point 
 * to your JSPWiki, then edit the jspwiki.properties fiel in Roller's WEB-INF
 * directory and set the jspwiki.baseURL appropriately. For example, if your
 * Wiki is on your localhost in the Servlet Context named 'wiki' then you'd
 * set jspwiki.baseURL like so:<br />
 * <br />
 *  jspwiki.baseURL=http://local:8080/wiki/<br />
 * 
 * @author David M Johnson
 */
public class WikiPlugin implements PagePlugin
{
    protected String name = "JSPWiki Syntax";
    public String description = "Allows use of JSPWiki formatting to easily " +
    "generate HTML. See the " +
    "<a href='http://www.jspwiki.org/Wiki.jsp?page=TextFormattingRules' target='jspwiki'>JSPWiki</a> site.";
    
    private static Log mLogger = 
       LogFactory.getFactory().getInstance(WikiPlugin.class);

    static WikiEngine mWikiEngine = null;
    static WikiContext mWikiContext = null;
    static WikiPage mWikiPage = new WikiPage("dummyPage");
    
    public WikiPlugin()
    {
        mLogger.debug("JSPWiki WikiPlugin instantiated.");
    }
    
    public String toString() { return name; }
    
    /** 
     * Initialize the JSPWiki Engine if not done so already.
     * Put the Plugin into the VelocityContex (is this still necessary?-Lance).
     */
    public void init(RollerRequest rreq, Context ctx)
    {
        try
        {
            if (WikiPlugin.mWikiEngine == null)
            {
                if (rreq != null && rreq.getPageContext() != null)
                {
                    WikiPlugin.mWikiEngine = WikiEngine.getInstance(
                        rreq.getPageContext().getServletConfig());
                }
            }
            if (WikiPlugin.mWikiContext == null && WikiPlugin.mWikiEngine != null)
            {
                WikiPlugin.mWikiContext = new WikiContext( 
                    WikiPlugin.mWikiEngine, WikiPlugin.mWikiPage );
            }

            if (WikiPlugin.mWikiContext != null && WikiPlugin.mWikiEngine != null)
            {
                ctx.put("wikiPlugin",this);
            }
        }
        catch (Exception e)
        {
            mLogger.error("ERROR initializing WikiPlugin",e);
        }
    }
    
    /** 
     * Convert an input string that contains text that uses JSPWiki
     * syntax to an output string in HTML format.
     * @param src Input string that uses JSPWiki syntax
     * @return Output string in HTML format.
     */
    public String render( String src )
    {
        String ret = null;        
        try
        {
            StringReader reader = new StringReader(src);            
            TranslatorReader tr = new TranslatorReader( mWikiContext, reader );
            ret = FileUtil.readContents( tr );        
        }
        catch (Exception e)
        {
            mLogger.error("ERROR rendering Wiki text",e);
        }
        return ret;
    }
    
    public String render( WeblogEntryData entry, boolean skipFlag)
    {
        return render(entry.getText());
    }
-    /** Return URL to the Wiki page for a weblog entry, CamelCase style */
    public String makeCamelCaseWikiLink( WeblogEntryData wd, String prefix )
    {
        StringBuffer sb = new StringBuffer();
        StringTokenizer toker = new StringTokenizer(wd.getAnchor(),"_");
        while ( toker.hasMoreTokens() )
        {
            String token = toker.nextToken();
            sb.append( token.substring(0,1).toUpperCase() );
            sb.append( token.substring(1) );
        }
        return mWikiEngine.getBaseURL()+"Wiki.jsp?page="+prefix+sb.toString();
    }
    
    /** Return URL to the Wiki page for a weblog entry, spacey style */
    public String makeSpacedWikiLink( WeblogEntryData wd, String prefix )
    {
        StringBuffer sb = new StringBuffer();
        StringTokenizer toker = new StringTokenizer(wd.getAnchor(),"_");
        while ( toker.hasMoreTokens() )
        {
            sb.append( toker.nextToken() );
            if ( toker.hasMoreTokens() ) sb.append("%20");
        }
        return mWikiEngine.getBaseURL()+"Wiki.jsp?page="+prefix+sb.toString();
    }

    public String getName() { return name; }
    public String getDescription() { return StringEscapeUtils.escapeJavaScript(description); }
}
\ No newline at end of file
+package org.roller.presentation.velocity.plugins.jspwiki;

import com.ecyrd.jspwiki.FileUtil;
import com.ecyrd.jspwiki.TranslatorReader;
import com.ecyrd.jspwiki.WikiContext;
import com.ecyrd.jspwiki.WikiEngine;
import com.ecyrd.jspwiki.WikiPage;

import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.velocity.context.Context;
import org.roller.pojos.WeblogEntryData;
import org.roller.model.PagePlugin;

import java.io.StringReader;
import java.util.Properties;
import java.util.StringTokenizer;
import javax.servlet.ServletContext;

import org.roller.pojos.WebsiteData;

/**
 * Wiki plugin using the JSPWiki WikiEngine. If you want Wiki links to point
 * to your JSPWiki, then edit the jspwiki.properties fiel in Roller's WEB-INF
 * directory and set the jspwiki.baseURL appropriately. For example, if your
 * Wiki is on your localhost in the Servlet Context named 'wiki' then you'd
 * set jspwiki.baseURL like so:<br />
 * <br />
 *  jspwiki.baseURL=http://local:8080/wiki/<br />
 *
 * @author David M Johnson
 */
public class WikiPlugin implements PagePlugin {
    protected String name = "JSPWiki Syntax";
    public String description = "Allows use of JSPWiki formatting to easily " +
            "generate HTML. See the " +
            "<a href='http://www.jspwiki.org/Wiki.jsp?page=TextFormattingRules' target='jspwiki'>JSPWiki</a> site.";
    
    private static Log mLogger =
            LogFactory.getFactory().getInstance(WikiPlugin.class);
    
    static WikiEngine mWikiEngine = null;
    static WikiContext mWikiContext = null;
    static WikiPage mWikiPage = new WikiPage("dummyPage");
    
    public WikiPlugin() {
        mLogger.debug("JSPWiki WikiPlugin instantiated.");
    }
    
    public String toString() { return name; }
    
    /**
     * Initialize the JSPWiki Engine if not done so already.
     * Put the Plugin into the VelocityContex (is this still necessary?-Lance).
     */
    public void init(
            WebsiteData website,
            Object context,
            String contextURL,
            Context ctx) {
        try {
            if (WikiPlugin.mWikiEngine == null) {
                if (context != null) {
                    // get wiki engine when running inside webapp
                    ServletContext servletContext = (ServletContext)context; 
                    WikiPlugin.mWikiEngine = WikiEngine.getInstance(servletContext, null);
                } else {
                    // get wiki engine when running from command-line
                    Properties wikiprops = new Properties();
                    wikiprops.load(getClass().getResourceAsStream("/jspwiki.properties"));
                    WikiPlugin.mWikiEngine = new WikiEngine(wikiprops);
                }
            }
            if (WikiPlugin.mWikiContext == null && WikiPlugin.mWikiEngine != null) {
                WikiPlugin.mWikiContext = new WikiContext(
                        WikiPlugin.mWikiEngine, WikiPlugin.mWikiPage );
            }
            if (WikiPlugin.mWikiContext != null && WikiPlugin.mWikiEngine != null) {
                ctx.put("wikiPlugin",this);
            }
        } catch (Exception e) {
            mLogger.error("ERROR initializing WikiPlugin",e);
        }
    }
    
    /**
     * Convert an input string that contains text that uses JSPWiki
     * syntax to an output string in HTML format.
     * @param src Input string that uses JSPWiki syntax
     * @return Output string in HTML format.
     */
    public String render( String src ) {
        String ret = null;
        try {
            StringReader reader = new StringReader(src);
            TranslatorReader tr = new TranslatorReader( mWikiContext, reader );
            ret = FileUtil.readContents( tr );
        } catch (Exception e) {
            mLogger.error("ERROR rendering Wiki text",e);
        }
        return ret;
    }
    
    public String render( WeblogEntryData entry, boolean skipFlag) {
        return render(entry.getText());
    }
    /** Return URL to the Wiki page for a weblog entry, CamelCase style */
    public String makeCamelCaseWikiLink( WeblogEntryData wd, String prefix ) {
        StringBuffer sb = new StringBuffer();
        StringTokenizer toker = new StringTokenizer(wd.getAnchor(),"_");
        while ( toker.hasMoreTokens() ) {
            String token = toker.nextToken();
            sb.append( token.substring(0,1).toUpperCase() );
            sb.append( token.substring(1) );
        }
        return mWikiEngine.getBaseURL()+"Wiki.jsp?page="+prefix+sb.toString();
    }
    
    /** Return URL to the Wiki page for a weblog entry, spacey style */
    public String makeSpacedWikiLink( WeblogEntryData wd, String prefix ) {
        StringBuffer sb = new StringBuffer();
        StringTokenizer toker = new StringTokenizer(wd.getAnchor(),"_");
        while ( toker.hasMoreTokens() ) {
            sb.append( toker.nextToken() );
            if ( toker.hasMoreTokens() ) sb.append("%20");
        }
        return mWikiEngine.getBaseURL()+"Wiki.jsp?page="+prefix+sb.toString();
    }
    
    public String getName() { return name; }
    public String getDescription() { return StringEscapeUtils.escapeJavaScript(description); }
}
\ No newline at end of file

Modified: incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/radeox/WikiPlugin.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/radeox/WikiPlugin.java?rev=349595&r1=349594&r2=349595&view=diff
==============================================================================
--- incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/radeox/WikiPlugin.java (original)
+++ incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/radeox/WikiPlugin.java Mon Nov 28 18:44:45 2005
@@ -9,8 +9,8 @@
 import org.radeox.engine.context.BaseRenderContext;
 import org.radeox.engine.context.RenderContext;
 import org.roller.pojos.WeblogEntryData;
-import org.roller.presentation.RollerRequest;
-import org.roller.presentation.velocity.PagePlugin;
+import org.roller.model.PagePlugin;
+import org.roller.pojos.WebsiteData;
 
 /**
  * @author David M Johnson
@@ -34,7 +34,11 @@
     /** 
      * Put plugin into the page context so templates may access it.
      */
-    public void init(RollerRequest rreq, Context ctx)
+    public void init(
+            WebsiteData website,
+            Object config,
+            String baseURL,
+            Context ctx)
     {
         ctx.put("wikiRenderer",this);
     }

Modified: incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/readmore/ReadMorePlugin.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/readmore/ReadMorePlugin.java?rev=349595&r1=349594&r2=349595&view=diff
==============================================================================
--- incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/readmore/ReadMorePlugin.java (original)
+++ incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/readmore/ReadMorePlugin.java Mon Nov 28 18:44:45 2005
@@ -4,6 +4,7 @@
  */
 package org.roller.presentation.velocity.plugins.readmore;
 
+import javax.servlet.ServletConfig;
 import org.apache.commons.lang.StringEscapeUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -13,8 +14,7 @@
 import org.roller.model.UserManager;
 import org.roller.pojos.WeblogEntryData;
 import org.roller.pojos.WebsiteData;
-import org.roller.presentation.RollerRequest;
-import org.roller.presentation.velocity.PagePlugin;
+import org.roller.model.PagePlugin;
 import org.roller.util.Utilities;
 
 /**
@@ -29,7 +29,7 @@
     private static Log mLogger = 
        LogFactory.getFactory().getInstance(ReadMorePlugin.class);
        
-    String ctxPath = "";
+    String baseURL = "";
     
     public ReadMorePlugin()
     {
@@ -39,13 +39,17 @@
     public String toString() { return name; }
 
 	/* (non-Javadoc)
-	 * @see org.roller.presentation.velocity.PagePlugin#init(org.roller.presentation.RollerRequest, org.apache.velocity.context.Context)
+	 * @see org.roller.presentation.velocity.PagePlugin#init(
+     *   org.roller.presentation.RollerRequest, 
+     *   org.apache.velocity.context.Context)
 	 */
-	public void init(RollerRequest rreq, Context ctx) throws RollerException
-	{
-        if (rreq == null) throw new RollerException("RollerRequest is null.");
-  
-        ctxPath = rreq.getRequest().getContextPath();        
+	public void init(
+            WebsiteData website,
+            Object config,
+            String baseURL,
+            Context ctx) throws RollerException
+	{  
+        this.baseURL = baseURL;        
 	}
 
 	/**
@@ -95,7 +99,7 @@
         if (result.length() < entry.getText().length())
         {            
             String link = "<div class=\"readMore\"><a href=\"" + 
-                ctxPath + "/comments/" + 
+                baseURL + "comments/" + 
                 entry.getWebsite().getHandle() + 
                 "/" + pageLink + "/" + Utilities.encode(entry.getAnchor()) +
                 "\">Read More</a></div>";

Modified: incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/smileys/SmileysPlugin.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/smileys/SmileysPlugin.java?rev=349595&r1=349594&r2=349595&view=diff
==============================================================================
--- incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/smileys/SmileysPlugin.java (original)
+++ incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/smileys/SmileysPlugin.java Mon Nov 28 18:44:45 2005
@@ -6,13 +6,13 @@
 import org.apache.velocity.context.Context;
 import org.roller.RollerException;
 import org.roller.pojos.WeblogEntryData;
-import org.roller.presentation.RollerRequest;
-import org.roller.presentation.velocity.PagePlugin;
+import org.roller.model.PagePlugin;
 
 import java.util.Enumeration;
 import java.util.Properties;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
+import org.roller.pojos.WebsiteData;
 
 /**
  * Converts ascii emoticons into HTML image tags.
@@ -79,16 +79,15 @@
      * 
      * @see org.roller.presentation.velocity.PagePlugin#init(org.roller.presentation.RollerRequest, org.apache.velocity.context.Context)
      */
-    public synchronized void init(RollerRequest rreq, Context ctx) throws RollerException
+    public synchronized void init(
+            WebsiteData website,
+            Object servletContext,
+            String baseURL,
+            Context ctx) throws RollerException
     {
         // don't do this work if Smileys already loaded
         if (SmileysPlugin.smileyPatterns.length < 1)
         {
-            String contextPath = "";
-            if (rreq != null && rreq.getRequest() != null) 
-            {
-                contextPath = rreq.getRequest().getContextPath();
-            }
             Pattern[] tempP = new Pattern[SmileysPlugin.smileyDefs.size()];
             String[] tempS = new String[SmileysPlugin.smileyDefs.size()];
             //System.out.println("# smileys: " + smileyDefs.size());
@@ -100,7 +99,7 @@
                 String smileyAlt = htmlEscape(smiley);
                 tempP[count] = Pattern.compile(regexEscape(smiley));
                 tempS[count] = "<img src=\"" + 
-                               contextPath + "/images/smileys/" + 
+                               baseURL + "images/smileys/" + 
                                smileyDefs.getProperty(smiley, "smile.gif") +
                                "\" class=\"smiley\"" + 
                                " alt=\"" + smileyAlt + "\"" +

Modified: incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/textile/TextilePlugin.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/textile/TextilePlugin.java?rev=349595&r1=349594&r2=349595&view=diff
==============================================================================
--- incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/textile/TextilePlugin.java (original)
+++ incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/textile/TextilePlugin.java Mon Nov 28 18:44:45 2005
@@ -1,13 +1,14 @@
 
 package org.roller.presentation.velocity.plugins.textile;
 
+import javax.servlet.ServletConfig;
 import org.apache.commons.lang.StringEscapeUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.velocity.context.Context;
 import org.roller.pojos.WeblogEntryData;
-import org.roller.presentation.RollerRequest;
-import org.roller.presentation.velocity.PagePlugin;
+import org.roller.pojos.WebsiteData;
+import org.roller.model.PagePlugin;
 
 /**
  * @author David M Johnson
@@ -33,7 +34,11 @@
     /** 
      * Put plugin into the page context so templates may access it.
      */
-    public void init(RollerRequest rreq, Context ctx)
+    public void init(
+            WebsiteData website,
+            Object config,
+            String baseURL,
+            Context ctx)
     {
         ctx.put("textileRenderer",this);
     }

Modified: incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/topictag/TopicTagPlugin.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/topictag/TopicTagPlugin.java?rev=349595&r1=349594&r2=349595&view=diff
==============================================================================
--- incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/topictag/TopicTagPlugin.java (original)
+++ incubator/roller/trunk/contrib/plugins/src/org/roller/presentation/velocity/plugins/topictag/TopicTagPlugin.java Mon Nov 28 18:44:45 2005
@@ -17,8 +17,7 @@
 import org.roller.pojos.BookmarkData;
 import org.roller.pojos.WeblogEntryData;
 import org.roller.pojos.WebsiteData;
-import org.roller.presentation.RollerRequest;
-import org.roller.presentation.velocity.PagePlugin;
+import org.roller.model.PagePlugin;
 
 import java.io.UnsupportedEncodingException;
 import java.net.URLEncoder;
@@ -31,6 +30,7 @@
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.regex.PatternSyntaxException;
+import javax.servlet.ServletConfig;
 
 /**
  * Provides an easy way to write topic tag links for Technorati (or similar services).
@@ -121,19 +121,22 @@
      * @param ctx  Plugins may place objects into the Velocity Context.
      * @see PagePlugin#init(org.roller.presentation.RollerRequest, org.apache.velocity.context.Context)
      */
-    public void init(RollerRequest rreq, Context ctx) throws RollerException
+    public void init(
+            WebsiteData website,
+            Object config,
+            String baseURL,
+            Context ctx) throws RollerException
     {
         if (mLogger.isDebugEnabled())
         {
             mLogger.debug("TopicTagPlugin v. " + version);
         }
 
-
         // Initialize property settings
         initializeProperties();
 
         // Build map of the user's bookmarks
-        userBookmarks = buildBookmarkMap(rreq.getWebsite());
+        userBookmarks = buildBookmarkMap(website);
 
         // Determine default topic site from bookmark if present
         BookmarkData defaultTopicBookmark = (BookmarkData) userBookmarks.get(defaultTopicBookmarkName);

Added: incubator/roller/trunk/src/org/roller/business/PagePluginManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/business/PagePluginManagerImpl.java?rev=349595&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/roller/business/PagePluginManagerImpl.java (added)
+++ incubator/roller/trunk/src/org/roller/business/PagePluginManagerImpl.java Mon Nov 28 18:44:45 2005
@@ -0,0 +1,135 @@
+/* Created on November 26, 2005, 9:04 AM */
+package org.roller.business;
+
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.velocity.VelocityContext;
+import org.apache.velocity.context.Context;
+import org.roller.config.RollerConfig;
+import org.roller.model.PagePlugin;
+import org.roller.model.PagePluginManager;
+import org.roller.pojos.WeblogEntryData;
+import org.roller.pojos.WebsiteData;
+import org.roller.util.StringUtils;
+
+/**
+ * Centralized page plugin management.
+ * @author Dave Johnson
+ */
+public class PagePluginManagerImpl implements PagePluginManager {
+    
+    private static Log mLogger =
+            LogFactory.getFactory().getInstance(PagePluginManagerImpl.class);
+    
+    // Plugin classes keyed by plugin name
+    static Map mPagePlugins = new LinkedHashMap();
+    
+    /**
+     * Creates a new instance of PagePluginManagerImpl
+     */
+    public PagePluginManagerImpl() {
+        loadPagePluginClasses();
+    }
+    
+    public boolean hasPagePlugins() {
+        mLogger.debug("mPluginClasses.size(): " + mPagePlugins.size());
+        return (mPagePlugins != null && mPagePlugins.size() > 0);
+    }
+    
+    /**
+     * Initialize PagePlugins declared in roller.properties.
+     * By using the full class name we also allow for the implementation of
+     * "external" Plugins (maybe even packaged seperately). These classes are
+     * then later instantiated by PageHelper.
+     */
+    private void loadPagePluginClasses() {
+        mLogger.debug("Initializing page plugins");
+        
+        String pluginStr = RollerConfig.getProperty("plugins.page");
+        if (mLogger.isDebugEnabled()) mLogger.debug(pluginStr);
+        if (pluginStr != null) {
+            String[] plugins = StringUtils.stripAll(
+                    StringUtils.split(pluginStr, ",") );
+            for (int i=0; i<plugins.length; i++) {
+                if (mLogger.isDebugEnabled()) mLogger.debug("try " + plugins[i]);
+                try {
+                    Class pluginClass = Class.forName(plugins[i]);
+                    if (isPagePlugin(pluginClass)) {
+                        PagePlugin plugin = (PagePlugin)pluginClass.newInstance();
+                        mPagePlugins.put(plugin.getName(), pluginClass);
+                    } else {
+                        mLogger.warn(pluginClass + " is not a PagePlugin");
+                    }
+                } catch (ClassNotFoundException e) {
+                    mLogger.error("ClassNotFoundException for " + plugins[i]);
+                } catch (InstantiationException e) {
+                    mLogger.error("InstantiationException for " + plugins[i]);
+                } catch (IllegalAccessException e) {
+                    mLogger.error("IllegalAccessException for " + plugins[i]);
+                }
+            }
+        }
+    }
+
+    /**
+     * Create and init plugins for processing entries in a specified website. 
+     */
+    public Map createAndInitPagePlugins(
+            WebsiteData website,
+            Object servletContext,
+            String contextPath,
+            Context ctx) {
+        Map ret = new LinkedHashMap();
+        Iterator it = getPagePluginClasses().values().iterator();
+        while (it.hasNext()) {
+            try {
+                Class pluginClass = (Class)it.next();
+                PagePlugin plugin = (PagePlugin)pluginClass.newInstance();
+                plugin.init(website, servletContext, contextPath, ctx);
+                ret.put(plugin.getName(), plugin);
+            } catch (Exception e) {
+                mLogger.error("Unable to init() PagePlugin: ", e);
+            }
+        }
+        return ret;
+    }
+    
+    public WeblogEntryData applyPagePlugins(
+            WeblogEntryData entry, Map pagePlugins, boolean skipFlag) { 
+        WeblogEntryData copy = new WeblogEntryData(entry);        
+        List entryPlugins = copy.getPluginsList();
+        if (entryPlugins != null && !entryPlugins.isEmpty()) {    
+            Iterator iter = entryPlugins.iterator();
+            while (iter.hasNext()) {
+                String key = (String)iter.next();
+                PagePlugin pagePlugin = (PagePlugin)pagePlugins.get(key);
+                if (pagePlugin != null) {
+                    copy.setText((pagePlugin).render(copy, skipFlag));
+                } else {
+                    mLogger.error("ERROR: plugin not found: " + key);
+                }
+            }
+        }
+        return copy;
+    }
+    
+    private static boolean isPagePlugin(Class pluginClass) {
+        Class[] interfaces = pluginClass.getInterfaces();
+        for (int i=0; i<interfaces.length; i++) {
+            if (interfaces[i].equals(PagePlugin.class)) return true;
+        }
+        return false;
+    }
+    
+    private Map getPagePluginClasses() {
+        return mPagePlugins;
+    }
+    
+    public void release() {
+        // no op
+    }
+}

Modified: incubator/roller/trunk/src/org/roller/business/PlanetManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/business/PlanetManagerImpl.java?rev=349595&r1=349594&r2=349595&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/business/PlanetManagerImpl.java (original)
+++ incubator/roller/trunk/src/org/roller/business/PlanetManagerImpl.java Mon Nov 28 18:44:45 2005
@@ -3,10 +3,7 @@
 import java.net.URL;
 import java.util.Calendar;
 import java.util.Date;
-import java.util.HashMap;
 import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
 import java.util.Set;
 import java.util.TreeSet;
 import java.text.MessageFormat;
@@ -18,10 +15,8 @@
 import org.roller.model.Roller;
 import org.roller.pojos.PlanetConfigData;
 import org.roller.pojos.PlanetEntryData;
-import org.roller.pojos.PlanetGroupData;
 import org.roller.pojos.PlanetSubscriptionData;
 import org.roller.util.rome.DiskFeedInfoCache;
-import org.roller.util.LRUCache2;
 
 import com.sun.syndication.feed.synd.SyndEntry;
 import com.sun.syndication.feed.synd.SyndFeed;
@@ -29,202 +24,191 @@
 import com.sun.syndication.fetcher.impl.FeedFetcherCache;
 import com.sun.syndication.fetcher.impl.HttpURLFeedFetcher;
 import com.sun.syndication.fetcher.impl.SyndFeedInfo;
+import org.roller.config.RollerRuntimeConfig;
 
 /**
  * Base class for PlanetManager implementations.
  * @author Dave Johnson
  */
-public abstract class PlanetManagerImpl implements PlanetManager
-{
+public abstract class PlanetManagerImpl implements PlanetManager {
     protected Roller roller = null;
     protected PersistenceStrategy strategy;
     
-    // Cache up to 20 aggregations, each for up to 30 minutes
-    // TODO: make this aggregation cache configurable
-    //protected LRUCache2 aggregationsByGroup = 
-        //new LRUCache2(20, 30 * 60 * 1000);
-    
-    // Cache up to 20 aggregations, each for up to 30 minutes
-    // TODO: make this top-subscriptions cache configurable
-    //protected LRUCache2 topSubscriptionsByGroup = 
-        //new LRUCache2(20, 30 * 60 * 1000);
-
     private static Log logger =
-        LogFactory.getFactory().getInstance(PlanetManagerImpl.class);
-        
-    public PlanetManagerImpl()
-    {   
+            LogFactory.getFactory().getInstance(PlanetManagerImpl.class);
+    
+    public PlanetManagerImpl() {
     }
-
-    public PlanetManagerImpl(PersistenceStrategy strategy, Roller roller)
-    {
+    
+    public PlanetManagerImpl(PersistenceStrategy strategy, Roller roller) {
         this.strategy = strategy;
-        this.roller = roller;    
+        this.roller = roller;
     }
     
-    public void refreshEntries() throws RollerException
-    {
+    public void refreshEntries() throws RollerException {
         Date now = new Date();
         long startTime = System.currentTimeMillis();
         PlanetConfigData config = getConfiguration();
-        if (config == null || config.getCacheDir() == null)
-        {
+        if (config == null || config.getCacheDir() == null) {
             logger.warn("Planet cache directory not set, aborting refresh");
             return;
         }
-        FeedFetcherCache feedInfoCache = 
+        FeedFetcherCache feedInfoCache =
                 new DiskFeedInfoCache(config.getCacheDir());
-               
-        if (config.getProxyHost()!=null && config.getProxyPort() > 0)
-        {
+        
+        if (config.getProxyHost()!=null && config.getProxyPort() > 0) {
             System.setProperty("proxySet", "true");
             System.setProperty("http.proxyHost", config.getProxyHost());
-            System.setProperty("http.proxyPort", 
+            System.setProperty("http.proxyPort",
                     Integer.toString(config.getProxyPort()));
         }
         /** a hack to set 15 sec timeouts for java.net.HttpURLConnection */
         System.setProperty("sun.net.client.defaultConnectTimeout", "15000");
         System.setProperty("sun.net.client.defaultReadTimeout", "15000");
-
+        
         FeedFetcher feedFetcher = new HttpURLFeedFetcher(feedInfoCache);
         //FeedFetcher feedFetcher = new HttpClientFeedFetcher(feedInfoCache);
         feedFetcher.setUsingDeltaEncoding(false);
-        feedFetcher.setUserAgent("RollerPlanetAggregator"); 
+        feedFetcher.setUserAgent("RollerPlanetAggregator");
+        
+        String localURL = RollerRuntimeConfig.getProperty("site.absoluteurl");
         
         // Loop through all subscriptions in the system
         Iterator subs = getAllSubscriptions();
-        while (subs.hasNext())
-        {
-            long subStartTime = System.currentTimeMillis();           
+        while (subs.hasNext()) {
+            long subStartTime = System.currentTimeMillis();
             
             // Fetch latest entries for each subscription
-            Set newEntries = new TreeSet();
+            Set newEntries = null;
+            int count = 0;
             PlanetSubscriptionData sub = (PlanetSubscriptionData)subs.next();
-            SyndFeed feed = null;
-            URL feedUrl = null;
-            Date lastUpdated = now;
-            try
-            {
-                feedUrl = new URL(sub.getFeedUrl());
-                logger.debug("Get feed from cache "+sub.getFeedUrl());
-                feed = feedFetcher.retrieveFeed(feedUrl);
-                SyndFeedInfo feedInfo = feedInfoCache.getFeedInfo(feedUrl);
-                if (feedInfo.getLastModified() != null) 
-                {
-                    long lastUpdatedLong = 
-                        ((Long)feedInfo.getLastModified()).longValue();
-                    if (lastUpdatedLong != 0)
-                    {
-                        lastUpdated = new Date(lastUpdatedLong);  
-                    }
-                }
-                Thread.sleep(100); // be nice
-            }
-            catch (Exception e)
-            {
-                logger.warn("ERROR parsing " + sub.getFeedUrl() 
-                    + " : " + e.getClass().getName() + " : " + e.getMessage());
-                logger.debug(e);
-                continue;
-            }
-            if (lastUpdated!=null && sub.getLastUpdated()!=null)
-            {
-                Calendar feedCal = Calendar.getInstance();
-                feedCal.setTime(lastUpdated);
-                
-                Calendar subCal = Calendar.getInstance();
-                subCal.setTime(sub.getLastUpdated());
-                
-                if (!feedCal.after(subCal)) 
-                {
-                    if (logger.isDebugEnabled())
-                    {
-                        String msg = MessageFormat.format(
-                            "   Skipping ({0} / {1})",
-                            new Object[] {
-                               lastUpdated, sub.getLastUpdated()});
-                       logger.debug(msg);
-                    }
-                    continue;
-                }
-            }
-            if (feed.getPublishedDate() != null)
-            {
-                sub.setLastUpdated(feed.getPublishedDate());
-                saveSubscription(sub);
+            if (sub.getFeedUrl().startsWith(localURL)) {
+                newEntries = getNewEntriesLocal(sub, feedFetcher, feedInfoCache);
+            } else {
+                newEntries = getNewEntriesRemote(sub, feedFetcher, feedInfoCache);
             }
+            count = newEntries.size();
             
-            // Kludge for Feeds without entry dates: most recent entry is given
-            // feed's last publish date (or yesterday if none exists) and earler
-            // entries are placed at once day intervals before that.
-            Calendar cal = Calendar.getInstance();
-            if (sub.getLastUpdated() != null)
-            {
-                cal.setTime(sub.getLastUpdated());
-            }
-            else
-            {
-                cal.setTime(new Date());
-                cal.add(Calendar.DATE, -1);
-            }
-
-            // Populate subscription object with new entries
-            int count = 0;
-            Iterator entries = feed.getEntries().iterator();
-            while (entries.hasNext())
-            {
-                try 
-                {
-                    SyndEntry romeEntry = (SyndEntry) entries.next();
-                    PlanetEntryData entry = 
-                            new PlanetEntryData(feed, romeEntry, sub);
-                    if (entry.getPublished() == null)
-                    {                    
-                        logger.debug(
-                         "No published date, assigning fake date for "+feedUrl);
-                        entry.setPublished(cal.getTime());
-                    }
-                    if (entry.getPermalink() == null)
-                    {
-                     logger.warn("No permalink, rejecting entry from "+feedUrl);
-                    }
-                    else 
-                    {
-                        saveEntry(entry);
-                        newEntries.add(entry);
-                    }
-                    cal.add(Calendar.DATE, -1);
-                    count++;
-                } 
-                catch (Exception e)
-                {
-                    logger.error("ERROR processing subscription entry", e);
-                }
-            }
             logger.debug("   Entry count: " + count);
-            if (count > 0) 
-            {
+            if (count > 0) {
                 Iterator entryIter = sub.getEntries().iterator();
-                while (entryIter.hasNext())
-                {
+                while (entryIter.hasNext()) {
                     deleteEntry((PlanetEntryData)entryIter.next());
                 }
                 sub.purgeEntries();
-                sub.addEntries(newEntries); 
+                sub.addEntries(newEntries);
                 if (roller != null) roller.commit();
             }
-            long subEndTime = System.currentTimeMillis();  
-            logger.info("   " + count + " - " 
-                    + ((subEndTime-subStartTime)/1000.0) 
-                    + " seconds to process (" + count + ") entries of " 
+            long subEndTime = System.currentTimeMillis();
+            logger.info("   " + count + " - "
+                    + ((subEndTime-subStartTime)/1000.0)
+                    + " seconds to process (" + count + ") entries of "
                     + sub.getFeedUrl());
         }
         // Clear the aggregation cache
         clearCachedAggregations();
         
         long endTime = System.currentTimeMillis();
-        logger.info("--- DONE --- Refreshed entries in " 
+        logger.info("--- DONE --- Refreshed entries in "
                 + ((endTime-startTime)/1000.0) + " seconds");
     }
-
+    
+    /**
+     * Override this if you have local feeds (i.e. feeds that you don't
+     * have to fetch via HTTP and parse with ROME).
+     */
+    protected Set getNewEntriesLocal(PlanetSubscriptionData sub,
+            FeedFetcher feedFetcher, FeedFetcherCache feedInfoCache)
+            throws RollerException {
+        
+        // If you don't override, local feeds will be treated as remote feeds
+        return getNewEntriesRemote(sub, feedFetcher, feedInfoCache);
+    }
+    
+    protected Set getNewEntriesRemote(PlanetSubscriptionData sub,
+            FeedFetcher feedFetcher, FeedFetcherCache feedInfoCache)
+            throws RollerException {
+        
+        Set newEntries = new TreeSet();
+        SyndFeed feed = null;
+        URL feedUrl = null;
+        Date lastUpdated = new Date();
+        try {
+            feedUrl = new URL(sub.getFeedUrl());
+            logger.debug("Get feed from cache "+sub.getFeedUrl());
+            feed = feedFetcher.retrieveFeed(feedUrl);
+            SyndFeedInfo feedInfo = feedInfoCache.getFeedInfo(feedUrl);
+            if (feedInfo.getLastModified() != null) {
+                long lastUpdatedLong =
+                        ((Long)feedInfo.getLastModified()).longValue();
+                if (lastUpdatedLong != 0) {
+                    lastUpdated = new Date(lastUpdatedLong);
+                }
+            }
+            Thread.sleep(100); // be nice
+        } catch (Exception e) {
+            logger.warn("ERROR parsing " + sub.getFeedUrl()
+            + " : " + e.getClass().getName() + " : " + e.getMessage());
+            logger.debug(e);
+            return newEntries; // bail out
+        }
+        if (lastUpdated!=null && sub.getLastUpdated()!=null) {
+            Calendar feedCal = Calendar.getInstance();
+            feedCal.setTime(lastUpdated);
+            
+            Calendar subCal = Calendar.getInstance();
+            subCal.setTime(sub.getLastUpdated());
+            
+            if (!feedCal.after(subCal)) {
+                if (logger.isDebugEnabled()) {
+                    String msg = MessageFormat.format(
+                            "   Skipping ({0} / {1})",
+                            new Object[] {
+                        lastUpdated, sub.getLastUpdated()});
+                        logger.debug(msg);
+                }
+                return newEntries; // bail out
+            }
+        }
+        if (feed.getPublishedDate() != null) {
+            sub.setLastUpdated(feed.getPublishedDate());
+            saveSubscription(sub);
+        }
+        
+        // Kludge for Feeds without entry dates: most recent entry is given
+        // feed's last publish date (or yesterday if none exists) and earler
+        // entries are placed at once day intervals before that.
+        Calendar cal = Calendar.getInstance();
+        if (sub.getLastUpdated() != null) {
+            cal.setTime(sub.getLastUpdated());
+        } else {
+            cal.setTime(new Date());
+            cal.add(Calendar.DATE, -1);
+        }
+        
+        // Populate subscription object with new entries
+        Iterator entries = feed.getEntries().iterator();
+        while (entries.hasNext()) {
+            try {
+                SyndEntry romeEntry = (SyndEntry) entries.next();
+                PlanetEntryData entry =
+                        new PlanetEntryData(feed, romeEntry, sub);
+                if (entry.getPublished() == null) {
+                    logger.debug(
+                            "No published date, assigning fake date for "+feedUrl);
+                    entry.setPublished(cal.getTime());
+                }
+                if (entry.getPermalink() == null) {
+                    logger.warn("No permalink, rejecting entry from "+feedUrl);
+                } else {
+                    saveEntry(entry);
+                    newEntries.add(entry);
+                }
+                cal.add(Calendar.DATE, -1);
+            } catch (Exception e) {
+                logger.error("ERROR processing subscription entry", e);
+            }
+        }
+        return newEntries;
+    }
 }

Modified: incubator/roller/trunk/src/org/roller/business/RollerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/business/RollerImpl.java?rev=349595&r1=349594&r2=349595&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/business/RollerImpl.java (original)
+++ incubator/roller/trunk/src/org/roller/business/RollerImpl.java Mon Nov 28 18:44:45 2005
@@ -3,7 +3,6 @@
  *
  * Created on April 29, 2005, 5:33 PM
  */
-
 package org.roller.business;
 
 import org.apache.commons.logging.Log;
@@ -11,12 +10,11 @@
 import org.roller.RollerException;
 import org.roller.model.FileManager;
 import org.roller.model.IndexManager;
+import org.roller.model.PagePluginManager;
 import org.roller.model.Roller;
 import org.roller.model.ThemeManager;
 import org.roller.model.ThreadManager;
 
-
-
 /**
  * The abstract version of the Roller implementation.
  * Here we put code that pertains to *all* implementations of the Roller
@@ -26,14 +24,14 @@
  */
 public abstract class RollerImpl implements Roller {
     
-    private static Log mLogger = 
-        LogFactory.getFactory().getInstance(RollerImpl.class);
-    
-    protected FileManager     mFileManager = null;
-    protected IndexManager    mIndexManager = null;
-    protected ThreadManager   mThreadManager = null;
-    protected ThemeManager    mThemeManager = null;
+    private static Log mLogger =
+            LogFactory.getFactory().getInstance(RollerImpl.class);
     
+    protected FileManager   mFileManager = null;
+    protected IndexManager  mIndexManager = null;
+    protected ThreadManager mThreadManager = null;
+    protected ThemeManager  mThemeManager = null;
+    protected PagePluginManager mPluginManager = null;
     
     /** Creates a new instance of RollerImpl */
     public RollerImpl() {
@@ -41,37 +39,31 @@
     }
     
     
-    /** 
+    /**
      * @see org.roller.model.Roller#getFileManager()
      */
-    public FileManager getFileManager() throws RollerException
-    {
-        if (mFileManager == null)
-        {
-                mFileManager = new FileManagerImpl();
+    public FileManager getFileManager() throws RollerException {
+        if (mFileManager == null) {
+            mFileManager = new FileManagerImpl();
         }
         return mFileManager;
     }
-
+    
     /**
      * @see org.roller.model.Roller#getThreadManager()
      */
-    public ThreadManager getThreadManager() throws RollerException
-    {
-        if (mThreadManager == null)
-        {
+    public ThreadManager getThreadManager() throws RollerException {
+        if (mThreadManager == null) {
             mThreadManager = new ThreadManagerImpl();
         }
         return mThreadManager;
     }
-
+    
     /**
      * @see org.roller.model.Roller#getIndexManager()
      */
-    public IndexManager getIndexManager() throws RollerException
-    {
-        if (mIndexManager == null)
-        {
+    public IndexManager getIndexManager() throws RollerException {
+        if (mIndexManager == null) {
             mIndexManager = new IndexManagerImpl();
         }
         return mIndexManager;
@@ -80,32 +72,36 @@
     /**
      * @see org.roller.model.Roller#getThemeManager()
      */
-    public ThemeManager getThemeManager() throws RollerException
-    {
-        if (mThemeManager == null)
-        {
+    public ThemeManager getThemeManager() throws RollerException {
+        if (mThemeManager == null) {
             mThemeManager = new ThemeManagerImpl();
         }
         return mThemeManager;
     }
     
+    /**
+     * @see org.roller.model.Roller#getPluginManager()
+     */
+    public PagePluginManager getPagePluginManager() throws RollerException {
+        if (mPluginManager == null) {
+            mPluginManager = new PagePluginManagerImpl();
+        }
+        return mPluginManager;
+    }
+    
     
-    public void release()
-    {
+    public void release() {
         if (mFileManager != null) mFileManager.release();
         if (mThreadManager != null) mThreadManager.release();
+        if (mPluginManager != null) mPluginManager.release();
     }
     
     
-    public void shutdown()
-    {
-        try 
-        {
+    public void shutdown() {
+        try {
             if (mIndexManager != null) mIndexManager.shutdown();
             if (mThreadManager != null) mThreadManager.shutdown();
-        } 
-        catch(Exception e) 
-        {
+        } catch(Exception e) {
             mLogger.warn(e);
         }
     }

Modified: incubator/roller/trunk/src/org/roller/business/UserManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/business/UserManagerImpl.java?rev=349595&r1=349594&r2=349595&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/business/UserManagerImpl.java (original)
+++ incubator/roller/trunk/src/org/roller/business/UserManagerImpl.java Mon Nov 28 18:44:45 2005
@@ -255,7 +255,10 @@
             "",                  // emailFromAddress
             Boolean.TRUE,        // isEnabled
             email,               // emailAddress
-            new Date());
+            new Date(),          // dateCreated
+            Boolean.TRUE,        // defaultAllowComments
+            0,                   // defaultCommentDays
+            Boolean.FALSE);      // moderateComments
         website.setEditorTheme(theme);
         website.setLocale(locale);
         website.setTimeZone(timeZone);

Modified: incubator/roller/trunk/src/org/roller/business/hibernate/HibernatePlanetManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/business/hibernate/HibernatePlanetManagerImpl.java?rev=349595&r1=349594&r2=349595&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/business/hibernate/HibernatePlanetManagerImpl.java (original)
+++ incubator/roller/trunk/src/org/roller/business/hibernate/HibernatePlanetManagerImpl.java Mon Nov 28 18:44:45 2005
@@ -16,12 +16,17 @@
 
 package org.roller.business.hibernate;
 
+import com.sun.syndication.fetcher.FeedFetcher;
+import com.sun.syndication.fetcher.impl.FeedFetcherCache;
+import java.text.MessageFormat;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
 
 import org.hibernate.Criteria;
 import org.hibernate.HibernateException;
@@ -32,78 +37,72 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.velocity.VelocityContext;
 import org.roller.RollerException;
 import org.roller.business.PersistenceStrategy;
 import org.roller.business.PlanetManagerImpl;
 import org.roller.config.RollerConfig;
+import org.roller.config.RollerRuntimeConfig;
+import org.roller.model.PagePluginManager;
 import org.roller.model.Roller;
+import org.roller.model.UserManager;
+import org.roller.model.WeblogManager;
 import org.roller.pojos.PlanetConfigData;
 import org.roller.pojos.PlanetEntryData;
 import org.roller.pojos.PlanetGroupData;
 import org.roller.pojos.PlanetGroupSubscriptionAssoc;
 import org.roller.pojos.PlanetSubscriptionData;
-
+import org.roller.pojos.WeblogEntryData;
+import org.roller.pojos.WebsiteData;
 
 /**
  * Manages Planet Roller objects and entry aggregations in a database.
  * @author Dave Johnson
  */
-public class HibernatePlanetManagerImpl extends PlanetManagerImpl
-{
+public class HibernatePlanetManagerImpl extends PlanetManagerImpl {
     protected Map lastUpdatedByGroup = new HashMap();
-    protected static final String NO_GROUP = "zzz_nogroup_zzz";     
-
-    private static Log logger = 
-        LogFactory.getFactory().getInstance(HibernatePlanetManagerImpl.class);
-
+    protected static final String NO_GROUP = "zzz_nogroup_zzz";
+    
+    private static Log logger =
+            LogFactory.getFactory().getInstance(HibernatePlanetManagerImpl.class);
+    
     public HibernatePlanetManagerImpl(
-        PersistenceStrategy strategy, Roller roller)
-    {
+            PersistenceStrategy strategy, Roller roller) {
         super(strategy, roller);
     }
-
-    public void saveConfiguration(PlanetConfigData config) 
-        throws RollerException
-    {
+    
+    public void saveConfiguration(PlanetConfigData config)
+    throws RollerException {
         config.save();
     }
     
-    public void saveGroup(PlanetGroupData group) throws RollerException
-    {
+    public void saveGroup(PlanetGroupData group) throws RollerException {
         Iterator assocs = group.getGroupSubscriptionAssocs().iterator();
-        while (assocs.hasNext())
-        {
-            PlanetGroupSubscriptionAssoc assoc = 
+        while (assocs.hasNext()) {
+            PlanetGroupSubscriptionAssoc assoc =
                     (PlanetGroupSubscriptionAssoc)assocs.next();
             assoc.save();
         }
         group.save();
     }
     
-    public void saveEntry(PlanetEntryData entry) throws RollerException
-    {
+    public void saveEntry(PlanetEntryData entry) throws RollerException {
         entry.save();
     }
     
-    public void saveSubscription(PlanetSubscriptionData sub) 
-        throws RollerException
-    {
+    public void saveSubscription(PlanetSubscriptionData sub)
+    throws RollerException {
         PlanetSubscriptionData existing = getSubscription(sub.getFeedUrl());
-        if (existing == null || (existing.getId().equals(sub.getId()))) 
-        {
+        if (existing == null || (existing.getId().equals(sub.getId()))) {
             sub.save();
-        }
-        else 
-        {
+        } else {
             throw new RollerException("ERROR: duplicate feed URLs not allowed");
         }
     }
     
-    public PlanetConfigData getConfiguration() throws RollerException
-    {
+    public PlanetConfigData getConfiguration() throws RollerException {
         PlanetConfigData config = null;
-        try
-        {
+        try {
             Session session = ((HibernateStrategy)strategy).getSession();
             Criteria criteria = session.createCriteria(PlanetConfigData.class);
             criteria.setMaxResults(1);
@@ -112,262 +111,283 @@
             
             // We inject the cache dir into the config object here to maintain
             // compatibility with the standaline version of the aggregator.
-            if (config != null) 
-            {
+            if (config != null) {
                 config.setCacheDir(
-                    RollerConfig.getProperty("planet.aggregator.cache.dir"));
-            }                
-        }
-        catch (HibernateException e)
-        {
+                        RollerConfig.getProperty("planet.aggregator.cache.dir"));
+            }
+        } catch (HibernateException e) {
             throw new RollerException(e);
         }
         return config;
     }
     
-    public List getGroups() throws RollerException
-    {
-        try
-        {
+    public List getGroups() throws RollerException {
+        try {
             Session session = ((HibernateStrategy)strategy).getSession();
             Criteria criteria = session.createCriteria(PlanetGroupData.class);
             return criteria.list();
-        }
-        catch (HibernateException e)
-        {
+        } catch (HibernateException e) {
             throw new RollerException(e);
-        }    
+        }
     }
-
-    public List getGroupHandles() throws RollerException
-    {
+    
+    public List getGroupHandles() throws RollerException {
         List handles = new ArrayList();
         Iterator list = getGroups().iterator();
-        while (list.hasNext()) 
-        {
+        while (list.hasNext()) {
             PlanetGroupData group = (PlanetGroupData)list.next();
             handles.add(group.getHandle());
         }
         return handles;
     }
     
-    public PlanetSubscriptionData getSubscription(String feedUrl) 
-        throws RollerException
-    {
-        try
-        {
+    public PlanetSubscriptionData getSubscription(String feedUrl)
+    throws RollerException {
+        try {
             Session session = ((HibernateStrategy)strategy).getSession();
-            Criteria criteria = 
+            Criteria criteria =
                     session.createCriteria(PlanetSubscriptionData.class);
             criteria.setMaxResults(1);
             criteria.add(Expression.eq("feedUrl", feedUrl));
             List list = criteria.list();
             return list.size()!=0 ? (PlanetSubscriptionData)list.get(0) : null;
-        }
-        catch (HibernateException e)
-        {
+        } catch (HibernateException e) {
             throw new RollerException(e);
         }
     }
     
-    public PlanetSubscriptionData getSubscriptionById(String id) 
-        throws RollerException
-    {
+    public PlanetSubscriptionData getSubscriptionById(String id)
+    throws RollerException {
         return (PlanetSubscriptionData)
-            strategy.load(id, PlanetSubscriptionData.class);
+        strategy.load(id, PlanetSubscriptionData.class);
     }
-
-    public PlanetGroupData getGroup(String handle) throws RollerException
-    {
-        try
-        {
+    
+    public PlanetGroupData getGroup(String handle) throws RollerException {
+        try {
             Session session = ((HibernateStrategy)strategy).getSession();
             Criteria criteria = session.createCriteria(PlanetGroupData.class);
             criteria.setMaxResults(1);
             criteria.add(Expression.eq("handle", handle));
             List list = criteria.list();
             return list.size()!=0 ? (PlanetGroupData)list.get(0) : null;
-        }
-        catch (HibernateException e)
-        {
+        } catch (HibernateException e) {
             throw new RollerException(e);
         }
     }
     
-    public PlanetGroupData getGroupById(String id) throws RollerException
-    {
+    public PlanetGroupData getGroupById(String id) throws RollerException {
         return (PlanetGroupData)
-            strategy.load(id, PlanetGroupData.class);
+        strategy.load(id, PlanetGroupData.class);
     }
-
-    public synchronized List getAggregation(int maxEntries) throws RollerException
-    {
+    
+    public synchronized List getAggregation(int maxEntries) throws RollerException {
         return getAggregation(null, maxEntries);
     }
     
-    public synchronized List getAggregation(PlanetGroupData group, int maxEntries) 
-        throws RollerException
-    {
+    public synchronized List getAggregation(PlanetGroupData group, int maxEntries)
+    throws RollerException {
         List ret = null;
-        try
-        {
+        try {
             String groupHandle = (group == null) ? NO_GROUP : group.getHandle();
             long startTime = System.currentTimeMillis();
-            Session session = 
-                ((HibernateStrategy)strategy).getSession();
-            if (group != null)
-            {
+            Session session =
+                    ((HibernateStrategy)strategy).getSession();
+            if (group != null) {
                 Query query = session.createQuery(
-                    "select entry from org.roller.pojos.PlanetEntryData entry "
-                    +"join entry.subscription.groupSubscriptionAssocs assoc "
-                    +"where assoc.group=:group order by entry.published desc");
+                        "select entry from org.roller.pojos.PlanetEntryData entry "
+                        +"join entry.subscription.groupSubscriptionAssocs assoc "
+                        +"where assoc.group=:group order by entry.published desc");
                 query.setEntity("group", group);
                 query.setMaxResults(maxEntries);
                 ret = query.list();
-            }
-            else
-            {
+            } else {
                 Query query = session.createQuery(
-                   "select entry from org.roller.pojos.PlanetEntryData entry "
-                   +"join entry.subscription.groupSubscriptionAssocs assoc "
-                   +"where "
-                   +"assoc.group.handle='external' or assoc.group.handle='all'"
-                   +" order by entry.published desc");
+                        "select entry from org.roller.pojos.PlanetEntryData entry "
+                        +"join entry.subscription.groupSubscriptionAssocs assoc "
+                        +"where "
+                        +"assoc.group.handle='external' or assoc.group.handle='all'"
+                        +" order by entry.published desc");
                 query.setMaxResults(maxEntries);
                 ret = query.list();
             }
             Date retLastUpdated = null;
-            if (ret.size() > 0)
-            {
+            if (ret.size() > 0) {
                 PlanetEntryData entry = (PlanetEntryData)ret.get(0);
                 retLastUpdated = entry.getPublished();
-            }
-            else 
-            {
+            } else {
                 retLastUpdated = new Date();
             }
             lastUpdatedByGroup.put(groupHandle, retLastUpdated);
-
+            
             long endTime = System.currentTimeMillis();
             logger.info("Generated aggregation in "
-                                +((endTime-startTime)/1000.0)+" seconds");
-        }
-        catch (Throwable e)
-        {
+                    +((endTime-startTime)/1000.0)+" seconds");
+        } catch (Throwable e) {
             logger.error("ERROR: building aggregation for: "+group, e);
             throw new RollerException(e);
         }
-        return ret; 
+        return ret;
     }
-
-    public void deleteEntry(PlanetEntryData entry) throws RollerException
-    {
+    
+    public void deleteEntry(PlanetEntryData entry) throws RollerException {
         entry.remove();
     }
-
-    public void deleteGroup(PlanetGroupData group) throws RollerException
-    {
+    
+    public void deleteGroup(PlanetGroupData group) throws RollerException {
         group.remove();
     }
-
-    public void deleteSubscription(PlanetSubscriptionData sub) 
-        throws RollerException
-    {
+    
+    public void deleteSubscription(PlanetSubscriptionData sub)
+    throws RollerException {
         sub.remove();
     }
     
-    public Iterator getAllSubscriptions()
-    {
-        try
-        {
+    public Iterator getAllSubscriptions() {
+        try {
             Session session = ((HibernateStrategy)strategy).getSession();
-            Criteria criteria = 
+            Criteria criteria =
                     session.createCriteria(PlanetSubscriptionData.class);
             criteria.addOrder(Order.asc("feedUrl"));
             List list = criteria.list();
             return list.iterator();
-        }
-        catch (Throwable e)
-        {
+        } catch (Throwable e) {
             throw new RuntimeException(
                     "ERROR fetching subscription collection", e);
         }
     }
     
-    public int getSubscriptionCount() throws RollerException 
-    {
-        try
-        {
+    public int getSubscriptionCount() throws RollerException {
+        try {
             Session session = ((HibernateStrategy)strategy).getSession();
             Integer count = (Integer)session.createQuery(
-                "select count(*) from org.roller.pojos.PlanetSubscriptionData").uniqueResult();
+                    "select count(*) from org.roller.pojos.PlanetSubscriptionData").uniqueResult();
             return count.intValue();
-        }
-        catch (Throwable e)
-        {
+        } catch (Throwable e) {
             throw new RuntimeException(
                     "ERROR fetching subscription count", e);
         }
     }
-
-    public synchronized List getTopSubscriptions(int max) throws RollerException
-    {
+    
+    public synchronized List getTopSubscriptions(int max) throws RollerException {
         String groupHandle = NO_GROUP;
         List ret = null;
-        try
-        {
+        try {
             Session session = ((HibernateStrategy)strategy).getSession();
-            Criteria criteria = 
+            Criteria criteria =
                     session.createCriteria(PlanetSubscriptionData.class);
             criteria.setMaxResults(max);
             criteria.addOrder(Order.desc("inboundblogs"));
             ret = criteria.list();
-        }
-        catch (HibernateException e)
-        {
+        } catch (HibernateException e) {
             throw new RollerException(e);
         }
         return ret;
     }
-
+    
     public synchronized List getTopSubscriptions(
-            PlanetGroupData group, int max) throws RollerException
-    {
+            PlanetGroupData group, int max) throws RollerException {
         String groupHandle = (group == null) ? NO_GROUP : group.getHandle();
         List ret = null;
-        try
-        {
+        try {
             Session session = ((HibernateStrategy)strategy).getSession();
             Query query = session.createQuery(
-             "select sub from org.roller.pojos.PlanetSubscriptionData sub "
-               +"join sub.groupSubscriptionAssocs assoc "
-               +"where "
-               +"assoc.group.handle=:groupHandle "
-               +"order by sub.inboundblogs desc");
+                    "select sub from org.roller.pojos.PlanetSubscriptionData sub "
+                    +"join sub.groupSubscriptionAssocs assoc "
+                    +"where "
+                    +"assoc.group.handle=:groupHandle "
+                    +"order by sub.inboundblogs desc");
             query.setString("groupHandle", group.getHandle());
             query.setMaxResults(max);
             ret = query.list();
-        }
-        catch (HibernateException e)
-        {
+        } catch (HibernateException e) {
             throw new RollerException(e);
         }
         return ret;
     }
     
-    public synchronized void clearCachedAggregations() 
-    {
+    public synchronized void clearCachedAggregations() {
         lastUpdatedByGroup.clear();
     }
     
-    public Date getLastUpdated()
-    {
+    public Date getLastUpdated() {
         return (Date)lastUpdatedByGroup.get(NO_GROUP);
     }
     
-    public Date getLastUpdated(PlanetGroupData group)
-    {
+    public Date getLastUpdated(PlanetGroupData group) {
         return (Date)lastUpdatedByGroup.get(group);
+    }
+    
+    protected Set getNewEntriesLocal(PlanetSubscriptionData sub,
+            FeedFetcher feedFetcher, FeedFetcherCache feedInfoCache)
+            throws RollerException {
+        
+        Set newEntries = new TreeSet();
+        try {
+            // for local feeds, sub.author = website.handle
+            if (sub.getFeedUrl().endsWith(sub.getAuthor())) {
+                
+                logger.debug("Getting LOCAL feed "+sub.getFeedUrl());
+            
+                // get corresponding website object
+                UserManager usermgr = roller.getUserManager();
+                WebsiteData website = usermgr.getWebsiteByHandle(sub.getAuthor());
+                
+                // figure website last update time
+                WeblogManager blogmgr = roller.getWeblogManager();
+                
+                // ISSUE: is this too expensive; can we use cached dates instead?
+                Date siteUpdated = blogmgr.getWeblogLastPublishTime(website);
+                
+                // if website last update time > subsciption last update time
+                List entries = new ArrayList();
+                if (sub.getLastUpdated() == null || siteUpdated.after(sub.getLastUpdated())) {
+                    int entryCount = RollerRuntimeConfig.getIntProperty(
+                        "site.newsfeeds.defaultEntries");    
+                     entries = blogmgr.getWeblogEntries(
+                        website, 
+                        null,                        // startDate
+                        new Date(),                  // endDate
+                        null,                        // catName
+                        WeblogEntryData.PUBLISHED,   // status
+                        new Integer(entryCount));    // maxEntries
+                    
+                    sub.setLastUpdated(siteUpdated);
+                    saveSubscription(sub);
+                    
+                } else {
+                    if (logger.isDebugEnabled()) {
+                        String msg = MessageFormat.format(
+                            "   Skipping ({0} / {1})", new Object[] {
+                            siteUpdated, sub.getLastUpdated()});
+                            logger.debug(msg);
+                    }
+                }  
+                // Populate subscription object with new entries
+                PagePluginManager ppmgr = roller.getPagePluginManager();
+                Map pagePlugins = ppmgr.createAndInitPagePlugins(
+                    website, 
+                    null,
+                    RollerRuntimeConfig.getProperty("site.absoluteurl"),
+                    new VelocityContext());
+                Iterator entryIter = entries.iterator();
+                while (entryIter.hasNext()) {
+                    try {
+                        WeblogEntryData rollerEntry = 
+                            (WeblogEntryData)entryIter.next();
+                        PlanetEntryData entry =
+                            new PlanetEntryData(rollerEntry, sub, pagePlugins);
+                        saveEntry(entry);
+                        newEntries.add(entry);
+                    } catch (Exception e) {
+                        logger.error("ERROR processing subscription entry", e);
+                    }
+                }
+                return newEntries;
+            }
+        } catch (Exception e) {
+            logger.warn("Problem reading local feed", e);
+        }
+        return getNewEntriesRemote(sub, feedFetcher, feedInfoCache);
     }
 }
 

Modified: incubator/roller/trunk/src/org/roller/config/RollerConfig.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/config/RollerConfig.java?rev=349595&r1=349594&r2=349595&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/config/RollerConfig.java (original)
+++ incubator/roller/trunk/src/org/roller/config/RollerConfig.java Mon Nov 28 18:44:45 2005
@@ -187,9 +187,9 @@
      *
      * This property is *not* persisted in any way.
      */
-    public static void setContextPath(String path) {
+    public static void setContextRealPath(String path) {
 
         mConfig.setProperty("context.realpath", path);
     }
-
+    
 }

Added: incubator/roller/trunk/src/org/roller/model/PagePlugin.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/model/PagePlugin.java?rev=349595&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/roller/model/PagePlugin.java (added)
+++ incubator/roller/trunk/src/org/roller/model/PagePlugin.java Mon Nov 28 18:44:45 2005
@@ -0,0 +1,92 @@
+/*
+ * Created on May 26, 2003
+ */
+package org.roller.model;
+
+import org.apache.velocity.context.Context;
+import org.roller.RollerException;
+import org.roller.pojos.WeblogEntryData;
+import org.roller.pojos.WebsiteData;
+
+/**
+ * Interface for Roller weblog entry plugins.
+ * Plugin objects operate on the text field of a weblog entry object. 
+ * Plugins save state and may not be thread-safe.
+ * Consequently, new plugin objects are created for each request.
+ * This interface has no dependency on Servlet classes, but page plugins may.
+ *
+ * Existing implementations:
+ * autogenerate links from Bookmarks (BookmarkPlugin),
+ * obfuscate email addresses (EmailObfuscator), truncate an Entry at 250
+ * characters and add a Read More... link (ReadMorePlugin), and transform
+ * 'simple markup' according to several schemes (JSPWiki, Radeox, Textile).
+ * See the "contrib" directory for these implementations.
+ *
+ * @author David M Johnson
+ */
+public interface PagePlugin {
+    public String name = "PagePlugin";
+    
+    /**
+     * Plugins can this as an opportunity to add any required objects
+     * to the RollerRequest and the VelocityContext.
+     * @param website     Website being processed
+     * @param config      javax.servlet.ServletContext (or null if running outside webapp)
+     * @param baseURL     Base URL of Roller site 
+     * @param ctx         Plugins may place objects into the Velocity Context.
+     */
+    public void init(
+            WebsiteData website,
+            Object servletContext,
+            String baseURL,
+            Context ctx) throws RollerException;
+    
+    /**
+     * Apply plugin to content of specified WeblogEntry.  The WeblogEntryData
+     * is actually a copy of the real thing, so that changes made via
+     * entry.setText() are not persisted.  Notice this; no changes made
+     * to the entry will be persisted.
+     * Some Plugins are only suited to rendering during Page display
+     * (not when generating RSS or Trackback content or in the
+     * Entry Preview) - ReadMorePlugin is an example of such a case.
+     * If the skipFlag is set to 'true' it merely returns the
+     * unadorned contents of entry.getText().
+     *
+     * @param entry WeblogEntry to which plugin should be applied.
+     * @param skipFlag Should processing be skipped.
+     * @return Results of applying plugin to entry.
+     */
+    public String render(WeblogEntryData entry, boolean skipFlag);
+    
+    /**
+     * Apply plugin to content of specified String.  Some plugins
+     * may require interaction with an Entry to do its job (such
+     * as the BookmarkPlugin) and will simply return the String
+     * that was passed in.
+     *
+     * @param str String to which plugin should be applied.
+     * @return Results of applying plugin to string.
+     */
+    public String render(String str);
+    
+    /**
+     * Must implement toString(), returning the human-friendly
+     * name of this Plugin.  This is what users will see.
+     * @return The human-friendly name of this Plugin.
+     */
+    public String toString();
+    
+    /**
+     * Returns the human-friendly name of this Plugin.
+     * This is what users will see.
+     * @return The human-friendly name of this Plugin.
+     */
+    public String getName();
+    
+    /**
+     * Briefly describes the function of the Plugin. May
+     * contain HTML.
+     * @return A brief description of the Plugin.
+     */
+    public String getDescription();
+}

Added: incubator/roller/trunk/src/org/roller/model/PagePluginManager.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/model/PagePluginManager.java?rev=349595&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/roller/model/PagePluginManager.java (added)
+++ incubator/roller/trunk/src/org/roller/model/PagePluginManager.java Mon Nov 28 18:44:45 2005
@@ -0,0 +1 @@
+/* Created on Nov. 26, 2005 */

package org.roller.model;

import java.util.Map;
import java.io.Serializable;
import org.apache.velocity.context.Context;
import org.roller.pojos.WeblogEntryData;
import org.roller.pojos.WebsiteData;

/**
 * Manages Roller page plugins
 */
public interface PagePluginManager extends Serializable {
    
    /** 
     * Returns true if plugins are present 
     */
    public boolean hasPagePlugins();
    
    /**
     * Create and init plugins for processing entries in a specified website. 
     * @param website        Website being processed 
     * @param servletContext ServetContext or null if running outside webapp
     * @param contextURL     Absolute URL of webapp    
     * @param ctx            Velocity context 
     */
    public Map createAndInitPagePlugins(
            WebsiteData website,
            Object servletContext,
            String contextPath,
            Context ctx);
    
    /**
     * Accepts weblog entry, creates copy, applies plugins to copy and
     * returns the results.
     * @param entry   Original weblog entry
     * @param plugins Map of plugins to apply
     * @return        Copy of weblog entry with plugins applied
     */
    public WeblogEntryData applyPagePlugins(
            WeblogEntryData entry, Map plugins, boolean skipFlag);
    
    /** 
     * Release all resources associated with Roller session. 
     */
    public void release();      
}
\ No newline at end of file

Modified: incubator/roller/trunk/src/org/roller/model/Roller.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/model/Roller.java?rev=349595&r1=349594&r2=349595&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/model/Roller.java (original)
+++ incubator/roller/trunk/src/org/roller/model/Roller.java Mon Nov 28 18:44:45 2005
@@ -95,6 +95,11 @@
      */
     public ThemeManager getThemeManager() throws RollerException;
     
+    /**
+     * Get PagePluginManager associated with this Roller instance.
+     */
+    public PagePluginManager getPagePluginManager() throws RollerException;
+    
     /** Begin transaction for a thread.
      */ 
     public void begin() throws RollerException;



Mime
View raw message