• 0.21.4

Amazon Dynamo DB Object Layer

This blog post explains what it does and what it's for.

Set of classes in com.jcabi.dynamo is an object layer on top of AWS SDK for Dynamo DB. For example, to read an item from your Dynamo table:

import com.jcabi.dynamo.Credentials;
import com.jcabi.dynamo.Region;
import com.jcabi.dynamo.Table;
import com.jcabi.dynamo.retry.ReRegion;
public class Main {
  public static void main(String[] args) {
    Credentials credentials = new Credentials.Simple(
      "AWS key", "AWS secret"
    );
    Region region = new ReRegion(
      new Region.Simple(credentials)
    );
    Table table = region.table("foo");
    Collection<Item> items = table.frame().where(
      "id", Conditions.equalTo(123)
    );
    for (Item item : items) {
      System.out.println(item.get("name").getS());
    }
  }
}

You can put an item using Table#put() method:

public class Main {
  public static void main(String[] args) {
    Table table = region.table("foo");
    table.put(
      new Attributes()
        .with("id", 123)
        .with("name", "Jeff Lebowski")
        .with("salary", 0.69d)
    );
  }
}

Since version 0.9, it is strongly recommended to use wrappers from com.jcabi.dynamo.retry package, which make sure that accidental connectivity problems do not affect execution. In other words, they retry every AWS call at least three times before giving up and throwing an exception.

The only dependency you need is (you can also download jcabi-dynamo-0.21.4.jar and add it to the classpath):

<dependency>
  <groupId>com.jcabi</groupId>
  <artifactId>jcabi-dynamo</artifactId>
  <version>0.21.4</version>
</dependency>

Cutting Edge Version

If you want to use current version of the product, you can do it with this configuration in your pom.xml:

<repositories>
  <repository>
    <id>oss.sonatype.org</id>
    <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
  </repository>
</repositories>
<dependencies>
  <dependency>
    <groupId>com.jcabi</groupId>
    <artifactId>jcabi-dynamo</artifactId>
    <version>1.0-SNAPSHOT</version>
  </dependency>
</dependencies>