[jboss-svn-commits] JBL Code SVN: r10219 - in labs/shotoku/trunk/shotoku-feeds: lib and 9 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Mar 15 07:21:34 EDT 2007
Author: adamw
Date: 2007-03-15 07:21:34 -0400 (Thu, 15 Mar 2007)
New Revision: 10219
Added:
labs/shotoku/trunk/shotoku-feeds/lib/jboss-blog-common.jar
labs/shotoku/trunk/shotoku-feeds/lib/rome-0.9.jar
Removed:
labs/shotoku/trunk/shotoku-feeds/src/etc/
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/comments/
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/CommentableFeed.java
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/ShotokuCommentableFeed.java
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/model/
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/special/CommentFeed.java
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/special/ConcreteCommentFeed.java
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/special/Rss2CommentFeed.java
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/rome/
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/CommentFeedTagHandler.java
labs/shotoku/trunk/shotoku-feeds/src/rome/
labs/shotoku/trunk/shotoku-feeds/src/web/index.jsp
Modified:
labs/shotoku/trunk/shotoku-feeds/maven.xml
labs/shotoku/trunk/shotoku-feeds/project.properties
labs/shotoku/trunk/shotoku-feeds/project.xml
labs/shotoku/trunk/shotoku-feeds/shotoku-feeds.iml
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/FeedFactory.java
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/FeedsDescriptor.java
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/FeedsService.java
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/AbstractFeed.java
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/DummyFeed.java
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/Feed.java
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/FeedParsing.java
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/InformaBasedFeed.java
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/NormalFeed.java
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/RomeBasedFeed.java
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/special/ConcreteTagFeed.java
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/special/TagFeed.java
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/service/FeedsServiceImpl.java
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/FeedTagHandlerManager.java
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/ShotokuFeedTagHandler.java
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tools/FeedDefAttributes.java
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tools/FeedsConstants.java
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tools/FeedsTools.java
labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tools/TextEscaping.java
labs/shotoku/trunk/shotoku-feeds/src/web/WEB-INF/web.xml
Log:
New feeds
Added: labs/shotoku/trunk/shotoku-feeds/lib/jboss-blog-common.jar
===================================================================
(Binary files differ)
Property changes on: labs/shotoku/trunk/shotoku-feeds/lib/jboss-blog-common.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: labs/shotoku/trunk/shotoku-feeds/lib/rome-0.9.jar
===================================================================
(Binary files differ)
Property changes on: labs/shotoku/trunk/shotoku-feeds/lib/rome-0.9.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: labs/shotoku/trunk/shotoku-feeds/maven.xml
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/maven.xml 2007-03-15 08:26:39 UTC (rev 10218)
+++ labs/shotoku/trunk/shotoku-feeds/maven.xml 2007-03-15 11:21:34 UTC (rev 10219)
@@ -10,11 +10,6 @@
<attainGoal name="java:compile" />
<attainGoal name="ejb" />
<attainGoal name="war" />
-
- <!-- Building the rome plugins jar -->
- <j:set var="maven.jar.includes" value="**/CommentRssModule*" />
- <j:set var="maven.final.name" value="rome-plugins" />
- <attainGoal name="jar" />
</goal>
<goal name="deploy">
@@ -25,13 +20,8 @@
file="target/shotoku-feeds.war"
todir="${local.deploy.dir}" />
- <!-- Copying the rome plugins jar -->
<ant:copy
todir="${shotoku.jar.dest}" overwrite="true"
- file="target/rome-plugins.jar" />
-
- <ant:copy
- todir="${shotoku.jar.dest}" overwrite="true"
file="${maven.repo.local}/jdom/jars/jdom-1.0.jar" />
<ant:copy
todir="${shotoku.jar.dest}" overwrite="true"
@@ -46,16 +36,12 @@
<ant:copy
todir="${shotoku.jar.dest}" overwrite="true"
file="lib/informa.jar" />
-
<ant:copy
todir="${shotoku.jar.dest}" overwrite="true"
- file="lib/rome-0.7.jar" />
- <j:set var="jar.to.dir" value="${shotoku.jar.dest}/rome-0.7.jar" />
- <attainGoal name="jar-to-dir" />
- <ant:copy todir="${shotoku.jar.dest}/rome-0.7.jar/com/sun/syndication"
- overwrite="true"
- file="src/rome/rome.properties" />
- <attainGoal name="dir-to-jar" />
+ file="lib/rome-0.9.jar" />
+ <ant:copy
+ todir="${shotoku.jar.dest}" overwrite="true"
+ file="lib/jboss-blog-common.jar" />
</goal>
<goal name="clean">
Modified: labs/shotoku/trunk/shotoku-feeds/project.properties
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/project.properties 2007-03-15 08:26:39 UTC (rev 10218)
+++ labs/shotoku/trunk/shotoku-feeds/project.properties 2007-03-15 11:21:34 UTC (rev 10219)
@@ -6,7 +6,8 @@
maven.jar.override=on
maven.jar.informa=${shotoku.root.dir}/shotoku-feeds/lib/informa.jar
-maven.jar.rome=${shotoku.root.dir}/shotoku-feeds/lib/rome-0.7.jar
+maven.jar.rome=${shotoku.root.dir}/shotoku-feeds/lib/rome-0.9.jar
+maven.jar.blog-common=${shotoku.root.dir}/shotoku-feeds/lib/jboss-blog-common.jar
maven.war.classes.includes=**/*Servlet*
maven.ejb.excludes=**/*Servlet*,**/CommentRssModule*
Modified: labs/shotoku/trunk/shotoku-feeds/project.xml
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/project.xml 2007-03-15 08:26:39 UTC (rev 10218)
+++ labs/shotoku/trunk/shotoku-feeds/project.xml 2007-03-15 11:21:34 UTC (rev 10219)
@@ -50,11 +50,18 @@
<dependency>
<groupId>rome</groupId>
<artifactId>rome</artifactId>
- <version>0.7</version>
- <jar>rome-0.7.jar</jar>
+ <version>0.9</version>
+ <jar>rome-0.9.jar</jar>
</dependency>
<dependency>
+ <groupId>blog-common</groupId>
+ <artifactId>blog-common</artifactId>
+ <version>1.0</version>
+ <jar>jboss-blog-common.jar</jar>
+ </dependency>
+
+ <dependency>
<groupId>informa</groupId>
<artifactId>informa</artifactId>
<version>0.6.5</version>
Modified: labs/shotoku/trunk/shotoku-feeds/shotoku-feeds.iml
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/shotoku-feeds.iml 2007-03-15 08:26:39 UTC (rev 10218)
+++ labs/shotoku/trunk/shotoku-feeds/shotoku-feeds.iml 2007-03-15 11:21:34 UTC (rev 10219)
@@ -17,6 +17,25 @@
<orderEntry type="library" name="junit" level="application" />
<orderEntry type="library" name="feeds" level="application" />
<orderEntry type="library" name="portlet" level="application" />
+ <orderEntry type="library" name="feeds" level="application" />
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/rome-0.9.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/jboss-blog-common.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
<orderEntryProperties />
</component>
</module>
Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/FeedFactory.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/FeedFactory.java 2007-03-15 08:26:39 UTC (rev 10218)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/FeedFactory.java 2007-03-15 11:21:34 UTC (rev 10219)
@@ -23,7 +23,6 @@
import org.jboss.shotoku.feeds.data.*;
import org.jboss.shotoku.feeds.data.special.Rss2TagFeed;
-import org.jboss.shotoku.feeds.data.special.Rss2CommentFeed;
import org.jboss.shotoku.feeds.tools.FeedsConstants;
import java.io.File;
@@ -57,12 +56,6 @@
tagsSpecialFeedClasses);
tagsSpecialFeedClasses.put("rss2", Rss2TagFeed.class);
- Map<String, Class> commentsSpecialFeedClasses =
- new HashMap<String, Class>();
- specialFeedClasses.put(FeedsConstants.COMMENTS_SPECIAL_FEED,
- commentsSpecialFeedClasses);
- commentsSpecialFeedClasses.put("rss2", Rss2CommentFeed.class);
-
random = new Random();
}
Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/FeedsDescriptor.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/FeedsDescriptor.java 2007-03-15 08:26:39 UTC (rev 10218)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/FeedsDescriptor.java 2007-03-15 11:21:34 UTC (rev 10219)
@@ -34,7 +34,6 @@
import org.jboss.shotoku.feeds.data.NormalFeed;
import org.jboss.shotoku.feeds.data.special.SpecialFeed;
import org.jboss.shotoku.feeds.data.Feed;
-import org.jboss.shotoku.feeds.data.CommentableFeed;
import org.jboss.shotoku.feeds.variables.VariableResolverManager;
import org.jboss.shotoku.feeds.tag.FeedTagHandler;
import org.jboss.shotoku.feeds.tag.FeedTagHandlerManager;
@@ -72,12 +71,6 @@
private Map<String, Map<String, SpecialFeed>> specialFeeds;
/**
- * Commentable feeds: feed name prefix -> (feed type ->
- * commentable feed).
- */
- private Map<String, Map<String, CommentableFeed>> commentableFeeds;
-
- /**
* Properties: sets of attributes which can be used in
* feeds.
*/
@@ -125,7 +118,6 @@
// Creating the maps that will hold the feeds.
feeds = new HashMap<String, Map<String, NormalFeed>>();
specialFeeds = new HashMap<String, Map<String, SpecialFeed>>();
- commentableFeeds = new HashMap<String, Map<String, CommentableFeed>>();
attributes = new HashMap<String, Map<String, Object>>();
// Looking for file containing feed definitons and filling the maps.
@@ -209,25 +201,6 @@
}
/**
- * Adds a ready commentable feed of the given name and type.
- * @param name
- * @param type
- * @param feed
- */
- public void addCommentableFeed(String name, String type,
- CommentableFeed feed) {
- Map<String, CommentableFeed> typesMap = commentableFeeds.get(name);
- if (typesMap == null) {
- typesMap = new HashMap<String, CommentableFeed>();
- commentableFeeds.put(name, typesMap);
- }
-
- typesMap.put(type, feed);
-
- addFeed(name, type, feed);
- }
-
- /**
* Adds a ready special feed of the given name and type.
* @param name
* @param type
@@ -306,30 +279,6 @@
}
/**
- * Gets a commentable feed of the given type and name.
- * @param name Name of the feed to get.
- * @param type Type of the feed to get.
- * @return Commentable feed with the given name and type.
- */
- public CommentableFeed getCommentableFeed(String name, String type)
- throws FeedDoesNotExistException {
- Map<String, CommentableFeed> feedTypes = commentableFeeds.get(name);
- if (feedTypes == null) {
- throw new FeedDoesNotExistException("Commentable feed " + name +
- " does not exist.");
- }
-
- CommentableFeed feed = feedTypes.get(type);
-
- if (feed == null) {
- throw new FeedDoesNotExistException("Commentable feed " + name +
- " exists, but not with type " + type + ".");
- }
-
- return feed;
- }
-
- /**
* Gets a feed (any - special or normal) of the given type and name.
* @param name Name of the feed to get.
* @param type Type of the feed to get.
Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/FeedsService.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/FeedsService.java 2007-03-15 08:26:39 UTC (rev 10218)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/FeedsService.java 2007-03-15 11:21:34 UTC (rev 10219)
@@ -2,7 +2,6 @@
import org.jboss.shotoku.service.AdministratedService;
import org.jboss.shotoku.feeds.data.Feed;
-import org.jboss.shotoku.feeds.data.CommentableFeed;
import org.jboss.shotoku.feeds.exceptions.FeedDoesNotExistException;
/**
@@ -12,7 +11,4 @@
public String getProperty(String id, String name);
public Feed getFeed(String id, String name, String type)
throws FeedDoesNotExistException;
- public CommentableFeed getCommentableFeed(String id, String name,
- String type)
- throws FeedDoesNotExistException;
}
Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/AbstractFeed.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/AbstractFeed.java 2007-03-15 08:26:39 UTC (rev 10218)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/AbstractFeed.java 2007-03-15 11:21:34 UTC (rev 10219)
@@ -1,12 +1,7 @@
package org.jboss.shotoku.feeds.data;
-import org.jboss.shotoku.feeds.tools.FeedDefAttributes;
-
import java.util.Map;
-import static org.jboss.shotoku.feeds.tools.FeedDefAttributes.EntriesExpandMode;
-import org.jboss.shotoku.tools.Tools;
-
/**
* @author Adam Warski (adamw at aster.pl)
*/
@@ -16,9 +11,6 @@
private String displayName;
private String type;
private Map<String, Object> attributes;
- private Integer entriesVisible;
- private EntriesExpandMode entriesExpandMode;
- private Boolean entriesExpanded;
private String guid;
protected AbstractFeed(String id, String name, String displayName,
@@ -50,44 +42,6 @@
return attributes;
}
- public int getEntriesVisible() {
- if (entriesVisible == null) {
- try {
- entriesVisible = Integer.parseInt(Tools.toStringNotNull(
- attributes.get(
- FeedDefAttributes.ENTRIES_VISIBLE_ATTR)));
- } catch (NumberFormatException e) {
- entriesVisible = FeedDefAttributes.ENTRIES_VISIBLE_DEFAULT;
- }
- }
-
- return entriesVisible;
- }
-
- public EntriesExpandMode getEntriesExpandMode() {
- if (entriesExpandMode == null) {
- try {
- entriesExpandMode = EntriesExpandMode.valueOf(
- Tools.toStringNotNull(attributes.get(
- FeedDefAttributes.ENTRIES_EXPAND_MODE_ATTR)));
- } catch (IllegalArgumentException e) {
- entriesExpandMode =
- FeedDefAttributes.ENTRIES_EXPAND_MODE_DEFAULT;
- }
- }
-
- return entriesExpandMode;
- }
-
- public boolean getEntriesExpanded() {
- if (entriesExpanded == null) {
- entriesExpanded = Tools.isTrue(Tools.toStringNotNull(
- attributes.get(FeedDefAttributes.ENTRIES_EXPANDED_ATTR)));
- }
-
- return entriesExpanded;
- }
-
public String getGuid() {
if (guid == null) {
guid = getId() + "/" + getName() + "/" + getType() + "/";
Deleted: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/CommentableFeed.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/CommentableFeed.java 2007-03-15 08:26:39 UTC (rev 10218)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/CommentableFeed.java 2007-03-15 11:21:34 UTC (rev 10219)
@@ -1,80 +0,0 @@
-package org.jboss.shotoku.feeds.data;
-
-import org.jboss.shotoku.feeds.comments.exceptions.UnauthorizedToCommentException;
-import org.jboss.shotoku.feeds.comments.exceptions.CommentsNotAvialableException;
-import org.jboss.shotoku.feeds.comments.exceptions.CommentableFeedDoesNotExistException;
-import org.jboss.shotoku.feeds.exceptions.FeedDoesNotExistException;
-
-/**
- * @author Adam Warski (adamw at aster.pl)
- */
-public interface CommentableFeed extends NormalFeed {
- /**
- * Checks if commenting is at all available for this feed.
- * @return True iff commenting of feed entries is at all
- * available for this feed.
- */
- public boolean getCommentsEnabled();
-
- /**
- * Checks if a specified user can add comments to entries
- * of this feed.
- * @param username Name of the user to check.
- * @return True iff the specified user can add comments to
- * entries of this feed.
- */
- public boolean getUserCanAddComments(String username);
-
- /**
- * Checks if comments to entries of this feed are moderated, that is,
- * need to be approved before being visible in the comments feed.
- * @return True if comments to entries of this feed are moderated.
- */
- public boolean getCommentsModerated();
-
- /**
- * Checks if a specified user can moderate comments to entries
- * of this feed.
- * @param username Name of the user to check.
- * @return True iff the specified user can moderate comments to
- * entries of this feed.
- */
- public boolean getUserModerateComments(String username);
-
- /**
- * Checks if a specified feed entry exists.
- * @param feedEntry Identifier of the entry to check.
- * @return True if a feed entry identified by <code>feedEntry</code>
- * exists.
- */
- public boolean getFeedEntryExists(String feedEntry);
-
- /**
- * Adds a comment to a specified feed entry.
- * @param feedEntry Identifier of an entry to which the comment should
- * be added. What <code>feedEntry</code> is depends on the comments
- * implementation. Most typically it is the guid.
- * @param username Name of the user which adds the comments.
- * @param title
- * @param content
- * @param userIp
- * @throws org.jboss.shotoku.feeds.comments.exceptions.UnauthorizedToCommentException
- * @throws org.jboss.shotoku.feeds.comments.exceptions.CommentsNotAvialableException
- * @throws org.jboss.shotoku.feeds.comments.exceptions.CommentableFeedDoesNotExistException
- */
- public void addComment(String feedEntry, String username, String title,
- String content, String userIp)
- throws UnauthorizedToCommentException,
- CommentsNotAvialableException, CommentableFeedDoesNotExistException;
-
- /**
- * Gets a feed of comments to a specific feed element.
- * @param feedEntry Identifier of an entry for which the comments should
- * be read. What <code>feedEntry</code> is depends on the comments
- * implementation. Most typically it is the guid.
- * @return A feed of comments to a specified element.
- * @throws FeedDoesNotExistException
- */
- public Feed getCommentFeed(String feedEntry)
- throws FeedDoesNotExistException;
-}
Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/DummyFeed.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/DummyFeed.java 2007-03-15 08:26:39 UTC (rev 10218)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/DummyFeed.java 2007-03-15 11:21:34 UTC (rev 10219)
@@ -1,8 +1,7 @@
package org.jboss.shotoku.feeds.data;
-import org.jboss.shotoku.feeds.data.model.FeedEntries;
-import org.jboss.shotoku.feeds.data.model.DummyFeedEntries;
-import org.jboss.shotoku.feeds.tools.FeedDefAttributes;
+import org.jboss.blog.model.BlogModel;
+import org.jboss.blog.model.impl.EmptyBlogModel;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -49,22 +48,10 @@
return new HashMap<String, Object>();
}
- public FeedEntries getFeedEntries() {
- return new DummyFeedEntries();
+ public BlogModel getBlogModel() {
+ return new EmptyBlogModel();
}
- public int getEntriesVisible() {
- return 0;
- }
-
- public boolean getEntriesExpanded() {
- return false;
- }
-
- public FeedDefAttributes.EntriesExpandMode getEntriesExpandMode() {
- return FeedDefAttributes.EntriesExpandMode.TOP;
- }
-
public String getGuid() {
return null;
}
Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/Feed.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/Feed.java 2007-03-15 08:26:39 UTC (rev 10218)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/Feed.java 2007-03-15 11:21:34 UTC (rev 10219)
@@ -1,7 +1,6 @@
package org.jboss.shotoku.feeds.data;
-import org.jboss.shotoku.feeds.data.model.FeedEntries;
-import org.jboss.shotoku.feeds.tools.FeedDefAttributes;
+import org.jboss.blog.model.BlogModel;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletRequest;
@@ -72,31 +71,9 @@
* normal feeds.
* @return Entries of this feed.
*/
- public FeedEntries getFeedEntries();
+ public BlogModel getBlogModel();
/**
- * Gets the number of entries that should be shown when displaying
- * this feed, as stated in attributes.
- * @return Number of entries that should be shown on one page.
- */
- public int getEntriesVisible();
-
- /**
- * Checks if entries should be displayed expanded when displaying
- * this feed, as stated in attributes.
- * @return True iff entries should be shown expanded on the page.
- */
- public boolean getEntriesExpanded();
-
- /**
- * Gets the default expand mode of entries for this feed. Only
- * valid if {@see getEntriesExpanded()} return <code>false</code>.
- * @return Mode in which selected entries of this feed should be
- * shown when displaying.
- */
- public FeedDefAttributes.EntriesExpandMode getEntriesExpandMode();
-
- /**
* Gets a unique identifier of this feed.
* @return A unique identifier of this feed.
*/
Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/FeedParsing.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/FeedParsing.java 2007-03-15 08:26:39 UTC (rev 10218)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/FeedParsing.java 2007-03-15 11:21:34 UTC (rev 10219)
@@ -1,9 +1,12 @@
package org.jboss.shotoku.feeds.data;
-import org.jboss.shotoku.feeds.data.model.FeedEntries;
-import org.jboss.shotoku.feeds.data.model.FeedEntry;
-import org.jboss.shotoku.feeds.rome.CommentRssModule;
import org.jboss.shotoku.tools.Tools;
+import org.jboss.blog.model.BlogPost;
+import org.jboss.blog.model.BlogModel;
+import org.jboss.blog.model.impl.BlogModelImpl;
+import org.jboss.blog.model.impl.BlogPostImpl;
+import org.jboss.blog.model.impl.BlogAuthorImpl;
+import org.jboss.blog.rome.CommentRssModule;
import java.io.InputStream;
import java.io.IOException;
@@ -24,9 +27,9 @@
* @author Adam Warski (adamw at aster.pl)
*/
public class FeedParsing {
- private final static Comparator<FeedEntry> feedEntryComparator =
- new Comparator<FeedEntry>() {
- public int compare(FeedEntry o1, FeedEntry o2) {
+ private final static Comparator<BlogPost> blogPostsComparator =
+ new Comparator<BlogPost>() {
+ public int compare(BlogPost o1, BlogPost o2) {
Date date1 = o1.getCreated();
Date date2 = o2.getCreated();
if ((date1 == null) && (date2 == null)) return 0;
@@ -36,13 +39,13 @@
}
};
- public static FeedEntries parseWithRome(InputStream is)
+ public static BlogModel parseWithRome(InputStream is)
throws IOException, FeedException {
// Parsing the generated feed.
SyndFeedInput input = new SyndFeedInput();
SyndFeed inFeed = input.build(new XmlReader(is));
- List<FeedEntry> entries = new ArrayList<FeedEntry>();
+ List<BlogPost> posts = new ArrayList<BlogPost>();
String defaultAuthor = inFeed.getAuthor();
for (Object o : inFeed.getEntries()) {
@@ -60,45 +63,50 @@
}
String author = entry.getAuthor();
- entries.add(new FeedEntry(
- Tools.isEmpty(author) ? defaultAuthor : author,
+ author = Tools.isEmpty(author) ? defaultAuthor : author;
+ // TODO: categories
+ posts.add(new BlogPostImpl(new BlogAuthorImpl(author, author, null),
entry.getTitle(), entry.getDescription().getValue(),
- entry.getPublishedDate(), entry.getLink(),
- entry.getUri(), commentsRss));
+ entry.getPublishedDate(), entry.getLink(), entry.getUri(),
+ null, commentsRss, null));
}
- Collections.sort(entries, feedEntryComparator);
+ Collections.sort(posts, blogPostsComparator);
- return new FeedEntries(inFeed.getAuthor(), inFeed.getTitle(),
- inFeed.getDescription(), inFeed.getPublishedDate(),
- inFeed.getLink(), entries);
+ // TODO: categories
+ return new BlogModelImpl(new BlogAuthorImpl(inFeed.getAuthor(), inFeed.getAuthor(), null),
+ inFeed.getTitle(), inFeed.getDescription(), inFeed.getLink(),
+ inFeed.getPublishedDate(), posts, null);
}
- public static FeedEntries parseWithInforma(InputStream is)
+ public static BlogModel parseWithInforma(InputStream is)
throws IOException, ParseException {
// Parsing the generated feed.
ChannelBuilder builder = new ChannelBuilder();
ChannelIF childChannel =
FeedParser.parse(builder, is);
- List<FeedEntry> entries = new ArrayList<FeedEntry>();
+ List<BlogPost> posts = new ArrayList<BlogPost>();
String defaultAuthor = childChannel.getCreator();
for (Object o : childChannel.getItems()) {
ItemIF nextItem = (ItemIF) o;
String author = nextItem.getCreator();
- entries.add(new FeedEntry(
- Tools.isEmpty(author) ? defaultAuthor : author,
+ author = Tools.isEmpty(author) ? defaultAuthor : author;
+
+ // TODO: categories
+ posts.add(new BlogPostImpl(new BlogAuthorImpl(author, author, null),
nextItem.getTitle(), nextItem.getDescription(),
nextItem.getDate(), nextItem.getLink().toString(),
- nextItem.getGuid().getLocation(), ""));
+ nextItem.getGuid().getLocation(), null, null, null));
}
- Collections.sort(entries, feedEntryComparator);
+ Collections.sort(posts, blogPostsComparator);
- return new FeedEntries(childChannel.getCreator(),
- childChannel.getTitle(), childChannel.getDescription(),
- childChannel.getPubDate(),
- "", entries);
+ // TODO: categories
+ return new BlogModelImpl(
+ new BlogAuthorImpl(childChannel.getCreator(), childChannel.getCreator(), null),
+ childChannel.getTitle(), childChannel.getDescription(), null,
+ childChannel.getPubDate(), posts, null);
}
}
Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/InformaBasedFeed.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/InformaBasedFeed.java 2007-03-15 08:26:39 UTC (rev 10218)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/InformaBasedFeed.java 2007-03-15 11:21:34 UTC (rev 10219)
@@ -12,9 +12,8 @@
import de.nava.informa.impl.basic.ChannelBuilder;
import de.nava.informa.parsers.FeedParser;
import de.nava.informa.utils.ItemComparator;
-import org.jboss.shotoku.feeds.data.model.FeedEntries;
-import org.jboss.shotoku.feeds.data.model.FeedEntry;
-import org.jboss.shotoku.feeds.data.model.DummyFeedEntries;
+import org.jboss.blog.model.BlogModel;
+import org.jboss.blog.model.impl.EmptyBlogModel;
public abstract class InformaBasedFeed extends FileBasedFeed {
public InformaBasedFeed(String id, String name, String displayName,
@@ -72,12 +71,11 @@
getExporter().write(newChannel);
}
- public FeedEntries getFeedEntries() {
+ public BlogModel getBlogModel() {
try {
return FeedParsing.parseWithInforma(getInputStream());
} catch (Exception e) {
- return new DummyFeedEntries("Error generating feed entries",
- e.getMessage());
+ return new EmptyBlogModel();
}
}
}
Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/NormalFeed.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/NormalFeed.java 2007-03-15 08:26:39 UTC (rev 10218)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/NormalFeed.java 2007-03-15 11:21:34 UTC (rev 10219)
@@ -23,7 +23,6 @@
import java.io.IOException;
import java.io.InputStream;
-import java.io.OutputStream;
import java.io.Writer;
import java.net.URL;
Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/RomeBasedFeed.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/RomeBasedFeed.java 2007-03-15 08:26:39 UTC (rev 10218)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/RomeBasedFeed.java 2007-03-15 11:21:34 UTC (rev 10219)
@@ -32,10 +32,8 @@
import com.sun.syndication.io.SyndFeedInput;
import com.sun.syndication.io.SyndFeedOutput;
import com.sun.syndication.io.XmlReader;
-import org.jboss.shotoku.feeds.data.model.FeedEntries;
-import org.jboss.shotoku.feeds.data.model.FeedEntry;
-import org.jboss.shotoku.feeds.data.model.DummyFeedEntries;
-import org.jboss.shotoku.feeds.rome.CommentRssModule;
+import org.jboss.blog.model.BlogModel;
+import org.jboss.blog.model.impl.EmptyBlogModel;
public abstract class RomeBasedFeed extends FileBasedFeed {
public RomeBasedFeed(String id, String name, String displayName,
@@ -110,12 +108,11 @@
}
}
- public FeedEntries getFeedEntries() {
+ public BlogModel getBlogModel() {
try {
return FeedParsing.parseWithRome(getInputStream());
} catch (Exception e) {
- return new DummyFeedEntries("Error generating feed entries",
- e.getMessage());
+ return new EmptyBlogModel();
}
}
}
Deleted: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/ShotokuCommentableFeed.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/ShotokuCommentableFeed.java 2007-03-15 08:26:39 UTC (rev 10218)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/ShotokuCommentableFeed.java 2007-03-15 11:21:34 UTC (rev 10219)
@@ -1,210 +0,0 @@
-package org.jboss.shotoku.feeds.data;
-
-import org.jboss.shotoku.NodeList;
-import org.jboss.shotoku.Node;
-import org.jboss.shotoku.feeds.data.model.FeedEntries;
-import org.jboss.shotoku.feeds.tools.FeedsTools;
-import org.jboss.shotoku.feeds.tools.FeedDefAttributes;
-import org.jboss.shotoku.feeds.comments.exceptions.UnauthorizedToCommentException;
-import org.jboss.shotoku.feeds.comments.exceptions.CommentsNotAvialableException;
-import org.jboss.shotoku.feeds.comments.exceptions.CommentableFeedDoesNotExistException;
-import org.jboss.shotoku.feeds.exceptions.FeedDoesNotExistException;
-import org.jboss.shotoku.tools.Tools;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.net.URL;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Writer;
-import java.io.OutputStream;
-import java.util.List;
-import java.util.Arrays;
-import java.util.Map;
-
-/**
- * @author Adam Warski (adamw at aster.pl)
- */
-public class ShotokuCommentableFeed implements CommentableFeed {
- private NormalFeed nf;
-
- private boolean commentsEnabled;
- private List<String> groupsAllowedToModerate;
- private boolean commentsModerated;
- private NodeList feedElements;
- private boolean requireLoggedInUsers;
-
- public ShotokuCommentableFeed(NormalFeed nf, NodeList feedElements) {
- this.nf = nf;
- this.feedElements = feedElements;
-
- commentsEnabled = Tools.isTrue(
- Tools.toString(getAttributes().get("commentsEnabled")));
- commentsModerated = Tools.isTrue(
- Tools.toString(getAttributes().get("commentsModerated")));
- groupsAllowedToModerate = Arrays.asList(
- Tools.toStringNotNull(
- getAttributes().get("moderators")).split("[,]"));
- requireLoggedInUsers = Tools.isTrue(
- Tools.toString(getAttributes().get("requireLoginToComment")));
- }
-
- /*
- * Comments methods.
- */
-
- public boolean getCommentsEnabled() {
- return commentsEnabled;
- }
-
- public boolean getCommentsModerated() {
- return commentsModerated;
- }
-
- public boolean getUserModerateComments(String username) {
- //TODO
- /*for (String group : groupsAllowedToModerate) {
- try {
- if (UserTools.getService().getUser(username).isInGroup(group)) {
- return true;
- }
- } catch (UserNotFoundException e) {
- return false;
- }
- }*/
-
- return false;
- }
-
- public boolean getFeedEntryExists(String feedElement) {
- return getNodeForFeedElement(feedElement) != null;
- }
-
- public Node getNodeForFeedElement(String feedElement) {
- String path = Tools.normalizeSlashes(feedElement, false);
- for (Node n : feedElements) {
- if (n.getFullName().equals(path)) {
- return n;
- }
- }
-
- return null;
- }
-
- private String prepareFeedElement(String feedElement)
- throws CommentableFeedDoesNotExistException {
- // It may be possible that the feed element is a full URL,
- // so we have to cut off the unnecessary part.
- if (Tools.isOutsideLink(feedElement)) {
- try {
- int i = feedElement.indexOf(':');
- feedElement = feedElement.substring(i+3);
- i = feedElement.indexOf('/');
- feedElement = feedElement.substring(i+1);
- } catch (IndexOutOfBoundsException e) {
- throw new CommentableFeedDoesNotExistException(
- "Invalid feed element: " + feedElement + ".");
- }
- }
-
- return feedElement;
- }
-
- public void addComment(String feedElement, String username, String title,
- String content, String userIp)
- throws UnauthorizedToCommentException,
- CommentsNotAvialableException, CommentableFeedDoesNotExistException {
- FeedsTools.getCommentsService().addComment(nf.getId(),
- nf.getName(), prepareFeedElement(feedElement), nf.getType(),
- username, title, content, userIp);
- }
-
- public Feed getCommentFeed(String feedElement)
- throws FeedDoesNotExistException {
- return FeedsTools.getService().getFeed(nf.getId(),
- FeedsTools.getCommentsService().getCommentFeedName(
- nf.getName(), prepareFeedElement(feedElement)),
- nf.getType());
- }
-
- public boolean getUserCanAddComments(String username) {
- return commentsEnabled && ((!requireLoggedInUsers) ||
- username != null);
- }
-
- /*
- * Delegating all non-comments methods.
- */
-
- public Map<String, Object> getAttributes() {
- return nf.getAttributes();
- }
-
- public void generate(URL url) throws IOException {
- nf.generate(url);
- }
-
- public void generate(InputStream is) throws IOException {
- nf.generate(is);
- }
-
- public Writer getWriter() throws IOException {
- return nf.getWriter();
- }
-
- public void generate(NormalFeed[] feeds, String title, String description, String author, String link) throws IllegalArgumentException, IOException {
- nf.generate(feeds, title, description, author, link);
- }
-
- public InputStream getInputStream() {
- return nf.getInputStream();
- }
-
- public void write(OutputStream os, HttpServletRequest request) throws IOException {
- nf.write(os, request);
- }
-
- public void write(HttpServletResponse response, HttpServletRequest request) throws IOException {
- nf.write(response, request);
- }
-
- public String getName() {
- return nf.getName();
- }
-
- public String getDisplayName() {
- return nf.getDisplayName();
- }
-
- public String getType() {
- return nf.getType();
- }
-
- public void release() {
- nf.release();
- }
-
- public FeedEntries getFeedEntries() {
- return nf.getFeedEntries();
- }
-
- public String getId() {
- return nf.getId();
- }
-
- public FeedDefAttributes.EntriesExpandMode getEntriesExpandMode() {
- return nf.getEntriesExpandMode();
- }
-
- public boolean getEntriesExpanded() {
- return nf.getEntriesExpanded();
- }
-
- public int getEntriesVisible() {
- return nf.getEntriesVisible();
- }
-
- public String getGuid() {
- return nf.getGuid();
- }
-}
Deleted: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/special/CommentFeed.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/special/CommentFeed.java 2007-03-15 08:26:39 UTC (rev 10218)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/special/CommentFeed.java 2007-03-15 11:21:34 UTC (rev 10219)
@@ -1,169 +0,0 @@
-package org.jboss.shotoku.feeds.data.special;
-
-import org.apache.velocity.VelocityContext;
-import org.jboss.shotoku.ContentManager;
-import org.jboss.shotoku.NodeList;
-import org.jboss.shotoku.Directory;
-import org.jboss.shotoku.Node;
-import org.jboss.shotoku.search.Search;
-import org.jboss.shotoku.search.DirectoryIncludeParameter;
-import org.jboss.shotoku.search.DateSortParameter;
-import org.jboss.shotoku.search.PropertyValueParameter;
-import org.jboss.shotoku.exceptions.ResourceDoesNotExist;
-import org.jboss.shotoku.feeds.data.Feed;
-import org.jboss.shotoku.feeds.data.CommentableFeed;
-import org.jboss.shotoku.feeds.data.ShotokuCommentableFeed;
-import org.jboss.shotoku.feeds.data.AbstractFeed;
-import org.jboss.shotoku.feeds.data.model.FeedEntries;
-import org.jboss.shotoku.feeds.tools.FeedsTools;
-import org.jboss.shotoku.feeds.tools.NodesFeedsProperties;
-import org.jboss.shotoku.feeds.tools.FeedDefAttributes;
-import org.jboss.shotoku.feeds.tools.VelocityContextAttributes;
-import org.jboss.shotoku.feeds.exceptions.FeedDoesNotExistException;
-import org.jboss.shotoku.tools.Tools;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.util.Map;
-import java.util.Date;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-
-/**
- * @author Adam Warski (adamw at aster.pl)
- */
-public abstract class CommentFeed extends AbstractFeed
- implements SpecialFeed {
- private VelocityContext vcOriginal;
-
- private int nameLength;
- private ContentManager cm;
-
- public CommentFeed(String id, String name, String type,
- Map<String, Object> attributes, VelocityContext vc) {
- super(id, name, null, type, attributes);
- this.vcOriginal = vc;
-
- nameLength = name.length();
- cm = ContentManager.getContentManager(
- Tools.toString(attributes.get(FeedDefAttributes.CM_ID)),
- Tools.toString(attributes.get(FeedDefAttributes.CM_PREFIX)));
- }
-
- public Feed concretizeFeed(String fullName) {
- return new ConcreteCommentFeed(this, fullName);
- }
-
- public abstract String getContentType();
-
- private void check(boolean b) throws IOException {
- if (!b) {
- throw new IOException("Invalid comment feed request.");
- }
- }
-
- public void write(OutputStream os, String fullName) throws IOException {
- // Getting the feed for which elements feed should be generated
- // and checking if everything is ok.
- check(fullName.length() >= nameLength+1);
-
- String info = fullName.substring(nameLength+1);
-
- int lastSlash = info.lastIndexOf('/');
- check(lastSlash != -1);
- String feedName = info.substring(0, lastSlash);
- String feedElement = Tools.decodeURL(info.substring(lastSlash+1));
-
- CommentableFeed feed;
- try {
- feed = FeedsTools.getService().getCommentableFeed(
- getId(), feedName, getType());
- } catch (FeedDoesNotExistException e) {
- throw new IOException(e.getMessage());
- }
-
- check(feed.getCommentsEnabled());
- check(feed instanceof ShotokuCommentableFeed);
-
- //noinspection ConstantConditions
- ShotokuCommentableFeed scf = (ShotokuCommentableFeed) feed;
- Node commentedNode = scf.getNodeForFeedElement(feedElement);
-
- check(commentedNode != null);
-
- NodeList comments;
-
- // Generating the list of nodes that should be included.
- try {
- Directory commentDir = FeedsTools.getCommentsService().
- getCommentsDirectory(commentedNode);
-
- Search s = new Search();
- s.add(new DirectoryIncludeParameter(commentDir));
-
- if (feed.getCommentsModerated()) {
- s.add(new PropertyValueParameter(
- NodesFeedsProperties.ACCEPTED_COMMENT_NAME,
- NodesFeedsProperties.ACCEPTED_COMMENT_VALUE));
- }
-
- s.add(new DateSortParameter());
-
- comments = s.perform(commentDir.getContentManager());
- } catch (ResourceDoesNotExist e) {
- comments = new NodeList();
- }
-
- VelocityContext vc = new VelocityContext(vcOriginal);
-
- // Computing the date of the youngest comment.
- Date youngest;
- if (comments.size() == 0) {
- //noinspection ConstantConditions
- youngest = commentedNode.getCreatedDate();
- } else {
- youngest = comments.get(0).getCreatedDate();
- }
-
- vc.put("commented", commentedNode);
- vc.put(VelocityContextAttributes.YOUNGEST_ENTRY, youngest);
- vc.put(VelocityContextAttributes.FEED_AUTHOR,
- feed.getAttributes().get(FeedDefAttributes.AUTHOR));
- vc.put(VelocityContextAttributes.NODES_LIST, comments);
-
- try {
- OutputStreamWriter osw = new OutputStreamWriter(os);
- cm.getVelocityEngine().mergeTemplate(
- Tools.toString(getAttributes().get(
- FeedDefAttributes.VELOCITY_TEMPLATE)), vc, osw);
- osw.flush();
- } catch (Exception e) {
- throw new IOException(e.getMessage());
- }
- }
-
- public void write(HttpServletResponse response, String fullName)
- throws IOException {
- response.setContentType(getContentType());
- write(response.getOutputStream(), fullName);
- }
-
- public void write(OutputStream os, HttpServletRequest request) throws IOException {
- throw new IOException("Can't write a non-concrete comment feed");
- }
-
- public void write(HttpServletResponse response, HttpServletRequest request) throws IOException {
- throw new IOException("Can't write a non-concrete comment feed");
- }
-
- public void release() {
-
- }
-
- public FeedEntries getFeedEntries() {
- throw new RuntimeException("Can't get entries of a special feed");
- }
-
- public abstract FeedEntries getFeedEntries(String fullName);
-}
Deleted: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/special/ConcreteCommentFeed.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/special/ConcreteCommentFeed.java 2007-03-15 08:26:39 UTC (rev 10218)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/special/ConcreteCommentFeed.java 2007-03-15 11:21:34 UTC (rev 10219)
@@ -1,78 +0,0 @@
-package org.jboss.shotoku.feeds.data.special;
-
-import org.jboss.shotoku.feeds.data.Feed;
-import org.jboss.shotoku.feeds.data.model.FeedEntries;
-import org.jboss.shotoku.feeds.tools.FeedDefAttributes;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.OutputStream;
-import java.io.IOException;
-import java.util.Map;
-
-/**
- * @author Adam Warski (adamw at aster.pl)
- */
-public class ConcreteCommentFeed implements Feed {
- private CommentFeed commentFeed;
- private String fullName;
-
- public ConcreteCommentFeed(CommentFeed commentFeed, String fullName) {
- this.commentFeed = commentFeed;
- this.fullName = fullName;
- }
-
- public void write(OutputStream os, HttpServletRequest request)
- throws IOException {
- commentFeed.write(os, fullName);
- }
-
- public void write(HttpServletResponse response, HttpServletRequest request)
- throws IOException {
- commentFeed.write(response, fullName);
- }
-
- public FeedEntries getFeedEntries() {
- return commentFeed.getFeedEntries(fullName);
- }
-
- public String getName() {
- return commentFeed.getName();
- }
-
- public String getDisplayName() {
- return commentFeed.getDisplayName();
- }
-
- public String getType() {
- return commentFeed.getType();
- }
-
- public void release() {
- commentFeed.release();
- }
-
- public Map<String, Object> getAttributes() {
- return commentFeed.getAttributes();
- }
-
- public String getId() {
- return commentFeed.getId();
- }
-
- public int getEntriesVisible() {
- return commentFeed.getEntriesVisible();
- }
-
- public FeedDefAttributes.EntriesExpandMode getEntriesExpandMode() {
- return commentFeed.getEntriesExpandMode();
- }
-
- public boolean getEntriesExpanded() {
- return commentFeed.getEntriesExpanded();
- }
-
- public String getGuid() {
- return commentFeed.getGuid();
- }
-}
Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/special/ConcreteTagFeed.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/special/ConcreteTagFeed.java 2007-03-15 08:26:39 UTC (rev 10218)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/special/ConcreteTagFeed.java 2007-03-15 11:21:34 UTC (rev 10219)
@@ -1,8 +1,7 @@
package org.jboss.shotoku.feeds.data.special;
import org.jboss.shotoku.feeds.data.Feed;
-import org.jboss.shotoku.feeds.data.model.FeedEntries;
-import org.jboss.shotoku.feeds.tools.FeedDefAttributes;
+import org.jboss.blog.model.BlogModel;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletRequest;
@@ -52,26 +51,14 @@
return tagFeed.getAttributes();
}
- public FeedEntries getFeedEntries() {
- return tagFeed.getFeedEntries();
+ public BlogModel getBlogModel() {
+ return tagFeed.getBlogModel();
}
public String getId() {
return tagFeed.getId();
}
- public boolean getEntriesExpanded() {
- return tagFeed.getEntriesExpanded();
- }
-
- public FeedDefAttributes.EntriesExpandMode getEntriesExpandMode() {
- return tagFeed.getEntriesExpandMode();
- }
-
- public int getEntriesVisible() {
- return tagFeed.getEntriesVisible();
- }
-
public String getGuid() {
return tagFeed.getGuid();
}
Deleted: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/special/Rss2CommentFeed.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/special/Rss2CommentFeed.java 2007-03-15 08:26:39 UTC (rev 10218)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/special/Rss2CommentFeed.java 2007-03-15 11:21:34 UTC (rev 10219)
@@ -1,38 +0,0 @@
-package org.jboss.shotoku.feeds.data.special;
-
-import org.apache.velocity.VelocityContext;
-import org.jboss.shotoku.feeds.tools.FeedsConstants;
-import org.jboss.shotoku.feeds.data.model.FeedEntries;
-import org.jboss.shotoku.feeds.data.model.DummyFeedEntries;
-import org.jboss.shotoku.feeds.data.FeedParsing;
-
-import java.util.Map;
-import java.io.ByteArrayOutputStream;
-import java.io.ByteArrayInputStream;
-
-/**
- * @author Adam Warski (adamw at aster.pl)
- */
-public class Rss2CommentFeed extends CommentFeed {
- public Rss2CommentFeed(String id, String name, String type,
- Map<String, Object> attributes, VelocityContext vc) {
- super(id, name, type, attributes, vc);
- }
-
- public String getContentType() {
- return FeedsConstants.RSS_CONTENT_TYPE;
- }
-
- public FeedEntries getFeedEntries(String fullName) {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- try {
- write(baos, fullName);
-
- return FeedParsing.parseWithRome(new ByteArrayInputStream(
- baos.toByteArray()));
- } catch (Exception e) {
- return new DummyFeedEntries("Error generating and parsing " +
- "comment feed", e.getMessage());
- }
- }
-}
Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/special/TagFeed.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/special/TagFeed.java 2007-03-15 08:26:39 UTC (rev 10218)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/special/TagFeed.java 2007-03-15 11:21:34 UTC (rev 10219)
@@ -4,7 +4,6 @@
import org.jboss.shotoku.ContentManager;
import org.jboss.shotoku.feeds.data.Feed;
import org.jboss.shotoku.feeds.data.AbstractFeed;
-import org.jboss.shotoku.feeds.data.model.FeedEntries;
import org.jboss.shotoku.feeds.tools.FeedDefAttributes;
import org.jboss.shotoku.feeds.tools.VelocityContextAttributes;
import org.jboss.shotoku.tools.Tools;
@@ -14,6 +13,7 @@
import org.jboss.shotoku.tags.tools.Constants;
import org.jboss.shotoku.tags.tools.FeedType;
import org.jboss.shotoku.tags.exceptions.TagGetException;
+import org.jboss.blog.model.BlogModel;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletRequest;
@@ -210,7 +210,8 @@
public void release() {
}
- public FeedEntries getFeedEntries() {
- throw new RuntimeException("Can't get entries of a special feed");
+
+ public BlogModel getBlogModel() {
+ throw new RuntimeException("Can't get model of a special feed");
}
}
Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/service/FeedsServiceImpl.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/service/FeedsServiceImpl.java 2007-03-15 08:26:39 UTC (rev 10218)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/service/FeedsServiceImpl.java 2007-03-15 11:21:34 UTC (rev 10219)
@@ -8,14 +8,12 @@
import org.jboss.shotoku.feeds.FeedsConfigurationWatcher;
import org.jboss.shotoku.feeds.exceptions.FeedDoesNotExistException;
import org.jboss.shotoku.feeds.data.Feed;
-import org.jboss.shotoku.feeds.data.CommentableFeed;
import org.jboss.shotoku.feeds.tools.FeedsConstants;
import org.jboss.shotoku.feeds.tools.FeedsTools;
import org.jboss.shotoku.service.AdministratedServiceImpl;
import org.jboss.shotoku.service.AdministratedService;
import org.jboss.shotoku.ContentManager;
import org.jboss.shotoku.tools.Constants;
-import org.jboss.shotoku.aop.CacheItem;
import javax.ejb.Local;
import java.util.HashMap;
@@ -57,12 +55,6 @@
return getFeedsDescriptor(id).getFeed(name, type);
}
- public CommentableFeed getCommentableFeed(String id, String name,
- String type)
- throws FeedDoesNotExistException {
- return getFeedsDescriptor(id).getCommentableFeed(name, type);
- }
-
/*
* Update method.
*/
Deleted: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/CommentFeedTagHandler.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/CommentFeedTagHandler.java 2007-03-15 08:26:39 UTC (rev 10218)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/CommentFeedTagHandler.java 2007-03-15 11:21:34 UTC (rev 10219)
@@ -1,50 +0,0 @@
-package org.jboss.shotoku.feeds.tag;
-
-import org.w3c.dom.Node;
-import org.jboss.shotoku.feeds.variables.Substitution;
-import org.jboss.shotoku.feeds.FeedsDescriptor;
-import org.jboss.shotoku.feeds.FeedFactory;
-import org.jboss.shotoku.feeds.data.special.SpecialFeed;
-import org.jboss.shotoku.feeds.tools.FeedsTools;
-import org.jboss.shotoku.feeds.tools.FeedsConstants;
-import org.apache.velocity.VelocityContext;
-
-import java.util.Map;
-
-/**
- * @author Adam Warski (adamw at aster.pl)
- */
-public class CommentFeedTagHandler extends FeedTagHandler {
- public CommentFeedTagHandler(String feedName, String group,
- Node definition, Substitution s) {
- super(feedName, group, definition, s);
- }
-
- public boolean innerGenerate(FeedsDescriptor fd) {
- // Reading all attributes and making the substitution on them.
- Map<String, Object> attributes = getAttributes();
-
- // Creating a velocity context with parts that won't change in all
- // generated feeds.
- VelocityContext vc = new VelocityContext(attributes);
- FeedsTools.prepareVelocityContext(attributes, vc);
-
- String feedName = getFeedName();
- String feedType = getFeedType();
-
- Class feedClass = FeedFactory.getNewSpecialFeedClass(
- FeedsConstants.COMMENTS_SPECIAL_FEED, feedType);
-
- try {
- fd.addSpecialFeed(feedName, feedType,
- (SpecialFeed) feedClass.getConstructor(String.class,
- String.class, String.class, Map.class,
- VelocityContext.class).newInstance(fd.getId(),
- feedName, feedType, attributes, vc));
- } catch (Exception e) {
- return false;
- }
-
- return true;
- }
-}
Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/FeedTagHandlerManager.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/FeedTagHandlerManager.java 2007-03-15 08:26:39 UTC (rev 10218)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/FeedTagHandlerManager.java 2007-03-15 11:21:34 UTC (rev 10219)
@@ -46,7 +46,6 @@
addHandler(FeedsConstants.REM_FEED_TAG, RemoteFeedTagHandler.class);
addHandler(FeedsConstants.SHO_FEED_TAG, ShotokuFeedTagHandler.class);
addHandler(FeedsConstants.TAG_FEED_TAG, TagFeedTagHandler.class);
- addHandler(FeedsConstants.COMMENT_FEED_TAG, CommentFeedTagHandler.class);
addHandler(FeedsConstants.ATTRS_TAG, AttributesTagHandler.class);
}
Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/ShotokuFeedTagHandler.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/ShotokuFeedTagHandler.java 2007-03-15 08:26:39 UTC (rev 10218)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/ShotokuFeedTagHandler.java 2007-03-15 11:21:34 UTC (rev 10219)
@@ -7,8 +7,6 @@
import org.jboss.shotoku.tools.Tools;
import org.jboss.shotoku.feeds.tools.FeedsTools;
import org.jboss.shotoku.feeds.data.NormalFeed;
-import org.jboss.shotoku.feeds.data.ShotokuCommentableFeed;
-import org.jboss.shotoku.feeds.data.CommentableFeed;
import org.jboss.shotoku.feeds.FeedFactory;
import org.jboss.shotoku.feeds.FeedsDescriptor;
import org.jboss.shotoku.feeds.tools.VelocityContextAttributes;
@@ -179,14 +177,6 @@
vc.put(VelocityContextAttributes.LINK,
generateFeedLink(fd, true, feedName, feedType));
- CommentableFeed cf =
- new ShotokuCommentableFeed(newFeed, nodesNodeList);
-
- if (cf.getCommentsEnabled()) {
- vc.put(VelocityContextAttributes.COMMENTS_SERVICE,
- FeedsTools.getCommentsService());
- }
-
// Now that we have type and site, we can render the
// template.
Writer w = newFeed.getWriter();
@@ -195,7 +185,7 @@
w.close();
// And add the feed.
- fd.addCommentableFeed(feedName, feedType, cf);
+ fd.addFeed(feedName, feedType, newFeed);
} catch (Exception e) {
log.error("Cannot merge template " + template + " for "
+ feedName + ".", e);
Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tools/FeedDefAttributes.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tools/FeedDefAttributes.java 2007-03-15 08:26:39 UTC (rev 10218)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tools/FeedDefAttributes.java 2007-03-15 11:21:34 UTC (rev 10219)
@@ -55,61 +55,4 @@
* Author of a feed.
*/
public static final String AUTHOR = "author";
-
- /*
- * Feed view parameters.
- */
-
- /**
- * Attribute name: number of visible entries on the page.
- */
- public static final String ENTRIES_VISIBLE_ATTR = "entriesVisible";
-
- /**
- * Attribute <code>ENTRIES_VISIBLE_ATTR</code>
- * value: default number of visible entries on the page.
- */
- public static final Integer ENTRIES_VISIBLE_DEFAULT = 10;
-
- /**
- * Attribute name: should entries be expanded or not
- * (defaults to false).
- */
- public static final String ENTRIES_EXPANDED_ATTR = "entriesExpanded";
-
- /**
- * Attribute name: expansion mode of entries (valid when
- * <code>ENTRIES_EXPANDED_ATTR</code> is false) - the selected
- * entry can be displayed at the top, or in the place where it was
- * when it was selected.
- */
- public static final String ENTRIES_EXPAND_MODE_ATTR = "expandMode";
-
- public static enum EntriesExpandMode {
- /**
- * Attribute <code>ENTRIES_EXPAND_MODE_TOP</code> value:
- * selected entry should be displayed at the top.
- */
- TOP,
- /**
- * Attribute <code>ENTRIES_EXPAND_MODE_TOP</code> value:
- * selected entry should be displayed where it was when it
- * was selected.
- */
- INPLACE,
- /**
- * Attribute <code>ENTRIES_EXPAND_MODE_TOP</code> value:
- * selected entry should be displayed as the only entry
- * on the page (required for comments).
- */
- SINGLE
- };
-
- /**
- * Attribute <code>ENTRIES_EXPAND_MODE_ATTR</code>
- * value: by default, selected entries should be shown at the
- * top.
- */
- public static final EntriesExpandMode ENTRIES_EXPAND_MODE_DEFAULT =
- EntriesExpandMode.TOP;
}
Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tools/FeedsConstants.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tools/FeedsConstants.java 2007-03-15 08:26:39 UTC (rev 10218)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tools/FeedsConstants.java 2007-03-15 11:21:34 UTC (rev 10219)
@@ -7,7 +7,6 @@
*/
public class FeedsConstants {
public static final String FEEDS_SERVICE_NAME = "shotoku:service=feeds";
- public static final String COMMENTS_SERVICE_NAME = "shotoku:service=comments";
/**
* Node with names ending with this string are parsed and
@@ -19,7 +18,6 @@
* Special feed types.
*/
public static final int TAGS_SPECIAL_FEED = 0;
- public static final int COMMENTS_SPECIAL_FEED = 1;
/*
* Tag names.
Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tools/FeedsTools.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tools/FeedsTools.java 2007-03-15 08:26:39 UTC (rev 10218)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tools/FeedsTools.java 2007-03-15 11:21:34 UTC (rev 10219)
@@ -4,9 +4,7 @@
import org.apache.log4j.Logger;
import org.jboss.shotoku.feeds.FeedsDescriptor;
import org.jboss.shotoku.feeds.FeedsService;
-import org.jboss.shotoku.feeds.comments.CommentsService;
import org.jboss.shotoku.feeds.service.FeedsServiceImpl;
-import org.jboss.shotoku.feeds.comments.service.CommentsServiceImpl;
import org.jboss.shotoku.ContentManager;
import org.jboss.shotoku.tools.Tools;
import org.jboss.mx.util.MBeanProxyExt;
@@ -118,32 +116,4 @@
throw new RuntimeException(e);
}
}
-
- private static CommentsService commentsInstance;
-
- /**
- * @return An instance of the comments service.
- */
- public synchronized static CommentsService getCommentsService() {
- try {
- if (commentsInstance == null) {
- if (ContentManager.isEmbedded()) {
- // Embedded mode - simply creating a new service instance.
- commentsInstance = new CommentsServiceImpl();
- commentsInstance.create();
- commentsInstance.start();
- } else {
- // Application server mode - creating a proxy to a mbean.
- commentsInstance = (CommentsService) MBeanProxyExt.create(
- CommentsService.class,
- FeedsConstants.COMMENTS_SERVICE_NAME,
- MBeanServerLocator.locate());
- }
- }
-
- return commentsInstance;
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
}
Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tools/TextEscaping.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tools/TextEscaping.java 2007-03-15 08:26:39 UTC (rev 10218)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tools/TextEscaping.java 2007-03-15 11:21:34 UTC (rev 10219)
@@ -89,15 +89,9 @@
* replaced by their escaped equivalents.
*
* <P>
- * If user input may contain tags which must be disabled, then call this
- * method, not {@link #forHTMLTag}. This method is used for text appearing
- * <em>outside</em> of a tag, while {@link #forHTMLTag} is used for text
- * appearing <em>inside</em> an HTML tag.
- *
- * <P>
* It is not uncommon to see text on a web page presented erroneously,
- * because <em>all</em> special characters are escaped (as in
- * {@link #forHTMLTag}). In particular, the ampersand character is often
+ * because <em>all</em> special characters are escaped.
+ * In particular, the ampersand character is often
* escaped not once but <em>twice</em> : once when the original input
* occurs, and then a second time when the same item is retrieved from the
* database. This occurs because the ampersand is the only escaped character
Modified: labs/shotoku/trunk/shotoku-feeds/src/web/WEB-INF/web.xml
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/web/WEB-INF/web.xml 2007-03-15 08:26:39 UTC (rev 10218)
+++ labs/shotoku/trunk/shotoku-feeds/src/web/WEB-INF/web.xml 2007-03-15 11:21:34 UTC (rev 10219)
@@ -44,16 +44,4 @@
<servlet-name>feedsServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
-
- <!-- Comments-adding servlet -->
-
- <servlet>
- <servlet-name>commentsServlet</servlet-name>
- <servlet-class>org.jboss.shotoku.feeds.comments.CommentsServlet</servlet-class>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>commentsServlet</servlet-name>
- <url-pattern>/commentsServlet/*</url-pattern>
- </servlet-mapping>
</web-app>
\ No newline at end of file
Deleted: labs/shotoku/trunk/shotoku-feeds/src/web/index.jsp
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/web/index.jsp 2007-03-15 08:26:39 UTC (rev 10218)
+++ labs/shotoku/trunk/shotoku-feeds/src/web/index.jsp 2007-03-15 11:21:34 UTC (rev 10219)
@@ -1,5 +0,0 @@
-<%@ page contentType="text/html" language="java" %>
-<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
-<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
-
-<jsp:forward page="repo-access/shotoku-test/blog/main.jsp" />
\ No newline at end of file
More information about the jboss-svn-commits
mailing list