You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by sn...@apache.org on 2006/03/10 20:08:11 UTC

svn commit: r384898 - in /incubator/roller/trunk/sandbox/atomadminprotocol: ./ src/org/roller/presentation/atomadminapi/ src/org/roller/presentation/atomadminapi/sdk/

Author: snoopdave
Date: Fri Mar 10 11:08:09 2006
New Revision: 384898

URL: http://svn.apache.org/viewcvs?rev=384898&view=rev
Log:
Ongoing work from Jeff Blatmann on Roller/Atom Admin Protocol

Added:
    incubator/roller/trunk/sandbox/atomadminprotocol/build.xml
    incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/sdk/
    incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/sdk/Entry.java
    incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/sdk/EntrySet.java
    incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/sdk/MemberEntry.java
    incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/sdk/MemberEntrySet.java
    incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/sdk/Service.java
    incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/sdk/UserEntry.java
    incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/sdk/UserEntrySet.java
    incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/sdk/WeblogEntry.java
    incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/sdk/WeblogEntrySet.java
Removed:
    incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/AtomAdminService.java
    incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/Entry.java
    incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/EntrySet.java
    incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/MemberEntry.java
    incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/MemberEntrySet.java
    incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/UserEntry.java
    incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/UserEntrySet.java
    incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/WeblogEntry.java
    incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/WeblogEntrySet.java
Modified:
    incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/AtomAdminServlet.java
    incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/Handler.java
    incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/IntrospectionHandler.java
    incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/RollerMemberHandler.java
    incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/RollerUserHandler.java
    incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/RollerWeblogHandler.java

Added: incubator/roller/trunk/sandbox/atomadminprotocol/build.xml
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/sandbox/atomadminprotocol/build.xml?rev=384898&view=auto
==============================================================================
--- incubator/roller/trunk/sandbox/atomadminprotocol/build.xml (added)
+++ incubator/roller/trunk/sandbox/atomadminprotocol/build.xml Fri Mar 10 11:08:09 2006
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<!DOCTYPE project [
+    <!ENTITY properties SYSTEM "properties.xmlf">
+]>
+<project name="aapp" default="all">	
+    <target name="all" depends="sdk,javadoc"/>
+            
+    <target name="sdk">
+        <mkdir dir="dist"/>
+        <jar basedir="../../build/compile_web/" destfile="dist/aapp-sdk.jar">
+            <include name="org/roller/presentation/atomadminapi/sdk/*.class"/>            
+        </jar>
+    </target>
+
+    <target name="javadoc">
+        <mkdir dir="javadoc"/>
+        <javadoc packagenames="org.roller.presentation.atomadminapi.sdk.*" sourcepath="src" destdir="javadoc" classpath="../../build/compile_web"/>
+    </target>
+    
+    <target name="clean">
+        <delete dir="dist" />
+        <delete dir="javadoc" />
+    </target>
+
+</project>

Modified: incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/AtomAdminServlet.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/AtomAdminServlet.java?rev=384898&r1=384897&r2=384898&view=diff
==============================================================================
--- incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/AtomAdminServlet.java (original)
+++ incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/AtomAdminServlet.java Fri Mar 10 11:08:09 2006
@@ -28,6 +28,7 @@
 import org.jdom.Document;
 import org.jdom.output.XMLOutputter;
 import org.jdom.output.Format;
+import org.roller.presentation.atomadminapi.sdk.EntrySet;
 
 /**
  * Atom Admin Servlet implements the Atom Admin endpoint.
@@ -54,16 +55,13 @@
             }
             
             EntrySet c = handler.processGet();
-            Document doc = c.toDocument();
             
+            res.setStatus(HttpServletResponse.SC_OK);            
             res.setContentType("application/xml; charset=utf8");
+            String s = c.toString();
             Writer writer = res.getWriter();
-            XMLOutputter outputter = new XMLOutputter();
-            outputter.setFormat(Format.getPrettyFormat());
-            outputter.output(doc, writer);
-            writer.close();
-            
-            res.setStatus(HttpServletResponse.SC_OK);
+            writer.write(s);            
+            writer.close();            
         } catch (Exception e) {
             res.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
             e.printStackTrace(res.getWriter());
@@ -85,17 +83,13 @@
             }
             
             EntrySet c = handler.processPost(new InputStreamReader(req.getInputStream()));
-            Document doc = c.toDocument();
-            
             
+            res.setStatus(HttpServletResponse.SC_CREATED);            
             res.setContentType("application/xml; charset=utf8");
+            String s = c.toString();
             Writer writer = res.getWriter();
-            XMLOutputter outputter = new XMLOutputter();
-            outputter.setFormat(Format.getPrettyFormat());
-            outputter.output(doc, writer);
-            writer.close();
-            
-            res.setStatus(HttpServletResponse.SC_OK);
+            writer.write(s);            
+            writer.close();            
         } catch (Exception e) {
             res.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
             e.printStackTrace(res.getWriter());
@@ -117,16 +111,13 @@
             }
             
             EntrySet c = handler.processPut(new InputStreamReader(req.getInputStream()));
-            Document doc = c.toDocument();
             
+            res.setStatus(HttpServletResponse.SC_OK);            
             res.setContentType("application/xml; charset=utf8");
+            String s = c.toString();
             Writer writer = res.getWriter();
-            XMLOutputter outputter = new XMLOutputter();
-            outputter.setFormat(Format.getPrettyFormat());
-            outputter.output(doc, writer);
-            writer.close();
-            
-            res.setStatus(HttpServletResponse.SC_OK);
+            writer.write(s);            
+            writer.close();            
         } catch (Exception e) {
             res.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
             e.printStackTrace(res.getWriter());
@@ -135,7 +126,7 @@
     }
     
     /**
-     * Handle Atom DELETE by calling appropriate handler.
+     * Handle Atom Admin DELETE by calling appropriate handler.
      */
     protected void doDelete(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
         try {
@@ -147,16 +138,13 @@
             }
             
             EntrySet es = handler.processDelete();
-            Document doc = es.toDocument();
             
+            res.setStatus(HttpServletResponse.SC_OK);                        
             res.setContentType("application/xml; charset=utf8");
+            String s = es.toString();
             Writer writer = res.getWriter();
-            XMLOutputter outputter = new XMLOutputter();
-            outputter.setFormat(Format.getPrettyFormat());
-            outputter.output(doc, writer);
-            writer.close();
-            
-            res.setStatus(HttpServletResponse.SC_OK);            
+            writer.write(s);            
+            writer.close();                        
         } catch (Exception e) {
             res.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
             e.printStackTrace(res.getWriter());

Modified: incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/Handler.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/Handler.java?rev=384898&r1=384897&r2=384898&view=diff
==============================================================================
--- incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/Handler.java (original)
+++ incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/Handler.java Fri Mar 10 11:08:09 2006
@@ -15,6 +15,7 @@
 import org.roller.model.RollerFactory;
 import org.roller.pojos.UserData;
 import org.roller.presentation.RollerContext;
+import org.roller.presentation.atomadminapi.sdk.EntrySet;
 import org.roller.util.StringUtils;
 
 /**

Modified: incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/IntrospectionHandler.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/IntrospectionHandler.java?rev=384898&r1=384897&r2=384898&view=diff
==============================================================================
--- incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/IntrospectionHandler.java (original)
+++ incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/IntrospectionHandler.java Fri Mar 10 11:08:09 2006
@@ -9,6 +9,9 @@
 import java.util.ArrayList;
 import java.util.List;
 import javax.servlet.http.HttpServletRequest;
+import org.roller.presentation.atomadminapi.sdk.Service;
+import org.roller.presentation.atomadminapi.sdk.Entry;
+import org.roller.presentation.atomadminapi.sdk.EntrySet;
 
 /**
  * This class handles requests for the AAPP introspection document.
@@ -41,33 +44,33 @@
         throw new UnsupportedOperationException("ERROR: DELETE not supported in this handler");
     }
     
-    private AtomAdminService getIntrospection(HttpServletRequest req) throws Exception {
+    private Service getIntrospection(HttpServletRequest req) throws Exception {
         String href = getUrlPrefix();
-        AtomAdminService service = new AtomAdminService(href);
+        Service service = new Service(href);
         
-        AtomAdminService.Workspace workspace = new AtomAdminService.Workspace();
+        Service.Workspace workspace = new Service.Workspace();
         workspace.setTitle("Workspace: Collections for administration");
         workspace.setHref(service.getHref());
         service.setEntries(new Entry[] { workspace });
         
         List workspaceCollections = new ArrayList();
         
-        AtomAdminService.WorkspaceCollection weblogCol = new AtomAdminService.WorkspaceCollection();
+        Service.Workspace.Collection weblogCol = new Service.Workspace.Collection();
         weblogCol.setTitle("Collection: Weblog administration entries");
-        weblogCol.setMemberType(org.roller.presentation.atomadminapi.Entry.Types.WEBLOG);
-        weblogCol.setHref(service.getHref() + "/" + org.roller.presentation.atomadminapi.EntrySet.Types.WEBLOGS);
+        weblogCol.setMemberType(org.roller.presentation.atomadminapi.sdk.Entry.Types.WEBLOG);
+        weblogCol.setHref(service.getHref() + "/" + org.roller.presentation.atomadminapi.sdk.EntrySet.Types.WEBLOGS);
         workspaceCollections.add(weblogCol);
         
-        AtomAdminService.WorkspaceCollection userCol = new AtomAdminService.WorkspaceCollection();
+        Service.Workspace.Collection userCol = new Service.Workspace.Collection();
         userCol.setTitle("Collection: User administration entries");
         userCol.setMemberType("user");
-        userCol.setHref(service.getHref() + "/" + org.roller.presentation.atomadminapi.EntrySet.Types.USERS);
+        userCol.setHref(service.getHref() + "/" + org.roller.presentation.atomadminapi.sdk.EntrySet.Types.USERS);
         workspaceCollections.add(userCol);
         
-        AtomAdminService.WorkspaceCollection memberCol = new AtomAdminService.WorkspaceCollection();
+        Service.Workspace.Collection memberCol = new Service.Workspace.Collection();
         memberCol.setTitle("Collection: Member administration entries");
         memberCol.setMemberType("member");
-        memberCol.setHref(service.getHref() + "/" + org.roller.presentation.atomadminapi.EntrySet.Types.MEMBERS);
+        memberCol.setHref(service.getHref() + "/" + org.roller.presentation.atomadminapi.sdk.EntrySet.Types.MEMBERS);
         workspaceCollections.add(memberCol);
         
         workspace.setEntries((Entry[])workspaceCollections.toArray(new Entry[0]));

Modified: incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/RollerMemberHandler.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/RollerMemberHandler.java?rev=384898&r1=384897&r2=384898&view=diff
==============================================================================
--- incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/RollerMemberHandler.java (original)
+++ incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/RollerMemberHandler.java Fri Mar 10 11:08:09 2006
@@ -18,6 +18,11 @@
 import org.roller.pojos.PermissionsData;
 import org.roller.pojos.UserData;
 import org.roller.pojos.WebsiteData;
+import org.roller.presentation.atomadminapi.sdk.Entry;
+import org.roller.presentation.atomadminapi.sdk.EntrySet;
+import org.roller.presentation.atomadminapi.sdk.MemberEntry;
+import org.roller.presentation.atomadminapi.sdk.MemberEntrySet;
+import org.roller.presentation.cache.CacheManager;
 
 /**
  * This class handles requests concerning Roller weblog membership (groups).
@@ -117,7 +122,7 @@
                 perms.add(pd);
             }
         }
-        EntrySet es = new MemberEntrySet((PermissionsData[])perms.toArray(new PermissionsData[0]), getUrlPrefix());
+        EntrySet es = toMemberEntrySet((PermissionsData[])perms.toArray(new PermissionsData[0]));
         return es;
     }
     
@@ -147,7 +152,7 @@
             perms = Collections.singletonList(getRoller().getUserManager().getPermissions(wd, ud));
         }
         
-        EntrySet es = new MemberEntrySet((PermissionsData[])perms.toArray(new PermissionsData[0]), getUrlPrefix());
+        EntrySet es = toMemberEntrySet((PermissionsData[])perms.toArray(new PermissionsData[0]));
         return es;
     }
     
@@ -240,7 +245,7 @@
             PermissionsData pd = new PermissionsData();
             pd.setUser(ud);
             pd.setWebsite(wd);
-            pd.setPermissionMask(entry.getPermissionMask());
+            pd.setPermissionMask(stringToMask(entry.getPermission()));
             pd.setPending(false);
             
             return pd;
@@ -287,7 +292,7 @@
         // only permission can be updated
         
         if (entry.getPermission() != null) {
-            pd.setPermissionMask(entry.getPermissionMask());
+            pd.setPermissionMask(stringToMask(entry.getPermission()));
         }
     }
     
@@ -305,15 +310,70 @@
             getRoller().setUser(UserData.SYSTEM_USER);
             PermissionsData pd = getPermissionsData(handle, username);
             PermissionsData[] pds = new PermissionsData[] { pd };               
-            EntrySet es = new MemberEntrySet(pds, getUrlPrefix());
+            EntrySet es = toMemberEntrySet(pds);
         
             pd.remove();
             getRoller().commit();
 
+            UserData ud = getRoller().getUserManager().getUser(username);            
+            CacheManager.invalidate(ud);
+            WebsiteData wd = getRoller().getUserManager().getWebsiteByHandle(handle);
+            CacheManager.invalidate(wd);
+            
             return es;            
         } catch (RollerException re) {
             throw new Exception(re);
         }
     }
+    
+    private MemberEntry toMemberEntry(PermissionsData pd) {
+        MemberEntry me = new MemberEntry(pd.getWebsite().getHandle(), pd.getUser().getUserName(), getUrlPrefix());        
+        me.setPermission(maskToString(pd.getPermissionMask()));          
+        
+        return me;
+    }
+    private MemberEntrySet toMemberEntrySet(PermissionsData[] pds) {
+        if (pds == null) {
+            throw new NullPointerException("ERROR: Null permission data not allowed");
+        }
+        
+        List entries = new ArrayList();        
+        for (int i = 0; i < pds.length; i++) {
+            PermissionsData pd = pds[i];
+            Entry entry = toMemberEntry(pd);
+            entries.add(entry);            
+        }
+        MemberEntrySet mes = new MemberEntrySet(getUrlPrefix());
+        mes.setEntries((Entry[])entries.toArray(new Entry[0])); 
+        
+        return mes;
+    }
+    
+    private static String maskToString(short mask) {
+        if (mask == PermissionsData.ADMIN) {
+            return MemberEntry.Permissions.ADMIN;
+        }
+        if (mask == PermissionsData.AUTHOR) {
+            return MemberEntry.Permissions.AUTHOR;
+        }
+        if (mask == PermissionsData.LIMITED) {
+            return MemberEntry.Permissions.LIMITED;
+        }
+        return null;
+    }
+
+    
+    private static short stringToMask(String s) {
+        if (s.equalsIgnoreCase(MemberEntry.Permissions.ADMIN)) {
+            return PermissionsData.ADMIN;
+        }
+        if (s.equalsIgnoreCase(MemberEntry.Permissions.AUTHOR)) {
+            return PermissionsData.AUTHOR;
+        }
+        if (s.equalsIgnoreCase(MemberEntry.Permissions.LIMITED)) {
+            return PermissionsData.LIMITED;
+        }
+        return 0;
+    }    
 }
 

Modified: incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/RollerUserHandler.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/RollerUserHandler.java?rev=384898&r1=384897&r2=384898&view=diff
==============================================================================
--- incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/RollerUserHandler.java (original)
+++ incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/RollerUserHandler.java Fri Mar 10 11:08:09 2006
@@ -6,7 +6,7 @@
 package org.roller.presentation.atomadminapi;
 
 import java.io.Reader;
-import java.util.HashMap;
+import java.util.ArrayList;
 import java.util.List;
 import javax.servlet.http.HttpServletRequest;
 import org.jdom.Document;
@@ -14,8 +14,11 @@
 import org.roller.RollerException;
 import org.roller.model.UserManager;
 import org.roller.pojos.UserData;
-import org.roller.pojos.WebsiteData;
-import org.roller.presentation.atomadminapi.EntrySet.Types;
+import org.roller.presentation.atomadminapi.sdk.Entry;
+import org.roller.presentation.atomadminapi.sdk.EntrySet;
+import org.roller.presentation.atomadminapi.sdk.UserEntry;
+import org.roller.presentation.atomadminapi.sdk.UserEntrySet;
+import org.roller.presentation.cache.CacheManager;
 
 /**
  * This class handles request concerning Roller users.
@@ -65,7 +68,7 @@
     
     private EntrySet getCollection() throws Exception {
         List users = getRoller().getUserManager().getUsers();
-        EntrySet es = new UserEntrySet((UserData[])users.toArray(new UserData[0]), getUrlPrefix());
+        EntrySet es = toUserEntrySet((UserData[])users.toArray(new UserData[0]));
         
         return es;
     }
@@ -76,7 +79,7 @@
             throw new Exception("ERROR: Unknown user name: " + getUri().getEntryId());
         }
         UserData[] uds = new UserData[] { ud };
-        EntrySet c = new UserEntrySet(uds, getUrlPrefix());
+        EntrySet c = toUserEntrySet(uds);
         
         return c;
     }
@@ -128,7 +131,7 @@
             
             for (int i = 0; i < c.getEntries().length; i++) {
                 UserEntry entry = (UserEntry)c.getEntries()[i];
-                UserData user = entry.toUserData();
+                UserData user = toUserData(entry);
                 mgr.addUser(user);
             }
             getRoller().commit();
@@ -182,16 +185,66 @@
             UserManager mgr = getRoller().getUserManager();
             UserData ud = mgr.getUser(getUri().getEntryId());
             
+            // don't allow deletion of the currently authenticated user
+            if (ud.getUserName().equals(getUsername())) {
+                throw new Exception("ERROR: Can't delete authenticated user: " + getUsername());
+            }
+            
             UserData[] uds = new UserData[] { ud };
-            EntrySet es = new UserEntrySet(uds, getUrlPrefix());
+            EntrySet es = toUserEntrySet(uds);
             
             ud.remove();
             getRoller().commit();
             
+            CacheManager.invalidate(ud);
+            
             return es;
         } catch (RollerException re) {
             throw new Exception(re);
         }
     }
+    
+    private UserEntry toUserEntry(UserData ud) {
+        UserEntry ue = new UserEntry(ud.getUserName(), getUrlPrefix());
+        ue.setFullName(ud.getFullName());
+        ue.setPassword(ud.getPassword());
+        ue.setLocale(ud.getLocale());
+        ue.setTimezone(ud.getTimeZone());
+        ue.setEmailAddress(ud.getEmailAddress());
+        ue.setDateCreated(ud.getDateCreated());        
+        
+        return ue;
+    }
+    
+    private UserEntrySet toUserEntrySet(UserData[] uds) {
+        if (uds == null) {
+            throw new NullPointerException("ERROR: Null user data not allowed");
+        }
+        UserEntrySet ues = new UserEntrySet(getUrlPrefix());        
+        
+        List entries = new ArrayList();        
+        for (int i = 0; i < uds.length; i++) {
+            UserData ud = uds[i];
+            Entry entry = toUserEntry(ud);
+            entries.add(entry);            
+        }
+        ues.setEntries((Entry[])entries.toArray(new Entry[0]));  
+        
+        return ues;
+    }
+    
+    /** This object, as a Roller UserData object. */
+    public UserData toUserData(UserEntry ue) {
+        UserData ud = new UserData();
+        ud.setUserName(ue.getName());
+        ud.setFullName(ue.getFullName());
+        ud.setPassword(ue.getPassword());
+        ud.setEmailAddress(ue.getEmailAddress());
+        ud.setLocale(ue.getLocale());
+        ud.setTimeZone(ue.getTimezone());
+        ud.setDateCreated(ue.getDateCreated());
+        
+        return ud;
+    }    
 }
 

Modified: incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/RollerWeblogHandler.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/RollerWeblogHandler.java?rev=384898&r1=384897&r2=384898&view=diff
==============================================================================
--- incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/RollerWeblogHandler.java (original)
+++ incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/RollerWeblogHandler.java Fri Mar 10 11:08:09 2006
@@ -6,16 +6,23 @@
 package org.roller.presentation.atomadminapi;
 
 import java.io.Reader;
+import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
 import javax.servlet.http.HttpServletRequest;
 import org.jdom.Document;
 import org.jdom.input.SAXBuilder;
 import org.roller.RollerException;
 import org.roller.model.UserManager;
+import org.roller.pojos.PermissionsData;
 import org.roller.pojos.UserData;
 import org.roller.pojos.WebsiteData;
-import org.roller.presentation.atomadminapi.EntrySet.Types;
+import org.roller.presentation.atomadminapi.sdk.Entry;
+import org.roller.presentation.atomadminapi.sdk.EntrySet;
+import org.roller.presentation.atomadminapi.sdk.WeblogEntry;
+import org.roller.presentation.atomadminapi.sdk.WeblogEntrySet;
+import org.roller.presentation.cache.CacheManager;
 
 /**
  * This class handles requests concernning Roller weblog resources.
@@ -68,7 +75,7 @@
     
     private EntrySet getCollection() throws Exception {
         List users = getRoller().getUserManager().getUsers();
-        EntrySet c = new WeblogEntrySet((UserData[])users.toArray(new UserData[0]), getUrlPrefix());
+        EntrySet c = toWeblogEntrySet(users);
         
         return c;
     }
@@ -79,7 +86,7 @@
             throw new Exception("ERROR: Unknown weblog handle: " + getUri().getEntryId());
         }
         WebsiteData[] wds = new WebsiteData[] { wd };
-        EntrySet c = new WeblogEntrySet(wds, getUrlPrefix());
+        EntrySet c = toWeblogEntrySet(wds);
         
         return c;
     }
@@ -197,15 +204,68 @@
             }
             
             WebsiteData[] wds = new WebsiteData[] { wd };            
-            EntrySet es = new WeblogEntrySet(wds, getUrlPrefix());            
+            EntrySet es = toWeblogEntrySet(wds);            
             
             wd.remove();
             getRoller().commit();
             
+            CacheManager.invalidate(wd);
+            
             return es;
         } catch (RollerException re) {
             throw new Exception(re);
         }
     }
+    
+    private WeblogEntry toWeblogEntry(WebsiteData wd) {
+        WeblogEntry we = new WeblogEntry(wd.getHandle(), getUrlPrefix());
+        we.setName(wd.getName());
+        we.setDescription(wd.getDescription());
+        we.setLocale(wd.getLocale());
+        we.setTimezone(wd.getTimeZone());
+        we.setCreatingUser(wd.getCreator().getUserName());
+        we.setEmailAddress(wd.getEmailAddress());        
+        we.setDateCreated(wd.getDateCreated());
+        
+        return we;
+    }
+    
+    private WeblogEntrySet toWeblogEntrySet(List uds) {
+        if (uds == null) {
+            throw new NullPointerException("ERROR: Null user data not allowed");
+        }
+        
+        WeblogEntrySet wes = new WeblogEntrySet(getUrlPrefix());
+        List entries = new ArrayList();        
+        for (Iterator i = uds.iterator(); i.hasNext(); ) {
+            UserData ud = (UserData)i.next();
+            List permissions = ud.getPermissions();
+            for (Iterator j = permissions.iterator(); j.hasNext(); ) {
+                PermissionsData pd = (PermissionsData)j.next();
+                WebsiteData wd = pd.getWebsite();
+                WeblogEntry we = toWeblogEntry(wd);
+                entries.add(we);
+            }
+        }
+        wes.setEntries((Entry[])entries.toArray(new Entry[0]));
+
+        return wes;
+    }
+    
+    private WeblogEntrySet toWeblogEntrySet(WebsiteData[] wds) {
+        if (wds == null) {
+            throw new NullPointerException("ERROR: Null website datas not allowed");
+        }
+        
+        WeblogEntrySet wes = new WeblogEntrySet(getUrlPrefix());        
+        List entries = new ArrayList();
+        for (int i = 0; i < wds.length; i++) {
+            WeblogEntry we = toWeblogEntry(wds[i]);
+            entries.add(we);
+        }
+        wes.setEntries((Entry[])entries.toArray(new Entry[0]));
+        
+        return wes;
+    }    
 }
 

Added: incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/sdk/Entry.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/sdk/Entry.java?rev=384898&view=auto
==============================================================================
--- incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/sdk/Entry.java (added)
+++ incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/sdk/Entry.java Fri Mar 10 11:08:09 2006
@@ -0,0 +1,89 @@
+/*
+ * Entry.java
+ *
+ * Created on January 17, 2006, 12:44 PM
+ */
+
+package org.roller.presentation.atomadminapi.sdk;
+
+import java.io.IOException;
+import java.io.StringWriter;
+import java.io.Writer;
+import org.jdom.Document;
+import org.jdom.Namespace;
+import org.jdom.output.Format;
+import org.jdom.output.XMLOutputter;
+
+/**
+ * This class is the abstract notion of an entry.
+ * Weblog resources are represented by sets of entries.
+ *
+ * @author jtb
+ */
+public abstract class Entry {
+    protected static final Namespace NAMESPACE = Namespace.getNamespace("http://purl.org/atom/aapp#");
+    
+    /** Entry types. */
+    public static interface Types {
+        /** 
+         * User entry.
+         * A user entry is contained within a user entry set.
+         */
+        public static final String USER = "user";
+        /**
+         * Weblog entry.
+         * A weblog entry is contained within a weblog entry set.
+         */
+        public static final String WEBLOG = "weblog";
+        /**
+         * Member entry.
+         * A member entry is contained within a member entry set.
+         */
+        public static final String MEMBER = "member";
+        /**
+         * Collection entry.
+         * A collection entry is contained within a workspace, which is
+         * contained within a service.
+         */
+        public static final String COLLECTION = "collection";
+    }
+    
+    /** XML attributes common to all entry types. */
+    protected static interface Attributes {
+        public static final String HREF = "href";
+    }
+    
+    private String href = null;
+    
+    /** Get the HREF that identifies this entry. */
+    public String getHref() {
+        return href;
+    }
+    
+    /** Set the HREF that identifies this entry. */
+    public void setHref(String href) {
+        this.href = href;
+    }
+    
+    /** This entry, as a JDOM Document object. */
+    public abstract Document toDocument();
+    
+    /** 
+     * This entry, as a String (XML).
+     */
+    public String toString() {
+        Writer writer = new StringWriter();
+        XMLOutputter outputter = new XMLOutputter();
+        outputter.setFormat(Format.getPrettyFormat());
+        try {
+            outputter.output(toDocument(), writer);
+            writer.close();
+        } catch (IOException ioe) {
+            throw new IllegalStateException(ioe.getMessage());
+        }
+        
+        return writer.toString();
+    }
+    
+    public abstract String getType();
+}

Added: incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/sdk/EntrySet.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/sdk/EntrySet.java?rev=384898&view=auto
==============================================================================
--- incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/sdk/EntrySet.java (added)
+++ incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/sdk/EntrySet.java Fri Mar 10 11:08:09 2006
@@ -0,0 +1,84 @@
+/*
+ * EntrySet.java
+ *
+ * Created on January 17, 2006, 12:44 PM
+ */
+
+package org.roller.presentation.atomadminapi.sdk;
+
+import java.util.Arrays;
+import java.util.List;
+import org.jdom.Document;
+import org.jdom.Element;
+
+/**
+ * This class is the abstract notion of a set of entries.
+ * Weblog resources are represented by sets of entries. 
+ *
+ * @author jtb
+ */
+public abstract class EntrySet extends Entry {
+    /** Entry set types. */
+    public static interface Types {
+        /*
+         * Set of user entries. 
+         * A user entry describes a user of the weblog server.
+         */
+        public static final String USERS = "users";
+        /** 
+         * Set of weblog entries. 
+         * Note that this is not a set of entries in a weblog, but rather,
+         * a set of entries that describe the weblog itself.
+         */
+        public static final String WEBLOGS = "weblogs";
+        /** 
+         * Set of member entries.
+         * A member entry describes a user's membership to and 
+         * permission with a particular weblog.
+         */
+        public static final String MEMBERS = "members";
+         /**
+          * Set of workspace entries.
+          * This type, along with WORKSPACE and COLLECTION, define
+          * the element that describe the introspection document
+          * for the AAPP service.
+          * <p>
+          * A service is a set of workspaces, and a workspace is a set of 
+          * collections.
+          */
+        public static final String SERVICE = "service";        
+        /** Set of collection entries. */
+        public static final String WORKSPACE = "workspace";           
+    }
+    
+    private List entries = null;
+        
+    /** Get the type of this object. */
+    public abstract String getType();
+    
+    /** Get the entries in this object. */
+    public Entry[] getEntries() {
+        return (Entry[])entries.toArray(new Entry[0]);
+    }
+    
+    /** Set the entries of this object. */
+    public void setEntries(Entry[] entryArray) {
+        entries = Arrays.asList(entryArray);
+    }
+    
+    /** This object as a JDOM Document */
+    public Document toDocument() {
+        Element e = new Element(getType(), NAMESPACE);
+        Document doc = new Document(e);
+        
+        // href
+        e.setAttribute(Attributes.HREF, getHref());
+        
+        // entries
+        for (int i = 0; i < getEntries().length; i++) {
+            e.addContent(getEntries()[i].toDocument().detachRootElement());
+        }
+        
+        return doc;
+    }    
+}

Added: incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/sdk/MemberEntry.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/sdk/MemberEntry.java?rev=384898&view=auto
==============================================================================
--- incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/sdk/MemberEntry.java (added)
+++ incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/sdk/MemberEntry.java Fri Mar 10 11:08:09 2006
@@ -0,0 +1,143 @@
+/*
+ * MemberEntry.java
+ *
+ * Created on January 17, 2006, 12:44 PM
+ */
+
+package org.roller.presentation.atomadminapi.sdk;
+
+import java.io.InputStream;
+import org.jdom.Document;
+import org.jdom.Element;
+import org.jdom.Text;
+import org.jdom.input.SAXBuilder;
+import org.roller.presentation.atomadminapi.sdk.Entry.Attributes;
+import org.roller.presentation.atomadminapi.sdk.Entry.Types;
+
+/**
+ * This class describes a member entry. 
+ * A member entry is a triple consisting of a user name, a weblog handle,
+ * and a permission.
+ */
+public class MemberEntry extends Entry {
+    /** Member permissions */
+    public interface Permissions {
+        public static final String ADMIN = "ADMIN";
+        public static final String AUTHOR = "AUTHOR";
+        public static final String LIMITED = "LIMITED";
+    }
+    
+    static interface Tags {
+        public static final String MEMBER = "member";
+        public static final String NAME = "name";
+        public static final String HANDLE = "handle";
+        public static final String PERMISSION = "permission";
+    }     
+    
+    private String name;
+    private String handle;
+    private String permission;
+    
+    public MemberEntry(Element e, String urlPrefix) throws Exception {
+        populate(e, urlPrefix);
+    }
+    
+    public MemberEntry(String handle, String userName, String urlPrefix) {
+        String href = urlPrefix + "/" + EntrySet.Types.MEMBERS + "/" + handle + "/" + userName;       
+	setHref(href);
+        setHandle(handle);
+        setName(userName);
+    }
+
+    public MemberEntry(InputStream stream, String urlPrefix) throws Exception {               
+        SAXBuilder sb = new SAXBuilder();
+        Document d = sb.build(stream);
+        Element e = d.detachRootElement();
+        
+        populate(e, urlPrefix);        
+    }
+
+    private void populate(Element e, String urlPrefix) throws Exception {
+        // name
+        Element nameElement = e.getChild(Tags.NAME, NAMESPACE);
+        if (nameElement == null) {
+            throw new Exception("ERROR: Missing element: " + Tags.NAME);
+        }
+        setName(nameElement.getText());
+                
+        // handle
+        Element handleElement = e.getChild(Tags.HANDLE, NAMESPACE);
+        if (handleElement == null) {
+            throw new Exception("ERROR: Missing element: " + Tags.HANDLE);
+        }
+        setHandle(handleElement.getText());
+
+        // href
+        setHref(urlPrefix + "/" + EntrySet.Types.MEMBERS + "/" + getHandle() + "/" + getName()); 
+        
+        // password
+        Element permissionElement = e.getChild(Tags.PERMISSION, NAMESPACE);
+        if (permissionElement == null) {
+            throw new Exception("ERROR: Missing element: " + Tags.PERMISSION);
+        }
+        setPermission(permissionElement.getText());
+    }
+    
+    
+    public String getType() {
+        return Types.MEMBER;
+    }
+    
+    public Document toDocument() {
+        Element member = new Element(Tags.MEMBER, NAMESPACE);
+        Document doc = new Document(member);
+        
+        // href
+        member.setAttribute(Attributes.HREF, getHref());
+               
+        // name
+        Element name = new Element(Tags.NAME, Service.NAMESPACE);
+        Text nameText = new Text(getName());
+        name.addContent(nameText);
+        member.addContent(name);
+       
+        // handle
+        Element handle = new Element(Tags.HANDLE, NAMESPACE);
+        Text handleText = new Text(getHandle());
+        handle.addContent(handleText);
+        member.addContent(handle);
+        
+        // permission
+        Element permission = new Element(Tags.PERMISSION, NAMESPACE);
+        Text permissionText = new Text(getPermission());
+        permission.addContent(permissionText);
+        member.addContent(permission);
+                
+        return doc;
+    }
+            
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getHandle() {
+        return handle;
+    }
+
+    public void setHandle(String handle) {
+        this.handle = handle;
+    }
+
+    public String getPermission() {
+        return permission;
+    }
+    
+    public void setPermission(String permission) {
+        this.permission = permission;
+    }
+}

Added: incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/sdk/MemberEntrySet.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/sdk/MemberEntrySet.java?rev=384898&view=auto
==============================================================================
--- incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/sdk/MemberEntrySet.java (added)
+++ incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/sdk/MemberEntrySet.java Fri Mar 10 11:08:09 2006
@@ -0,0 +1,65 @@
+/*
+ * WeblogEntrySet.java
+ *
+ * Created on January 17, 2006, 12:44 PM
+ */
+
+package org.roller.presentation.atomadminapi.sdk;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import org.jdom.Document;
+import org.jdom.Element;
+import org.jdom.input.SAXBuilder;
+import org.roller.presentation.atomadminapi.sdk.EntrySet.Types;
+
+/**
+ * This class describes a set of member entries. 
+ *
+ * @author jtb
+ */
+public class MemberEntrySet extends EntrySet {
+    static interface Tags {
+        public static final String MEMBERS = "members";
+    }       
+        
+    public MemberEntrySet(String urlPrefix) {
+        setHref(urlPrefix + "/" + Types.MEMBERS);        
+    }    
+
+    public MemberEntrySet(Document d, String urlPrefix) throws Exception {
+        populate(d, urlPrefix);
+    }
+    
+    public MemberEntrySet(InputStream stream, String urlPrefix) throws Exception {               
+        SAXBuilder sb = new SAXBuilder();
+        Document d = sb.build(stream);
+
+        populate(d, urlPrefix);        
+    }    
+    
+    private void populate(Document d, String urlPrefix) throws Exception {
+        Element root = d.getRootElement();
+        String rootName = root.getName();
+        if (!rootName.equals(Tags.MEMBERS)) {
+            throw new Exception("ERROR: Expected root name: " + Tags.MEMBERS + ", root name was: " + rootName);
+        }
+        List members = root.getChildren(MemberEntry.Tags.MEMBER, NAMESPACE);
+        if (members != null) {
+            List entries = new ArrayList();
+            for (Iterator i = members.iterator(); i.hasNext(); ) {
+                Element member = (Element)i.next();
+                MemberEntry entry = new MemberEntry(member, urlPrefix);
+                entries.add(entry);
+            }
+            setEntries((Entry[])entries.toArray(new Entry[0]));
+        }
+        setHref(urlPrefix + "/" + Types.MEMBERS);
+    }
+        
+    public String getType() {
+        return Types.MEMBERS;
+    }    
+}

Added: incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/sdk/Service.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/sdk/Service.java?rev=384898&view=auto
==============================================================================
--- incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/sdk/Service.java (added)
+++ incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/sdk/Service.java Fri Mar 10 11:08:09 2006
@@ -0,0 +1,139 @@
+/*
+ * AtomAdminService.java
+ *
+ * Created on January 17, 2006, 12:44 PM
+ */
+package org.roller.presentation.atomadminapi.sdk;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.jdom.Document;
+import org.jdom.Element;
+import org.jdom.Namespace;
+import org.jdom.filter.Filter;
+
+/**
+ * This class describes an AAPP service (introspection document).
+ * A Service is a set of workspaces, which is a set of
+ * collections.
+ *
+ * @author jtb
+ */
+
+public class Service extends EntrySet {
+    /** This class describes a service workspace. */    
+    public static class Workspace extends EntrySet {        
+        /** This class describes a workspace collection. */
+        public static class Collection extends Entry {
+            private static interface Tags {
+                public static final String MEMBER_TYPE = "member-type";
+            }
+            
+            private static interface Attributes {
+                public static final String TITLE = "title";
+            }
+            
+            private String title;
+            private String memberType;
+            
+            public Collection() {
+                // nothing
+            }
+            
+            public String getType() {
+                return Types.COLLECTION;
+            }
+            
+            public String getTitle() {
+                return title;
+            }
+            
+            public void setTitle(String title) {
+                this.title = title;
+            }
+            
+            
+            public Document toDocument() {
+                Document doc = new Document();
+                Element element = new Element(Types.COLLECTION, NAMESPACE);
+                doc.setRootElement(element);
+                
+                element.setAttribute(Attributes.TITLE, getTitle());
+                element.setAttribute(Entry.Attributes.HREF, getHref());
+                
+                Element memberType = new Element(Tags.MEMBER_TYPE, NAMESPACE);
+                memberType.setText(getMemberType());
+                element.addContent(memberType);
+                
+                return doc;
+            }
+            
+            public String getMemberType() {
+                return memberType;
+            }
+            
+            public void setMemberType(String memberType) {
+                this.memberType = memberType;
+            }
+            
+        }
+        
+        private static interface Attributes {
+            public static final String TITLE = "title";
+        }
+        
+        private String title = null;
+        
+        public Workspace() {
+        }
+        
+        public String getType() {
+            return Types.WORKSPACE;
+        }
+        
+        public String getTitle() {
+            return title;
+        }
+        
+        public void setTitle(String title) {
+            this.title = title;
+        }
+        
+        
+        public Document toDocument() {
+            Document doc = new Document();
+            Element element = new Element(EntrySet.Types.WORKSPACE, NAMESPACE);
+            doc.setRootElement(element);
+            
+            element.setAttribute(Attributes.TITLE, getTitle());
+            for (int i = 0; i < getEntries().length; i++) {
+                Entry entry = getEntries()[i];
+                element.addContent(entry.toDocument().detachRootElement());
+            }
+            
+            return doc;
+        }
+    }
+    
+    public Service(String href) {
+        setHref(href);
+    }
+    
+    public String getType() {
+        return Types.SERVICE;
+    }
+    
+    public Document toDocument() {
+        Document doc = new Document();
+        Element root = new Element(Types.SERVICE, NAMESPACE);
+        doc.setRootElement(root);
+        
+        for (int i = 0; i < getEntries().length; i++) {
+            Entry entry = getEntries()[i];
+            root.addContent(entry.toDocument().detachRootElement());
+        }
+        
+        return doc;
+    }

Added: incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/sdk/UserEntry.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/sdk/UserEntry.java?rev=384898&view=auto
==============================================================================
--- incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/sdk/UserEntry.java (added)
+++ incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/sdk/UserEntry.java Fri Mar 10 11:08:09 2006
@@ -0,0 +1,267 @@
+/*
+ * UserEntry.java
+ *
+ * Created on January 17, 2006, 12:44 PM
+ */
+
+package org.roller.presentation.atomadminapi.sdk;
+
+import java.io.InputStream;
+import java.util.Date;
+import org.jdom.Document;
+import org.jdom.Element;
+import org.jdom.Text;
+import org.jdom.input.SAXBuilder;
+import org.roller.presentation.atomadminapi.sdk.Entry.Attributes;
+import org.roller.presentation.atomadminapi.sdk.Entry.Types;
+
+/**
+ * This class describes a user entry; a user weblog resource.
+ * @author jtb
+ */
+public class UserEntry extends Entry {
+    /** XML tags that define a user entry. */
+    static interface Tags {
+        public static final String USER = "user";
+        public static final String NAME = "name";
+        public static final String FULL_NAME = "full-name";
+        public static final String PASSWORD = "password";
+        public static final String EMAIL_ADDRESS = "email-address";
+        public static final String LOCALE = "locale";
+        public static final String TIMEZONE = "timezone";
+        public static final String DATE_CREATED = "date-created";
+    }
+    
+    private String name;
+    private String fullName;
+    private String password;
+    private String locale;
+    private String timezone;
+    private Date dateCreated;
+    private String emailAddress;
+    
+    /** Construct an empty user entry */
+    public UserEntry(String name, String urlPrefix) {
+        setName(name);
+        String href = urlPrefix + "/" + EntrySet.Types.USERS + "/" + name;                
+        setHref(href);
+    }
+    
+    /** Construct a user entry from a JDOM element. */
+    public UserEntry(Element e, String urlPrefix) throws Exception {
+        populate(e, urlPrefix);
+    }
+    
+    public UserEntry(InputStream stream, String urlPrefix) throws Exception {               
+        SAXBuilder sb = new SAXBuilder();
+        Document d = sb.build(stream);
+        Element e = d.detachRootElement();
+        
+        populate(e, urlPrefix);        
+    }
+    
+    private void populate(Element e, String urlPrefix) throws Exception {
+        // name
+        Element nameElement = e.getChild(Tags.NAME, NAMESPACE);
+        if (nameElement == null) {
+            throw new Exception("ERROR: Missing element: " + Tags.NAME);
+        }
+        setName(nameElement.getText());
+        
+        // href
+        String href = urlPrefix + "/" + EntrySet.Types.USERS + "/" + getName();
+        setHref(href);
+        
+        // full name
+        Element fullNameElement = e.getChild(Tags.FULL_NAME, NAMESPACE);
+        if (fullNameElement == null) {
+            throw new Exception("ERROR: Missing element: " + Tags.FULL_NAME);
+        }
+        setFullName(fullNameElement.getText());
+        
+        // password
+        Element passwordElement = e.getChild(Tags.PASSWORD, NAMESPACE);
+        if (passwordElement == null) {
+            throw new Exception("ERROR: Missing element: " + Tags.PASSWORD);
+        }
+        setPassword(passwordElement.getText());
+        
+        // locale
+        Element localeElement = e.getChild(Tags.LOCALE, Service.NAMESPACE);
+        if (localeElement == null) {
+            throw new Exception("ERROR: Missing element: " + Tags.LOCALE);
+        }
+        setLocale(localeElement.getText());
+        
+        // timezone
+        Element tzElement = e.getChild(Tags.TIMEZONE, Service.NAMESPACE);
+        if (tzElement == null) {
+            throw new Exception("ERROR: Missing element: " + Tags.TIMEZONE);
+        }
+        setTimezone(tzElement.getText());
+        
+        // email address
+        Element emailElement = e.getChild(Tags.EMAIL_ADDRESS, Service.NAMESPACE);
+        if (emailElement == null) {
+            throw new Exception("ERROR: Missing element: " + Tags.EMAIL_ADDRESS);
+        }
+        setEmailAddress(emailElement.getText());
+        
+        // created (optional)
+        Element createdElement = e.getChild(Tags.DATE_CREATED, Service.NAMESPACE);
+        if (createdElement != null) {
+            setDateCreated(new Date(Long.valueOf(createdElement.getText()).longValue()));
+        }
+    }
+    
+        
+    public String getType() {
+        return Types.USER;
+    }
+    
+    public Document toDocument() {
+        Element userElement = new Element(Tags.USER, NAMESPACE);
+        Document doc = new Document(userElement);
+        
+        // href
+        String href = getHref();
+        if (href != null) {
+            userElement.setAttribute(Attributes.HREF, href);
+        }
+        
+        // name
+        String name = getName();
+        if (name != null) {
+            Element nameElement = new Element(Tags.NAME, Service.NAMESPACE);
+            Text nameText = new Text(getName());
+            nameElement.addContent(nameText);
+            userElement.addContent(nameElement);
+        }
+        
+        // full name
+        String fullName = getFullName();
+        if (fullName != null) {
+            Element fullNameElement = new Element(Tags.FULL_NAME, NAMESPACE);
+            Text fullNameText = new Text(getFullName());
+            fullNameElement.addContent(fullNameText);
+            userElement.addContent(fullNameElement);
+        }
+        
+        // password
+        String password = getPassword();
+        if (password != null) {
+            Element passwordElement = new Element(Tags.PASSWORD, NAMESPACE);
+            Text passwordText = new Text(getPassword());
+            passwordElement.addContent(passwordText);
+            userElement.addContent(passwordElement);
+        }
+        
+        // locale
+        String locale = getLocale();
+        if (locale != null ) {
+            Element localeElement = new Element(Tags.LOCALE, Service.NAMESPACE);
+            Text localeText = new Text(getLocale());
+            localeElement.addContent(localeText);
+            userElement.addContent(localeElement);
+        }
+        
+        // timezone
+        String timezone = getTimezone();
+        if (timezone != null) {
+            Element timezoneElement = new Element(Tags.TIMEZONE, Service.NAMESPACE);
+            Text timezoneText = new Text(timezone);
+            timezoneElement.addContent(timezoneText);
+            userElement.addContent(timezoneElement);
+        }
+        
+        // email address
+        String emailAddress = getEmailAddress();
+        if (emailAddress != null) {
+            Element emailAddressElement = new Element(Tags.EMAIL_ADDRESS, Service.NAMESPACE);
+            Text emailAddressText = new Text(String.valueOf(emailAddress));
+            emailAddressElement.addContent(emailAddressText);
+            userElement.addContent(emailAddressElement);
+        }
+        
+        // creation date (optional)
+        Date datedCreated = getDateCreated();
+        if (dateCreated != null) {
+            Element dateCreatedElement = new Element(Tags.DATE_CREATED, Service.NAMESPACE);
+            Text dateCreatedText = new Text(String.valueOf(dateCreated.getTime()));
+            dateCreatedElement.addContent(dateCreatedText);
+            userElement.addContent(dateCreatedElement);
+        }
+        
+        return doc;
+    }
+    
+    /** Get the user name of this user entry. */
+    public String getName() {
+        return name;
+    }
+    
+    /** Set of the user name of this user entry. */
+    public void setName(String name) {
+        this.name = name;
+    }
+    
+    /** Get the full name of this user entry. */
+    public String getFullName() {
+        return fullName;
+    }
+    
+    /** Set the full name of this user entry. */
+    public void setFullName(String fullName) {
+        this.fullName = fullName;
+    }
+    
+    /** Get the password of this user entry. */
+    public String getPassword() {
+        return password;
+    }
+    
+    /** Set the password of this user entry. */
+    public void setPassword(String password) {
+        this.password = password;
+    }
+    
+    /** Get the locale string of this user entry. */
+    public String getLocale() {
+        return locale;
+    }
+    
+    /** Set the locale string of this user entry. */
+    public void setLocale(String locale) {
+        this.locale = locale;
+    }
+    
+    /** Get the timezone string of this user entry. */
+    public String getTimezone() {
+        return timezone;
+    }
+    
+    /** Set the timezone string of this user entry. */
+    public void setTimezone(String timezone) {
+        this.timezone = timezone;
+    }
+    
+    /** Get the date created of this user entry. */
+    public Date getDateCreated() {
+        return dateCreated;
+    }
+    
+    /** Set the date created of this user entry. */
+    public void setDateCreated(Date dateCreated) {
+        this.dateCreated = dateCreated;
+    }
+    
+    /** Get the email address of this user entry. */
+    public String getEmailAddress() {
+        return emailAddress;
+    }
+    
+    /** Set the email address of this user entry. */
+    public void setEmailAddress(String emailAddress) {
+        this.emailAddress = emailAddress;
+    }    
+}

Added: incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/sdk/UserEntrySet.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/sdk/UserEntrySet.java?rev=384898&view=auto
==============================================================================
--- incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/sdk/UserEntrySet.java (added)
+++ incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/sdk/UserEntrySet.java Fri Mar 10 11:08:09 2006
@@ -0,0 +1,67 @@
+/*
+ * UserEntrySet.java
+ *
+ * Created on January 17, 2006, 12:44 PM
+ */
+
+package org.roller.presentation.atomadminapi.sdk;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import org.jdom.Document;
+import org.jdom.Element;
+import org.jdom.input.SAXBuilder;
+import org.roller.presentation.atomadminapi.sdk.EntrySet.Types;
+
+/**
+ * This class describes a set of user entries. 
+ * @author jtb
+ */
+public class UserEntrySet extends EntrySet {
+    /** XML tags that describe a set of user entries. */
+    private static interface Tags {
+        public static final String USERS = "users";
+    }       
+        
+    /** Construct based on an array of Roller UserData objects. */
+    public UserEntrySet(String urlPrefix) {
+        setHref(urlPrefix + "/" + Types.USERS);
+    }
+    
+    /** Construct based on a JDOM Document object. */
+    public UserEntrySet(Document d, String urlPrefix) throws Exception {
+        populate(d, urlPrefix);
+    }
+    
+    public UserEntrySet(InputStream stream, String urlPrefix) throws Exception {               
+        SAXBuilder sb = new SAXBuilder();
+        Document d = sb.build(stream);
+
+        populate(d, urlPrefix);        
+    }        
+    
+    private void populate(Document d, String urlPrefix) throws Exception {
+        Element root = d.getRootElement();
+        String rootName = root.getName();
+        if (!rootName.equals(Tags.USERS)) {
+            throw new Exception("ERROR: Expected root name: " + Tags.USERS + ", root name was: " + rootName);
+        }
+        List users = root.getChildren(UserEntry.Tags.USER, NAMESPACE);
+        if (users != null) {
+            List entries = new ArrayList();
+            for (Iterator i = users.iterator(); i.hasNext(); ) {
+                Element user = (Element)i.next();
+                UserEntry entry = new UserEntry(user, urlPrefix);
+                entries.add(entry);
+            }
+            setEntries((Entry[])entries.toArray(new Entry[0]));
+        }
+        setHref(urlPrefix + "/" + Types.USERS);
+    }    
+        
+    public String getType() {
+        return Types.USERS;
+    }    
+}

Added: incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/sdk/WeblogEntry.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/sdk/WeblogEntry.java?rev=384898&view=auto
==============================================================================
--- incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/sdk/WeblogEntry.java (added)
+++ incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/sdk/WeblogEntry.java Fri Mar 10 11:08:09 2006
@@ -0,0 +1,250 @@
+package org.roller.presentation.atomadminapi.sdk;
+/*
+ * WeblogEntry.java
+ *
+ * Created on January 17, 2006, 12:44 PM
+ */
+
+import java.io.InputStream;
+import java.util.Date;
+import org.jdom.Document;
+import org.jdom.Element;
+import org.jdom.Text;
+import org.jdom.input.SAXBuilder;
+import org.roller.presentation.atomadminapi.sdk.Entry.Attributes;
+import org.roller.presentation.atomadminapi.sdk.Entry.Types;
+
+/**
+ * This class describes a weblog entry. 
+ */
+public class WeblogEntry extends Entry {
+    static interface Tags {
+        public static final String WEBLOG = "weblog";
+        public static final String HANDLE = "handle";
+        public static final String NAME = "name";
+        public static final String DESCRIPTION = "description";
+        public static final String LOCALE = "locale";
+        public static final String TIMEZONE = "timezone";
+        public static final String DATE_CREATED = "date-created";
+        public static final String CREATING_USER = "creating-user";
+        public static final String EMAIL_ADDRESS = "email-address";
+    }
+    
+    private String handle;
+    private String name;
+    private String description;
+    private String locale;
+    private String timezone;
+    private Date dateCreated;
+    private String creatingUser;
+    private String emailAddress;
+    
+    public WeblogEntry(Element e, String urlPrefix) throws Exception {
+        populate(e, urlPrefix);
+    }
+    
+    public WeblogEntry(InputStream stream, String urlPrefix) throws Exception {               
+        SAXBuilder sb = new SAXBuilder();
+        Document d = sb.build(stream);
+        Element e = d.detachRootElement();
+        
+        populate(e, urlPrefix);        
+    }
+    
+    private void populate(Element e, String urlPrefix) throws Exception {
+        // handle
+        Element handleElement = e.getChild(Tags.HANDLE, Service.NAMESPACE);
+        if (handleElement == null) {
+            throw new Exception("ERROR: Missing element: " + Tags.HANDLE);
+        }
+        
+        // href
+        setHandle(handleElement.getText());
+        String href = urlPrefix + "/" + EntrySet.Types.WEBLOGS + "/" + getHandle();        
+        setHref(href);        
+        
+        // name
+        Element nameElement = e.getChild(Tags.NAME, Service.NAMESPACE);
+        if (nameElement == null) {
+            throw new Exception("ERROR: Missing element: " + Tags.NAME);
+        }
+        setName(nameElement.getText());
+        
+        // description
+        Element descElement = e.getChild(Tags.DESCRIPTION, Service.NAMESPACE);
+        if (descElement == null) {
+            throw new Exception("ERROR: Missing element: " + Tags.DESCRIPTION);
+        }
+        setDescription(descElement.getText());
+        
+        // locale
+        Element localeElement = e.getChild(Tags.LOCALE, Service.NAMESPACE);
+        if (localeElement == null) {
+            throw new Exception("ERROR: Missing element: " + Tags.LOCALE);
+        }
+        setLocale(localeElement.getText());
+        
+        // timezone
+        Element tzElement = e.getChild(Tags.TIMEZONE, Service.NAMESPACE);
+        if (tzElement == null) {
+            throw new Exception("ERROR: Missing element: " + Tags.TIMEZONE);
+        }
+        setTimezone(tzElement.getText());
+        
+        // creator
+        Element creatorElement = e.getChild(Tags.CREATING_USER, Service.NAMESPACE);
+        if (creatorElement == null) {
+            throw new Exception("ERROR: Missing element: " + Tags.CREATING_USER);
+        }
+        setCreatingUser(creatorElement.getText());
+        
+        // email address
+        Element emailElement = e.getChild(Tags.EMAIL_ADDRESS, Service.NAMESPACE);
+        if (emailElement == null) {
+            throw new Exception("ERROR: Missing element: " + Tags.EMAIL_ADDRESS);
+        }
+        setEmailAddress(emailElement.getText());        
+        
+        // created (optional)
+        Element createdElement = e.getChild(Tags.DATE_CREATED, Service.NAMESPACE);
+        if (createdElement != null) {
+            setDateCreated(new Date(Long.valueOf(createdElement.getText()).longValue()));
+        }              
+    }
+    
+    
+    public WeblogEntry(String handle, String urlPrefix) {
+        String href = urlPrefix + "/" + EntrySet.Types.WEBLOGS + "/" + handle;        
+        setHref(href);
+        setHandle(handle);
+    }
+    
+    public String getType() {
+        return Types.WEBLOG;
+    }
+    
+    public Document toDocument() {        
+        Element weblog = new Element(Tags.WEBLOG, Service.NAMESPACE);
+        Document doc = new Document(weblog);
+        
+        // link
+        weblog.setAttribute(Attributes.HREF, getHref());
+        
+        // handle
+        Element handle = new Element(Tags.HANDLE, Service.NAMESPACE);
+        Text handleText = new Text(getHandle());
+        handle.addContent(handleText);
+        weblog.addContent(handle);
+        
+        // name
+        Element name = new Element(Tags.NAME, Service.NAMESPACE);
+        Text nameText = new Text(getName());
+        name.addContent(nameText);
+        weblog.addContent(name);
+        
+        // description
+        Element desc = new Element(Tags.DESCRIPTION, Service.NAMESPACE);
+        Text descText = new Text(getDescription());
+        desc.addContent(descText);
+        weblog.addContent(desc);
+        
+        // locale
+        Element locale = new Element(Tags.LOCALE, Service.NAMESPACE);
+        Text localeText = new Text(getLocale());
+        locale.addContent(localeText);
+        weblog.addContent(locale);
+        
+        // timezone
+        Element tz = new Element(Tags.TIMEZONE, Service.NAMESPACE);
+        Text tzText = new Text(getTimezone());
+        tz.addContent(tzText);
+        weblog.addContent(tz);
+        
+        // creating user
+        Element creator = new Element(Tags.CREATING_USER, Service.NAMESPACE);
+        Text creatorText = new Text(String.valueOf(getCreatingUser()));
+        creator.addContent(creatorText);
+        weblog.addContent(creator);
+        
+        // email address
+        Element email = new Element(Tags.EMAIL_ADDRESS, Service.NAMESPACE);
+        Text emailText = new Text(String.valueOf(getEmailAddress()));
+        email.addContent(emailText);
+        weblog.addContent(email);        
+        
+        // creation date (optional)
+        Element created = new Element(Tags.DATE_CREATED, Service.NAMESPACE);
+        Date datedCreated = getDateCreated();
+        if (dateCreated != null) {
+            Text createdText = new Text(String.valueOf(dateCreated.getTime()));
+            created.addContent(createdText);
+            weblog.addContent(created);
+        }
+        
+        return doc;
+    }    
+    
+    public String getHandle() {
+        return handle;
+    }
+    
+    public void setHandle(String handle) {
+        this.handle = handle;
+    }
+    
+    public String getDescription() {
+        return description;
+    }
+    
+    public void setDescription(String description) {
+        this.description = description;
+    }
+    
+    public String getLocale() {
+        return locale;
+    }
+    
+    public void setLocale(String locale) {
+        this.locale = locale;
+    }
+    
+    public String getTimezone() {
+        return timezone;
+    }
+    
+    public void setTimezone(String timezone) {
+        this.timezone = timezone;
+    }
+    
+    public String getName() {
+        return name;
+    }
+    
+    public void setName(String name) {
+        this.name = name;
+    }
+    
+    public Date getDateCreated() {
+        return dateCreated;
+    }
+    
+    public void setDateCreated(Date dateCreated) {
+        this.dateCreated = dateCreated;
+    }
+    
+    public String getCreatingUser() {
+        return creatingUser;
+    }
+    
+    public void setCreatingUser(String creatingUser) {
+        this.creatingUser = creatingUser;
+    }
+
+    public String getEmailAddress() {
+        return emailAddress;
+    }
+
+    public void setEmailAddress(String emailAddress) {
+        this.emailAddress = emailAddress;
+    }
+}

Added: incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/sdk/WeblogEntrySet.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/sdk/WeblogEntrySet.java?rev=384898&view=auto
==============================================================================
--- incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/sdk/WeblogEntrySet.java (added)
+++ incubator/roller/trunk/sandbox/atomadminprotocol/src/org/roller/presentation/atomadminapi/sdk/WeblogEntrySet.java Fri Mar 10 11:08:09 2006
@@ -0,0 +1,64 @@
+/*
+ * WeblogEntrySet.java
+ *
+ * Created on January 17, 2006, 12:44 PM
+ */
+
+package org.roller.presentation.atomadminapi.sdk;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import org.jdom.Document;
+import org.jdom.Element;
+import org.jdom.input.SAXBuilder;
+import org.roller.presentation.atomadminapi.sdk.EntrySet.Types;
+
+/**
+ * This class describes a set of weblog entries. 
+ * @author jtb
+ */
+public class WeblogEntrySet extends EntrySet {
+    static interface Tags {
+        public static final String WEBLOGS = "weblogs";
+    }      
+    
+    public WeblogEntrySet(String urlPrefix) {
+        setHref(urlPrefix + "/" + Types.WEBLOGS);
+    }
+    
+    public WeblogEntrySet(Document d, String urlPrefix) throws Exception {
+        populate(d, urlPrefix);
+    }
+    
+    public WeblogEntrySet(InputStream stream, String urlPrefix) throws Exception {               
+        SAXBuilder sb = new SAXBuilder();
+        Document d = sb.build(stream);
+
+        populate(d, urlPrefix);        
+    }    
+    
+    private void populate(Document d, String urlPrefix) throws Exception {
+        Element root = d.getRootElement();
+        String rootName = root.getName();
+        if (!rootName.equals(Tags.WEBLOGS)) {
+            throw new Exception("ERROR: Expected root name: " + Tags.WEBLOGS + ", root name was: " + rootName);
+        }
+        List weblogs = root.getChildren(WeblogEntry.Tags.WEBLOG, Service.NAMESPACE);
+        if (weblogs != null) {
+            List entries = new ArrayList();
+            for (Iterator i = weblogs.iterator(); i.hasNext(); ) {
+                Element weblog = (Element)i.next();
+                WeblogEntry entry = new WeblogEntry(weblog, urlPrefix);
+                entries.add(entry);
+            }
+            setEntries((Entry[])entries.toArray(new Entry[0]));
+        }
+        setHref(urlPrefix + "/" + Types.WEBLOGS);
+    }    
+       
+    public String getType() {
+        return Types.WEBLOGS;
+    }    
+}