abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r1175999 - in /abdera/abdera2: activities/src/main/java/org/apache/abdera2/activities/client/ client/src/main/java/org/apache/abdera2/protocol/client/
Date Mon, 26 Sep 2011 19:02:08 GMT
Author: jmsnell
Date: Mon Sep 26 19:02:08 2011
New Revision: 1175999

URL: http://svn.apache.org/viewvc?rev=1175999&view=rev
Log: (empty)

Modified:
    abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/client/ActivitiesClient.java
    abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/client/ActivitiesSession.java
    abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/AbderaSession.java
    abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/Session.java

Modified: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/client/ActivitiesClient.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/client/ActivitiesClient.java?rev=1175999&r1=1175998&r2=1175999&view=diff
==============================================================================
--- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/client/ActivitiesClient.java
(original)
+++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/client/ActivitiesClient.java
Mon Sep 26 19:02:08 2011
@@ -14,6 +14,7 @@ import org.apache.abdera2.protocol.clien
  * for working with Activity Stream objects. The ActivityClient acts 
  * as a decorator for the base Abdera Client. 
  */
+@SuppressWarnings("unchecked")
 public class ActivitiesClient 
   extends ClientWrapper {
 
@@ -25,7 +26,6 @@ public class ActivitiesClient 
     super(client);
   }
 
-  @SuppressWarnings("unchecked")
   @Override
   public <T extends Session> T newSession() {
     return (T)new ActivitiesSession(this);
@@ -33,31 +33,31 @@ public class ActivitiesClient 
 
   public <T extends Collection<?>>T getCollection(String uri) {
     ActivitiesSession session = newSession();
-    return session.getCollection(uri);
+    return (T)session.getCollection(uri);
   }
   
   public <T extends Collection<?>>T getCollection(String uri, RequestOptions
options) {
     ActivitiesSession session = newSession();
-    return session.getCollection(uri,options);
+    return (T)session.getCollection(uri,options);
   }
   
   public <T extends Activity>T getActivity(String uri) {
     ActivitiesSession session = newSession();
-    return session.getActivity(uri);
+    return (T)session.getActivity(uri);
   }
   
   public <T extends Activity>T getActivity(String uri, RequestOptions options) {
     ActivitiesSession session = newSession();
-    return session.getActivity(uri,options);
+    return (T)session.getActivity(uri,options);
   }
   
   public <T extends ASObject>T getObject(String uri) {
     ActivitiesSession session = newSession();
-    return session.getObject(uri);
+    return (T)session.getObject(uri);
   }
   
   public <T extends ASObject>T getObject(String uri, RequestOptions options) {
     ActivitiesSession session = newSession();
-    return session.getObject(uri,options);
+    return (T)session.getObject(uri,options);
   }
 }

Modified: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/client/ActivitiesSession.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/client/ActivitiesSession.java?rev=1175999&r1=1175998&r2=1175999&view=diff
==============================================================================
--- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/client/ActivitiesSession.java
(original)
+++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/client/ActivitiesSession.java
Mon Sep 26 19:02:08 2011
@@ -20,6 +20,7 @@ import org.apache.abdera2.protocol.clien
  * Extension of the base Abdera Client Session that provides utility 
  * methods for working with Activity Streams objects.
  */
+@SuppressWarnings("unchecked")
 public class ActivitiesSession 
   extends Session {
 
@@ -39,28 +40,27 @@ public class ActivitiesSession 
   }
 
   public <T extends Collection<?>>T getCollection(String uri) {
-    return getCollection(uri, this.getDefaultRequestOptions());
+    return (T)getCollection(uri, this.getDefaultRequestOptions());
   }
   
   public <T extends ClientResponse>T post(String uri, ASBase base) {
-    return post(uri,base, this.getDefaultRequestOptions());
+    return (T)post(uri,base, this.getDefaultRequestOptions());
   }
   
   public <T extends ClientResponse>T post(String uri, ASBase base, RequestOptions options)
{
     ActivityEntity entity = new ActivityEntity(base);
-    return post(uri, entity, options);
+    return (T)post(uri, entity, options);
   }
 
   public <T extends ClientResponse>T put(String uri, ASBase base) {
-    return put(uri,base, this.getDefaultRequestOptions());
+    return (T)put(uri,base, this.getDefaultRequestOptions());
   }
   
   public <T extends ClientResponse>T put(String uri, ASBase base, RequestOptions options)
{
     ActivityEntity entity = new ActivityEntity(base);
-    return put(uri, entity, options);
+    return (T)put(uri, entity, options);
   }
   
-  @SuppressWarnings("unchecked")
   public <T extends Collection<?>>T getCollection(String uri, RequestOptions
options) {
     ClientResponse cr = get(uri, options);
     try {
@@ -86,10 +86,9 @@ public class ActivitiesSession 
   }
   
   public <T extends Activity>T getActivity(String uri) {
-    return getActivity(uri,this.getDefaultRequestOptions());
+    return (T)getActivity(uri,this.getDefaultRequestOptions());
   }
   
-  @SuppressWarnings("unchecked")
   public <T extends Activity>T getActivity(String uri, RequestOptions options) {
     ClientResponse cr = get(uri, options);
     try {
@@ -115,10 +114,9 @@ public class ActivitiesSession 
   }
   
   public <T extends ASObject>T getObject(String uri) {
-    return getObject(uri, this.getDefaultRequestOptions());
+    return (T)getObject(uri, this.getDefaultRequestOptions());
   }
-  
-  @SuppressWarnings("unchecked")
+
   public <T extends ASObject>T getObject(String uri, RequestOptions options) {
     ClientResponse cr = get(uri, options);
     try {

Modified: abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/AbderaSession.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/AbderaSession.java?rev=1175999&r1=1175998&r2=1175999&view=diff
==============================================================================
--- abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/AbderaSession.java
(original)
+++ abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/AbderaSession.java
Mon Sep 26 19:02:08 2011
@@ -38,6 +38,7 @@ import org.apache.http.entity.mime.conte
  * consume each ClientResponse before executing an additional request on 
  * the same session.
  */
+@SuppressWarnings("unchecked")
 public class AbderaSession extends Session {
 
     protected AbderaSession(AbderaClient client) {
@@ -52,7 +53,6 @@ public class AbderaSession extends Sessi
       return getAbderaClient().getAbdera();
     }
     
-    @SuppressWarnings("unchecked")
     protected <T extends ClientResponse>T wrap(ClientResponse resp) {
       return (T)(resp instanceof AbderaClientResponseImpl ?
         resp : new AbderaClientResponseImpl(resp));
@@ -66,7 +66,7 @@ public class AbderaSession extends Sessi
      * @param options The request options
      */
     public <T extends ClientResponse>T post(String uri, EntityProvider provider, RequestOptions
options) {
-        return wrap(post(uri, new EntityProviderEntity(getAbdera(), provider), options));
+        return (T)wrap(post(uri, new EntityProviderEntity(getAbdera(), provider), options));
     }
 
     /**
@@ -82,7 +82,7 @@ public class AbderaSession extends Sessi
             if (options.getSlug() == null && d.getSlug() != null)
                 options.setSlug(d.getSlug());
         }
-        return wrap(execute("POST", uri, new AbderaEntity(base), options));
+        return (T)wrap(execute("POST", uri, new AbderaEntity(base), options));
     }
 
     /**
@@ -95,7 +95,7 @@ public class AbderaSession extends Sessi
      * @param media The media object that will be sent as the second element of the multipart/related
object
      */
     public <T extends ClientResponse>T post(String uri, Entry entry, ContentBody media)
{
-        return wrap(post(uri, entry, media, getDefaultRequestOptions()));
+        return (T)wrap(post(uri, entry, media, getDefaultRequestOptions()));
     }
 
     /**
@@ -109,7 +109,7 @@ public class AbderaSession extends Sessi
      * @param options The request options
      */
     public <T extends ClientResponse>T post(String uri, Entry entry, ContentBody media,
RequestOptions options) {
-        return wrap(post(uri, entry, media, null, options));
+        return (T)wrap(post(uri, entry, media, null, options));
     }
 
     /**
@@ -146,7 +146,7 @@ public class AbderaSession extends Sessi
                     options.setIfUnmodifiedSince(lm);
             }
         }
-        return wrap(put(uri, new EntityProviderEntity(getAbdera(), provider), options));
+        return (T)wrap(put(uri, new EntityProviderEntity(getAbdera(), provider), options));
     }
 
     /**
@@ -171,7 +171,7 @@ public class AbderaSession extends Sessi
                     options.setIfUnmodifiedSince(d.getLastModified());
             }
         }
-        return wrap(execute("PUT", uri, new AbderaEntity(base), options));
+        return (T)wrap(execute("PUT", uri, new AbderaEntity(base), options));
     }
 
     /**
@@ -181,7 +181,7 @@ public class AbderaSession extends Sessi
      * @param provider An EntityProvider implementation providing the payload the request
      */
     public <T extends ClientResponse>T post(String uri, EntityProvider provider) {
-        return wrap(post(uri, provider, getDefaultRequestOptions()));
+        return (T)wrap(post(uri, provider, getDefaultRequestOptions()));
     }
 
     /**
@@ -191,7 +191,7 @@ public class AbderaSession extends Sessi
      * @param base A FOM Document or Element providing the payload of the request
      */
     public <T extends ClientResponse>T post(String uri, Base base) {
-        return wrap(post(uri, base, getDefaultRequestOptions()));
+        return (T)wrap(post(uri, base, getDefaultRequestOptions()));
     }
 
     /**
@@ -201,7 +201,7 @@ public class AbderaSession extends Sessi
      * @param provider An EntityProvider implementation providing the payload of the request
      */
     public <T extends ClientResponse>T put(String uri, EntityProvider provider) {
-        return wrap(put(uri, provider, getDefaultRequestOptions()));
+        return (T)wrap(put(uri, provider, getDefaultRequestOptions()));
     }
 
     /**
@@ -211,7 +211,7 @@ public class AbderaSession extends Sessi
      * @param base A FOM Document or Element providing the payload of the request
      */
     public <T extends ClientResponse>T put(String uri, Base base) {
-        return wrap(put(uri, base, getDefaultRequestOptions()));
+        return (T)wrap(put(uri, base, getDefaultRequestOptions()));
     }
 
     /**
@@ -228,7 +228,7 @@ public class AbderaSession extends Sessi
         String uri, 
         Base base, 
         RequestOptions options) {
-        return wrap(execute(
+        return (T)wrap(execute(
             method, 
             uri, 
             new AbderaEntity(base), 
@@ -249,7 +249,7 @@ public class AbderaSession extends Sessi
         String uri, 
         Base base, 
         RequestOptions options) {
-        return wrap(execute(
+        return (T)wrap(execute(
             method.name(), 
             uri, 
             new AbderaEntity(base), 
@@ -271,7 +271,7 @@ public class AbderaSession extends Sessi
         RequestOptions options) {
         if (options == null)
             options = getDefaultRequestOptions();
-        return wrap(execute(
+        return (T)wrap(execute(
             method, 
             uri, 
             new EntityProviderEntity(getAbdera(), provider), 
@@ -291,10 +291,9 @@ public class AbderaSession extends Sessi
         Method method, String uri, 
         EntityProvider provider, 
         RequestOptions options) {
-          return wrap(execute(method.name(),uri,provider,options));
+          return (T)wrap(execute(method.name(),uri,provider,options));
     }
     
-    @SuppressWarnings("unchecked")
     protected <T extends ClientResponse>T checkRequestException(ClientResponse response,
RequestOptions options) {
         if (response == null)
             return (T)response;

Modified: abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/Session.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/Session.java?rev=1175999&r1=1175998&r2=1175999&view=diff
==============================================================================
--- abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/Session.java (original)
+++ abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/Session.java Mon
Sep 26 19:02:08 2011
@@ -53,6 +53,7 @@ import org.apache.http.util.EntityUtils;
  * consume each ClientResponse before executing an additional request on 
  * the same session.
  */
+@SuppressWarnings("unchecked")
 public class Session {
 
     protected final Client client;
@@ -68,21 +69,10 @@ public class Session {
       return client.getClient();
     }
     
-    @SuppressWarnings("unchecked")
     protected <T extends ClientResponse>T wrap(ClientResponse resp) {
       return (T)resp;
     }
-    
-    /**
-     * Sends an HTTP HEAD request to the specified URI.
-     * 
-     * @param uri The request URI
-     * @param options The request options
-     */
-    public <T extends ClientResponse>T head(String uri, RequestOptions options) {
-        return wrap(execute("HEAD", uri, (HttpEntity)null, options));
-    }
-    
+        
     /**
      * Sends an HTTP GET request to the specified URI.
      * 
@@ -90,7 +80,7 @@ public class Session {
      * @param options The request options
      */
     public <T extends ClientResponse>T get(String uri, RequestOptions options) {
-        return wrap(execute("GET", uri, (HttpEntity)null, options));
+        return (T)wrap(execute("GET", uri, (HttpEntity)null, options));
     }
 
     /**
@@ -101,7 +91,7 @@ public class Session {
      * @param options The request options
      */
     public <T extends ClientResponse>T post(String uri, HttpEntity entity, RequestOptions
options) {
-        return wrap(execute("POST", uri, entity, options));
+        return (T)wrap(execute("POST", uri, entity, options));
     }
 
     /**
@@ -112,7 +102,7 @@ public class Session {
      * @param options The request options
      */
     public <T extends ClientResponse>T post(String uri, InputStream in, RequestOptions
options) {
-        return wrap(execute("POST", uri, new InputStreamEntity(in,-1), options));
+        return (T)wrap(execute("POST", uri, new InputStreamEntity(in,-1), options));
     }
 
     /**
@@ -123,7 +113,7 @@ public class Session {
      * @param options The request options
      */
     public <T extends ClientResponse>T put(String uri, HttpEntity entity, RequestOptions
options) {
-        return wrap(execute("PUT", uri, entity, options));
+        return (T)wrap(execute("PUT", uri, entity, options));
     }
 
     /**
@@ -134,7 +124,7 @@ public class Session {
      * @param options The request options
      */
     public <T extends ClientResponse>T put(String uri, InputStream in, RequestOptions
options) {
-        return wrap(execute("PUT", uri, new InputStreamEntity(in,-1), options));
+        return (T)wrap(execute("PUT", uri, new InputStreamEntity(in,-1), options));
     }
 
     /**
@@ -144,7 +134,7 @@ public class Session {
      * @param options The request options
      */
     public <T extends ClientResponse>T delete(String uri, RequestOptions options) {
-        return wrap(execute("DELETE", uri, (HttpEntity)null, options));
+        return (T)wrap(execute("DELETE", uri, (HttpEntity)null, options));
     }
 
     /**
@@ -153,7 +143,16 @@ public class Session {
      * @param uri The request URI
      */
     public <T extends ClientResponse>T head(String uri) {
-        return wrap(head(uri, getDefaultRequestOptions()));
+        return (T)wrap(head(uri, getDefaultRequestOptions()));
+    }
+    
+    /**
+     * Sends an HTTP HEAD request to the specified URI
+     * 
+     * @param uri The request URI
+     */
+    public <T extends ClientResponse>T head(String uri, RequestOptions options) {
+       return (T)wrap(execute("HEAD", uri, (HttpEntity)null, options));
     }
 
     /**
@@ -162,7 +161,7 @@ public class Session {
      * @param uri The request URI
      */
     public <T extends ClientResponse>T get(String uri) {
-        return wrap(get(uri, getDefaultRequestOptions()));
+        return (T)wrap(get(uri, getDefaultRequestOptions()));
     }
 
     /**
@@ -172,7 +171,7 @@ public class Session {
      * @param entity A RequestEntity object providing the payload of the request
      */
     public <T extends ClientResponse>T post(String uri, HttpEntity entity) {
-        return wrap(post(uri, entity, getDefaultRequestOptions()));
+        return (T)wrap(post(uri, entity, getDefaultRequestOptions()));
     }
 
     /**
@@ -182,7 +181,7 @@ public class Session {
      * @param in An InputStream providing the payload of the request
      */
     public <T extends ClientResponse>T post(String uri, InputStream in) {
-        return wrap(post(uri, in, getDefaultRequestOptions()));
+        return (T)wrap(post(uri, in, getDefaultRequestOptions()));
     }
 
     /**
@@ -192,7 +191,7 @@ public class Session {
      * @param entity A RequestEntity object providing the payload of the request
      */
     public <T extends ClientResponse>T put(String uri, HttpEntity entity) {
-        return wrap(put(uri, entity, getDefaultRequestOptions()));
+        return (T)wrap(put(uri, entity, getDefaultRequestOptions()));
     }
 
     /**
@@ -202,7 +201,7 @@ public class Session {
      * @param in An InputStream providing the payload of the request
      */
     public <T extends ClientResponse>T put(String uri, InputStream in) {
-        return wrap(put(uri, in, getDefaultRequestOptions()));
+        return (T)wrap(put(uri, in, getDefaultRequestOptions()));
     }
 
     /**
@@ -211,7 +210,7 @@ public class Session {
      * @param uri The request URI
      */
     public <T extends ClientResponse>T delete(String uri) {
-        return wrap(delete(uri, getDefaultRequestOptions()));
+        return (T)wrap(delete(uri, getDefaultRequestOptions()));
     }
     
     /**
@@ -234,7 +233,7 @@ public class Session {
           new InputStreamEntity(in, -1);
         re.setContentType(
           options.getContentType().toString());
-        return wrap(execute(
+        return (T)wrap(execute(
           method, uri, re, options));
     }
     
@@ -252,7 +251,7 @@ public class Session {
         String uri, 
         InputStream in, 
         RequestOptions options) {
-        return wrap(execute(method.name(),uri,in,options));
+        return (T)wrap(execute(method.name(),uri,in,options));
     }
 
     public <T extends ClientResponse>T execute(
@@ -260,7 +259,7 @@ public class Session {
         String uri, 
         HttpEntity entity, 
         RequestOptions options) {
-      return wrap(execute(method.name(),uri,entity,options));
+      return (T)wrap(execute(method.name(),uri,entity,options));
     }
     
     /**
@@ -290,7 +289,7 @@ public class Session {
             ClientResponse resp = 
               wrap(new ClientResponseImpl(
                 this, response, method, localContext));
-            return checkRequestException(resp, options);
+            return (T)checkRequestException(resp, options);
         } catch (RuntimeException r) {
             throw r;
         } catch (Throwable t) {
@@ -298,7 +297,6 @@ public class Session {
         }
     }
 
-    @SuppressWarnings("unchecked")
     protected <T extends ClientResponse>T checkRequestException(ClientResponse response,
RequestOptions options) {
       if (response == null)
           return (T)response;



Mime
View raw message