Package com.google.feedserver.adapters

Examples of com.google.feedserver.adapters.FeedServerAdapterException


  }

  @Override
  public void deleteEntry(RequestContext request, Object entryId) throws FeedServerAdapterException {
    if (AclResult.ACCESS_GRANTED != getAclValidator().canDeleteEntry(request, entryId)) {
      throw new FeedServerAdapterException(FeedServerAdapterException.Reason.NOT_AUTHORIZED,
          "Access Denied");
    }
    super.deleteEntry(request, entryId);
  }
View Full Code Here


      try {
        checkAccess(operation, request, null);
        return;
      } catch(FeedServerAdapterException e) {
        logger.info("checkAccess: access denied");
        throw new FeedServerAdapterException(
            FeedServerAdapterException.Reason.NOT_AUTHORIZED, "No ACL defined for '" +
                operation + "," + resourcePath + "'; " + e.getMessage());
      }
    }

    Set<String> principals = operationPrincipalsMap.get(operation);
    logger.info("checkAccess: principals=" + principals);
    if (principals == null) {
      logger.info("checkAccess: access denied");
      throw new FeedServerAdapterException(
          FeedServerAdapterException.Reason.NOT_AUTHORIZED, "No ACL defined for '" +
              operation + "," + resourcePath + "'");
    }

    String userEmail = getUserEmailForRequest(request);
    logger.info("checkAccess: userEmail=" + userEmail);

    if (userEmail == null) {
      // user unauthenticated
      if (!principals.contains(ANYONE)) {
        throw new FeedServerAdapterException(
            FeedServerAdapterException.Reason.NOT_AUTHORIZED, "viewer unauthenticated and " +
                ANYONE + " not allowed for '" + operation + "," + resourcePath + "'");
      }
    } else {
      // user authenticated
      if (!principals.contains(userEmail) &&
          !(principals.contains(DOMAIN_USERS) && userEmail.endsWith(getNameSpace()))) {
        logger.info("checkAccess: access denied");
        throw new FeedServerAdapterException(
            FeedServerAdapterException.Reason.NOT_AUTHORIZED, "viewer '" + userEmail +
                "' not on list of principals for '" + operation + "," + resourcePath + "'");
      }
    }
View Full Code Here

    // entryId may be null. if it is, assign one
    setEntryIdIfNull(entry);
    String entryId = getEntryIdFromUri(entry.getId().toString());

    if (entries.containsKey(entryId)) {
      throw new FeedServerAdapterException(FeedServerAdapterException.Reason.ENTRY_ALREADY_EXISTS,
          ERROR_DUP_ENTRY);
    }
    // add an "updated" element if one was not provided
    if (entry.getUpdated() == null) {
      entry.setUpdated(new Date());
View Full Code Here

  @Override
  public Entry updateEntry(RequestContext request, Object entryId, Entry entry)
      throws FeedServerAdapterException {
    String id = getEntryIdFromUri((String) entryId);
    if (!entries.containsKey(id)) {
      throw new FeedServerAdapterException(FeedServerAdapterException.Reason.ENTRY_DOES_NOT_EXIST,
          ERROR_INVALID_ENTRY);
    }
    entries.remove(entryId);
    // add an "updated" element if one was not provided
    if (entry.getUpdated() == null) {
View Full Code Here

    Document<Element> entryDoc = entry.getDocument();
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    try {
      entryDoc.writeTo(bos);
    } catch (IOException e) {
      throw new FeedServerAdapterException(FeedServerAdapterException.Reason.REMOTE_SERVER_ERROR,
          "error");
    }

    // Get the bytes of the serialized object and store in hashmap
    byte[] buf = bos.toByteArray();
    try {
      bos.close();
    } catch (IOException e) {
      throw new FeedServerAdapterException(FeedServerAdapterException.Reason.REMOTE_SERVER_ERROR,
          "error");
    }
    entries.put(entryId, buf);
  }
View Full Code Here

TOP

Related Classes of com.google.feedserver.adapters.FeedServerAdapterException

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.