abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r600720 - in /incubator/abdera/java/trunk: client/src/main/java/org/apache/abdera/protocol/client/ client/src/main/java/org/apache/abdera/protocol/client/util/ protocol/src/main/java/org/apache/abdera/protocol/ server/src/main/java/org/apac...
Date Mon, 03 Dec 2007 23:06:21 GMT
Author: jmsnell
Date: Mon Dec  3 15:06:20 2007
New Revision: 600720

URL: http://svn.apache.org/viewvc?rev=600720&view=rev
Log:
Move EntityProvider to the protocol module so it can be used on the server and client.
Add a new EntityProviderResponseContext as a subclass of StreamWriterResponseContext. This
will make it possible for applications to create a single EntityProvider implementation for

their application java objects and reuse those on both the client and server.

Added:
    incubator/abdera/java/trunk/protocol/src/main/java/org/apache/abdera/protocol/EntityProvider.java
      - copied, changed from r600708, incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/EntityProvider.java
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/EntityProviderResponseContext.java
Removed:
    incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/EntityProvider.java
Modified:
    incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/AbderaClient.java
    incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/EntityProviderRequestEntity.java

Modified: incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/AbderaClient.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/AbderaClient.java?rev=600720&r1=600719&r2=600720&view=diff
==============================================================================
--- incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/AbderaClient.java
(original)
+++ incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/AbderaClient.java
Mon Dec  3 15:06:20 2007
@@ -32,6 +32,7 @@
 import org.apache.abdera.model.Base;
 import org.apache.abdera.model.Document;
 import org.apache.abdera.model.Element;
+import org.apache.abdera.protocol.EntityProvider;
 import org.apache.abdera.protocol.Response.ResponseType;
 import org.apache.abdera.protocol.client.cache.Cache;
 import org.apache.abdera.protocol.client.cache.CacheDisposition;

Modified: incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/EntityProviderRequestEntity.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/EntityProviderRequestEntity.java?rev=600720&r1=600719&r2=600720&view=diff
==============================================================================
--- incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/EntityProviderRequestEntity.java
(original)
+++ incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/EntityProviderRequestEntity.java
Mon Dec  3 15:06:20 2007
@@ -22,7 +22,7 @@
 import java.io.OutputStream;
 
 import org.apache.abdera.Abdera;
-import org.apache.abdera.protocol.client.EntityProvider;
+import org.apache.abdera.protocol.EntityProvider;
 import org.apache.commons.httpclient.methods.RequestEntity;
 
 public class EntityProviderRequestEntity 

Copied: incubator/abdera/java/trunk/protocol/src/main/java/org/apache/abdera/protocol/EntityProvider.java
(from r600708, incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/EntityProvider.java)
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/protocol/src/main/java/org/apache/abdera/protocol/EntityProvider.java?p2=incubator/abdera/java/trunk/protocol/src/main/java/org/apache/abdera/protocol/EntityProvider.java&p1=incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/EntityProvider.java&r1=600708&r2=600720&rev=600720&view=diff
==============================================================================
--- incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/EntityProvider.java
(original)
+++ incubator/abdera/java/trunk/protocol/src/main/java/org/apache/abdera/protocol/EntityProvider.java
Mon Dec  3 15:06:20 2007
@@ -15,7 +15,7 @@
 * copyright in this work, please see the NOTICE file in the top level
 * directory of this distribution.
 */
-package org.apache.abdera.protocol.client;
+package org.apache.abdera.protocol;
 
 import java.util.Date;
 
@@ -23,8 +23,8 @@
 import org.apache.abdera.writer.StreamWriter;
 
 /**
- * An EntityProvider is used to serialize client requests using the StreamWriter
- * interface.  The EntityProvider interface can be implemented by client applications
+ * An EntityProvider is used to serialize entities using the StreamWriter
+ * interface.  The EntityProvider interface can be implemented by applications
  * to provide an efficient means of serializing non-FOM objects to Atom/XML. 
  */
 public abstract class EntityProvider {

Added: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/EntityProviderResponseContext.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/EntityProviderResponseContext.java?rev=600720&view=auto
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/EntityProviderResponseContext.java
(added)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/EntityProviderResponseContext.java
Mon Dec  3 15:06:20 2007
@@ -0,0 +1,74 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.protocol.server.impl;
+
+import java.io.IOException;
+
+import org.apache.abdera.Abdera;
+import org.apache.abdera.protocol.EntityProvider;
+import org.apache.abdera.writer.StreamWriter;
+
+/**
+ * StreamWriterResponseContext implementation based on the EntityProvider interface
+ */
+public class EntityProviderResponseContext 
+  extends StreamWriterResponseContext {
+  
+  private final EntityProvider provider;
+  
+  public EntityProviderResponseContext(
+    EntityProvider provider,
+    Abdera abdera, 
+    String encoding, 
+    String sw) {
+      super(abdera, encoding, sw);
+      this.provider = provider;
+      init();
+  }
+
+  public EntityProviderResponseContext(
+    EntityProvider provider,
+    Abdera abdera, 
+    String encoding) {
+      super(abdera, encoding);
+      this.provider = provider;
+      init();
+  }
+
+  public EntityProviderResponseContext(
+    EntityProvider provider,
+    Abdera abdera) {
+      super(abdera);
+      this.provider = provider;
+      init();
+  }
+
+  private void init() {
+    setContentType(provider.getContentType());
+    setEntityTag(provider.getEntityTag());
+    setLastModified(provider.getLastModified());
+  }
+  
+  @Override 
+  protected void writeTo(
+    StreamWriter sw) 
+      throws IOException {
+    provider.writeTo(sw);
+  }
+  
+}



Mime
View raw message