Package com.amazonaws.services.dynamodb.model

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


            // Look at every getter and construct a value object for it
            for ( Method method : reflector.getRelevantGetters(clazz) ) {
                Object getterResult = safeInvoke(method, toWrite);
                String attributeName = reflector.getAttributeName(method);

                AttributeValue currentValue = null;
                if ( getterResult == null && reflector.isAssignableKey(method) ) {
                    currentValue = getAutoGeneratedKeyAttributeValue(method, getterResult);
                    inMemoryUpdates.add(new ValueUpdate(method, currentValue, toWrite));
                } else {
                    currentValue = getSimpleAttributeValue(method, getterResult);
                }

                if ( currentValue != null ) {
                    attributeValues.put(attributeName, currentValue);
                }
            }

            if ( !requestItems.containsKey(tableName) ) {
                requestItems.put(tableName, new LinkedList<WriteRequest>());
            }

            requestItems.get(tableName).add(
                    new WriteRequest().withPutRequest(new PutRequest().withItem(transformAttributes(clazz, attributeValues))));
        }

        for ( Object toDelete : objectsToDelete ) {
            Class<?> clazz = toDelete.getClass();

            String tableName = getTableName(clazz, config);

            Method hashKeyGetter = reflector.getHashKeyGetter(clazz);
            AttributeValue hashKeyElement = getHashKeyElement(safeInvoke(hashKeyGetter, toDelete), hashKeyGetter);

            AttributeValue rangeKeyElement = null;
            Method rangeKeyGetter = reflector.getRangeKeyGetter(clazz);
            if ( rangeKeyGetter != null ) {
                rangeKeyElement = getRangeKeyElement(safeInvoke(rangeKeyGetter, toDelete), rangeKeyGetter);
            }
View Full Code Here


            }
            classesByTableName.put(tableName, clazz);

            Method hashKeyGetter = reflector.getHashKeyGetter(clazz);
            for ( KeyPair keyPair : keyPairs ) {
                AttributeValue hashKeyElement = getHashKeyElement(keyPair.getHashKey(), hashKeyGetter);

                // Determine the range key, if provided
                AttributeValue rangeKeyElement = null;
                if ( keyPair.getRangeKey() != null ) {
                    Method rangeKeyMethod = reflector.getRangeKeyGetter(clazz);
                    if ( rangeKeyMethod == null ) {
                        throw new DynamoDBMappingException("Zero-parameter range key property must be annotated with "
                                + DynamoDBRangeKey.class);
View Full Code Here

       
        @Override
        public Object call() throws Exception {
            long epoch = System.currentTimeMillis();
           
            AttributeValue avPath = new AttributeValue(normalize(path.getParent()));
            AttributeValue avFile = new AttributeValue(path.getName());
            AttributeValue avEpoch = new AttributeValue().withN(epoch+"");
           
            PutItemRequest put = new PutItemRequest();
            put.setTableName(tableName);
            Map<String, AttributeValue> items = new HashMap<String, AttributeValue>();

            items.put(HASH_KEY, avPath);
            items.put(RANGE_KEY, avFile);
            items.put(EPOCH_VALUE, avEpoch);
           
            if(directory) {
                items.put(DIRECTORY_VALUE, new AttributeValue(Boolean.TRUE.toString()));
            }
           
            put.setItem(items);

            if(log.isDebugEnabled()) {
                log.debug("Adding metastore entry for: " + path.toUri());
            }

            db.putItem(put);

            PutItemRequest tsPut = new PutItemRequest();
            tsPut.setTableName(tableName);
            Map<String, AttributeValue> tsItems = new HashMap<String, AttributeValue>();
           
            tsItems.put(HASH_KEY, new AttributeValue(TIMESERIES_KEY));
            tsItems.put(RANGE_KEY, new AttributeValue(epoch+"-"+rand.nextInt()));
            tsItems.put(LINK_HASH_KEY, avPath);
            tsItems.put(LINK_RANGE_KEY, avFile);
            tsPut.setItem(tsItems);
           
            db.putItem(tsPut);
View Full Code Here

       
        @Override
        public QueryResult call() throws Exception {
            QueryRequest query = new QueryRequest();
            query.setTableName(tableName);
            query.withHashKeyValue(new AttributeValue(normalize(path)));
            query.setConsistentRead(true);

            if(startKey != null) {
                query.setExclusiveStartKey(startKey);
            }
View Full Code Here

        @Override
        public DeleteItemResult call() throws Exception {
            DeleteItemRequest delete = new DeleteItemRequest();
            delete.setTableName(tableName);
            delete.setKey(new Key(new AttributeValue(normalize(path.getParent())), new AttributeValue(path.getName())));
            delete.setReturnValues(ReturnValue.NONE);
           
            if(log.isDebugEnabled()) {
                log.debug("Deleting DynamoDB path: " + path.toUri());
            }
View Full Code Here

       
        @Override
        public UpdateItemResult call() throws Exception {
            UpdateItemRequest update = new UpdateItemRequest();
            update.setTableName(tableName);
            update.setKey(new Key(new AttributeValue(normalize(path.getParent())), new AttributeValue(path.getName())));
           
            Map<String, AttributeValueUpdate> items = new HashMap<String, AttributeValueUpdate>();
            items.put(DELETE_MARKER, new AttributeValueUpdate().withValue(new AttributeValue().withS(Boolean.TRUE.toString())));
            items.put(EPOCH_VALUE, new AttributeValueUpdate().withValue(new AttributeValue().withN(System.currentTimeMillis()+"")));
           
            update.setAttributeUpdates(items);

            if(log.isDebugEnabled()) {
                log.debug("Marking DynamoDB path deleted: " + path.toUri());
View Full Code Here

       
        long deleteEpoch = System.currentTimeMillis() - age;
       
        Map<String, Condition> filter = new HashMap<String, Condition>();
       
        AttributeValue value = new AttributeValue();
        value.setN(deleteEpoch + "");
       
        Condition c = new Condition();
        c.setComparisonOperator(ComparisonOperator.LT);
        c.setAttributeValueList(Collections.singletonList(value));
       
View Full Code Here

       
        long deleteEpoch = System.currentTimeMillis() - age;
       
        QueryRequest query = new QueryRequest();
        query.setTableName(MetastoreJanitor.tableName);
        query.setHashKeyValue(new AttributeValue().withS(DynamoDBMetastore.TIMESERIES_KEY));
        query.setLimit(queueSize/2);
       
        QueryResult result;
       
        int scanCount = 0;
View Full Code Here

  @Override
  public List<String> getLogs(String key) throws Exception {
        QueryRequest queryRequest = new QueryRequest()
                .withTableName(tableName.get())
                .withHashKeyValue(new AttributeValue(key));
       
        Stopwatch stopwatch = getLogsTimer.start();
       
        QueryResult result;
        try {
View Full Code Here

   
    String dateTimeStr = String.valueOf(dateTime);
   
        PutItemRequest putItemRequest = new PutItemRequest()
          .withTableName(tableName.get())
          .withItem(ImmutableMap.of(hashKeyName.get(), new AttributeValue(key),
                        rangeKeyName.get(), new AttributeValue(dateTimeStr),
                        valueName.get(), new AttributeValue(log)));
       
        Stopwatch stopwatch = addLogTimer.start();

        try {
          dbClient.putItem(putItemRequest);
View Full Code Here

TOP

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

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.