[jboss-svn-commits] JBL Code SVN: r8570 - in labs/shotoku/trunk-2.6: . lib/portal shotoku-base/src/java/org/jboss/shotoku/service shotoku-base/src/java/org/jboss/shotoku/tools shotoku-feeds/src/java/org/jboss/shotoku/feeds shotoku-feeds/src/java/org/jboss/shotoku/feeds/data shotoku-feeds/src/web/WEB-INF shotoku-portal/src/java/org/jboss/shotoku/portal shotoku-test/src/java/org/jboss/shotoku/test

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Dec 22 17:54:31 EST 2006


Author: adamw
Date: 2006-12-22 17:53:55 -0500 (Fri, 22 Dec 2006)
New Revision: 8570

Added:
   labs/shotoku/trunk-2.6/shotoku-test/src/java/org/jboss/shotoku/test/ShotokuDemo.java
Removed:
   labs/shotoku/trunk-2.6/shotoku-feeds/src/java/org/jboss/shotoku/feeds/portlet/
   labs/shotoku/trunk-2.6/shotoku-feeds/src/web/WEB-INF/feeds-object.xml
   labs/shotoku/trunk-2.6/shotoku-feeds/src/web/WEB-INF/portlet-instances.xml
   labs/shotoku/trunk-2.6/shotoku-feeds/src/web/WEB-INF/portlet.xml
Modified:
   labs/shotoku/trunk-2.6/lib/portal/portal-cms-lib.jar
   labs/shotoku/trunk-2.6/lib/portal/portal-common-lib.jar
   labs/shotoku/trunk-2.6/lib/portal/portal-core-lib.jar
   labs/shotoku/trunk-2.6/lib/portal/portal-identity-lib.jar
   labs/shotoku/trunk-2.6/lib/portal/portal-portlet-lib.jar
   labs/shotoku/trunk-2.6/shotoku-base/src/java/org/jboss/shotoku/service/ShotokuServiceImpl.java
   labs/shotoku/trunk-2.6/shotoku-base/src/java/org/jboss/shotoku/tools/Tools.java
   labs/shotoku/trunk-2.6/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/FeedParsing.java
   labs/shotoku/trunk-2.6/shotoku-portal/src/java/org/jboss/shotoku/portal/ShotokuCMS.java
   labs/shotoku/trunk-2.6/shotoku.iml
Log:
http://jira.jboss.com/jira/browse/JBLAB-817

Modified: labs/shotoku/trunk-2.6/lib/portal/portal-cms-lib.jar
===================================================================
(Binary files differ)

Modified: labs/shotoku/trunk-2.6/lib/portal/portal-common-lib.jar
===================================================================
(Binary files differ)

Modified: labs/shotoku/trunk-2.6/lib/portal/portal-core-lib.jar
===================================================================
(Binary files differ)

Modified: labs/shotoku/trunk-2.6/lib/portal/portal-identity-lib.jar
===================================================================
(Binary files differ)

Modified: labs/shotoku/trunk-2.6/lib/portal/portal-portlet-lib.jar
===================================================================
(Binary files differ)

Modified: labs/shotoku/trunk-2.6/shotoku-base/src/java/org/jboss/shotoku/service/ShotokuServiceImpl.java
===================================================================
--- labs/shotoku/trunk-2.6/shotoku-base/src/java/org/jboss/shotoku/service/ShotokuServiceImpl.java	2006-12-22 22:53:04 UTC (rev 8569)
+++ labs/shotoku/trunk-2.6/shotoku-base/src/java/org/jboss/shotoku/service/ShotokuServiceImpl.java	2006-12-22 22:53:55 UTC (rev 8570)
@@ -163,7 +163,7 @@
             new LinkedBlockingQueue<UpdateThread>();
     private int updateThreadCount;
     /**
-     * Number of threads that should be removed, instead of
+     * Number of threads that should be removed, instead of returned
      */
     private volatile int toRemove = 0;
 

Modified: labs/shotoku/trunk-2.6/shotoku-base/src/java/org/jboss/shotoku/tools/Tools.java
===================================================================
--- labs/shotoku/trunk-2.6/shotoku-base/src/java/org/jboss/shotoku/tools/Tools.java	2006-12-22 22:53:04 UTC (rev 8569)
+++ labs/shotoku/trunk-2.6/shotoku-base/src/java/org/jboss/shotoku/tools/Tools.java	2006-12-22 22:53:55 UTC (rev 8570)
@@ -258,6 +258,8 @@
 
     /**
      * Checks if the given string is empty (null or "").
+     * @param s String to check.
+     * @return True iff the given string is null or equal to "".
      */
     public static boolean isEmpty(String s) {
         return (s == null) || ("".equals(s));
@@ -355,7 +357,7 @@
      *            Input stream to read from.
      * @param os
      *            Output stream to write to.
-     * @throws IOException
+     * @throws IOException In case of an IO exception.
      */
     public static void transfer(InputStream is, OutputStream os) throws IOException {
         byte[] buffer = new byte[ContentManager.getTransferBufferSize()];
@@ -373,7 +375,7 @@
      *            Input stream to read from.
      * @param w
      *            Printwriter to write to.
-     * @throws IOException
+     * @throws IOException In case of an IO exception.
      */
     public static void transfer(InputStream is, PrintWriter w) throws IOException {
         char[] buffer = new char[ContentManager.getTransferBufferSize()];
@@ -421,7 +423,7 @@
     /**
      * @param file File to read from.
      * @return Content of the given file represented as a byte buffer.
-     * @throws IOException
+     * @throws IOException In case of an IO exception.
      */
     public static ByteBuffer getFileBytes(File file) throws IOException {
         FileChannel fc = new FileInputStream(file).getChannel();
@@ -435,7 +437,7 @@
     /**
      * @param file File to read from.
      * @return Content of the given file represented as a String.
-     * @throws IOException
+     * @throws IOException In case of an IO exception.
      */
     public static String getFileString(File file) throws IOException {
         return Charset.forName(

Modified: labs/shotoku/trunk-2.6/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/FeedParsing.java
===================================================================
--- labs/shotoku/trunk-2.6/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/FeedParsing.java	2006-12-22 22:53:04 UTC (rev 8569)
+++ labs/shotoku/trunk-2.6/shotoku-feeds/src/java/org/jboss/shotoku/feeds/data/FeedParsing.java	2006-12-22 22:53:55 UTC (rev 8570)
@@ -7,8 +7,7 @@
 
 import java.io.InputStream;
 import java.io.IOException;
-import java.util.List;
-import java.util.ArrayList;
+import java.util.*;
 
 import com.sun.syndication.io.SyndFeedInput;
 import com.sun.syndication.io.XmlReader;
@@ -25,6 +24,18 @@
  * @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) {
+                    Date date1 = o1.getCreated();
+                    Date date2 = o2.getCreated();
+                    if ((date1 == null) && (date2 == null)) return 0;
+                    if (date1 == null) return 1;
+                    if (date2 == null) return -1;
+                    return date2.compareTo(date1);
+                }
+            };
+
     public static FeedEntries parseWithRome(InputStream is)
             throws IOException, FeedException {
         // Parsing the generated feed.
@@ -56,6 +67,8 @@
                     entry.getUri(), commentsRss));
         }
 
+        Collections.sort(entries, feedEntryComparator);
+
         return new FeedEntries(inFeed.getAuthor(), inFeed.getTitle(),
                 inFeed.getDescription(), inFeed.getPublishedDate(),
                 inFeed.getLink(), entries);
@@ -81,6 +94,8 @@
                     nextItem.getGuid().getLocation(), ""));
         }
 
+        Collections.sort(entries, feedEntryComparator);
+
         return new FeedEntries(childChannel.getCreator(),
                 childChannel.getTitle(), childChannel.getDescription(),
                 childChannel.getPubDate(),

Deleted: labs/shotoku/trunk-2.6/shotoku-feeds/src/web/WEB-INF/feeds-object.xml
===================================================================
--- labs/shotoku/trunk-2.6/shotoku-feeds/src/web/WEB-INF/feeds-object.xml	2006-12-22 22:53:04 UTC (rev 8569)
+++ labs/shotoku/trunk-2.6/shotoku-feeds/src/web/WEB-INF/feeds-object.xml	2006-12-22 22:53:55 UTC (rev 8570)
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<deployments>
-    <deployment>
-		<if-exists>overwrite</if-exists>
-		<parent-ref>default</parent-ref>
-		<page>
-			<page-name>feedsview</page-name>
-			<window>
-				<window-name>FeedsViewPortletWindow</window-name>
-				<instance-ref>FeedsViewPortletInstance</instance-ref>
-				<region>center</region>
-				<height>0</height>
-			</window>
-		</page>
-	</deployment>
-</deployments>

Deleted: labs/shotoku/trunk-2.6/shotoku-feeds/src/web/WEB-INF/portlet-instances.xml
===================================================================
--- labs/shotoku/trunk-2.6/shotoku-feeds/src/web/WEB-INF/portlet-instances.xml	2006-12-22 22:53:04 UTC (rev 8569)
+++ labs/shotoku/trunk-2.6/shotoku-feeds/src/web/WEB-INF/portlet-instances.xml	2006-12-22 22:53:55 UTC (rev 8570)
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<deployments>
-    <deployment>
-        <if-exists>overwrite</if-exists>
-        <instance>
-            <instance-id>FeedsViewPortletInstance</instance-id>
-            <portlet-ref>FeedsViewPortlet</portlet-ref>
-        </instance>
-    </deployment>
-</deployments>

Deleted: labs/shotoku/trunk-2.6/shotoku-feeds/src/web/WEB-INF/portlet.xml
===================================================================
--- labs/shotoku/trunk-2.6/shotoku-feeds/src/web/WEB-INF/portlet.xml	2006-12-22 22:53:04 UTC (rev 8569)
+++ labs/shotoku/trunk-2.6/shotoku-feeds/src/web/WEB-INF/portlet.xml	2006-12-22 22:53:55 UTC (rev 8570)
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
-             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-             xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd" version="1.0">
-    <portlet>
-        <portlet-name>FeedsViewPortlet</portlet-name>
-        <portlet-class>org.jboss.shotoku.feeds.portlet.FeedsViewPortlet</portlet-class>
-        <supports>
-            <mime-type>text/html</mime-type>
-            <portlet-mode>VIEW</portlet-mode>
-        </supports>
-        <supported-locale>en</supported-locale>
-        <portlet-info>
-            <title>JBoss Feeds View Portlet</title>
-        </portlet-info>
-    </portlet>
-</portlet-app>

Modified: labs/shotoku/trunk-2.6/shotoku-portal/src/java/org/jboss/shotoku/portal/ShotokuCMS.java
===================================================================
--- labs/shotoku/trunk-2.6/shotoku-portal/src/java/org/jboss/shotoku/portal/ShotokuCMS.java	2006-12-22 22:53:04 UTC (rev 8569)
+++ labs/shotoku/trunk-2.6/shotoku-portal/src/java/org/jboss/shotoku/portal/ShotokuCMS.java	2006-12-22 22:53:55 UTC (rev 8570)
@@ -21,7 +21,6 @@
 */
 package org.jboss.shotoku.portal;
 
-import org.jboss.portal.common.system.AbstractJBossService;
 import org.jboss.portal.cms.CMS;
 import org.jboss.portal.cms.Command;
 import org.jboss.portal.cms.CommandFactory;

Added: labs/shotoku/trunk-2.6/shotoku-test/src/java/org/jboss/shotoku/test/ShotokuDemo.java
===================================================================
--- labs/shotoku/trunk-2.6/shotoku-test/src/java/org/jboss/shotoku/test/ShotokuDemo.java	2006-12-22 22:53:04 UTC (rev 8569)
+++ labs/shotoku/trunk-2.6/shotoku-test/src/java/org/jboss/shotoku/test/ShotokuDemo.java	2006-12-22 22:53:55 UTC (rev 8570)
@@ -0,0 +1,51 @@
+package org.jboss.shotoku.test;
+
+import org.jboss.shotoku.ContentManager;
+import org.jboss.shotoku.Node;
+import org.jboss.shotoku.aop.Inject;
+import org.jboss.shotoku.exceptions.ResourceDoesNotExist;
+
+import static java.lang.System.out;
+
+import java.util.Map;
+
+/**
+ * @author Adam Warski (adamw at aster.pl)
+ */
+public class ShotokuDemo {
+	@Inject
+    private ContentManager cm;
+
+	public void printNode(String pathToNode) {
+        try {
+            Node node = cm.getNode(pathToNode);
+
+            out.println("Content of node" + pathToNode + ": ");
+            out.println(node.getContent());
+
+            Map<String, String> properties = node.getProperties();
+            out.println("Properties of node " + pathToNode + ": ");
+            for (String propName : properties.keySet()) {
+                out.println(propName + " = " + properties.get(propName));
+            }
+        } catch (ResourceDoesNotExist resourceDoesNotExist) {
+            System.out.println("The given node does not exist: " + pathToNode + ".");
+        }
+
+    }
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

Modified: labs/shotoku/trunk-2.6/shotoku.iml
===================================================================
--- labs/shotoku/trunk-2.6/shotoku.iml	2006-12-22 22:53:04 UTC (rev 8569)
+++ labs/shotoku/trunk-2.6/shotoku.iml	2006-12-22 22:53:55 UTC (rev 8570)
@@ -5,6 +5,7 @@
     <output url="file://$MODULE_DIR$" />
     <content url="file://$MODULE_DIR$">
       <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+      <excludeFolder url="file://$MODULE_DIR$/shotoku-portal" />
     </content>
     <orderEntry type="inheritedJdk" />
     <orderEntry type="sourceFolder" forTests="false" />




More information about the jboss-svn-commits mailing list