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 2006/10/19 17:51:24 UTC
svn commit: r465665 - in /incubator/roller/trunk: sandbox/planetroller/
sandbox/planetroller/nbproject/
sandbox/planetroller/src/org/apache/roller/planet/tasks/
sandbox/planetroller/templates/ src/org/apache/roller/planet/pojos/
Author: snoopdave
Date: Thu Oct 19 08:51:22 2006
New Revision: 465665
URL: http://svn.apache.org/viewvc?view=rev&rev=465665
Log:
Planet generation task working properly now
Modified:
incubator/roller/trunk/sandbox/planetroller/ant.properties
incubator/roller/trunk/sandbox/planetroller/build.xml
incubator/roller/trunk/sandbox/planetroller/nbproject/project.xml
incubator/roller/trunk/sandbox/planetroller/src/org/apache/roller/planet/tasks/GeneratePlanetTask.java
incubator/roller/trunk/sandbox/planetroller/templates/control.vm
incubator/roller/trunk/sandbox/planetroller/templates/html.vm
incubator/roller/trunk/sandbox/planetroller/templates/opml.vm
incubator/roller/trunk/sandbox/planetroller/templates/rss.vm
incubator/roller/trunk/src/org/apache/roller/planet/pojos/PlanetEntryData.java
Modified: incubator/roller/trunk/sandbox/planetroller/ant.properties
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/sandbox/planetroller/ant.properties?view=diff&rev=465665&r1=465664&r2=465665
==============================================================================
--- incubator/roller/trunk/sandbox/planetroller/ant.properties (original)
+++ incubator/roller/trunk/sandbox/planetroller/ant.properties Thu Oct 19 08:51:22 2006
@@ -1,3 +1 @@
-#Wed Sep 20 10:50:44 EDT 2006
-rollerjars.dir=/Users/dave/roller_trunk/build/webapp/WEB-INF/lib
-planet.version=1.0-dev
+rollersrc.dir=../..
\ No newline at end of file
Modified: incubator/roller/trunk/sandbox/planetroller/build.xml
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/sandbox/planetroller/build.xml?view=diff&rev=465665&r1=465664&r2=465665
==============================================================================
--- incubator/roller/trunk/sandbox/planetroller/build.xml (original)
+++ incubator/roller/trunk/sandbox/planetroller/build.xml Thu Oct 19 08:51:22 2006
@@ -21,9 +21,15 @@
<property file="./ant.properties" />
- <fileset id="roller-jars" dir="${rollersrc.dir}/build/webapp/WEB-INF/lib">
- <include name="roller-business.jar"/>
+ <fileset id="roller-jars" dir="${rollersrc.dir}/build/webapp/WEB-INF/lib">
+ <!-- needed for business layer model and pojos -->
+ <include name="roller-business.jar"/>
+
+ <!-- needed for OldUtilities and UtilitiesModel -->
+ <include name="roller-web.jar"/>
+
+ <!-- needed for Hibernate -->
<include name="hibernate3.jar"/>
<include name="antlr.jar"/>
<include name="asm.jar"/>
@@ -33,23 +39,24 @@
<include name="dom4j-1.6.1.jar"/>
<include name="jta.jar"/>
<include name="jdbc2_0-stdext.jar"/>
-
- <include name="log4j-1.2.11.jar"/>
-
+
+ <!-- needed for ROME -->
<include name="rome-0.8.jar"/>
<include name="rome-fetcher-0.8.jar"/>
<include name="jdom.jar"/>
- <include name="jaxen-full.jar"/>
- <include name="saxpath.jar"/>
-
+ <!-- Needed for Velocity -->
<include name="velocity-1.4.jar"/>
<include name="velocity-dep-1.4.jar"/>
+ <!-- General dependencies -->
<include name="commons-lang-2.0.jar"/>
<include name="commons-logging.jar"/>
<include name="commons-fileupload.jar"/>
<include name="commons-validator.jar"/>
+ <include name="log4j-1.2.11.jar"/>
+ <include name="jaxen-full.jar"/>
+ <include name="saxpath.jar"/>
</fileset>
Modified: incubator/roller/trunk/sandbox/planetroller/nbproject/project.xml
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/sandbox/planetroller/nbproject/project.xml?view=diff&rev=465665&r1=465664&r2=465665
==============================================================================
--- incubator/roller/trunk/sandbox/planetroller/nbproject/project.xml (original)
+++ incubator/roller/trunk/sandbox/planetroller/nbproject/project.xml Thu Oct 19 08:51:22 2006
@@ -55,7 +55,7 @@
<java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/1">
<compilation-unit>
<package-root>src</package-root>
- <classpath mode="compile">lib/asm-attrs.jar:lib/asm.jar:lib/cglib-2.1.3.jar:lib/commons-fileupload.jar:lib/commons-validator.jar:lib/dom4j-1.6.1.jar:lib/ehcache-1.1.jar:lib/hibernate3.jar:lib/jaxen-full.jar:lib/jdbc2_0-stdext.jar:lib/jdom.jar:lib/jta.jar:lib/log4j-1.2.11.jar:lib/roller-business.jar:lib/rome-0.8.jar:lib/rome-fetcher-0.8.jar:lib/saxpath.jar:lib/velocity-1.4.jar:lib/velocity-dep-1.4.jar:lib/commons-logging.jar:lib/commons-lang-2.0.jar</classpath>
+ <classpath mode="compile">lib/asm-attrs.jar:lib/asm.jar:lib/cglib-2.1.3.jar:lib/commons-fileupload.jar:lib/commons-validator.jar:lib/dom4j-1.6.1.jar:lib/ehcache-1.1.jar:lib/hibernate3.jar:lib/jaxen-full.jar:lib/jdbc2_0-stdext.jar:lib/jdom.jar:lib/jta.jar:lib/log4j-1.2.11.jar:lib/roller-business.jar:lib/rome-0.8.jar:lib/rome-fetcher-0.8.jar:lib/saxpath.jar:lib/velocity-1.4.jar:lib/velocity-dep-1.4.jar:lib/commons-logging.jar:lib/commons-lang-2.0.jar:lib/roller-web.jar</classpath>
<source-level>1.4</source-level>
</compilation-unit>
</java-data>
Modified: incubator/roller/trunk/sandbox/planetroller/src/org/apache/roller/planet/tasks/GeneratePlanetTask.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/sandbox/planetroller/src/org/apache/roller/planet/tasks/GeneratePlanetTask.java?view=diff&rev=465665&r1=465664&r2=465665
==============================================================================
--- incubator/roller/trunk/sandbox/planetroller/src/org/apache/roller/planet/tasks/GeneratePlanetTask.java (original)
+++ incubator/roller/trunk/sandbox/planetroller/src/org/apache/roller/planet/tasks/GeneratePlanetTask.java Thu Oct 19 08:51:22 2006
@@ -20,6 +20,8 @@
import java.io.File;
import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.roller.RollerException;
@@ -27,7 +29,8 @@
import org.apache.roller.planet.model.Planet;
import org.apache.roller.planet.model.PlanetFactory;
import org.apache.roller.planet.model.PlanetManager;
-import org.apache.roller.util.Utilities;
+import org.apache.roller.ui.rendering.model.UtilitiesModel;
+import org.apache.roller.ui.rendering.velocity.deprecated.OldUtilities;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.VelocityEngine;
import org.apache.velocity.texen.Generator;
@@ -37,14 +40,15 @@
* Updates Planet aggregator's database of feed entries and generates Planet
* files based on those entries and the Planet configuration.
*
- * - Calls Roller business layer to refresh entries
- * - Uses Velocity Texen to generate the static files
* - Designed to be run outside of Roller via the TaskRunner class
+ * - Calls Planet business layer to refresh entries
+ * - Uses PlanetConfig properties for templateDir, outputDir and template name
+ * - Creates outputdir and a subdirectory for each group
+ * - Uses Velocity Texen to generate the static files
*/
public class GeneratePlanetTask implements Runnable {
private static Log log = LogFactory.getLog(GeneratePlanetTask.class);
-
public void run() {
try {
// Update all feeds in planet
@@ -98,14 +102,22 @@
// Build context with current date
VelocityContext context = new VelocityContext();
context.put("date", new Date());
- context.put("utilities", new Utilities());
+ context.put("utils", new UtilitiesModel());
+ context.put("utilities", new OldUtilities());
context.put("planet", new StaticPlanetModel());
- // Ensure that output directory exists
+ // Ensure that output directories exists, one for each group
File outputDirObj = new File(outputDir);
if (!outputDirObj.exists()) outputDirObj.mkdirs();
+ List groups = planetManager.getGroupHandles();
+ for (Iterator it = groups.iterator(); it.hasNext();) {
+ String groupHandle = (String) it.next();
+ String groupDirName = outputDirObj + File.separator + groupHandle;
+ File groupDir = new File(groupDirName);
+ if (!groupDir.exists()) groupDir.mkdirs();
+ }
- // Execute mainPage Texen control template
+ // Generate files: execute control template
Generator generator = Generator.getInstance();
generator.setVelocityEngine(engine);
generator.setOutputEncoding("utf-8");
@@ -116,7 +128,7 @@
generator.shutdown();
} catch (Exception e) {
- throw new RollerException("Writing planet files",e);
+ throw new RollerException("ERROR: writing planet files",e);
}
}
}
Modified: incubator/roller/trunk/sandbox/planetroller/templates/control.vm
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/sandbox/planetroller/templates/control.vm?view=diff&rev=465665&r1=465664&r2=465665
==============================================================================
--- incubator/roller/trunk/sandbox/planetroller/templates/control.vm (original)
+++ incubator/roller/trunk/sandbox/planetroller/templates/control.vm Thu Oct 19 08:51:22 2006
@@ -1,10 +1,13 @@
#set ($groupHandles = $planet.groupHandles)
+#set ($outputPath = $generator.getOutputPath())
#foreach ($groupHandle in $groupHandles)
- #set ($outputFile = $strings.concat([$groupHandle, ".html"]))
+ #set ($groupPath = $strings.concat([$outputPath, "/", $groupHandle]))
+ $generator.setOutputPath($groupPath);
+ #set ($outputFile = $strings.concat(["index", ".html"]))
$generator.parse("html.vm", $outputFile, "groupHandle", $groupHandle)
- #set ($outputFile = $strings.concat([$groupHandle, ".rss"]))
+ #set ($outputFile = $strings.concat(["index", ".rss"]))
$generator.parse("rss.vm", $outputFile, "groupHandle", $groupHandle)
- #set ($outputFile = $strings.concat([$groupHandle, ".opml"]))
+ #set ($outputFile = $strings.concat(["index", ".opml"]))
$generator.parse("opml.vm", $outputFile, "groupHandle", $groupHandle)
#end
-ê
\ No newline at end of file
+?
\ No newline at end of file
Modified: incubator/roller/trunk/sandbox/planetroller/templates/html.vm
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/sandbox/planetroller/templates/html.vm?view=diff&rev=465665&r1=465664&r2=465665
==============================================================================
--- incubator/roller/trunk/sandbox/planetroller/templates/html.vm (original)
+++ incubator/roller/trunk/sandbox/planetroller/templates/html.vm Thu Oct 19 08:51:22 2006
@@ -1,6 +1,6 @@
<html>
#set($group = $planet.getGroup($groupHandle))
-#set($entries = $planet.getAggregation($group, 0, $group.maxPageEntries))
+#set($entries = $planet.getAggregation($group, $group.maxPageEntries))
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" >
<title>$group.title</title>
@@ -11,7 +11,7 @@
<td width="80%" valign="top">
<h1>$group.title</h1>
<p><i>$group.description<i/></p>
- <p>Last updated: $utilities.formatRfc822Date($date)</p>
+ <p>Last updated: $utils.formatRfc822Date($date)</p>
#foreach($entry in $entries)
<h2>$entry.title</h2>
Blog: $entry.subscription.title <br/>
@@ -22,9 +22,9 @@
</td>
<td width="20%" valign="top">
<h3>Other formats</h3>
- <a href="$planet.configuration.siteUrl/${groupHandle}.rss">
+ <a href="$planet.configuration.siteURL/${groupHandle}/index.rss">
<img src="rss20.png" alt="RSS 2.0 Feed" border="0"></a><p />
- <a href="$planet.configuration.siteUrl/${groupHandle}.opml">
+ <a href="$planet.configuration.siteURL/${groupHandle}/index.opml">
<img src="opml.png" alt="OPML Subscriptions" border="0"></a>
<h3>Subscriptions</h3>
#foreach ($sub in $group.subscriptions)
Modified: incubator/roller/trunk/sandbox/planetroller/templates/opml.vm
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/sandbox/planetroller/templates/opml.vm?view=diff&rev=465665&r1=465664&r2=465665
==============================================================================
--- incubator/roller/trunk/sandbox/planetroller/templates/opml.vm (original)
+++ incubator/roller/trunk/sandbox/planetroller/templates/opml.vm Thu Oct 19 08:51:22 2006
@@ -3,16 +3,16 @@
<opml version="1.1">
<head>
<title>$group.description</title>
- <dateCreated>$utilities.formatRfc822Date($date)</dateCreated>
- <dateModified>$utilities.formatRfc822Date($date)</dateModified>
+ <dateCreated>$utils.formatRfc822Date($date)</dateCreated>
+ <dateModified>$utils.formatRfc822Date($date)</dateModified>
<ownerName>$planet.configuration.adminName</ownerName>
<ownerEmail>$planet.configuration.adminEmail</ownerEmail>
</head>
<body>
#foreach($sub in $group.subscriptions)
- <outline text="$utilities.textToHTML($sub.title)"
- xmlUrl="$utilities.textToHTML($sub.feedUrl)"
- htmlUrl="$utilities.textToHTML($sub.siteUrl)" />
+ <outline text="$utils.escapeXML($sub.title)"
+ xmlUrl="$utils.escapeXML($sub.feedURL)"
+ htmlUrl="$utils.escapeXML($sub.siteURL)" />
#end
</body>
</opml>
Modified: incubator/roller/trunk/sandbox/planetroller/templates/rss.vm
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/sandbox/planetroller/templates/rss.vm?view=diff&rev=465665&r1=465664&r2=465665
==============================================================================
--- incubator/roller/trunk/sandbox/planetroller/templates/rss.vm (original)
+++ incubator/roller/trunk/sandbox/planetroller/templates/rss.vm Thu Oct 19 08:51:22 2006
@@ -2,26 +2,26 @@
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
#set($group = $planet.getGroup($groupHandle))
- <title>$utilities.textToHTML($group.title,true)</title>
- <link>$utilities.textToHTML(${planet.configuration.siteUrl})/${group.handle}.html</link>
- <description>$utilities.textToHTML($group.description,true)</description>
- <lastBuildDate>$utilities.formatRfc822Date($date)</lastBuildDate>
- <generator>Roller Planet 1.1-dev</generator>
+ <title>$utils.escapeXML($group.title)</title>
+ <link>$utils.escapeXML(${planet.configuration.siteURL})/${group.handle}.html</link>
+ <description>$utils.escapeXML($group.description)</description>
+ <lastBuildDate>$utils.formatRfc822Date($date)</lastBuildDate>
+ <generator>Planet Roller</generator>
#set($entries = $planet.getAggregation($group, $group.maxFeedEntries))
#foreach( $entry in $entries )
<item>
- #if($entry.title)<title>$utilities.textToHTML($entry.title,true)</title> #end
+ #if($entry.title)<title>$utils.escapeXML($entry.title)</title> #end
#if($entry.content)
- <description>$utilities.textToHTML($entry.content,true)</description> #end
+ <description>$utils.escapeXML($entry.content)</description> #end
#if($entry.categories)
#foreach($cat in $entry.categories)
- <category>$utilities.textToHTML($cat,true)</category>
+ <category>$utils.escapeXML($cat)</category>
#end
#end
- #if($entry.permalink)<link>$utilities.textToHTML($entry.permalink)</link> #end
- <pubDate>$utilities.formatRfc822Date($entry.published)</pubDate>
+ #if($entry.permalink)<link>$utils.escapeXML($entry.permalink)</link> #end
+ <pubDate>$utils.formatRfc822Date($entry.published)</pubDate>
#if($entry.author)
- <dc:creator>$utilities.textToHTML($entry.author,true)</dc:creator>
+ <dc:creator>$utils.escapeXML($entry.author)</dc:creator>
#end
</item>
#end
Modified: incubator/roller/trunk/src/org/apache/roller/planet/pojos/PlanetEntryData.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/planet/pojos/PlanetEntryData.java?view=diff&rev=465665&r1=465664&r2=465665
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/planet/pojos/PlanetEntryData.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/planet/pojos/PlanetEntryData.java Thu Oct 19 08:51:22 2006
@@ -408,6 +408,37 @@
public void setWebsite() {
// noop
}
+
+ /**
+ * Return text as content, to maintain compatibility with PlanetTool templates.
+ */
+ public String getContent() {
+ return text;
+ }
+ public void setContent(String ignored) {
+ // no-op
+ }
+
+ /**
+ * Return updateTime as updated, to maintain compatibility with PlanetTool templates.
+ */
+ public Timestamp getUpdated() {
+ return updated;
+ }
+ public void setUpdated(Timestamp ignored) {
+ // no-op
+ }
+
+ /**
+ * Return pubTime as published, to maintain compatibility with PlanetTool templates.
+ */
+ public Timestamp getPublished() {
+ return published;
+ }
+ public void setPublished(Timestamp ignored) {
+ // no-op
+ }
+
}