Amazon SimpleDB Object Layer
Set of classes in com.jcabi.simpledb
is an object layer on top of AWS SDK for SimpleDB. For example, to read an item from your Dynamo table:
public class Main { public static void main(String[] args) { Credentials credentials = new Credentials.Simple("AWS key", "AWS secret"); Region region = new Region.Simple(credentials); Domain domain = region.domain("foo"); Collection<Item> items = domain.select( new SelectRequest().withSelectExpression("SELECT * FROM foo") ); for (Item item : items) { System.out.println(item.get("name")); } } }
You can put an item using Item#put()
method:
public class Main { public static void main(String[] args) { Domain domain = region.domain("foo"); domain.put("id", "234"); } }
Read JavaDoc for more information and examples.
The only dependency you need is (you can also download jcabi-simpledb-0.4.0.jar
and add it to the classpath):
<dependency> <groupId>com.jcabi</groupId> <artifactId>jcabi-simpledb</artifactId> <version>0.4.0</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-simpledb</artifactId> <version>1.0-SNAPSHOT</version> </dependency> </dependencies>