abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r1239414 - in /abdera/abdera2/common/src/main/java/org/apache/abdera2/common: Discover.java io/Compression.java templates/Operation.java
Date Wed, 01 Feb 2012 23:59:19 GMT
Author: jmsnell
Date: Wed Feb  1 23:59:19 2012
New Revision: 1239414

URL: http://svn.apache.org/viewvc?rev=1239414&view=rev
Log:
Couple javadoc updates and a minor tweak to the URI Template impl.... 

The URI Template spec is complete, thankfully... so there will be no more spec changes we'll
have to track.. +1!

Modified:
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/Discover.java
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/io/Compression.java
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/templates/Operation.java

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/Discover.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/Discover.java?rev=1239414&r1=1239413&r2=1239414&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/Discover.java (original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/Discover.java Wed Feb  1
23:59:19 2012
@@ -116,7 +116,7 @@ public final class Discover {
         }
     }
 
-    private static ClassLoader getLoader() {
+    static ClassLoader getLoader() {
         return Thread.currentThread().getContextClassLoader();
     }
 
@@ -324,7 +324,7 @@ public final class Discover {
       }
     }
 
-    private static <T> T load(
+    static <T> T load(
       ClassLoader loader,
       String spec, 
       boolean classesonly, 

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/io/Compression.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/io/Compression.java?rev=1239414&r1=1239413&r2=1239414&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/io/Compression.java (original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/io/Compression.java Wed
Feb  1 23:59:19 2012
@@ -30,7 +30,12 @@ import com.google.common.collect.Iterabl
 import static org.apache.abdera2.common.text.CharUtils.splitAndTrim;
 import static com.google.common.base.Preconditions.*;
 
-public class Compression {
+/**
+ * Appropriately wraps inputstream and outputstream instances for 
+ * transparent data (de)compression using either the gzip or deflate
+ * methods.
+ */
+public final class Compression {
 
     public enum CompressionCodec {
         GZIP, XGZIP, DEFLATE;
@@ -66,23 +71,36 @@ public class Compression {
     }
 
     public static CompressionCodec getCodec(String name) {
-        CompressionCodec codec = null;
-        if (name == null)
-            return null;
-        try {
-            codec = CompressionCodec.valueOf(name.toUpperCase().trim());
-        } catch (Exception e) {}
-        return codec;
+      CompressionCodec codec = null;
+      if (name == null)
+          return null;
+      try {
+          codec = CompressionCodec.valueOf(name.toUpperCase().trim());
+      } catch (Exception e) {}
+      return codec;
     }
 
     private static void checkCodecs(boolean exp) {
       checkArgument(exp, "At least one codec must be specified");
     }
     
-    public static OutputStream wrap(OutputStream out, Iterable<CompressionCodec> codecs)
throws IOException {
+    /**
+     * Wrap an OutputStream of data so it can be automatically
+     * compressed as it is written. If multiple compression codecs have
+     * been applied, they will be layered accordingly
+     */
+    public static OutputStream wrap(
+      OutputStream out, 
+      Iterable<CompressionCodec> codecs) 
+        throws IOException {
       return wrap(out,Iterables.toArray(codecs,CompressionCodec.class));
     }
     
+    /**
+     * Wrap an OutputStream of data so it can be automatically
+     * compressed as it is written. If multiple compression codecs have
+     * been applied, they will be layered accordingly
+     */
     public static OutputStream wrap(
         OutputStream out, 
         CompressionCodec... codecs)
@@ -92,7 +110,12 @@ public class Compression {
         out = codecs[n].wrap(out);
       return out;      
     }
-    
+
+    /**
+     * Wrap an OutputStream of data so it can be automatically
+     * compressed as it is written. If multiple compression codecs have
+     * been applied, they will be layered accordingly
+     */
     public static OutputStream wrap(
         OutputStream out, 
         CompressionCodec codec,
@@ -103,6 +126,11 @@ public class Compression {
         return codec.wrap(wrap(out,codecs));
     }
 
+    /**
+     * Wrap an InputStream of compressed data so it can be automatically
+     * decompressed as it is read. If multiple compression codecs have
+     * been applied, they will be layered accordingly
+     */
     public static InputStream wrap(
       InputStream in, 
       Iterable<CompressionCodec> codecs) 
@@ -110,6 +138,11 @@ public class Compression {
       return wrap(in, Iterables.toArray(codecs, CompressionCodec.class));
     }
     
+    /**
+     * Wrap an InputStream of compressed data so it can be automatically
+     * decompressed as it is read. If multiple compression codecs have
+     * been applied, they will be layered accordingly
+     */
     public static InputStream wrap(
       InputStream in, 
       CompressionCodec... codecs)
@@ -120,7 +153,12 @@ public class Compression {
         in = codecs[n].wrap(in);
       return in;
     }
-    
+
+    /**
+     * Wrap an InputStream of compressed data so it can be automatically
+     * decompressed as it is read. If multiple compression codecs have
+     * been applied, they will be layered accordingly
+     */
     public static InputStream wrap(
         InputStream in, 
         CompressionCodec codec,
@@ -131,6 +169,11 @@ public class Compression {
         return codec.wrap(wrap(in,codecs));
     }
 
+    /**
+     * Wrap an InputStream of compressed data so it can be automatically
+     * decompressed as it is read. If multiple compression codecs have
+     * been applied, they will be layered accordingly
+     */
     public static InputStream wrap(
         InputStream in, 
         String ce) 
@@ -147,6 +190,12 @@ public class Compression {
         return in;
     }
 
+    /**
+     * Generates a description of the compression codecs used in a manner
+     * that conforms with the HTTP Content-Encoding and Transfer-Encoding
+     * mechanisms, that is, the codecs are listed in the order they will 
+     * be applied to the data
+     */
     public static String describe(
         CompressionCodec codec, 
         CompressionCodec... codecs) {

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/templates/Operation.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/templates/Operation.java?rev=1239414&r1=1239413&r2=1239414&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/templates/Operation.java
(original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/templates/Operation.java
Wed Feb  1 23:59:19 2012
@@ -418,7 +418,7 @@ public abstract class Operation implemen
         public String evaluate(Expression exp, Context context) {
             StringBuilder buf = new StringBuilder();
             for (VarSpec varspec : exp) {
-              String val = eval(varspec, context, false, ";", null);
+              String val = eval(varspec, context, false, ";", String.format("%s=",varspec.getName()));
               if (val != null)
                 buf.append(';');
               if (!varspec.isExplode()) {
@@ -443,7 +443,7 @@ public abstract class Operation implemen
             boolean first = true;
             buf.append("?");
             for (VarSpec varspec : exp) {
-              String val = eval(varspec, context, false, "&", ""); // Per Draft Seven
(http://tools.ietf.org/html/draft-gregorio-uritemplate-07)
+              String val = eval(varspec, context, false, "&",  String.format("%s=",varspec.getName()));
// Per Draft Seven (http://tools.ietf.org/html/draft-gregorio-uritemplate-07)
               if (context.contains(varspec.getName())) {
                 if (!first && val != null) buf.append('&');
                 if ((val != null && !varspec.isExplode()) || varspec.isNoval()) {
@@ -468,7 +468,7 @@ public abstract class Operation implemen
         public String evaluate(Expression exp, Context context) {
             StringBuilder buf = new StringBuilder();
             for (VarSpec varspec : exp) {
-              String val = eval(varspec, context, false, "&", ""); // Per Draft Seven
(http://tools.ietf.org/html/draft-gregorio-uritemplate-07)
+              String val = eval(varspec, context, false, "&",  String.format("%s=",varspec.getName()));
// Per Draft Seven (http://tools.ietf.org/html/draft-gregorio-uritemplate-07)
               if (context.contains(varspec.getName())) {
                 if (varspec.isExplode()) buf.append('&');
                 if ((val != null && !varspec.isExplode()) || varspec.isNoval())



Mime
View raw message