Package com.amazonaws.services.dynamodb.model

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


        assertEquals("FULL_DESCRIBE_TABLE", ddbClient.describeTableRequest.getTableName());
        assertEquals("FULL_DESCRIBE_TABLE", exchange.getIn().getHeader(DdbConstants.TABLE_NAME));
        assertEquals("ACTIVE", exchange.getIn().getHeader(DdbConstants.TABLE_STATUS));
        assertEquals(new Date(AmazonDDBClientMock.NOW), exchange.getIn().getHeader(DdbConstants.CREATION_DATE));
        assertEquals(100L, exchange.getIn().getHeader(DdbConstants.ITEM_COUNT));
        assertEquals(new KeySchema(new KeySchemaElement().withAttributeName("name")),
                exchange.getIn().getHeader(DdbConstants.KEY_SCHEMA));
        assertEquals(20L, exchange.getIn().getHeader(DdbConstants.READ_CAPACITY));
        assertEquals(10L, exchange.getIn().getHeader(DdbConstants.WRITE_CAPACITY));
        assertEquals(1000L, exchange.getIn().getHeader(DdbConstants.TABLE_SIZE));
    }
View Full Code Here


            return new DescribeTableResult().withTable(new TableDescription()
                    .withTableName(tableName)
                    .withTableStatus(TableStatus.ACTIVE)
                    .withCreationDateTime(new Date(NOW))
                    .withItemCount(100L)
                    .withKeySchema(new KeySchema(new KeySchemaElement().withAttributeName("name")))
                    .withProvisionedThroughput(new ProvisionedThroughputDescription()
                            .withReadCapacityUnits(20L)
                            .withWriteCapacityUnits(10L))
                    .withTableSizeBytes(1000L));
        }
View Full Code Here

        return new DeleteTableResult().withTableDescription(new TableDescription()
                .withProvisionedThroughput(new ProvisionedThroughputDescription())
                .withTableName(deleteTableRequest.getTableName())
                .withCreationDateTime(new Date(NOW))
                .withItemCount(10L)
                .withKeySchema(new KeySchema())
                .withTableSizeBytes(20L)
                .withTableStatus(TableStatus.ACTIVE));
    }
View Full Code Here

        assertEquals(new ProvisionedThroughputDescription(), exchange.getIn().getHeader(
                DdbConstants.PROVISIONED_THROUGHPUT));
        assertEquals(new Date(AmazonDDBClientMock.NOW), exchange.getIn().getHeader(DdbConstants.CREATION_DATE,
                Date.class));
        assertEquals(Long.valueOf(10L), exchange.getIn().getHeader(DdbConstants.ITEM_COUNT, Long.class));
        assertEquals(new KeySchema(), exchange.getIn().getHeader(DdbConstants.KEY_SCHEMA, KeySchema.class));
        assertEquals(Long.valueOf(20L), exchange.getIn().getHeader(DdbConstants.TABLE_SIZE, Long.class));
        assertEquals(TableStatus.ACTIVE, exchange.getIn().getHeader(DdbConstants.TABLE_STATUS, TableStatus.class));
    }
View Full Code Here

        }
    }

    private TableDescription createTable(String tableName) {
        CreateTableRequest createTableRequest = new CreateTableRequest().withTableName(tableName)
                .withKeySchema(new KeySchema(
                        new KeySchemaElement().withAttributeName(
                                configuration.getKeyAttributeName())
                                .withAttributeType(configuration.getKeyAttributeType())))
                .withProvisionedThroughput(
                        new ProvisionedThroughput().withReadCapacityUnits(configuration.getReadCapacity())
View Full Code Here

        }
    }

    private TableDescription createTable(String tableName) {
        CreateTableRequest createTableRequest = new CreateTableRequest().withTableName(tableName)
                .withKeySchema(new KeySchema(
                        new KeySchemaElement().withAttributeName(
                                configuration.getKeyAttributeName())
                                .withAttributeType(configuration.getKeyAttributeType())))
                .withProvisionedThroughput(
                        new ProvisionedThroughput().withReadCapacityUnits(configuration.getReadCapacity())
View Full Code Here

        Class       modelClass = jsoda.getModelClass(modelName);
        String      table = jsoda.getModelTable(modelName);
        Field       idField = jsoda.getIdField(modelName);
        String      idName = getFieldAttrName(modelName, idField.getName());
        Field       rangeField = jsoda.getRangeField(modelName);
        KeySchema   key = new KeySchema();
        Long        readTP  = ReflectUtil.getAnnotationValueEx(modelClass, Model.class, "readThroughput", Long.class, new Long(10));
        Long        writeTP = ReflectUtil.getAnnotationValueEx(modelClass, Model.class, "writeThroughput", Long.class, new Long(5));

        key.setHashKeyElement(makeKeySchemaElement(idField));
        if (rangeField != null)
            key.setRangeKeyElement(makeKeySchemaElement(rangeField));

        ddbClient.createTable(new CreateTableRequest(table, key)
                              .withProvisionedThroughput(new ProvisionedThroughput()
                                                         .withReadCapacityUnits(readTP)
                                                         .withWriteCapacityUnits(writeTP)));
View Full Code Here

     * @param tableName
     * @param rangeKeyName
     * @param rangeKeyType
     */
    public void setHashRangeKeySchema(String tableName, String rangeKeyName, String rangeKeyType){
      KeySchema kSchema = tablesToKeySchemas.get(tableName);
      if ( kSchema == null)
        kSchema = new KeySchema();
  
      KeySchemaElement rangeKeyElement = new KeySchemaElement().withAttributeName(rangeKeyName).withAttributeType(rangeKeyType);
      kSchema.setRangeKeyElement(rangeKeyElement);
      tablesToKeySchemas.put(tableName, kSchema);
    }
View Full Code Here

     * @param tableName
     * @param keyName
     * @param keyType
     */
    public void setHashKeySchema(String tableName, String keyName, String keyType){
      KeySchema kSchema = tablesToKeySchemas.get(tableName);
        if ( kSchema == null)
          kSchema = new KeySchema();
        KeySchemaElement hashKey = new KeySchemaElement().withAttributeName(keyName).withAttributeType(keyType);
        kSchema.setHashKeyElement(hashKey);
        tablesToKeySchemas.put(tableName, kSchema);
    }
View Full Code Here

     * Verifies is a table has a key schema defined
     * @param tableName  Table name to determine which key schema to obtain
     * @return
     */
    private boolean verifyKeySchema(String tableName){
      KeySchema kSchema = tablesToKeySchemas.get(tableName);
 
      if (kSchema == null)
        return false;
 
      KeySchemaElement rangeKey = kSchema.getRangeKeyElement();
      KeySchemaElement hashKey = kSchema.getHashKeyElement();
      // A range key must have a hash key as well
     
      if (rangeKey != null){
        if (hashKey != null
          return true;
View Full Code Here

TOP

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

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.