alanwilliamson

Updated Simple Java API class for Amazon SimpleDB

I have recently updated the beautiful class that Ian Schumacher originally developed to access Amazon's SimpleDB without using any external dependencies.

Back in July I made some enhancements to this class by adding a very simple in-class XML parser that would pull back the results in a format that the calling class could actually use.

simple life

I have added a couple of new methods to catch the new methods added by Amazon to SimpleDB. Namely the QueryWithAttributes directive that lets you pull back all the attributes for a given Item that matches the query results. This makes querying SimpleDB even more efficient as you can get all your data in one call.

As usual, you can get at this data as a List of HashMap's.

SimpleDB sDb = new SimpleDB( amzID, amzKey );
List results = sDb.queryWithAttributesAsListMap( amzDomain, qry, null );

I also added in a new method to delete a whole record from SimpleDB given a domain and an Item.

SimpleDB sDb = new SimpleDB( amzID, amzKey );
sDb.deleteItem( amzDomain, item);

Now if anything goes wrong, with any of the calls, an Exception is thrown. Remember, if you delete something and straight afterwards do a query, you may still see it, that's because of Amazon's caching and updating mechanisms.

Thanks again to Ian Schumacher for developing the original class and making it available on Amazon under a very liberal license (Absolutely free in all senses of the word, absolutely no restrictions, no attribution necessary).

In the same spirit, I include the updated version of that code here, to be used in the same spirit as the original author. Just "Copy and Paste" It!

Adapated from the original code submission.


 

Recent Cloud posts

Recent JAVA posts

Latest CFML posts


 
Site Links