abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r443018 - in /incubator/abdera/java/trunk: examples/src/main/java/org/apache/abdera/examples/appserver/ server/src/main/java/org/apache/abdera/protocol/server/provider/ server/src/main/java/org/apache/abdera/protocol/server/servlet/
Date Wed, 13 Sep 2006 16:36:40 GMT
Author: jmsnell
Date: Wed Sep 13 09:36:39 2006
New Revision: 443018

URL: http://svn.apache.org/viewvc?view=rev&rev=443018
Log:
Draft -10 updates

 * There is no longer any distinction between the member uri (ENTRY) and it's edit uri 
   (ENTRY_EDIT).  

 * Add a method for retrieving the Categories document

Modified:
    incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/appserver/SimpleProvider.java
    incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/appserver/SimpleTargetResolver.java
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/provider/Provider.java
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/provider/TargetType.java
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/servlet/DefaultRequestHandler.java

Modified: incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/appserver/SimpleProvider.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/appserver/SimpleProvider.java?view=diff&rev=443018&r1=443017&r2=443018
==============================================================================
--- incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/appserver/SimpleProvider.java
(original)
+++ incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/appserver/SimpleProvider.java
Wed Sep 13 09:36:39 2006
@@ -61,6 +61,7 @@
     try {
       Collection collection = workspace.addCollection("Simple", "atom/feed");
       collection.setAccept("entry");
+      collection.addCategories().setFixed(false);
     } catch (Exception e) {}
     return service.getDocument();
   }
@@ -124,7 +125,7 @@
       TargetType type = request.getTarget().getType();
       if (type == TargetType.TYPE_SERVICE) return getService(request, false);
       if (type == TargetType.TYPE_COLLECTION) return getFeed(request, false);
-      if (type == TargetType.TYPE_ENTRY_EDIT) return getEntry(request, false, true);
+      if (type == TargetType.TYPE_ENTRY) return getEntry(request, false);
       return null;
   }
 
@@ -184,8 +185,7 @@
 
   public ResponseContext getEntry(
     RequestContext request, 
-    boolean full,
-    boolean editable) {
+    boolean full) {
       Entry entry = (Entry) getEntry(request);
       if (entry != null) {
         Feed feed = entry.getParentElement();
@@ -277,7 +277,7 @@
   }
   
   private String getEntryID(RequestContext request) {
-    if (request.getTarget().getType() != TargetType.TYPE_ENTRY_EDIT) 
+    if (request.getTarget().getType() != TargetType.TYPE_ENTRY) 
       return null;
     String path = request.getUri().toString();
     String[] segments = path.split("/");
@@ -301,8 +301,7 @@
   
   public ResponseContext getMedia(
     RequestContext request, 
-    boolean full,
-    boolean editable) {
+    boolean full) {
       throw new UnsupportedOperationException();
   }
   
@@ -327,4 +326,9 @@
     }
     return true;
   }
+
+  public ResponseContext getCategories(RequestContext request, boolean full) {
+    return null;
+  }
+
 }

Modified: incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/appserver/SimpleTargetResolver.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/appserver/SimpleTargetResolver.java?view=diff&rev=443018&r1=443017&r2=443018
==============================================================================
--- incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/appserver/SimpleTargetResolver.java
(original)
+++ incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/appserver/SimpleTargetResolver.java
Wed Sep 13 09:36:39 2006
@@ -26,7 +26,7 @@
   public SimpleTargetResolver() {
     setPattern("/appserver/atom(\\?[^#]*)?", TargetType.TYPE_SERVICE);
     setPattern("/appserver/atom/feed(\\?[^#]*)?", TargetType.TYPE_COLLECTION);
-    setPattern("/appserver/atom/feed/([^/#?]+)(\\?[^#]*)?", TargetType.TYPE_ENTRY_EDIT);
+    setPattern("/appserver/atom/feed/([^/#?]+)(\\?[^#]*)?", TargetType.TYPE_ENTRY);
   }
   
 }

Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/provider/Provider.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/provider/Provider.java?view=diff&rev=443018&r1=443017&r2=443018
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/provider/Provider.java
(original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/provider/Provider.java
Wed Sep 13 09:36:39 2006
@@ -37,9 +37,11 @@
   
   ResponseContext getFeed(RequestContext request, boolean full);
   
-  ResponseContext getEntry(RequestContext request, boolean full, boolean editable);
+  ResponseContext getEntry(RequestContext request, boolean full);
   
-  ResponseContext getMedia(RequestContext request, boolean full, boolean editable);
+  ResponseContext getMedia(RequestContext request, boolean full);
+  
+  ResponseContext getCategories(RequestContext request, boolean full);
   
   ResponseContext entryPost(RequestContext request);
   

Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/provider/TargetType.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/provider/TargetType.java?view=diff&rev=443018&r1=443017&r2=443018
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/provider/TargetType.java
(original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/provider/TargetType.java
Wed Sep 13 09:36:39 2006
@@ -24,16 +24,14 @@
   public static final String COLLECTION = "COLLECTION";
   public static final String ENTRY = "ENTRY";
   public static final String MEDIA = "MEDIA";
-  public static final String ENTRY_EDIT = "ENTRY_EDIT";
-  public static final String MEDIA_EDIT = "MEDIA_EDIT";
+  public static final String CATEGORIES = "CATEGORIES";
   
   public static final TargetType TYPE_UNKNOWN = new TargetType(UNKNOWN);
   public static final TargetType TYPE_SERVICE = new TargetType(SERVICE);
   public static final TargetType TYPE_COLLECTION = new TargetType(COLLECTION);
   public static final TargetType TYPE_ENTRY = new TargetType(ENTRY);
   public static final TargetType TYPE_MEDIA = new TargetType(MEDIA);
-  public static final TargetType TYPE_ENTRY_EDIT = new TargetType(ENTRY_EDIT);
-  public static final TargetType TYPE_MEDIA_EDIT = new TargetType(MEDIA_EDIT);
+  public static final TargetType TYPE_CATEGORIES = new TargetType(CATEGORIES);
   
   public static TargetType get(String name) {
     if (name == null) return null;
@@ -42,8 +40,7 @@
     if (name == COLLECTION) return TYPE_COLLECTION;
     if (name == ENTRY) return TYPE_ENTRY;
     if (name == MEDIA) return TYPE_MEDIA;
-    if (name == ENTRY_EDIT) return TYPE_ENTRY_EDIT;
-    if (name == MEDIA_EDIT) return TYPE_MEDIA_EDIT;
+    if (name == CATEGORIES) return TYPE_CATEGORIES;
     return null;
   }
   

Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/servlet/DefaultRequestHandler.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/servlet/DefaultRequestHandler.java?view=diff&rev=443018&r1=443017&r2=443018
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/servlet/DefaultRequestHandler.java
(original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/servlet/DefaultRequestHandler.java
Wed Sep 13 09:36:39 2006
@@ -41,16 +41,13 @@
           return provider.getFeed(request, true);
         }
         if (type == TargetType.TYPE_ENTRY) {
-          return provider.getEntry(request, true, false);
-        }
-        if (type == TargetType.TYPE_ENTRY_EDIT) {
-          return provider.getEntry(request, true, true);
+          return provider.getEntry(request, true);
         }
         if (type == TargetType.TYPE_MEDIA) {
-          return provider.getMedia(request, true, false);
+          return provider.getMedia(request, true);
         }
-        if (type == TargetType.TYPE_MEDIA_EDIT) {
-          return provider.getMedia(request, true, true);
+        if (type == TargetType.TYPE_CATEGORIES) {
+          return provider.getCategories(request, true);
         }
       }
       else if (method == "HEAD") {
@@ -61,42 +58,39 @@
           return provider.getFeed(request, false);
         }
         if (type == TargetType.TYPE_ENTRY) {
-          return provider.getEntry(request, false, false);
-        }
-        if (type == TargetType.TYPE_ENTRY_EDIT) {
-          return provider.getEntry(request, false, true);
+          return provider.getEntry(request, false);
         }
         if (type == TargetType.TYPE_MEDIA) {
-          return provider.getMedia(request, false, false);
+          return provider.getMedia(request, false);
         }
-        if (type == TargetType.TYPE_MEDIA_EDIT) {
-          return provider.getMedia(request, false, true);
+        if (type == TargetType.TYPE_CATEGORIES) {
+          return provider.getCategories(request, false);
         }
       }
       else if (method == "POST") {
         if (type == TargetType.TYPE_COLLECTION) {
           return provider.createEntry(request);
         }
-        if (type == TargetType.TYPE_ENTRY_EDIT) {
+        if (type == TargetType.TYPE_ENTRY) {
           return provider.entryPost(request);
         }
-        if (type == TargetType.TYPE_MEDIA_EDIT) {
+        if (type == TargetType.TYPE_MEDIA) {
           return provider.mediaPost(request);
         }
       }
       else if (method == "PUT") {
-        if (type == TargetType.TYPE_ENTRY_EDIT) {
+        if (type == TargetType.TYPE_ENTRY) {
           return provider.updateEntry(request);
         }
-        if (type == TargetType.TYPE_MEDIA_EDIT) {
+        if (type == TargetType.TYPE_MEDIA) {
           return provider.updateMedia(request);
         }
       }
       else if (method == "DELETE") {
-        if (type == TargetType.TYPE_ENTRY_EDIT) {
+        if (type == TargetType.TYPE_ENTRY) {
           return provider.deleteEntry(request);
         }
-        if (type == TargetType.TYPE_MEDIA_EDIT) {
+        if (type == TargetType.TYPE_MEDIA) {
           return provider.deleteMedia(request);
         }
       } 
@@ -111,10 +105,9 @@
   protected String[] getAllowedMethods(TargetType type) {
     if (type == null)                       return new String[0];
     if (type == TargetType.TYPE_COLLECTION) return new String[] { "GET", "POST", "HEAD",
"OPTIONS" };
-    if (type == TargetType.TYPE_ENTRY)      return new String[] { "GET", "HEAD", "OPTIONS"
};
-    if (type == TargetType.TYPE_MEDIA)      return new String[] { "GET", "HEAD", "OPTIONS"
};
-    if (type == TargetType.TYPE_ENTRY_EDIT) return new String[] { "GET", "DELETE", "PUT",
"POST", "HEAD", "OPTIONS" };
-    if (type == TargetType.TYPE_MEDIA_EDIT) return new String[] { "GET", "DELETE", "PUT",
"POST", "HEAD", "OPTIONS" };
+    if (type == TargetType.TYPE_CATEGORIES) return new String[] { "GET", "HEAD", "OPTIONS"
};
+    if (type == TargetType.TYPE_ENTRY)      return new String[] { "GET", "DELETE", "PUT",
"POST", "HEAD", "OPTIONS" };
+    if (type == TargetType.TYPE_MEDIA)      return new String[] { "GET", "DELETE", "PUT",
"POST", "HEAD", "OPTIONS" };
     if (type == TargetType.TYPE_SERVICE)    return new String[] { "GET", "HEAD", "OPTIONS"
};
     return new String[] { "GET", "HEAD", "OPTIONS" };
   }



Mime
View raw message