Package com.amazonaws.services.dynamodb.model

Examples of com.amazonaws.services.dynamodb.model.ResourceNotFoundException


      throw new AmazonServiceException(errors.toString());
    }

    // Check existence
    if (!this.tables.containsKey(request.getTableName())) {
      throw new ResourceNotFoundException("The table '" + request.getTableName() + "' doesn't exist.");
    }

    // Update Table
    Table table = this.tables.get(request.getTableName());
    table.setProvisionedThroughput(request.getProvisionedThroughput());
View Full Code Here


    }

    // Check existence of table
    Table table = this.tables.get(request.getTableName());
    if (table == null) {
      throw new ResourceNotFoundException("The table '" + request.getTableName() + "' doesn't exist.");
    }

    // Make sure that item specifies hash key and range key (if in schema)
    KeySchemaElement hashKey = table.getKeySchema().getHashKeyElement();
    KeySchemaElement rangeKey = table.getKeySchema().getRangeKeyElement();
View Full Code Here

    List<String> attributesToGet = request.getAttributesToGet();
    GetItemResult result = new GetItemResult();

    // Check to make sure table exists
    if (!this.tables.containsKey(tableName)) {
      throw new ResourceNotFoundException("The table you're currently trying to access (" + tableName + ") doesn't exists.");
    }
    // Check to make sure Key is valid
    String hashKeyValue = getKeyValue(key.getHashKeyElement());
        ItemRangeGroup rangeGroup = this.tables.get(tableName).getItemRangeGroup(hashKeyValue);
View Full Code Here

    }

    // Check existence of table
    Table table = this.tables.get(request.getTableName());
    if (table == null) {
      throw new ResourceNotFoundException("The table '" + request.getTableName() + "' doesn't exist.");
    }

    // Get hash and range key
    String hashKey = getKeyValue(request.getKey().getHashKeyElement());
    String rangeKey = getKeyValue(request.getKey().getRangeKeyElement());

    // Get current item if exist
    Map<String, AttributeValue> item = table.getItem(hashKey, rangeKey);

    if (item == null) {
            if (rangeKey == null) {
                throw new ResourceNotFoundException("The item with hash key '" + hashKey + "' doesn't exist in table '" + table.getName() + "'");
            } else {
                throw new ResourceNotFoundException("The item with hash key '" + hashKey + "' and range key '" + rangeKey + "' doesn't exist in table '" + table.getName() + "'");
            }
    }

    // Check conditional put
    validateExpected(request.getExpected(), item);
View Full Code Here

            final Condition cond = request.getScanFilter().get(k);
                        final AttributeValue comp = cond.getAttributeValueList().isEmpty() ? null : cond.getAttributeValueList().get(0);
                        final int condSize = cond.getAttributeValueList().size();

                        if (cond.getComparisonOperator() == null) {
              throw new ResourceNotFoundException("There must be a comparisonOperator");
            }

                        if (cond.getComparisonOperator().equals("EQ")) {
              if (condSize == 1 && isComparableInScan(attribute, comp)) {
                conditionMatches = compareForScan(attribute, comp) == 0;
View Full Code Here

    }

    // Check existence of table
    Table table = this.tables.get(request.getTableName());
    if (table == null) {
      throw new ResourceNotFoundException("The table '" + request.getTableName() + "' doesn't exist.");
    }

        String hashKeyValue = getKeyValue(request.getHashKeyValue());
        List<String> attributesToGet = request.getAttributesToGet();
View Full Code Here

    UpdateItemResult result = new UpdateItemResult();
    result.setConsumedCapacityUnits(0.5);

    // Check to make sure table exists
    if (!this.tables.containsKey(tableName)) {
      throw new ResourceNotFoundException("The table you're currently trying to access (" + tableName + ") doesn't exists.");
    }
    // Check to make sure Key is valid
        String hashKeyValue = getKeyValue(key.getHashKeyElement());
        String rangeKeyValue = getKeyValue(key.getRangeKeyElement());
        Map<String, AttributeValue> item = this.tables.get(tableName).getItem(hashKeyValue, rangeKeyValue);
      
    // Check conditional put
        validateExpected(request.getExpected(), item);
       
    if (item == null) {
      item = new HashMap<String, AttributeValue>();
      item.put(this.tables.get(tableName).getHashKeyName(), key.getHashKeyElement());
      if (key.getRangeKeyElement() != null) {
        item.put(this.tables.get(tableName).getRangeKeyName(), key.getRangeKeyElement());
      }
      for (String sKey : attributesToUpdate.keySet()) {
        if (attributesToUpdate.get(sKey).getValue() != null) {
          item.put(sKey, attributesToUpdate.get(sKey).getValue());
        }
      }
      this.tables.get(tableName).putItem(item);
      result.setAttributes(item);
    } else {
      Set<String> sKeyz = new HashSet<String>(item.keySet());
      sKeyz.addAll(attributesToUpdate.keySet());
      for (String sKey : sKeyz) {
        if (attributesToUpdate.containsKey(sKey)) {
          if (attributesToUpdate.get(sKey).getAction().equalsIgnoreCase(AttributeAction.PUT.name())) {
            item.remove(sKey);
            item.put(sKey, attributesToUpdate.get(sKey).getValue());
            attributesToUpdate.remove(sKey);
          } else if (attributesToUpdate.get(sKey).getAction().equalsIgnoreCase(AttributeAction.DELETE.name())) {
            if (attributesToUpdate.get(sKey).getValue() != null) {
              deleteAttributeValue(item, sKey, attributesToUpdate.get(sKey));
            } else {
              item.remove(sKey);
            }
            attributesToUpdate.remove(sKey);
          } else if (attributesToUpdate.get(sKey).getAction().equalsIgnoreCase(AttributeAction.ADD.name())) {
            if (attributesToUpdate.get(sKey).getValue() != null) {
              addAttributeValue(item, sKey, attributesToUpdate.get(sKey));
            } else {
              throw new ResourceNotFoundException("the provided update item with attribute (" + sKey + ") doesn't have an AttributeValue to perform the ADD");
            }
          }
        }
      }
      result.setAttributes(item);
View Full Code Here

        // marshaller understands.
        String errorCode = parseErrorCode(json);
        if (errorCode == null || !errorCode.equals("ResourceNotFoundException"))
            return null;

        ResourceNotFoundException e = (ResourceNotFoundException)super.unmarshall(json);
       
       
        return e;
    }
View Full Code Here

        // marshaller understands.
        String errorCode = parseErrorCode(json);
        if (errorCode == null || !errorCode.equals("ResourceNotFoundException"))
            return null;

        ResourceNotFoundException e = (ResourceNotFoundException)super.unmarshall(json);
       
       
        return e;
    }
View Full Code Here

TOP

Related Classes of com.amazonaws.services.dynamodb.model.ResourceNotFoundException

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.