diff --git a/aws/core/src/main/java/org/jclouds/aws/simpledb/SimpleDBAsyncClient.java b/aws/core/src/main/java/org/jclouds/aws/simpledb/SimpleDBAsyncClient.java index f797191579..855bf45568 100644 --- a/aws/core/src/main/java/org/jclouds/aws/simpledb/SimpleDBAsyncClient.java +++ b/aws/core/src/main/java/org/jclouds/aws/simpledb/SimpleDBAsyncClient.java @@ -22,6 +22,8 @@ package org.jclouds.aws.simpledb; import static org.jclouds.aws.simpledb.reference.SimpleDBParameters.ACTION; import static org.jclouds.aws.simpledb.reference.SimpleDBParameters.VERSION; +import java.util.Map; + import javax.annotation.Nullable; import javax.ws.rs.FormParam; import javax.ws.rs.POST; @@ -29,9 +31,14 @@ import javax.ws.rs.Path; import org.jclouds.aws.filters.FormSigner; import org.jclouds.aws.functions.RegionToEndpoint; +import org.jclouds.aws.simpledb.binders.BindAttributesToIndexedFormParams; +import org.jclouds.aws.simpledb.domain.Item; +import org.jclouds.aws.simpledb.domain.AttributePair; import org.jclouds.aws.simpledb.domain.ListDomainsResponse; import org.jclouds.aws.simpledb.options.ListDomainsOptions; +import org.jclouds.aws.simpledb.xml.ItemsHandler; import org.jclouds.aws.simpledb.xml.ListDomainsResponseHandler; +import org.jclouds.rest.annotations.BinderParam; import org.jclouds.rest.annotations.EndpointParam; import org.jclouds.rest.annotations.FormParams; import org.jclouds.rest.annotations.RequestFilters; @@ -45,6 +52,7 @@ import com.google.common.util.concurrent.ListenableFuture; *

* * @author Adrian Cole + * @author Luís A. Bastião Silva */ @RequestFilters(FormSigner.class) @FormParams(keys = VERSION, values = SimpleDBAsyncClient.VERSION) @@ -80,4 +88,28 @@ public interface SimpleDBAsyncClient { ListenableFuture deleteDomainInRegion(@EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("DomainName") String domainName); + + /** + * @see SimpleDBClient#putAttributes + */ + @POST + @Path("/") + @FormParams(keys = ACTION, values = "PutAttributes") + ListenableFuture putAttributes(@EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, + @FormParam("DomainName") String domainName, + @FormParam("ItemName") String itemName, + @BinderParam(BindAttributesToIndexedFormParams.class) Item attributes); + + /** + * @see SimpleDBClient#putAttributes + */ + @POST + @Path("/") + @FormParams(keys = ACTION, values = "Select") + @XMLResponseParser(ItemsHandler.class) + ListenableFuture> select(@EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, + @FormParam("SelectExpression") String selectExpression); + + + } diff --git a/aws/core/src/main/java/org/jclouds/aws/simpledb/SimpleDBClient.java b/aws/core/src/main/java/org/jclouds/aws/simpledb/SimpleDBClient.java index e3d63cc080..25aa7db973 100644 --- a/aws/core/src/main/java/org/jclouds/aws/simpledb/SimpleDBClient.java +++ b/aws/core/src/main/java/org/jclouds/aws/simpledb/SimpleDBClient.java @@ -19,19 +19,28 @@ package org.jclouds.aws.simpledb; +import java.util.Map; import java.util.concurrent.TimeUnit; import javax.annotation.Nullable; +import javax.ws.rs.FormParam; +import org.jclouds.aws.functions.RegionToEndpoint; +import org.jclouds.aws.simpledb.domain.Item; +import org.jclouds.aws.simpledb.domain.AttributePair; import org.jclouds.aws.simpledb.domain.ListDomainsResponse; import org.jclouds.aws.simpledb.options.ListDomainsOptions; import org.jclouds.concurrent.Timeout; +import org.jclouds.rest.annotations.EndpointParam; + +import com.google.common.util.concurrent.ListenableFuture; /** * Provides access to SimpleDB via their REST API. *

* * @author Adrian Cole + * @author Luís A. Bastião Silva */ @Timeout(duration = 30, timeUnit = TimeUnit.SECONDS) public interface SimpleDBClient { @@ -103,5 +112,6 @@ public interface SimpleDBClient { * /> */ void deleteDomainInRegion(String region, String domainName); - + void putAttributes(String region, String domain, String itemName, Item attributes); + Map select(String region, String selectionExpression); } diff --git a/aws/core/src/main/java/org/jclouds/aws/simpledb/SimpleDBContextBuilder.java b/aws/core/src/main/java/org/jclouds/aws/simpledb/SimpleDBContextBuilder.java index 4b210cd866..ecb61057ca 100644 --- a/aws/core/src/main/java/org/jclouds/aws/simpledb/SimpleDBContextBuilder.java +++ b/aws/core/src/main/java/org/jclouds/aws/simpledb/SimpleDBContextBuilder.java @@ -41,6 +41,7 @@ import com.google.inject.Module; * {@link JavaUrlHttpCommandExecutorServiceModule http transports} will be installed. * * @author Adrian Cole + * @author Luís A. Bastião Silva * @see SimpleDBContext */ public class SimpleDBContextBuilder extends RestContextBuilder { diff --git a/aws/core/src/main/java/org/jclouds/aws/simpledb/binders/BindAttributesToIndexedFormParams.java b/aws/core/src/main/java/org/jclouds/aws/simpledb/binders/BindAttributesToIndexedFormParams.java new file mode 100644 index 0000000000..44d1d67158 --- /dev/null +++ b/aws/core/src/main/java/org/jclouds/aws/simpledb/binders/BindAttributesToIndexedFormParams.java @@ -0,0 +1,63 @@ +package org.jclouds.aws.simpledb.binders; + +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkNotNull; +import static java.lang.String.format; +import static org.jclouds.http.HttpUtils.addFormParamTo; + +import java.util.Collection; +import java.util.Iterator; + +import java.util.List; +import org.jclouds.aws.simpledb.domain.Item; +import org.jclouds.aws.simpledb.domain.AttributePair; +import org.jclouds.http.HttpRequest; +import org.jclouds.rest.Binder; + +/** + * + * @author Luís A. Bastião Silva + */ +public class BindAttributesToIndexedFormParams implements Binder +{ + + private final String attributeName = "Attribute.%d.Name"; + private final String attributeValue = "Attribute.%d.Value"; + private final String attributeReplace = "Attribute.%d.Replace"; + + public void bindToRequest(HttpRequest request, Object input) { + checkArgument(checkNotNull(input, "input") instanceof Item, + "this binder is only valid for AttributeMap"); + Item attributeMap = (Item) input; + + int amazonOneBasedIndex = 1; // according to docs, counters must start with 1 + for (String itemName : attributeMap.getAttributes().keySet()) + { + + Collection c = attributeMap.getAttributes().get(itemName); + Iterator it = c.iterator(); + while(it.hasNext()) + { + AttributePair attr = it.next(); + // not null by contract + + String value = attr.getValue(); + + if (value != null) { + addFormParamTo(request, format(attributeName, amazonOneBasedIndex), attr.getKey() ); + addFormParamTo(request, format(attributeValue, amazonOneBasedIndex), + value); + addFormParamTo(request, format(attributeReplace, amazonOneBasedIndex), String + .valueOf(attr.isReplace())); + + + } + amazonOneBasedIndex++; + } + + + } + + } + +} diff --git a/aws/core/src/main/java/org/jclouds/aws/simpledb/config/SimpleDBRestClientModule.java b/aws/core/src/main/java/org/jclouds/aws/simpledb/config/SimpleDBRestClientModule.java index 4870bfcded..4aca4586a9 100644 --- a/aws/core/src/main/java/org/jclouds/aws/simpledb/config/SimpleDBRestClientModule.java +++ b/aws/core/src/main/java/org/jclouds/aws/simpledb/config/SimpleDBRestClientModule.java @@ -29,6 +29,7 @@ import org.jclouds.rest.ConfiguresRestClient; * Configures the SimpleDB connection. * * @author Adrian Cole + * @author Luís A. Bastião Silva */ @RequiresHttp @ConfiguresRestClient diff --git a/aws/core/src/main/java/org/jclouds/aws/simpledb/domain/AttributePair.java b/aws/core/src/main/java/org/jclouds/aws/simpledb/domain/AttributePair.java new file mode 100644 index 0000000000..03c68816b0 --- /dev/null +++ b/aws/core/src/main/java/org/jclouds/aws/simpledb/domain/AttributePair.java @@ -0,0 +1,62 @@ +package org.jclouds.aws.simpledb.domain; + +import java.util.ArrayList; +import java.util.List; + + +/** + * AttributePair is a class to support the attributes to put in the SimpleDB + *

+ * + * @author Luís A. Bastião Silva + */ +public class AttributePair +{ + + private String key; + private String value; + private boolean replace; + + + /** + * + * Default constructor to represent an attribute in a domain in SimpleDB + * + *

+ * + * @param key Name of Attribute + * @param value Value of Attribute + * @param replace Replace value if it already exists in domain + */ + public AttributePair(String key, String value, boolean replace) + { + this.key = key; + + this.value = value ; + this.replace = replace; + } + + + public String getKey() { + return key; + } + + + public String getValue() { + return value; + } + + public void setValue(String value) + { + this.value = value; + } + + + public boolean isReplace() { + return replace; + } + + + + +} diff --git a/aws/core/src/main/java/org/jclouds/aws/simpledb/domain/DomainMetadata.java b/aws/core/src/main/java/org/jclouds/aws/simpledb/domain/DomainMetadata.java index 90d5a9c3f2..aff4dffdec 100644 --- a/aws/core/src/main/java/org/jclouds/aws/simpledb/domain/DomainMetadata.java +++ b/aws/core/src/main/java/org/jclouds/aws/simpledb/domain/DomainMetadata.java @@ -27,6 +27,7 @@ import java.util.Date; * "http://docs.amazonwebservices.com/AmazonSimpleDB/2009-04-15/DeveloperGuide/index.html?SDB_API_CreateDomain.html" * /> * @author Adrian Cole + * @author Luís A. Bastião Silva */ public class DomainMetadata { private final String region; diff --git a/aws/core/src/main/java/org/jclouds/aws/simpledb/domain/Item.java b/aws/core/src/main/java/org/jclouds/aws/simpledb/domain/Item.java new file mode 100644 index 0000000000..aa6c9b590f --- /dev/null +++ b/aws/core/src/main/java/org/jclouds/aws/simpledb/domain/Item.java @@ -0,0 +1,45 @@ +package org.jclouds.aws.simpledb.domain; + +import javax.annotation.Nullable; + +import com.google.common.collect.ImmutableMultimap; +import com.google.common.collect.LinkedHashMultimap; +import com.google.common.collect.Multimap; + +/** + * Defines the mapping of Items + * + * @author Luís A. Bastião Silva + */ +public class Item { + + private final Multimap attributes = LinkedHashMultimap + .create(); + + public Item() { + } + + /** + * Creates a map of Attribute Pair + * + */ + public Item(Multimap attributes) + { + + this.attributes.putAll(attributes); + + } + + public Item addAttributePair(@Nullable String itemName, + AttributePair attrPair) + { + this.attributes.put(itemName, attrPair); + return this; + } + + public Multimap getAttributes() + { + return ImmutableMultimap. builder().putAll( + attributes).build(); + } +} diff --git a/aws/core/src/main/java/org/jclouds/aws/simpledb/domain/ListDomainsResponse.java b/aws/core/src/main/java/org/jclouds/aws/simpledb/domain/ListDomainsResponse.java index 4fa1ba9339..c15bc02dcd 100644 --- a/aws/core/src/main/java/org/jclouds/aws/simpledb/domain/ListDomainsResponse.java +++ b/aws/core/src/main/java/org/jclouds/aws/simpledb/domain/ListDomainsResponse.java @@ -24,6 +24,7 @@ import java.util.Set; /** * * @author Adrian Cole + * @author Luís A. Bastião Silva * @see */ public interface ListDomainsResponse extends Set { diff --git a/aws/core/src/main/java/org/jclouds/aws/simpledb/options/ListDomainsOptions.java b/aws/core/src/main/java/org/jclouds/aws/simpledb/options/ListDomainsOptions.java index 4db2c3453f..6fbef10003 100644 --- a/aws/core/src/main/java/org/jclouds/aws/simpledb/options/ListDomainsOptions.java +++ b/aws/core/src/main/java/org/jclouds/aws/simpledb/options/ListDomainsOptions.java @@ -38,6 +38,7 @@ import org.jclouds.http.options.BaseHttpRequestOptions; * * * @author Adrian Cole + * @author Luís A. Bastião Silva * @see diff --git a/aws/core/src/main/java/org/jclouds/aws/simpledb/package-info.java b/aws/core/src/main/java/org/jclouds/aws/simpledb/package-info.java index 12a98f4bdd..bcd961915c 100644 --- a/aws/core/src/main/java/org/jclouds/aws/simpledb/package-info.java +++ b/aws/core/src/main/java/org/jclouds/aws/simpledb/package-info.java @@ -21,5 +21,6 @@ * * @see * @author Adrian Cole + * @author Luís A. Bastião Silva */ package org.jclouds.aws.simpledb; diff --git a/aws/core/src/main/java/org/jclouds/aws/simpledb/reference/SimpleDBParameters.java b/aws/core/src/main/java/org/jclouds/aws/simpledb/reference/SimpleDBParameters.java index afd6e8e638..d325be7f22 100644 --- a/aws/core/src/main/java/org/jclouds/aws/simpledb/reference/SimpleDBParameters.java +++ b/aws/core/src/main/java/org/jclouds/aws/simpledb/reference/SimpleDBParameters.java @@ -25,6 +25,7 @@ package org.jclouds.aws.simpledb.reference; * @see * @author Adrian Cole + * @author Luís A. Bastião Silva */ public interface SimpleDBParameters { diff --git a/aws/core/src/main/java/org/jclouds/aws/simpledb/xml/ItemsHandler.java b/aws/core/src/main/java/org/jclouds/aws/simpledb/xml/ItemsHandler.java new file mode 100644 index 0000000000..c23043520f --- /dev/null +++ b/aws/core/src/main/java/org/jclouds/aws/simpledb/xml/ItemsHandler.java @@ -0,0 +1,112 @@ +/** + * + * Copyright (C) 2010 Cloud Conscious, LLC. + * + * ==================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ==================================================================== + */ + +package org.jclouds.aws.simpledb.xml; + +import com.google.common.collect.LinkedHashMultimap; +import java.util.Map; + +import org.jclouds.aws.simpledb.domain.AttributePair; +import org.jclouds.date.DateService; +import org.jclouds.http.functions.ParseSax; + +import com.google.common.collect.Maps; +import com.google.common.collect.Multimap; +import com.google.inject.Inject; +import java.util.ArrayList; +import java.util.List; +import org.jclouds.aws.simpledb.domain.Item; +import org.xml.sax.Attributes; + +/** + * + * @author Luís A. Bastião Silva + */ +public class ItemsHandler extends + ParseSax.HandlerWithResult> { + private StringBuilder currentText = new StringBuilder(); + + private Map items = Maps.newConcurrentMap(); + private Multimap attributes = LinkedHashMultimap.create(); + private String attributeName; + private String attributeValue = ""; + private String itemName; + + private boolean inside = false; + + protected final DateService dateService; + + @Inject + public ItemsHandler(DateService dateService) { + this.dateService = dateService; + } + + public Map getResult() { + return items; + } + + public void startElement(String uri, String localName, String qName, Attributes attributes) + { + if (qName.equals("Attribute")) { + inside = true; + } + } + + public void endElement(String uri, String name, String qName) + { + if (qName.equals("Attribute")) + { + inside = false; + + + System.out.println("AttributeName: " + attributeName); + System.out.println("AttributeValue: " + attributeValue); + } + else if(qName.equals("Name")) { + if (inside) + attributeName = currentText.toString().trim(); + else + itemName = currentText.toString().trim(); + + } else if (qName.equals("Value")) + { + attributeValue = currentText.toString().trim(); + + attributes.put(attributeName,new AttributePair(attributeName, + attributeValue, false)); + } + else if (qName.equals("Item")) + { + System.out.println("ItemName: " + itemName); + + Item item = new Item(attributes); + items.put(itemName, item); + attributes = LinkedHashMultimap.create(); + this.attributeName = null; + this.attributeValue = null; + this.itemName = null; + inside = false; + } + currentText = new StringBuilder(); + } + + public void characters(char ch[], int start, int length) { + currentText.append(ch, start, length); + } +} diff --git a/aws/core/src/main/java/org/jclouds/aws/simpledb/xml/ListDomainsResponseHandler.java b/aws/core/src/main/java/org/jclouds/aws/simpledb/xml/ListDomainsResponseHandler.java index 5b4b4063f1..11b2d6a5aa 100755 --- a/aws/core/src/main/java/org/jclouds/aws/simpledb/xml/ListDomainsResponseHandler.java +++ b/aws/core/src/main/java/org/jclouds/aws/simpledb/xml/ListDomainsResponseHandler.java @@ -34,6 +34,7 @@ import com.google.common.collect.Sets; * ListDomainsResponse * * @author Adrian Cole + * @author Luís A. Bastião Silva * @see diff --git a/aws/core/src/test/java/org/jclouds/aws/simpledb/SimpleDBAsyncClientTest.java b/aws/core/src/test/java/org/jclouds/aws/simpledb/SimpleDBAsyncClientTest.java index 947dd6ec7c..308cfba3be 100644 --- a/aws/core/src/test/java/org/jclouds/aws/simpledb/SimpleDBAsyncClientTest.java +++ b/aws/core/src/test/java/org/jclouds/aws/simpledb/SimpleDBAsyncClientTest.java @@ -23,6 +23,7 @@ import static org.testng.Assert.assertEquals; import java.io.IOException; import java.lang.reflect.Method; +import java.util.Map; import java.util.Properties; import org.jclouds.aws.domain.Region; @@ -96,11 +97,31 @@ public class SimpleDBAsyncClientTest extends RestClientTest } public void testAllRegions() throws SecurityException, NoSuchMethodException, IOException { - Method method = SimpleDBAsyncClient.class.getMethod("createDomainInRegion", String.class, String.class); + Method method = SimpleDBAsyncClient.class.getMethod("putAttributes", String.class, String.class); for (String region : Region.ALL_SIMPLEDB) { processor.createRequest(method, region, "domainName"); } } + + public void testPutAttributes() throws SecurityException, NoSuchMethodException, IOException { + Method method = SimpleDBAsyncClient.class.getMethod("putAttributes", String.class, String.class, Map.class); + HttpRequest request = processor.createRequest(method, null, "domainName"); + + assertRequestLineEquals(request, "POST https://sdb.amazonaws.com/ HTTP/1.1"); + assertNonPayloadHeadersEqual(request, "Host: sdb.amazonaws.com\n"); + assertPayloadEquals(request, "Version=2009-04-15&Action=PutAttributes&DomainName=domainName&ItemName=itemName" + + "&Attribute.1.Name=name" + + "&Attribute.1.Value=fuzzy" + + "&Attribute.1.Replace=true", + "application/x-www-form-urlencoded", false); + + assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class); + assertSaxResponseParserClassEquals(method, null); + assertExceptionParserClassEquals(method, null); + + checkFilters(request); + } + @Override protected void checkFilters(HttpRequest request) { diff --git a/aws/demos/pom.xml b/aws/demos/pom.xml index b1d6a76dd1..03104dde95 100644 --- a/aws/demos/pom.xml +++ b/aws/demos/pom.xml @@ -37,6 +37,7 @@ createlamp speedtest-sqs createandlistbuckets + simpledb diff --git a/aws/demos/simpledb/README.txt b/aws/demos/simpledb/README.txt new file mode 100644 index 0000000000..f072b3aec6 --- /dev/null +++ b/aws/demos/simpledb/README.txt @@ -0,0 +1,29 @@ +==== + + Copyright (C) 2010 Cloud Conscious, LLC. + + ==================================================================== + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ==================================================================== +==== + +# +# this is a simple example command line client to test usage of simpledb +# functions like putAttribute is tested and then it select and retrieve results. +# 1. execute 'mvn install' to build the sample +# 2. invoke the jar, passing your aws credentials and the bucket you wish to create +# ex. +# java -jar target/jclouds-aws-demo-simpledb-jar-with-dependencies.jar $AWS_USER $AWS_PWD simpledbtest + + +# Further information: Luís A. astião Silva bastiao@ua.pt> diff --git a/aws/demos/simpledb/pom.xml b/aws/demos/simpledb/pom.xml new file mode 100644 index 0000000000..7f1f67771f --- /dev/null +++ b/aws/demos/simpledb/pom.xml @@ -0,0 +1,75 @@ + + + + + 4.0.0 + + org.jclouds + jclouds-aws-demos-project + 1.0-SNAPSHOT + + jclouds-aws-demo-simpledb + jclouds simpledb sample that putAttributes and select it + jclouds simpledb sample that putAttributes and select it + + ${project.artifactId} + + + + org.apache.maven.plugins + maven-jar-plugin + + + + org.jclouds.aws.s3.samples.MainApp + + + + + + + maven-assembly-plugin + + + jar-with-dependencies + + + + org.jclouds.aws.simpledb.samples.MainApp + + + + + + make-assembly + package + + single + + + + + + + + + diff --git a/aws/demos/simpledb/src/main/java/org/jclouds/aws/simpledb/samples/MainApp.java b/aws/demos/simpledb/src/main/java/org/jclouds/aws/simpledb/samples/MainApp.java new file mode 100644 index 0000000000..1323f836da --- /dev/null +++ b/aws/demos/simpledb/src/main/java/org/jclouds/aws/simpledb/samples/MainApp.java @@ -0,0 +1,80 @@ +/** + * + * Copyright (C) 2010 Cloud Conscious, LLC. + * + * ==================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ==================================================================== + */ + +package org.jclouds.aws.simpledb.samples; + +import java.io.IOException; +import java.util.Map; +import java.util.Properties; + +import org.jclouds.aws.domain.Region; +import org.jclouds.aws.simpledb.SimpleDBAsyncClient; +import org.jclouds.aws.simpledb.SimpleDBClient; +import org.jclouds.aws.simpledb.domain.AttributePair; +import org.jclouds.aws.simpledb.domain.Item; +import org.jclouds.aws.simpledb.options.ListDomainsOptions; +import org.jclouds.rest.RestContext; +import org.jclouds.rest.RestContextFactory; + +import com.google.common.collect.LinkedHashMultimap; +import com.google.common.collect.Multimap; + + +/** + * This the Main class of an Application that demonstrates the use of the simpledb. + * + * Usage is: java MainApp \"accesskeyid\" \"secretkey\" + * + * @author Luís A. Bastião Silva + * + */ +public class MainApp +{ + + public static int PARAMETERS = 3; + public static String INVALID_SYNTAX = "Invalid number of parameters. Syntax is: \"accesskeyid\" \"secretkey\" \"bucketName\" "; + + public static void main(String[] args) throws IOException { + + + // Args + String accesskeyid = args[0]; + String secretkey = args[1]; + Properties properties = new Properties(); + properties.setProperty("simpledb.identity", accesskeyid); + properties.setProperty("simpledb.credential", secretkey); + + + RestContext context = new RestContextFactory().createContext("simpledb", "AKIAJODKICBEKG7MM4XA", "FfqiNSiC88B6tJPDIOKUWUJGY68BQaQpkNz6Fsgq", new Properties()); + AttributePair p = new AttributePair("AccessNumber", "1213123", true); + Multimap m =LinkedHashMultimap.create(); + m.put("AccessNumber", p); + Item attributes = new Item(m); + + // Use Provider API + context.getApi().putAttributes(Region.EU_WEST_1, "tse", "AccessNumber", attributes ); + //context.getApi().createDomainInRegion(Region.EU_WEST_1, "tse"); + Map results = context.getApi().select(Region.EU_WEST_1, "select * from tse"); + System.out.println(results); + ListDomainsOptions [] list = new ListDomainsOptions[100]; + //context.getApi().listDomainsInRegion(Region.EU_WEST_1, list); + System.out.println(list[0]); + context.close(); + } +}