abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r600739 - in /incubator/abdera/java/trunk/server/src: main/java/org/apache/abdera/protocol/server/ main/java/org/apache/abdera/protocol/server/impl/ test/java/org/apache/abdera/protocol/server/ test/java/org/apache/abdera/test/server/
Date Tue, 04 Dec 2007 00:14:50 GMT
Author: jmsnell
Date: Mon Dec  3 16:14:49 2007
New Revision: 600739

URL: http://svn.apache.org/viewvc?rev=600739&view=rev
Log:
More API cleanup

Modified:
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/RequestContext.java
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/Target.java
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractTarget.java
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/HttpServletRequestContext.java
    incubator/abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/ContentProviderTest.java
    incubator/abdera/java/trunk/server/src/test/java/org/apache/abdera/test/server/UtilityTest.java

Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/RequestContext.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/RequestContext.java?rev=600739&r1=600738&r2=600739&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/RequestContext.java
(original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/RequestContext.java
Mon Dec  3 16:14:49 2007
@@ -26,13 +26,13 @@
 import javax.security.auth.Subject;
 
 import org.apache.abdera.Abdera;
+import org.apache.abdera.i18n.iri.IRI;
 import org.apache.abdera.model.Document;
 import org.apache.abdera.model.Element;
 import org.apache.abdera.parser.ParseException;
 import org.apache.abdera.parser.Parser;
 import org.apache.abdera.parser.ParserOptions;
 import org.apache.abdera.protocol.Request;
-import org.apache.abdera.i18n.iri.IRI;
 
 public interface RequestContext 
   extends Request {
@@ -75,7 +75,7 @@
   
   String[] getAttributeNames(Scope scope);
   
-  void setAttribute(Scope scope, String name, Object value);
+  RequestContext setAttribute(Scope scope, String name, Object value);
   
   InputStream getInputStream() throws IOException;
   

Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/Target.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/Target.java?rev=600739&r1=600738&r2=600739&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/Target.java
(original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/Target.java
Mon Dec  3 16:14:49 2007
@@ -17,7 +17,8 @@
 */
 package org.apache.abdera.protocol.server;
 
-public interface Target {
+public interface Target 
+  extends Iterable<String> {
 
   TargetType getType();
   

Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractTarget.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractTarget.java?rev=600739&r1=600738&r2=600739&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractTarget.java
(original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractTarget.java
Mon Dec  3 16:14:49 2007
@@ -17,6 +17,8 @@
 */
 package org.apache.abdera.protocol.server.impl;
 
+import java.util.Iterator;
+
 import org.apache.abdera.protocol.server.RequestContext;
 import org.apache.abdera.protocol.server.Target;
 import org.apache.abdera.protocol.server.TargetType;
@@ -45,6 +47,10 @@
   public String[] getParameterNames() {
     String[] pn = context.getParameterNames();
     return (pn != null) ? pn : new String[0];
+  }
+
+  public Iterator<String> iterator() {
+    return java.util.Arrays.asList(getParameterNames()).iterator();
   }
 
   public TargetType getType() {

Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/HttpServletRequestContext.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/HttpServletRequestContext.java?rev=600739&r1=600738&r2=600739&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/HttpServletRequestContext.java
(original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/HttpServletRequestContext.java
Mon Dec  3 16:14:49 2007
@@ -114,11 +114,12 @@
     return session;
   }
   
-  public void setAttribute(Scope scope, String name, Object value) {
+  public RequestContext setAttribute(Scope scope, String name, Object value) {
     switch(scope) {
       case REQUEST: request.setAttribute(name, value); break;
       case SESSION: getSession().setAttribute(name, value); break;
     }
+    return this;
   }
   
   public Object getAttribute(Scope scope, String name) {

Modified: incubator/abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/ContentProviderTest.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/ContentProviderTest.java?rev=600739&r1=600738&r2=600739&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/ContentProviderTest.java
(original)
+++ incubator/abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/ContentProviderTest.java
Mon Dec  3 16:14:49 2007
@@ -10,6 +10,7 @@
 import javax.xml.namespace.QName;
 
 import junit.framework.TestCase;
+
 import org.apache.abdera.Abdera;
 import org.apache.abdera.factory.Factory;
 import org.apache.abdera.i18n.iri.IRI;
@@ -19,10 +20,6 @@
 import org.apache.abdera.protocol.client.AbderaClient;
 import org.apache.abdera.protocol.client.ClientResponse;
 import org.apache.abdera.protocol.client.RequestOptions;
-import org.apache.abdera.protocol.server.CollectionProvider;
-import org.apache.abdera.protocol.server.ServiceContext;
-import org.apache.abdera.protocol.server.TargetType;
-import org.apache.abdera.protocol.server.WorkspaceInfo;
 import org.apache.abdera.protocol.server.impl.DefaultServiceContext;
 import org.apache.abdera.protocol.server.impl.RegexTargetResolver;
 import org.apache.abdera.protocol.server.impl.SimpleWorkspaceInfo;
@@ -46,11 +43,12 @@
     
     abderaServiceContext = new DefaultServiceContext();
 
-    RegexTargetResolver resolver = new RegexTargetResolver();
-    resolver.setPattern("/acme(\\?[^#]*)?", TargetType.TYPE_SERVICE);
-    resolver.setPattern("/acme/customers(\\?[^#]*)?", TargetType.TYPE_COLLECTION);
-    resolver.setPattern("/acme/customers/([^/#?]+)(\\?[^#]*)?", TargetType.TYPE_ENTRY);
-    abderaServiceContext.setTargetResolver(resolver);
+    abderaServiceContext.setTargetResolver(
+      new RegexTargetResolver()
+        .setPattern("/acme(\\?[^#]*)?", TargetType.TYPE_SERVICE)
+        .setPattern("/acme/customers(\\?[^#]*)?", TargetType.TYPE_COLLECTION)
+        .setPattern("/acme/customers/([^/#?]+)(\\?[^#]*)?", TargetType.TYPE_ENTRY)
+    );
     
     SingletonProviderManager pm = new SingletonProviderManager();
     abderaServiceContext.setProviderManager(pm);

Modified: incubator/abdera/java/trunk/server/src/test/java/org/apache/abdera/test/server/UtilityTest.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/test/java/org/apache/abdera/test/server/UtilityTest.java?rev=600739&r1=600738&r2=600739&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/test/java/org/apache/abdera/test/server/UtilityTest.java
(original)
+++ incubator/abdera/java/trunk/server/src/test/java/org/apache/abdera/test/server/UtilityTest.java
Mon Dec  3 16:14:49 2007
@@ -28,6 +28,7 @@
 import junit.framework.TestCase;
 
 import org.apache.abdera.i18n.iri.IRI;
+import org.apache.abdera.protocol.server.RequestContext;
 import org.apache.abdera.protocol.server.ServiceManager;
 import org.apache.abdera.protocol.server.Target;
 import org.apache.abdera.protocol.server.TargetType;
@@ -166,7 +167,8 @@
       return null;
     }
 
-    public void setAttribute(Scope scope, String name, Object value) {
+    public RequestContext setAttribute(Scope scope, String name, Object value) {
+      return this;
     }
 
     public Date getDateHeader(String name) {



Mime
View raw message