Example usage for com.amazonaws.services.dynamodbv2.document Table getTableName

List of usage examples for com.amazonaws.services.dynamodbv2.document Table getTableName

Introduction

In this page you can find the example usage for com.amazonaws.services.dynamodbv2.document Table getTableName.

Prototype

public String getTableName() 

Source Link

Usage

From source file:com.github.sdmcraft.slingdynamo.impl.DynamoDBResourceProvider.java

License:Open Source License

/**
 * Gets the children./*ww w . j a v  a2s . c o  m*/
 *
 * @param dbtable the dbtable
 * @param parent the parent
 * @param childIds the child ids
 * @param path the path
 * @param resolver the resolver
 * @return the children
 */
private List<Resource> getChildren(Table dbtable, int parent, Object[] childIds, String path,
        ResourceResolver resolver) {
    ScanFilter idFilter = new ScanFilter("parent").in(parent);
    ScanFilter childIdsFilter = new ScanFilter("child_id").in(childIds);
    ItemCollection<ScanOutcome> items = dbtable.scan(idFilter, childIdsFilter);
    Iterator<Item> itemItr = items.iterator();
    List<Resource> children = new ArrayList<Resource>();

    while (itemItr.hasNext()) {
        Item item = itemItr.next();
        Iterable<Entry<String, Object>> attributes = item.attributes();
        Iterator<Entry<String, Object>> attributesItr = attributes.iterator();
        Map<String, Object> resourceProps = new HashMap<String, Object>();

        while (attributesItr.hasNext()) {
            Entry<String, Object> attribute = attributesItr.next();
            resourceProps.put(attribute.getKey(), attribute.getValue());
        }

        ModifiableValueMapDecorator valueMap = new ModifiableValueMapDecorator(resourceProps);
        ResourceMetadata resourceMetadata = new ResourceMetadata();
        resourceMetadata.setResolutionPath(path + '/' + resourceProps.get("child_id"));
        resourceMetadata.put("table", dbtable.getTableName());

        children.add(new DynamoDBResource(resolver, resourceMetadata, valueMap, resourceType));
    }

    return children;
}

From source file:dynamodb.CrudOperationsOnDynamoDBTable.java

License:Open Source License

static void listMyTables() {

    TableCollection<ListTablesResult> tables = dynamoDB.listTables();
    Iterator<Table> iterator = tables.iterator();

    System.out.println("Listing table names");

    while (iterator.hasNext()) {
        Table table = iterator.next();
        System.out.println(table.getTableName());
    }//  w  w  w  . ja v a2  s  .  c om
}

From source file:org.kmbmicro.chatwebsocket.DbString.java

public static void createItems(ChatData chatData) {

    Table table = dynamoDB.getTable(tableName);
    System.out.println(table.getTableName());
    try {// w ww  .ja v a  2s . c  om

        Item item = new Item().withPrimaryKey("TimeStamp", dateNow()).withString("user", chatData.getUser())
                .withString("chat", chatData.getChat());
        table.putItem(item);
    } catch (Exception e) {
        System.err.println("Create items failed.");
        System.err.println(e.getMessage());

    }
}