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

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


    this.personService = personService;
  }

  @Override
  protected Future<?> handleDelete(RequestItem request) throws SocialSpiException {
    throw new SocialSpiException(ResponseError.BAD_REQUEST, "You can't delete people.");
  }
View Full Code Here


    throw new SocialSpiException(ResponseError.BAD_REQUEST, "You can't delete people.");
  }

  @Override
  protected Future<?> handlePut(RequestItem request) throws SocialSpiException {
    throw new SocialSpiException(ResponseError.NOT_IMPLEMENTED, "You can't update right now.");
  }
View Full Code Here

    throw new SocialSpiException(ResponseError.NOT_IMPLEMENTED, "You can't update right now.");
  }

  @Override
  protected Future<?> handlePost(RequestItem request) throws SocialSpiException {
    throw new SocialSpiException(ResponseError.NOT_IMPLEMENTED, "You can't add people right now.");
  }
View Full Code Here

        if (personFields == null) {
        logger.fine("personFieldsList is null");
        try {
        personFields = this.containerConf.getPersonFields();
      } catch (ContainerConfigException e) {
            throw new SocialSpiException(ResponseError.INTERNAL_ERROR,
        "Error trying to Supported Person Fields from container.js", e);
      }
      }
        return ImmediateFuture.newInstance(personFields);
      }
View Full Code Here

    this.containerConf = containerConf;
  }
 
  public Future<?> handleItem(RequestItem request) {
    if (request.getOperation() == null) {
      return ImmediateFuture.errorInstance(new SocialSpiException(ResponseError.NOT_IMPLEMENTED,
          "Unserviced operation"));
    }
    String operation = request.getOperation().toLowerCase();
    Future<?> responseItem;
    try {
      if (GET_SYNONYMS.contains(operation)) {
        responseItem = handleGet(request);
      } else if (UPDATE_SYNONYMS.contains(operation)) {
        responseItem = handlePost(request);
      } else if (CREATE_SYNONYMS.contains(operation)) {
        responseItem = handlePut(request);
      } else if (DELETE_SYNONYMS.contains(operation)) {
        responseItem = handleDelete(request);
      } else {
        throw new SocialSpiException(ResponseError.NOT_IMPLEMENTED,
            "Unserviced operation " + operation);
      }
    } catch (SocialSpiException spe) {
      return ImmediateFuture.errorInstance(spe);
    } catch (Throwable t) {
      return ImmediateFuture.errorInstance(new SocialSpiException(ResponseError.INTERNAL_ERROR,
          "Unknown error " + t.getMessage(), t));
    }
    return responseItem;
  }
View Full Code Here

  public static class Preconditions {

    public static void requireNotEmpty(Collection<?> coll, String message)
        throws SocialSpiException {
      if (coll.isEmpty()) {
        throw new SocialSpiException(ResponseError.BAD_REQUEST, message);
      }
    }
View Full Code Here

      }
    }

    public static void requireEmpty(Collection<?> list, String message) throws SocialSpiException {
      if (!list.isEmpty()) {
        throw new SocialSpiException(ResponseError.BAD_REQUEST, message);
      }
    }
View Full Code Here

    }

    public static void requireSingular(Collection<?> coll, String message)
        throws SocialSpiException {
      if (coll.size() != 1) {
        throw new SocialSpiException(ResponseError.BAD_REQUEST, message);
      }
    }
View Full Code Here

      }
    }

    public static void requirePlural(Collection<?> coll, String message) throws SocialSpiException {
      if (coll.size() <= 1) {
        throw new SocialSpiException(ResponseError.BAD_REQUEST, message);
      }
    }
View Full Code Here

    String startIndex = getParameter(START_INDEX);
    try {
      return startIndex == null ? DEFAULT_START_INDEX
          : Integer.valueOf(startIndex);
    } catch (NumberFormatException nfe) {
      throw new SocialSpiException(ResponseError.BAD_REQUEST,
          "Parameter " + START_INDEX + " (" + startIndex + ") is not a number.");
    }
  }
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.