Package org.apache.shindig.social.opensocial.spi

Examples of org.apache.shindig.social.opensocial.spi.SocialSpiException


  public int getCount() {
    String count = getParameter(COUNT);
    try {
      return count == null ? DEFAULT_COUNT : Integer.valueOf(count);
    } catch (NumberFormatException nfe) {
      throw new SocialSpiException(ResponseError.BAD_REQUEST,
           "Parameter " + COUNT + " (" + count + ") is not a number.");
    }
  }
View Full Code Here


    try {
      return sortOrder == null
            ? PersonService.SortOrder.ascending
            : PersonService.SortOrder.valueOf(sortOrder);
    } catch (IllegalArgumentException iae) {
      throw new SocialSpiException(ResponseError.BAD_REQUEST,
           "Parameter " + SORT_ORDER + " (" + sortOrder + ") is not valid.");
    }
  }
View Full Code Here

    try {
      return filterOp == null
          ? PersonService.FilterOperation.contains
          : PersonService.FilterOperation.valueOf(filterOp);
    } catch (IllegalArgumentException iae) {
      throw new SocialSpiException(ResponseError.BAD_REQUEST,
           "Parameter " + FILTER_OPERATION + " (" + filterOp + ") is not valid.");
    }
  }
View Full Code Here

  protected Future<?> handleRequestItem(RequestItem requestItem,
      HttpServletRequest servletRequest) {
    DataRequestHandler handler = dispatcher.getHandler(requestItem.getService());

    if (handler == null) {
      return ImmediateFuture.errorInstance(new SocialSpiException(ResponseError.NOT_IMPLEMENTED,
          "The service " + requestItem.getService() + " is not implemented"));
    }

    return handler.handleItem(requestItem);
  }
View Full Code Here

    return response;
  }

  protected ResponseItem responseItemFromException(Throwable t) {
    if (t instanceof SocialSpiException) {
      SocialSpiException spe = (SocialSpiException) t;
      return new ResponseItem(spe.getError(), spe.getMessage());
    }

    return new ResponseItem(ResponseError.INTERNAL_ERROR, t.getMessage());
  }
View Full Code Here

        return data.getString(paramName);
      } else {
        return null;
      }
    } catch (JSONException je) {
      throw new SocialSpiException(ResponseError.BAD_REQUEST, je.getMessage(), je);
    }
  }
View Full Code Here

        return data.getString(paramName);
      } else {
        return defaultValue;
      }
    } catch (JSONException je) {
      throw new SocialSpiException(ResponseError.BAD_REQUEST, je.getMessage(), je);
    }
  }
View Full Code Here

        }
      } else {
        return Collections.emptyList();
      }
    } catch (JSONException je) {
      throw new SocialSpiException(ResponseError.BAD_REQUEST, je.getMessage(), je);
    }
  }
View Full Code Here

  @Override
  public <T> T getTypedParameter(String parameterName, Class<T> dataTypeClass) {
    try {
      return converter.convertToObject(data.get(parameterName).toString(), dataTypeClass);
    } catch (JSONException je) {
      throw new SocialSpiException(ResponseError.BAD_REQUEST, je.getMessage(), je);
    }
  }
View Full Code Here

    Preconditions.requireSingular(userIds, "Multiple userIds not supported");

    Map<String, String> values = request.getTypedParameter("data", HashMap.class);
    for (String key : values.keySet()) {
      if (!isValidKey(key)) {
        throw new SocialSpiException(ResponseError.BAD_REQUEST,
            "One or more of the app data keys are invalid: " + key);
      }
    }

    return service.updatePersonData(userIds.iterator().next(), request.getGroup(),
View Full Code Here

TOP

Related Classes of org.apache.shindig.social.opensocial.spi.SocialSpiException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.