Author: ieb
Date: Sun May  3 22:25:38 2009
New Revision: 771131

URL: http://svn.apache.org/viewvc?rev=771131&view=rev
Log:
Fixed borken build caused by replacement of the SpiServiceException with a 
ProtocolExceptiona and the removal of the response code
constants in favour of using the servlet provided constants.

Modified:
    
incubator/shindig/trunk/java/samples/src/main/java/org/apache/shindig/social/opensocial/jpa/spi/ActivityServiceDb.java
    
incubator/shindig/trunk/java/samples/src/main/java/org/apache/shindig/social/opensocial/jpa/spi/AppDataServiceDb.java
    
incubator/shindig/trunk/java/samples/src/main/java/org/apache/shindig/social/opensocial/jpa/spi/JPQLUtils.java
    
incubator/shindig/trunk/java/samples/src/main/java/org/apache/shindig/social/opensocial/jpa/spi/PersonServiceDb.java
    
incubator/shindig/trunk/java/samples/src/test/java/org/apache/shindig/social/opensocial/jpa/spi/integration/JpaTestGuiceModule.java

Modified: 
incubator/shindig/trunk/java/samples/src/main/java/org/apache/shindig/social/opensocial/jpa/spi/ActivityServiceDb.java
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/samples/src/main/java/org/apache/shindig/social/opensocial/jpa/spi/ActivityServiceDb.java?rev=771131&r1=771130&r2=771131&view=diff
==============================================================================
--- 
incubator/shindig/trunk/java/samples/src/main/java/org/apache/shindig/social/opensocial/jpa/spi/ActivityServiceDb.java
 (original)
+++ 
incubator/shindig/trunk/java/samples/src/main/java/org/apache/shindig/social/opensocial/jpa/spi/ActivityServiceDb.java
 Sun May  3 22:25:38 2009
@@ -22,7 +22,7 @@
 
 import org.apache.shindig.auth.SecurityToken;
 import org.apache.shindig.common.util.ImmediateFuture;
-import org.apache.shindig.protocol.ResponseError;
+import org.apache.shindig.protocol.ProtocolException;
 import org.apache.shindig.protocol.RestfulCollection;
 import org.apache.shindig.social.opensocial.jpa.ActivityDb;
 import org.apache.shindig.social.opensocial.jpa.MediaItemDb;
@@ -31,7 +31,6 @@
 import org.apache.shindig.social.opensocial.spi.ActivityService;
 import org.apache.shindig.social.opensocial.spi.CollectionOptions;
 import org.apache.shindig.social.opensocial.spi.GroupId;
-import org.apache.shindig.social.opensocial.spi.SocialSpiException;
 import org.apache.shindig.social.opensocial.spi.UserId;
 
 import java.util.ArrayList;
@@ -42,6 +41,7 @@
 
 import javax.persistence.EntityManager;
 import javax.persistence.Query;
+import javax.servlet.http.HttpServletResponse;
 
 /**
  * The Class ActivityServiceDb.
@@ -65,7 +65,7 @@
    * @see 
org.apache.shindig.social.opensocial.spi.ActivityService#createActivity(org.apache.shindig.social.opensocial.spi.UserId,
 org.apache.shindig.social.opensocial.spi.GroupId, java.lang.String, 
java.util.Set, org.apache.shindig.social.opensocial.model.Activity, 
org.apache.shindig.auth.SecurityToken)
    */
   public Future<Void> createActivity(UserId userId, GroupId groupId, String 
appId,
-      Set<String> fields, Activity activity, SecurityToken token) throws 
SocialSpiException {
+      Set<String> fields, Activity activity, SecurityToken token) throws 
ProtocolException {
     String uid = SPIUtils.getUserList(userId, token);
 
     try {
@@ -111,7 +111,7 @@
       entityManager.getTransaction().commit();
 
     } catch (Exception e) {
-      throw new SocialSpiException(ResponseError.INTERNAL_ERROR, "Failed to 
create activity", e);
+      throw new 
ProtocolException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Failed to 
create activity", e);
     }
 
     return null;
@@ -121,7 +121,7 @@
    * @see 
org.apache.shindig.social.opensocial.spi.ActivityService#deleteActivities(org.apache.shindig.social.opensocial.spi.UserId,
 org.apache.shindig.social.opensocial.spi.GroupId, java.lang.String, 
java.util.Set, org.apache.shindig.auth.SecurityToken)
    */
   public Future<Void> deleteActivities(UserId userId, GroupId groupId, String 
appId,
-      Set<String> activityIds, SecurityToken token) throws SocialSpiException {
+      Set<String> activityIds, SecurityToken token) throws ProtocolException {
     // TODO Auto-generated method stub
     return null;
   }
@@ -131,7 +131,7 @@
    */
   public Future<RestfulCollection<Activity>> getActivities(Set<UserId> userIds,
       GroupId groupId, String appId, Set<String> fields,
-      CollectionOptions options, SecurityToken token) throws 
SocialSpiException {
+      CollectionOptions options, SecurityToken token) throws ProtocolException 
{
 
     // TODO currently the implementation of this method ignores the fields 
variable. Is this correct?
 
@@ -173,7 +173,7 @@
       lastPos = JPQLUtils.addInClause(sb, "a", "userId", lastPos, 
paramList.size());
       break;
     default:
-      throw new SocialSpiException(ResponseError.BAD_REQUEST, "Group ID not 
recognized");
+      throw new ProtocolException(HttpServletResponse.SC_BAD_REQUEST, "Group 
ID not recognized");
 
     }
     
@@ -206,7 +206,7 @@
   public Future<RestfulCollection<Activity>> getActivities(UserId userId,
       GroupId groupId, String appId, Set<String> fields,
       CollectionOptions options, Set<String> activityIds, SecurityToken token)
-      throws SocialSpiException {
+      throws ProtocolException {
     return ImmediateFuture.newInstance(new 
RestfulCollection<Activity>(getActivities(userId, activityIds, token)));
   }
 
@@ -214,12 +214,12 @@
    * @see 
org.apache.shindig.social.opensocial.spi.ActivityService#getActivity(org.apache.shindig.social.opensocial.spi.UserId,
 org.apache.shindig.social.opensocial.spi.GroupId, java.lang.String, 
java.util.Set, java.lang.String, org.apache.shindig.auth.SecurityToken)
    */
   public Future<Activity> getActivity(UserId userId, GroupId groupId, String 
appId,
-      Set<String> fields, String activityId, SecurityToken token) throws 
SocialSpiException {
+      Set<String> fields, String activityId, SecurityToken token) throws 
ProtocolException {
     Activity activity = getActivities(userId, activityId,  token);
     if ( activity != null  ) {
       return ImmediateFuture.newInstance(activity);
     }
-    throw new SocialSpiException(ResponseError.BAD_REQUEST,"Cant find 
activity");
+    throw new ProtocolException(HttpServletResponse.SC_BAD_REQUEST,"Cant find 
activity");
   }
 
 

Modified: 
incubator/shindig/trunk/java/samples/src/main/java/org/apache/shindig/social/opensocial/jpa/spi/AppDataServiceDb.java
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/samples/src/main/java/org/apache/shindig/social/opensocial/jpa/spi/AppDataServiceDb.java?rev=771131&r1=771130&r2=771131&view=diff
==============================================================================
--- 
incubator/shindig/trunk/java/samples/src/main/java/org/apache/shindig/social/opensocial/jpa/spi/AppDataServiceDb.java
 (original)
+++ 
incubator/shindig/trunk/java/samples/src/main/java/org/apache/shindig/social/opensocial/jpa/spi/AppDataServiceDb.java
 Sun May  3 22:25:38 2009
@@ -24,10 +24,10 @@
 import org.apache.shindig.auth.SecurityToken;
 import org.apache.shindig.common.util.ImmediateFuture;
 import org.apache.shindig.protocol.DataCollection;
+import org.apache.shindig.protocol.ProtocolException;
 import org.apache.shindig.social.opensocial.jpa.ApplicationDataMapDb;
 import org.apache.shindig.social.opensocial.spi.AppDataService;
 import org.apache.shindig.social.opensocial.spi.GroupId;
-import org.apache.shindig.social.opensocial.spi.SocialSpiException;
 import org.apache.shindig.social.opensocial.spi.UserId;
 
 import java.util.HashMap;
@@ -54,7 +54,7 @@
    * {...@inheritdoc}
    */
   public Future<Void> deletePersonData(UserId userId, GroupId groupId, String 
appId,
-      Set<String> fields, SecurityToken token) throws SocialSpiException {
+      Set<String> fields, SecurityToken token) throws ProtocolException {
 
     List<ApplicationDataMapDb> dataMaps = getDataMap(userId, groupId, appId, 
token);
     for (ApplicationDataMapDb adm : dataMaps) {
@@ -131,7 +131,7 @@
    * {...@inheritdoc}
    */
   public Future<DataCollection> getPersonData(Set<UserId> userIds, GroupId 
groupId, String appId,
-      Set<String> fields, SecurityToken token) throws SocialSpiException {
+      Set<String> fields, SecurityToken token) throws ProtocolException {
     List<String> paramList = SPIUtils.getUserList(userIds, token);
     int lastParam = 1;
     StringBuilder sb = new StringBuilder();
@@ -201,7 +201,7 @@
    */
   public Future<Void> updatePersonData(UserId userId, GroupId groupId, String 
appId,
       Set<String> fields, Map<String, String> values, SecurityToken token)
-      throws SocialSpiException {
+      throws ProtocolException {
     List<ApplicationDataMapDb> dataMaps = getDataMap(userId, groupId, appId, 
token);
     for (ApplicationDataMapDb adm : dataMaps) {
       for (String f : fields) {

Modified: 
incubator/shindig/trunk/java/samples/src/main/java/org/apache/shindig/social/opensocial/jpa/spi/JPQLUtils.java
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/samples/src/main/java/org/apache/shindig/social/opensocial/jpa/spi/JPQLUtils.java?rev=771131&r1=771130&r2=771131&view=diff
==============================================================================
--- 
incubator/shindig/trunk/java/samples/src/main/java/org/apache/shindig/social/opensocial/jpa/spi/JPQLUtils.java
 (original)
+++ 
incubator/shindig/trunk/java/samples/src/main/java/org/apache/shindig/social/opensocial/jpa/spi/JPQLUtils.java
 Sun May  3 22:25:38 2009
@@ -17,14 +17,14 @@
  */
 package org.apache.shindig.social.opensocial.jpa.spi;
 
-import org.apache.shindig.protocol.ResponseError;
+import org.apache.shindig.protocol.ProtocolException;
 import org.apache.shindig.social.opensocial.spi.CollectionOptions;
-import org.apache.shindig.social.opensocial.spi.SocialSpiException;
 
 import java.util.List;
 
 import javax.persistence.EntityManager;
 import javax.persistence.Query;
+import javax.servlet.http.HttpServletResponse;
 
 /**
  *
@@ -81,7 +81,6 @@
    * @param parametersValues
    * @return
    */
-  @SuppressWarnings("unchecked")
   public static Long getTotalResults(EntityManager entityManager, String query,
       List<?> parametersValues) {
     int fromIndex = 0;
@@ -92,7 +91,7 @@
       fromIndex = queryInUpperCase.indexOf(" FROM ");
       if (fromIndex == -1) {
         // Couldn't find the FROM keyword in the query
-        throw new SocialSpiException(ResponseError.INTERNAL_ERROR, "Invalid 
query [" + query + "]");
+        throw new 
ProtocolException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Invalid query 
[" + query + "]");
       }
     }
     query = "select count(*) " + query.substring(fromIndex, query.length());

Modified: 
incubator/shindig/trunk/java/samples/src/main/java/org/apache/shindig/social/opensocial/jpa/spi/PersonServiceDb.java
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/samples/src/main/java/org/apache/shindig/social/opensocial/jpa/spi/PersonServiceDb.java?rev=771131&r1=771130&r2=771131&view=diff
==============================================================================
--- 
incubator/shindig/trunk/java/samples/src/main/java/org/apache/shindig/social/opensocial/jpa/spi/PersonServiceDb.java
 (original)
+++ 
incubator/shindig/trunk/java/samples/src/main/java/org/apache/shindig/social/opensocial/jpa/spi/PersonServiceDb.java
 Sun May  3 22:25:38 2009
@@ -22,7 +22,7 @@
 
 import org.apache.shindig.auth.SecurityToken;
 import org.apache.shindig.common.util.ImmediateFuture;
-import org.apache.shindig.protocol.ResponseError;
+import org.apache.shindig.protocol.ProtocolException;
 import org.apache.shindig.protocol.RestfulCollection;
 import org.apache.shindig.social.opensocial.jpa.PersonDb;
 import org.apache.shindig.social.opensocial.jpa.api.FilterCapability;
@@ -31,7 +31,6 @@
 import org.apache.shindig.social.opensocial.spi.CollectionOptions;
 import org.apache.shindig.social.opensocial.spi.GroupId;
 import org.apache.shindig.social.opensocial.spi.PersonService;
-import org.apache.shindig.social.opensocial.spi.SocialSpiException;
 import org.apache.shindig.social.opensocial.spi.UserId;
 
 import java.util.List;
@@ -40,6 +39,7 @@
 
 import javax.persistence.EntityManager;
 import javax.persistence.Query;
+import javax.servlet.http.HttpServletResponse;
 
 /**
  * Implements the PersonService from the SPI binding to the JPA model and 
providing queries to
@@ -69,7 +69,7 @@
    */
   public Future<RestfulCollection<Person>> getPeople(Set<UserId> userIds,
        GroupId groupId, CollectionOptions collectionOptions, Set<String> 
fields,
-       SecurityToken token) throws SocialSpiException {
+       SecurityToken token) throws ProtocolException {
     // for each user id get the filtered userid using the token and then, get 
the users identified
     // by the group id, the final set is filtered
     // using the collectionOptions and return the fields requested.
@@ -114,7 +114,7 @@
       lastPos = JPQLUtils.addInClause(sb, "p", "id", lastPos, 
paramList.size());
       break;
     default:
-      throw new SocialSpiException(ResponseError.BAD_REQUEST, "Group ID not 
recognized");
+      throw new ProtocolException(HttpServletResponse.SC_BAD_REQUEST, "Group 
ID not recognized");
 
     }
 
@@ -122,7 +122,7 @@
       plist = JPQLUtils.getListQuery(entiyManager, sb.toString(), paramList, 
collectionOptions);
       totalResults = Long.valueOf(1);
       if (0 == plist.size()) {
-        throw new SocialSpiException(ResponseError.BAD_REQUEST, "Person not 
found");
+        throw new ProtocolException(HttpServletResponse.SC_BAD_REQUEST, 
"Person not found");
       }
     } else {
       int filterPos = addFilterClause(sb, PersonDb.getFilterCapability(), 
collectionOptions,
@@ -155,7 +155,7 @@
    * {...@inheritdoc}
    */
   public Future<Person> getPerson(UserId id, Set<String> fields, SecurityToken 
token)
-      throws SocialSpiException {
+      throws ProtocolException {
     String uid = id.getUserId(token);
     Query q = entiyManager.createNamedQuery(PersonDb.FINDBY_PERSONID);
     q.setParameter(PersonDb.PARAM_PERSONID, uid);

Modified: 
incubator/shindig/trunk/java/samples/src/test/java/org/apache/shindig/social/opensocial/jpa/spi/integration/JpaTestGuiceModule.java
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/samples/src/test/java/org/apache/shindig/social/opensocial/jpa/spi/integration/JpaTestGuiceModule.java?rev=771131&r1=771130&r2=771131&view=diff
==============================================================================
--- 
incubator/shindig/trunk/java/samples/src/test/java/org/apache/shindig/social/opensocial/jpa/spi/integration/JpaTestGuiceModule.java
 (original)
+++ 
incubator/shindig/trunk/java/samples/src/test/java/org/apache/shindig/social/opensocial/jpa/spi/integration/JpaTestGuiceModule.java
 Sun May  3 22:25:38 2009
@@ -54,6 +54,7 @@
 import com.google.inject.AbstractModule;
 
 import net.oauth.OAuthConsumer;
+import net.oauth.OAuthProblemException;
 
 /**
  * Provides component injection for tests
@@ -121,5 +122,30 @@
     public SecurityToken getSecurityTokenForConsumerRequest(String 
consumerKey, String userId) {
       throw new UnsupportedOperationException();
     }
+
+    /**
+     * {...@inheritdoc}
+     * @see 
org.apache.shindig.social.opensocial.oauth.OAuthDataStore#disableToken(org.apache.shindig.social.opensocial.oauth.OAuthEntry)
+     */
+    public void disableToken(OAuthEntry entry) {
+      throw new UnsupportedOperationException();
+    }
+
+    /**
+     * {...@inheritdoc}
+     * @see 
org.apache.shindig.social.opensocial.oauth.OAuthDataStore#generateRequestToken(java.lang.String,
 java.lang.String)
+     */
+    public OAuthEntry generateRequestToken(String consumerKey, String 
oauthVersion)
+        throws OAuthProblemException {
+      throw new UnsupportedOperationException();
+    }
+
+    /**
+     * {...@inheritdoc}
+     * @see 
org.apache.shindig.social.opensocial.oauth.OAuthDataStore#removeToken(org.apache.shindig.social.opensocial.oauth.OAuthEntry)
+     */
+    public void removeToken(OAuthEntry entry) {
+      throw new UnsupportedOperationException();
+    }
   }
 }


Reply via email to