roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r551778 - in /roller/trunk/apps/weblogger: src/java/org/apache/roller/weblogger/webservices/atomprotocol/ web/WEB-INF/classes/
Date Fri, 29 Jun 2007 03:02:57 GMT
Author: snoopdave
Date: Thu Jun 28 20:02:55 2007
New Revision: 551778

URL: http://svn.apache.org/viewvc?view=rev&rev=551778
Log:
Added final APP namespace URI and support for app:edited. Tested against latest Ape, there's
still one error that needs to be fixed.

Added:
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/AppModule.java
      - copied, changed from r551531, roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/PubControlModule.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/AppModuleGenerator.java
      - copied, changed from r551531, roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/PubControlModuleGenerator.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/AppModuleImpl.java
      - copied, changed from r551531, roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/PubControlModuleImpl.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/AppModuleParser.java
      - copied, changed from r551531, roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/PubControlModuleParser.java
Removed:
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/PubControlModule.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/PubControlModuleGenerator.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/PubControlModuleImpl.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/PubControlModuleParser.java
Modified:
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/AtomService.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/RollerAtomHandler.java
    roller/trunk/apps/weblogger/web/WEB-INF/classes/rome.properties

Copied: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/AppModule.java
(from r551531, roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/PubControlModule.java)
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/AppModule.java?view=diff&rev=551778&p1=roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/PubControlModule.java&r1=551531&p2=roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/AppModule.java&r2=551778
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/PubControlModule.java
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/AppModule.java
Thu Jun 28 20:02:55 2007
@@ -18,9 +18,12 @@
 package org.apache.roller.weblogger.webservices.atomprotocol;
 
 import com.sun.syndication.feed.module.Module;
+import java.util.Date;
 
-public interface PubControlModule extends Module {
-    public static final String URI = "http://purl.org/atom/app#";
+public interface AppModule extends Module {
+    public static final String URI = "http://www.w3.org/2007/app";
     public boolean getDraft();
     public void setDraft(boolean draft);
+    public Date getEdited();
+    public void setEdited(Date edited);
 }

Copied: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/AppModuleGenerator.java
(from r551531, roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/PubControlModuleGenerator.java)
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/AppModuleGenerator.java?view=diff&rev=551778&p1=roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/PubControlModuleGenerator.java&r1=551531&p2=roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/AppModuleGenerator.java&r2=551778
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/PubControlModuleGenerator.java
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/AppModuleGenerator.java
Thu Jun 28 20:02:55 2007
@@ -20,6 +20,8 @@
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Set;
+import org.apache.roller.weblogger.util.DateUtil;
+import org.apache.roller.weblogger.util.Utilities;
 
 import org.jdom.Element;
 import org.jdom.Namespace;
@@ -27,19 +29,19 @@
 import com.sun.syndication.feed.module.Module;
 import com.sun.syndication.io.ModuleGenerator;
 
-public class PubControlModuleGenerator implements ModuleGenerator {
-    private static final Namespace PUBCONTROL_NS  = 
-        Namespace.getNamespace("app", PubControlModule.URI);
+public class AppModuleGenerator implements ModuleGenerator {
+    private static final Namespace APP_NS  = 
+        Namespace.getNamespace("app", AppModule.URI);
 
     public String getNamespaceUri() {
-        return PubControlModule.URI;
+        return AppModule.URI;
     }
 
     private static final Set NAMESPACES;
 
     static {
         Set nss = new HashSet();
-        nss.add(PUBCONTROL_NS);
+        nss.add(APP_NS);
         NAMESPACES = Collections.unmodifiableSet(nss);
     }
 
@@ -48,17 +50,23 @@
     }
 
     public void generate(Module module, Element element) {
-        PubControlModule m = (PubControlModule)module;
+        AppModule m = (AppModule)module;
+        
         String draft = m.getDraft() ? "yes" : "no";
-        Element control = new Element("control", PUBCONTROL_NS);
+        Element control = new Element("control", APP_NS);
         control.addContent(generateSimpleElement("draft", draft));
         element.addContent(control);
+        
+        if (m.getEdited() != null) {
+            Element edited = new Element("edited", APP_NS);
+            edited.addContent(DateUtil.formatIso8601(m.getEdited()));
+            element.addContent(edited);
+        }
     }
 
     protected Element generateSimpleElement(String name, String value)  {
-        Element element = new Element(name, PUBCONTROL_NS);
+        Element element = new Element(name, APP_NS);
         element.addContent(value);
         return element;
     }
-
 }

Copied: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/AppModuleImpl.java
(from r551531, roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/PubControlModuleImpl.java)
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/AppModuleImpl.java?view=diff&rev=551778&p1=roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/PubControlModuleImpl.java&r1=551531&p2=roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/AppModuleImpl.java&r2=551778
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/PubControlModuleImpl.java
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/AppModuleImpl.java
Thu Jun 28 20:02:55 2007
@@ -18,24 +18,38 @@
 package org.apache.roller.weblogger.webservices.atomprotocol;
 
 import com.sun.syndication.feed.module.ModuleImpl;
+import java.util.Date;
 
-public class PubControlModuleImpl extends ModuleImpl implements PubControlModule {
-    private boolean _draft = false;
-
-    public PubControlModuleImpl() {
-        super(PubControlModule.class,PubControlModule.URI);
+public class AppModuleImpl extends ModuleImpl implements AppModule {
+    private boolean draft = false;
+    private Date edited = null;
+    
+    public AppModuleImpl() {
+        super(AppModule.class, AppModule.URI);
     }
+    
     public boolean getDraft() {
-        return _draft;
+        return draft;
     }
+    
     public void setDraft(boolean draft) {
-        _draft = draft;
+        this.draft = draft;
+    }
+    
+    public Date getEdited() {
+        return edited;
+    }
+
+    public void setEdited(Date edited) {
+        this.edited = edited;
     }
+    
     public Class getInterface() {
-        return PubControlModule.class;
+        return AppModule.class;
     }
+    
     public void copyFrom(Object obj) {
-        PubControlModule m = (PubControlModule)obj;
+        AppModule m = (AppModule)obj;
         setDraft(m.getDraft());
     }
 }

Copied: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/AppModuleParser.java
(from r551531, roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/PubControlModuleParser.java)
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/AppModuleParser.java?view=diff&rev=551778&p1=roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/PubControlModuleParser.java&r1=551531&p2=roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/AppModuleParser.java&r2=551778
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/PubControlModuleParser.java
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/AppModuleParser.java
Thu Jun 28 20:02:55 2007
@@ -17,31 +17,39 @@
 */
 package org.apache.roller.weblogger.webservices.atomprotocol;
 
+import org.apache.roller.weblogger.util.DateUtil;
 import org.jdom.Element;
 import org.jdom.Namespace;
 
 import com.sun.syndication.feed.module.Module;
 import com.sun.syndication.io.ModuleParser;
 
-public class PubControlModuleParser implements ModuleParser {
+public class AppModuleParser implements ModuleParser {
 
     public String getNamespaceUri() {
-        return PubControlModule.URI;
+        return AppModule.URI;
     }
 
     public Namespace getContentNamespace() {
-        return Namespace.getNamespace(PubControlModule.URI);
+        return Namespace.getNamespace(AppModule.URI);
     }
+    
     public Module parse(Element elem) {
         boolean foundSomething = false;
-        PubControlModule m = new PubControlModuleImpl();
-        Element e = elem.getChild("control", getContentNamespace());
-        if (e != null) {
-            Element draftElem = e.getChild("draft", getContentNamespace());
+        AppModule m = new AppModuleImpl();
+        Element control = elem.getChild("control", getContentNamespace());
+        if (control != null) {
+            Element draftElem = control.getChild("draft", getContentNamespace());
             if (draftElem != null) {
                 if ("yes".equals(draftElem.getText())) m.setDraft(true); 
                 if ("no".equals(draftElem.getText())) m.setDraft(false);                
             }
+        }
+        Element edited = elem.getChild("editied", getContentNamespace());
+        if (edited != null) {
+            try {
+                m.setEdited(DateUtil.parseIso8601(edited.getTextTrim()));
+            } catch (Exception ignored) {}
         }
         return m;
     }

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/AtomService.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/AtomService.java?view=diff&rev=551778&r1=551777&r2=551778
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/AtomService.java
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/AtomService.java
Thu Jun 28 20:02:55 2007
@@ -28,58 +28,8 @@
 
 /**
  * This class models an Atom Publishing Protocol AtomService Document.
- * <p />
- * Based on: draft-ietf-atompub-protocol-10.txt
- * <p />
+ * Based on: draft-ietf-atompub-protocol-10.txt.
  * Designed to be Roller independent.
- *//* 
-
-	namespace app = "http://purl.org/atom/app#"
-	start = appService
-	             
-	appService =
-	   element app:service {
-	      appCommonAttributes,
-	      ( appWorkspace+
-	        & extensionElement* )
-	   }
-	   
-	For example:
-	 
-	<?xml version="1.0" encoding='utf-8'?>
-	<service xmlns="http://purl.org/atom/app#"
-	         xmlns:atom="http://www.w3.org/2005/Atom">
-	  <workspace>
-	    <atom:title>Main Site</atom:title>
-	    <collection
-	        href="http://example.org/reilly/main" >
-	      <atom:title>My Blog Entries</atom:title>
-	      <categories
-	         href="http://example.com/cats/forMain.cats" />
-	    </collection>
-	    <collection
-	        href="http://example.org/reilly/pic" >
-	      <atom:title>Pictures</atom:title>
-	      <accept>image/*</accept>
-	    </collection>
-	  </workspace>
-	  <workspace>
-	    <atom:title>Side Bar Blog</atom:title>
-	    <collection
-	        href="http://example.org/reilly/list" >
-	      <atom:title>Remaindered Links</atom:title>
-	      <accept>entry</accept>
-	      <categories fixed="yes">
-	        <atom:category
-	          scheme="http://example.org/extra-cats/"
-	          term="joke" />
-	        <atom:category
-	          scheme="http://example.org/extra-cats/"
-	          term="serious" />
-	      </categories>
-	    </collection>
-	  </workspace>
-	</service>
  */
 public class AtomService {
 
@@ -91,7 +41,7 @@
     
     /** Namespace for Atom Publishing Protocol */
     public static Namespace ATOM_PROTOCOL = 
-        Namespace.getNamespace("app","http://purl.org/atom/app#");  
+        Namespace.getNamespace("app","http://www.w3.org/2007/app");  
         
     public AtomService() {
     }

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/RollerAtomHandler.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/RollerAtomHandler.java?view=diff&rev=551778&r1=551777&r2=551778
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/RollerAtomHandler.java
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/RollerAtomHandler.java
Thu Jun 28 20:02:55 2007
@@ -1032,10 +1032,10 @@
         atomEntry.setOtherLinks(otherlinks);
         
         List modules = new ArrayList();
-        PubControlModule pubControl = new PubControlModuleImpl();
-        pubControl.setDraft(
-                !WeblogEntry.PUBLISHED.equals(entry.getStatus()));
-        modules.add(pubControl);
+        AppModule app = new AppModuleImpl();
+        app.setDraft(!WeblogEntry.PUBLISHED.equals(entry.getStatus()));
+        app.setEdited(entry.getUpdateTime());
+        modules.add(app);
         atomEntry.setModules(modules);
         
         return atomEntry;
@@ -1085,6 +1085,13 @@
         contents.add(content);
         entry.setContents(contents);
         
+        List modules = new ArrayList();
+        AppModule app = new AppModuleImpl();
+        app.setDraft(false);
+        app.setEdited(entry.getUpdated());
+        modules.add(app);
+        entry.setModules(modules);
+        
         return entry;
     }
     
@@ -1113,8 +1120,8 @@
         rollerEntry.setPubTime(pubTime);
         rollerEntry.setUpdateTime(updateTime);
         
-        PubControlModule control =
-                (PubControlModule)entry.getModule("http://purl.org/atom/app#");
+        AppModule control =
+                (AppModule)entry.getModule("http://purl.org/atom/app#");
         if (control!=null && control.getDraft()) {
             rollerEntry.setStatus(WeblogEntry.DRAFT);
         } else {

Modified: roller/trunk/apps/weblogger/web/WEB-INF/classes/rome.properties
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/web/WEB-INF/classes/rome.properties?view=diff&rev=551778&r1=551777&r2=551778
==============================================================================
--- roller/trunk/apps/weblogger/web/WEB-INF/classes/rome.properties (original)
+++ roller/trunk/apps/weblogger/web/WEB-INF/classes/rome.properties Thu Jun 28 20:02:55 2007
@@ -54,9 +54,9 @@
                                   
 # Handle Atom Pub Protocol pubcontrol extension
                                       
-atom_1.0.item.ModuleParser.classes   =org.apache.roller.weblogger.webservices.atomprotocol.PubControlModuleParser
+atom_1.0.item.ModuleParser.classes   =org.apache.roller.weblogger.webservices.atomprotocol.AppModuleParser
 
-atom_1.0.item.ModuleGenerator.classes =org.apache.roller.weblogger.webservices.atomprotocol.PubControlModuleGenerator
+atom_1.0.item.ModuleGenerator.classes =org.apache.roller.weblogger.webservices.atomprotocol.AppModuleGenerator
                                   
 
 



Mime
View raw message