[jboss-svn-commits] JBL Code SVN: r5347 - in labs/shotoku/trunk: . shotoku-feeds shotoku-feeds/lib shotoku-feeds/src shotoku-feeds/src/java/org/jboss/shotoku/feeds shotoku-feeds/src/java/org/jboss/shotoku/feeds/comments shotoku-feeds/src/java/org/jboss/shotoku/feeds/data shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/model shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/special shotoku-feeds/src/java/org/jboss/shotoku/feeds/rome shotoku-feeds/src/rome shotoku-feeds/src/web shotoku-feeds/src/web/WEB-INF

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Jul 28 16:45:54 EDT 2006


Author: adamw
Date: 2006-07-28 16:45:47 -0400 (Fri, 28 Jul 2006)
New Revision: 5347

Added:
   labs/shotoku/trunk/shotoku-feeds/lib/rome-0.7.jar
   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/model/FeedEntries.java
   labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/model/FeedEntry.java
   labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/rome/
   labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/rome/CommentRssModule.java
   labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/rome/CommentRssModuleGenerator.java
   labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/rome/CommentRssModuleImpl.java
   labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/rome/CommentRssModuleParser.java
   labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/view/
   labs/shotoku/trunk/shotoku-feeds/src/rome/
   labs/shotoku/trunk/shotoku-feeds/src/rome/rome.properties
   labs/shotoku/trunk/shotoku-feeds/src/web/WEB-INF/faces-config.xml
   labs/shotoku/trunk/shotoku-feeds/src/web/index.jsp
Modified:
   labs/shotoku/trunk/maven.xml
   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/src/java/org/jboss/shotoku/feeds/comments/CommentsServlet.java
   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/Feed.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/RomeBasedFeed.java
   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/ConcreteTagFeed.java
   labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/special/TagFeed.java
   labs/shotoku/trunk/shotoku-feeds/src/web/WEB-INF/web.xml
Log:
http://jira.jboss.org/jira/browse/JBSHOTOKU-38

Modified: labs/shotoku/trunk/maven.xml
===================================================================
--- labs/shotoku/trunk/maven.xml	2006-07-28 16:43:03 UTC (rev 5346)
+++ labs/shotoku/trunk/maven.xml	2006-07-28 20:45:47 UTC (rev 5347)
@@ -19,15 +19,15 @@
     <goal name="shotoku-all-projects">
         <u:tokenize var="subprjs" delim=",">${shotoku.subprojects}</u:tokenize>
         <j:forEach items="${subprjs}" var="subprojectId">
-	    <maven:reactor
-                includes="shotoku-${subprojectId}/project.xml"
-                excludes="" basedir="." banner="Shotoku build"
-                goals="${goal}" ignoreFailures="false" />
+            <maven:reactor
+                    includes="shotoku-${subprojectId}/project.xml"
+                    excludes="" basedir="." banner="Shotoku build"
+                    goals="${goal}" ignoreFailures="false" />
         </j:forEach>
     </goal>
 
     <!-- Main goals -->
-    
+
     <goal name="shotoku:build">
         <j:set var="goal" value="build" />
         <attainGoal name="shotoku-all-projects" />
@@ -98,7 +98,7 @@
         <j:forEach items="${subprjs}" var="subprojectId">
             <j:set var="jar.to.dir"
                    value="target/binary/${shotoku.sar.dir}/shotoku-${subprojectId}.ejb3" />
-        <attainGoal name="jar-to-dir" />
+            <attainGoal name="jar-to-dir" />
         </j:forEach>
 
         <ant:tar destfile="target/shotoku-${version}-binary.tar.gz"
@@ -121,4 +121,12 @@
             <ant:fileset dir="temp" />
         </ant:move>
     </goal>
+
+    <goal name="dir-to-jar">
+        <ant:move todir="temp">
+            <ant:fileset dir="${jar.to.dir}" />
+        </ant:move>
+        <ant:jar basedir="temp" destfile="${jar.to.dir}" />
+        <ant:delete dir="temp" />
+    </goal>
 </project>

Added: labs/shotoku/trunk/shotoku-feeds/lib/rome-0.7.jar
===================================================================
(Binary files differ)


Property changes on: labs/shotoku/trunk/shotoku-feeds/lib/rome-0.7.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: labs/shotoku/trunk/shotoku-feeds/maven.xml
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/maven.xml	2006-07-28 16:43:03 UTC (rev 5346)
+++ labs/shotoku/trunk/shotoku-feeds/maven.xml	2006-07-28 20:45:47 UTC (rev 5347)
@@ -10,12 +10,11 @@
         <attainGoal name="java:compile" />
         <attainGoal name="ejb" />
         <attainGoal name="war" />
-    </goal>
 
-    <goal name="copy-from-maven-to-sar">
-        <ant:copy
-                file="${maven.repo.local}/${to.copy}"
-                todir="target/${feeds.sar.dir}" />
+        <!-- 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">
@@ -26,24 +25,37 @@
                 file="target/shotoku-feeds.war"
                 todir="${local.deploy.dir}" />
 
+        <!-- Copying the rome plugins jar -->
         <ant:copy
                 todir="../target/${shotoku.sar.dir}" overwrite="true"
+                file="target/rome-plugins.jar" />
+
+        <ant:copy
+                todir="../target/${shotoku.sar.dir}" overwrite="true"
                 file="${maven.repo.local}/jdom/jars/jdom-1.0.jar" />
         <ant:copy
                 todir="../target/${shotoku.sar.dir}" overwrite="true"
-                file="${maven.repo.local}/rome/jars/rome-0.7.jar" />
+                file="${maven.repo.local}/xerces/jars/xercesImpl-2.8.0.jar" />
         <ant:copy
                 todir="../target/${shotoku.sar.dir}" overwrite="true"
-                file="${maven.repo.local}/informa/jars/informa.jar" />
+                file="${maven.repo.local}/xerces/jars/xmlParserAPIs-2.6.2.jar" />
         <ant:copy
                 todir="../target/${shotoku.sar.dir}" overwrite="true"
-                file="${maven.repo.local}/xerces/jars/xercesImpl-2.8.0.jar" />
+                file="${maven.repo.local}/xalan/jars/xalan-2.7.0.jar" />
+
         <ant:copy
                 todir="../target/${shotoku.sar.dir}" overwrite="true"
-                file="${maven.repo.local}/xerces/jars/xmlParserAPIs-2.6.2.jar" />
+                file="lib/informa.jar" />
+
         <ant:copy
                 todir="../target/${shotoku.sar.dir}" overwrite="true"
-                file="${maven.repo.local}/xalan/jars/xalan-2.7.0.jar" />
+                file="lib/rome-0.7.jar" />
+        <j:set var="jar.to.dir" value="../target/${shotoku.sar.dir}/rome-0.7.jar" />
+        <attainGoal name="jar-to-dir" />
+        <ant:copy todir="../target/${shotoku.sar.dir}/rome-0.7.jar/com/sun/syndication"
+                  overwrite="true"
+                  file="src/rome/rome.properties" />
+        <attainGoal name="dir-to-jar" />
     </goal>
 
     <goal name="clean">

Modified: labs/shotoku/trunk/shotoku-feeds/project.properties
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/project.properties	2006-07-28 16:43:03 UTC (rev 5346)
+++ labs/shotoku/trunk/shotoku-feeds/project.properties	2006-07-28 20:45:47 UTC (rev 5347)
@@ -6,7 +6,7 @@
 
 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.war.classes.includes=**/*Servlet*
-maven.ejb.excludes=**/*Servlet*
-
+maven.ejb.excludes=**/*Servlet*,**/CommentRssModule*

Modified: labs/shotoku/trunk/shotoku-feeds/project.xml
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/project.xml	2006-07-28 16:43:03 UTC (rev 5346)
+++ labs/shotoku/trunk/shotoku-feeds/project.xml	2006-07-28 20:45:47 UTC (rev 5347)
@@ -57,6 +57,7 @@
             <groupId>rome</groupId>
             <artifactId>rome</artifactId>
             <version>0.7</version>
+            <jar>rome-0.7.jar</jar>
         </dependency>
 
         <dependency>

Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/comments/CommentsServlet.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/comments/CommentsServlet.java	2006-07-28 16:43:03 UTC (rev 5346)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/comments/CommentsServlet.java	2006-07-28 20:45:47 UTC (rev 5347)
@@ -6,6 +6,7 @@
 import org.w3c.dom.Node;
 import org.jboss.shotoku.tools.Tools;
 import org.jboss.shotoku.feeds.tools.FeedsTools;
+import org.jboss.shotoku.feeds.data.model.FeedEntries;
 
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
@@ -27,7 +28,16 @@
     protected void service(HttpServletRequest request,
                            HttpServletResponse response)
             throws ServletException, IOException {
-        try {
+        FeedEntries fe =
+                FeedsTools.getService().getFeed(
+                        "default", "kosmos", "rss2").getFeedEntries();
+        System.out.println("fe.getTitle() = " + fe.getTitle());
+        System.out.println("fe.getEntries().size() = " +
+                fe.getEntries().size());
+        System.out.println("fe.getDescription() = " + fe.getDescription());
+        System.out.println("fe.getEntries().get(0).getCommentLink() = " +
+                fe.getEntries().get(0).getCommentLink());
+        /*try {
             // Getting the comment parameters.
             String feedId = request.getParameter("id");
             String feedName = request.getParameter("name");
@@ -81,6 +91,6 @@
             response.sendError(404, e.getMessage());
         } catch (Exception e) {
             response.sendError(400, e.getMessage());
-        }
+        }      */
     }
 }

Modified: 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	2006-07-28 16:43:03 UTC (rev 5346)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/CommentableFeed.java	2006-07-28 20:45:47 UTC (rev 5347)
@@ -2,6 +2,7 @@
 
 import org.jboss.shotoku.NodeList;
 import org.jboss.shotoku.Node;
+import org.jboss.shotoku.feeds.data.model.FeedEntries;
 import org.jboss.shotoku.tools.Tools;
 
 import javax.servlet.http.HttpServletRequest;
@@ -117,4 +118,8 @@
     public void release() {
         nf.release();
     }
+
+    public FeedEntries getFeedEntries() {
+        return nf.getFeedEntries();
+    }
 }

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	2006-07-28 16:43:03 UTC (rev 5346)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/Feed.java	2006-07-28 20:45:47 UTC (rev 5347)
@@ -1,5 +1,7 @@
 package org.jboss.shotoku.feeds.data;
 
+import org.jboss.shotoku.feeds.data.model.FeedEntries;
+
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletRequest;
 import java.io.OutputStream;
@@ -50,8 +52,17 @@
     public void release();
 
     /**
-     *
+     * Gets attributes of this feed, which are transformed attributes
+     * of the corresponding node in the xml definition file.
      * @return Attributes of this feed.
      */
     public Map<String, Object> getAttributes();
+
+    /**
+     * All entries that this feed containes in a parsed form. Should only
+     * be called after a feed is generated. Currently works only for
+     * normal feeds.
+     * @return Entries of this feed.
+     */
+    public FeedEntries getFeedEntries();
 }

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	2006-07-28 16:43:03 UTC (rev 5346)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/InformaBasedFeed.java	2006-07-28 20:45:47 UTC (rev 5347)
@@ -12,6 +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;
 
 public abstract class InformaBasedFeed extends FileBasedFeed {
     public InformaBasedFeed(String name, String displayName, String type,
@@ -67,4 +69,32 @@
 
         getExporter().write(newChannel);
     }
+
+    public FeedEntries getFeedEntries() {
+        try {
+            // Parsing the generated feed.
+            ChannelBuilder builder = new ChannelBuilder();
+            ChannelIF childChannel =
+                    FeedParser.parse(builder, getInputStream());
+
+            List<FeedEntry> entries = new ArrayList<FeedEntry>();
+
+            for (Object o : childChannel.getItems()) {
+                ItemIF nextItem = (ItemIF) o;
+                entries.add(new FeedEntry(nextItem.getCreator(),
+                        nextItem.getTitle(), nextItem.getDescription(),
+                        nextItem.getDate(), nextItem.getLink().toString(),
+                        nextItem.getGuid().getLocation(), ""));
+            }
+
+            return new FeedEntries(childChannel.getCreator(),
+                    childChannel.getTitle(), childChannel.getDescription(),
+                    childChannel.getPubDate(),
+                    "", entries);
+        } catch (Exception e) {
+            return new FeedEntries("", "Error generating feed entries",
+                    e.getMessage(), new Date(), "",
+                    new ArrayList<FeedEntry>());
+        }
+    }
 }

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	2006-07-28 16:43:03 UTC (rev 5346)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/RomeBasedFeed.java	2006-07-28 20:45:47 UTC (rev 5347)
@@ -32,6 +32,9 @@
 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.rome.CommentRssModule;
 
 public abstract class RomeBasedFeed extends FileBasedFeed {
     public RomeBasedFeed(String name, String displayName, String type,
@@ -104,4 +107,42 @@
             throw new IOException(e.getMessage());
         }
     }
+
+    public FeedEntries getFeedEntries() {
+        try {
+            // Parsing the generated feed.
+            SyndFeedInput input = new SyndFeedInput();
+            SyndFeed inFeed = input.build(new XmlReader(getInputStream()));
+
+            List<FeedEntry> entries = new ArrayList<FeedEntry>();
+
+            for (Object o : inFeed.getEntries()) {
+                SyndEntry entry = (SyndEntry) o;
+
+                CommentRssModule commRssModule = (CommentRssModule)
+                        entry.getModule(
+                                "http://wellformedweb.org/CommentAPI/");
+                String commentsRss = null;
+                if (commRssModule != null) {
+                    commentsRss = commRssModule.getCommentRss();
+                    if (commentsRss != null) {
+                        commentsRss = commentsRss.trim();
+                    }
+                }
+
+                entries.add(new FeedEntry(entry.getAuthor(),
+                        entry.getTitle(), entry.getDescription().getValue(),
+                        entry.getPublishedDate(), entry.getLink(),
+                        entry.getUri(), commentsRss));
+            }
+
+            return new FeedEntries(inFeed.getAuthor(), inFeed.getTitle(),
+                    inFeed.getDescription(), inFeed.getPublishedDate(),
+                    inFeed.getLink(), entries);
+        } catch (Exception e) {
+            return new FeedEntries("", "Error generating feed entries",
+                    e.getMessage(), new Date(), "",
+                    new ArrayList<FeedEntry>());
+        }
+    }
 }

Added: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/model/FeedEntries.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/model/FeedEntries.java	2006-07-28 16:43:03 UTC (rev 5346)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/model/FeedEntries.java	2006-07-28 20:45:47 UTC (rev 5347)
@@ -0,0 +1,50 @@
+package org.jboss.shotoku.feeds.data.model;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @author Adam Warski (adamw at aster.pl)
+ */
+public class FeedEntries {
+    private String author;
+    private String title;
+    private String description;
+    private Date created;
+    private String link;
+    private List<FeedEntry> entries;
+
+    public FeedEntries(String author, String title, String description,
+                       Date created, String link, List<FeedEntry> entries) {
+        this.author = author;
+        this.title = title;
+        this.description = description;
+        this.created = created;
+        this.link = link;
+        this.entries = entries;
+    }
+
+    public String getAuthor() {
+        return author;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public Date getCreated() {
+        return created;
+    }
+
+    public String getLink() {
+        return link;
+    }
+
+    public List<FeedEntry> getEntries() {
+        return entries;
+    }
+}

Added: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/model/FeedEntry.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/model/FeedEntry.java	2006-07-28 16:43:03 UTC (rev 5346)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/model/FeedEntry.java	2006-07-28 20:45:47 UTC (rev 5347)
@@ -0,0 +1,56 @@
+package org.jboss.shotoku.feeds.data.model;
+
+import java.util.Date;
+
+/**
+ * @author Adam Warski (adamw at aster.pl)
+ */
+public class FeedEntry {
+    private String author;
+    private String title;
+    private String description;
+    private Date created;
+    private String link;
+    private String guid;
+    private String commentLink;
+
+    public FeedEntry(String author, String title, String description,
+                     Date created, String link, String guid,
+                     String commentLink) {
+        this.author = author;
+        this.title = title;
+        this.description = description;
+        this.created = created;
+        this.link = link;
+        this.guid = guid;
+        this.commentLink = commentLink;
+    }
+
+    public String getAuthor() {
+        return author;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public Date getCreated() {
+        return created;
+    }
+
+    public String getLink() {
+        return link;
+    }
+
+    public String getGuid() {
+        return guid;
+    }
+
+    public String getCommentLink() {
+        return commentLink;
+    }
+}

Modified: 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	2006-07-28 16:43:03 UTC (rev 5346)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/special/CommentFeed.java	2006-07-28 20:45:47 UTC (rev 5347)
@@ -12,6 +12,7 @@
 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.model.FeedEntries;
 import org.jboss.shotoku.feeds.tools.FeedsTools;
 import org.jboss.shotoku.feeds.tools.NodesFeedsProperties;
 import org.jboss.shotoku.feeds.tools.FeedDefAttributes;
@@ -172,4 +173,8 @@
     public Map<String, Object> getAttributes() {
         return attributes;
     }
+
+    public FeedEntries getFeedEntries() {
+        throw new RuntimeException("Can't get entries of a special feed");
+    }
 }

Modified: 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	2006-07-28 16:43:03 UTC (rev 5346)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/special/ConcreteCommentFeed.java	2006-07-28 20:45:47 UTC (rev 5347)
@@ -1,6 +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 javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -49,4 +50,8 @@
     public Map<String, Object> getAttributes() {
         return commentFeed.getAttributes();
     }
+
+    public FeedEntries getFeedEntries() {
+        return commentFeed.getFeedEntries();
+    }
 }

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	2006-07-28 16:43:03 UTC (rev 5346)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/special/ConcreteTagFeed.java	2006-07-28 20:45:47 UTC (rev 5347)
@@ -1,7 +1,7 @@
 package org.jboss.shotoku.feeds.data.special;
 
-import org.jboss.shotoku.feeds.data.special.TagFeed;
 import org.jboss.shotoku.feeds.data.Feed;
+import org.jboss.shotoku.feeds.data.model.FeedEntries;
 
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletRequest;
@@ -50,4 +50,8 @@
     public Map<String, Object> getAttributes() {
         return tagFeed.getAttributes();
     }
+
+    public FeedEntries getFeedEntries() {
+        return tagFeed.getFeedEntries();
+    }
 }

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	2006-07-28 16:43:03 UTC (rev 5346)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/special/TagFeed.java	2006-07-28 20:45:47 UTC (rev 5347)
@@ -3,6 +3,7 @@
 import org.apache.velocity.VelocityContext;
 import org.jboss.shotoku.ContentManager;
 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.shotoku.feeds.tools.VelocityContextAttributes;
 import org.jboss.shotoku.tools.Tools;
@@ -228,4 +229,8 @@
     public Map<String, Object> getAttributes() {
         return attributes;
     }
+
+    public FeedEntries getFeedEntries() {
+        throw new RuntimeException("Can't get entries of a special feed");
+    }
 }

Added: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/rome/CommentRssModule.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/rome/CommentRssModule.java	2006-07-28 16:43:03 UTC (rev 5346)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/rome/CommentRssModule.java	2006-07-28 20:45:47 UTC (rev 5347)
@@ -0,0 +1,16 @@
+package org.jboss.shotoku.feeds.rome;
+
+import com.sun.syndication.feed.CopyFrom;
+import com.sun.syndication.feed.module.Module;
+
+/**
+ * @author Adam Warski (adamw at aster.pl)
+ */
+public interface CommentRssModule extends Module, CopyFrom {
+    public static final String URI = "http://wellformedweb.org/CommentAPI/";
+
+    public String getCommentRss();
+    public void setCommentRss(String commentRss);
+}
+
+

Added: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/rome/CommentRssModuleGenerator.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/rome/CommentRssModuleGenerator.java	2006-07-28 16:43:03 UTC (rev 5346)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/rome/CommentRssModuleGenerator.java	2006-07-28 20:45:47 UTC (rev 5347)
@@ -0,0 +1,58 @@
+package org.jboss.shotoku.feeds.rome;
+
+import com.sun.syndication.io.ModuleGenerator;
+import com.sun.syndication.feed.module.Module;
+import org.jdom.Namespace;
+import org.jdom.Element;
+
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Collections;
+
+/**
+ * @author Adam Warski (adamw at aster.pl)
+ */
+public class CommentRssModuleGenerator implements ModuleGenerator {
+    private static final Namespace COMM_RSS_NS =
+            Namespace.getNamespace("wfw", CommentRssModule.URI);
+
+    public String getNamespaceUri() {
+        return CommentRssModule.URI;
+    }
+
+    private static final Set NAMESPACES;
+
+    static {
+        Set nss = new HashSet();
+        //noinspection unchecked
+        nss.add(COMM_RSS_NS);
+        //noinspection unchecked
+        NAMESPACES = Collections.unmodifiableSet(nss);
+    }
+
+    public Set getNamespaces() {
+        return NAMESPACES;
+    }
+
+    public void generate(Module module, Element element) {
+        // this is not necessary, it is done to avoid the namespace definition in every item.
+        Element root = element;
+        while (root.getParent()!=null && root.getParent() instanceof Element) {
+            root = (Element) element.getParent();
+        }
+        root.addNamespaceDeclaration(COMM_RSS_NS);
+
+        CommentRssModule crm = (CommentRssModule) module;
+        if (crm.getCommentRss() != null) {
+            element.addContent(generateSimpleElement("commentRss",
+                    crm.getCommentRss()));
+        }
+    }
+
+    protected Element generateSimpleElement(String name, String value)  {
+        Element element = new Element(name, COMM_RSS_NS);
+        element.addContent(value);
+        return element;
+    }
+}
+

Added: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/rome/CommentRssModuleImpl.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/rome/CommentRssModuleImpl.java	2006-07-28 16:43:03 UTC (rev 5346)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/rome/CommentRssModuleImpl.java	2006-07-28 20:45:47 UTC (rev 5347)
@@ -0,0 +1,32 @@
+package org.jboss.shotoku.feeds.rome;
+
+import com.sun.syndication.feed.module.ModuleImpl;
+
+/**
+ * @author Adam Warski (adamw at aster.pl)
+ */
+public class CommentRssModuleImpl extends ModuleImpl
+        implements CommentRssModule {
+    private String commentRss;
+
+    public CommentRssModuleImpl() {
+        super(CommentRssModule.class, CommentRssModule.URI);
+    }
+
+    public String getCommentRss() {
+        return commentRss;
+    }
+
+    public void setCommentRss(String commentRss) {
+        this.commentRss = commentRss;
+    }
+
+    public Class getInterface() {
+        return CommentRssModule.class;
+    }
+
+    public void copyFrom(Object obj) {
+        CommentRssModule crm = (CommentRssModule) obj;
+        setCommentRss(crm.getCommentRss());
+    }
+}

Added: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/rome/CommentRssModuleParser.java
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/rome/CommentRssModuleParser.java	2006-07-28 16:43:03 UTC (rev 5346)
+++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/rome/CommentRssModuleParser.java	2006-07-28 20:45:47 UTC (rev 5347)
@@ -0,0 +1,32 @@
+package org.jboss.shotoku.feeds.rome;
+
+import com.sun.syndication.io.ModuleParser;
+import com.sun.syndication.feed.module.Module;
+import org.jdom.Namespace;
+import org.jdom.Element;
+
+/**
+ * @author Adam Warski (adamw at aster.pl)
+ */
+public class CommentRssModuleParser implements ModuleParser {
+    private static final Namespace COMM_RSS_NS =
+            Namespace.getNamespace("wfw", CommentRssModule.URI);
+
+    public String getNamespaceUri() {
+        return CommentRssModule.URI;
+    }
+
+    public Module parse(Element dcRoot) {
+        boolean foundSomething = false;
+        CommentRssModule fm = new CommentRssModuleImpl();
+
+        Element e = dcRoot.getChild("commentRss", COMM_RSS_NS);
+        if (e != null) {
+            foundSomething = true;
+            fm.setCommentRss(e.getText());
+        }
+
+        return (foundSomething) ? fm : null;
+    }
+}
+

Added: labs/shotoku/trunk/shotoku-feeds/src/rome/rome.properties
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/rome/rome.properties	2006-07-28 16:43:03 UTC (rev 5346)
+++ labs/shotoku/trunk/shotoku-feeds/src/rome/rome.properties	2006-07-28 20:45:47 UTC (rev 5347)
@@ -0,0 +1,119 @@
+#
+#   Copyright 2004 Sun Microsystems, Inc.
+#
+#   Licensed under the Apache License, Version 2.0 (the "License");
+#   you may not use this file except in compliance with the License.
+#   You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+#
+
+
+# Feed Parser implementation classes
+#
+WireFeedParser.classes=com.sun.syndication.io.impl.RSS090Parser \
+                       com.sun.syndication.io.impl.RSS091NetscapeParser \
+                       com.sun.syndication.io.impl.RSS091UserlandParser \
+                       com.sun.syndication.io.impl.RSS092Parser \
+                       com.sun.syndication.io.impl.RSS093Parser \
+                       com.sun.syndication.io.impl.RSS094Parser \
+                       com.sun.syndication.io.impl.RSS10Parser  \
+                       com.sun.syndication.io.impl.RSS20wNSParser  \
+                       com.sun.syndication.io.impl.RSS20Parser  \
+                       com.sun.syndication.io.impl.Atom03Parser
+
+# Parsers for Atom 0.3 feed modules
+#
+atom_0.3.feed.ModuleParser.classes=com.sun.syndication.io.impl.SyModuleParser \
+                                   com.sun.syndication.io.impl.DCModuleParser
+
+# Parsers for Atom 0.3 entry modules
+#
+atom_0.3.item.ModuleParser.classes=com.sun.syndication.io.impl.DCModuleParser
+
+# Parsers for RSS 1.0 feed modules
+#
+rss_1.0.feed.ModuleParser.classes=com.sun.syndication.io.impl.SyModuleParser \
+                                  com.sun.syndication.io.impl.DCModuleParser
+
+# Parsers for RSS 1.0 item modules
+#
+rss_1.0.item.ModuleParser.classes=com.sun.syndication.io.impl.DCModuleParser
+
+# Parsers for RSS 2.0 (w/NS) feed modules
+#
+rss_2.0wNS.feed.ModuleParser.classes=com.sun.syndication.io.impl.DCModuleParser
+
+# Parsers for RSS 2.0 (w/NS) item modules
+#
+rss_2.0wNS.item.ModuleParser.classes=com.sun.syndication.io.impl.DCModuleParser
+
+# Parsers for RSS 2.0 feed modules
+#
+rss_2.0.feed.ModuleParser.classes=com.sun.syndication.io.impl.DCModuleParser
+
+# Parsers for RSS 2.0 item modules
+#
+rss_2.0.item.ModuleParser.classes=com.sun.syndication.io.impl.DCModuleParser,org.jboss.shotoku.feeds.rome.CommentRssModuleParser
+
+
+
+
+# Feed Generator implementation classes
+#
+WireFeedGenerator.classes=com.sun.syndication.io.impl.RSS090Generator \
+                          com.sun.syndication.io.impl.RSS091NetscapeGenerator \
+                          com.sun.syndication.io.impl.RSS091UserlandGenerator \
+                          com.sun.syndication.io.impl.RSS092Generator \
+                          com.sun.syndication.io.impl.RSS093Generator \
+                          com.sun.syndication.io.impl.RSS094Generator \
+                          com.sun.syndication.io.impl.RSS10Generator  \
+                          com.sun.syndication.io.impl.RSS20Generator  \
+                          com.sun.syndication.io.impl.Atom03Generator
+
+# Generators for Atom 0.3 feed modules
+#
+atom_0.3.feed.ModuleGenerator.classes=com.sun.syndication.io.impl.SyModuleGenerator \
+                                      com.sun.syndication.io.impl.DCModuleGenerator
+
+# Generators for Atom 0.3 entry modules
+#
+atom_0.3.item.ModuleGenerator.classes=com.sun.syndication.io.impl.DCModuleGenerator
+
+# Generators for RSS 1.0 feed modules
+#
+rss_1.0.feed.ModuleGenerator.classes=com.sun.syndication.io.impl.SyModuleGenerator \
+                                     com.sun.syndication.io.impl.DCModuleGenerator
+
+# Generators for RSS_1.0 entry modules
+#
+rss_1.0.item.ModuleGenerator.classes=com.sun.syndication.io.impl.DCModuleGenerator
+
+# Generators for RSS 2.0 feed modules
+#
+rss_2.0.feed.ModuleGenerator.classes=com.sun.syndication.io.impl.DCModuleGenerator
+
+# Generators for RSS_2.0 entry modules
+#
+rss_2.0.item.ModuleGenerator.classes=com.sun.syndication.io.impl.DCModuleGenerator,org.jboss.shotoku.feeds.rome.CommentRssModuleGenerator
+
+
+
+
+# Feed Conversor implementation classes
+#
+Converter.classes=com.sun.syndication.feed.synd.impl.ConverterForAtom03 \
+                  com.sun.syndication.feed.synd.impl.ConverterForRSS090 \
+                  com.sun.syndication.feed.synd.impl.ConverterForRSS091Netscape \
+                  com.sun.syndication.feed.synd.impl.ConverterForRSS091Userland \
+                  com.sun.syndication.feed.synd.impl.ConverterForRSS092 \
+                  com.sun.syndication.feed.synd.impl.ConverterForRSS093 \
+                  com.sun.syndication.feed.synd.impl.ConverterForRSS094 \
+                  com.sun.syndication.feed.synd.impl.ConverterForRSS10  \
+                  com.sun.syndication.feed.synd.impl.ConverterForRSS20

Added: labs/shotoku/trunk/shotoku-feeds/src/web/WEB-INF/faces-config.xml
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/web/WEB-INF/faces-config.xml	2006-07-28 16:43:03 UTC (rev 5346)
+++ labs/shotoku/trunk/shotoku-feeds/src/web/WEB-INF/faces-config.xml	2006-07-28 20:45:47 UTC (rev 5347)
@@ -0,0 +1,117 @@
+<?xml version='1.0' encoding='UTF-8'?>
+
+<!DOCTYPE faces-config PUBLIC
+  "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
+  "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
+
+<faces-config>
+    <navigation-rule>
+		<from-view-id>/repo-access/shotoku-test/blog/main2.jsp</from-view-id>
+		<navigation-case>
+			<from-outcome>main2</from-outcome>
+			<to-view-id>/repo-access/shotoku-test/blog/main2.jsp</to-view-id>
+		</navigation-case>
+        <navigation-case>
+			<from-outcome>main3</from-outcome>
+			<to-view-id>/repo-access/shotoku-test/blog/main3.jsp</to-view-id>
+		</navigation-case>
+	</navigation-rule>
+
+    <navigation-rule>
+		<from-view-id>/repo-access/shotoku-test/blog/main3.jsp</from-view-id>
+		<navigation-case>
+			<from-outcome>main2</from-outcome>
+			<to-view-id>/repo-access/shotoku-test/blog/main2.jsp</to-view-id>
+		</navigation-case>
+        <navigation-case>
+			<from-outcome>main3</from-outcome>
+			<to-view-id>/repo-access/shotoku-test/blog/main3.jsp</to-view-id>
+		</navigation-case>
+	</navigation-rule>
+
+    <navigation-rule>
+		<from-view-id>/</from-view-id>
+		<navigation-case>
+			<from-outcome>main2</from-outcome>
+			<to-view-id>/repo-access/shotoku-test/blog/main2.jsp</to-view-id>
+		</navigation-case>
+        <navigation-case>
+			<from-outcome>main3</from-outcome>
+			<to-view-id>/repo-access/shotoku-test/blog/main3.jsp</to-view-id>
+		</navigation-case>
+    </navigation-rule>
+    
+    <!--<navigation-rule>
+		<from-view-id>/repo-access/default/contributor/contributor.jsp</from-view-id>
+		<navigation-case>
+			<from-outcome>apply</from-outcome>
+			<to-view-id>/repo-access/default/contributor/apply.jsp</to-view-id>
+		</navigation-case>
+		<navigation-case>
+			<from-outcome>admin</from-outcome>
+			<to-view-id>/repo-access/default/contributor/admin.jsp</to-view-id>
+		</navigation-case>
+	</navigation-rule>
+
+	<navigation-rule>
+		<from-view-id>/repo-access/default/contributor/admin.jsp</from-view-id>
+		<navigation-case>
+			<from-outcome>back</from-outcome>
+			<to-view-id>/repo-access/default/contributor/contributor.jsp</to-view-id>
+		</navigation-case>
+	</navigation-rule>
+
+	<navigation-rule>
+		<from-view-id>/repo-access/default/contributor/apply.jsp</from-view-id>
+		<navigation-case>
+			<from-outcome>back</from-outcome>
+			<to-view-id>/repo-access/default/contributor/contributor.jsp</to-view-id>
+		</navigation-case>
+		<navigation-case>
+			<from-outcome>individual</from-outcome>
+			<to-view-id>/repo-access/default/contributor/individual.jsp</to-view-id>
+		</navigation-case>
+		<navigation-case>
+			<from-outcome>corporate</from-outcome>
+			<to-view-id>/repo-access/default/contributor/corporate.jsp</to-view-id>
+		</navigation-case>
+	</navigation-rule>
+
+	<navigation-rule>
+		<from-view-id>/repo-access/default/contributor/individual.jsp</from-view-id>
+		<navigation-case>
+			<from-outcome>back</from-outcome>
+			<to-view-id>/repo-access/default/contributor/apply.jsp</to-view-id>
+		</navigation-case>
+	</navigation-rule>
+
+	<navigation-rule>
+		<from-view-id>/repo-access/default/contributor/corporate.jsp</from-view-id>
+		<navigation-case>
+			<from-outcome>back</from-outcome>
+			<to-view-id>/repo-access/default/contributor/apply.jsp</to-view-id>
+		</navigation-case>
+	</navigation-rule>
+
+	<managed-bean>
+		<managed-bean-name>conServer</managed-bean-name>
+		<managed-bean-class>org.jboss.forge.contributor.ConServer</managed-bean-class>
+		<managed-bean-scope>application</managed-bean-scope>
+	</managed-bean>
+
+	<managed-bean>
+		<managed-bean-name>con</managed-bean-name>
+		<managed-bean-class>org.jboss.forge.contributor.ConMainBean</managed-bean-class>
+		<managed-bean-scope>session</managed-bean-scope>
+		<managed-property>
+			<property-name>server</property-name>
+			<value>#{conServer}</value>
+		</managed-property>
+	</managed-bean>
+
+	<managed-bean>
+		<managed-bean-name>conAccessBean</managed-bean-name>
+		<managed-bean-class>org.jboss.forge.contributor.ConAccessBean</managed-bean-class>
+		<managed-bean-scope>request</managed-bean-scope>
+	</managed-bean> -->
+</faces-config>

Modified: labs/shotoku/trunk/shotoku-feeds/src/web/WEB-INF/web.xml
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/web/WEB-INF/web.xml	2006-07-28 16:43:03 UTC (rev 5346)
+++ labs/shotoku/trunk/shotoku-feeds/src/web/WEB-INF/web.xml	2006-07-28 20:45:47 UTC (rev 5347)
@@ -4,6 +4,8 @@
          xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
             http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
          version="2.4">
+    <!-- Files from repo filter configuration -->
+
     <filter>
         <filter-name>filesFromRepoFilter</filter-name>
         <filter-class>org.jboss.shotoku.web.FilesFromRepoFilter</filter-class>
@@ -17,16 +19,6 @@
         </init-param>
     </filter>
 
-    <servlet>
-        <servlet-name>feedsServlet</servlet-name>
-        <servlet-class>org.jboss.shotoku.feeds.FeedsServlet</servlet-class>
-    </servlet>
-
-    <servlet>
-        <servlet-name>commentsServlet</servlet-name>
-        <servlet-class>org.jboss.shotoku.feeds.comments.CommentsServlet</servlet-class>
-    </servlet>
-
     <filter-mapping>
         <filter-name>filesFromRepoFilter</filter-name>
         <url-pattern>/repo-access/*</url-pattern>
@@ -41,13 +33,44 @@
         <dispatcher>FORWARD</dispatcher>
     </filter-mapping>
 
+    <!-- Main feeds servlet -->
+
+    <servlet>
+        <servlet-name>feedsServlet</servlet-name>
+        <servlet-class>org.jboss.shotoku.feeds.FeedsServlet</servlet-class>
+    </servlet>
+
     <servlet-mapping>
         <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>/comments/*</url-pattern>
     </servlet-mapping>
+
+    <!-- Feeds-view JSF servlet -->
+
+    <listener>
+        <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
+    </listener>
+
+    <servlet>
+        <servlet-name>Faces Servlet</servlet-name>
+        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+
+    <servlet-mapping>
+        <servlet-name>Faces Servlet</servlet-name>
+        <url-pattern>/view/*</url-pattern>
+    </servlet-mapping>
 </web-app>
\ No newline at end of file

Added: labs/shotoku/trunk/shotoku-feeds/src/web/index.jsp
===================================================================
--- labs/shotoku/trunk/shotoku-feeds/src/web/index.jsp	2006-07-28 16:43:03 UTC (rev 5346)
+++ labs/shotoku/trunk/shotoku-feeds/src/web/index.jsp	2006-07-28 20:45:47 UTC (rev 5347)
@@ -0,0 +1,5 @@
+<%@ 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