List of usage examples for com.amazonaws.services.simpledb AmazonSimpleDBClient select
@Override
public SelectResult select(SelectRequest request)
The Select
operation returns a set of attributes for ItemNames
that match the select expression.
From source file:c3.ops.priam.aws.SDBInstanceData.java
License:Apache License
/** * Get the instance details from SimpleDB * * @param app Cluster name/*www . j a v a2s. c o m*/ * @param id Node ID * @return the node with the given {@code id}, or {@code null} if no such node exists */ public PriamInstance getInstance(String app, String dc, int id) { AmazonSimpleDBClient simpleDBClient = getSimpleDBClient(); SelectRequest request = new SelectRequest(String.format(INSTANCE_QUERY, app, dc, id)); SelectResult result = simpleDBClient.select(request); if (result.getItems().size() == 0) return null; return transform(result.getItems().get(0)); }
From source file:c3.ops.priam.aws.SDBInstanceData.java
License:Apache License
/** * Get the set of all nodes in the cluster * * @param app Cluster name//w ww. j ava2s. c om * @return the set of all instances in the given {@code app} */ public Set<PriamInstance> getAllIds(String app) { AmazonSimpleDBClient simpleDBClient = getSimpleDBClient(); Set<PriamInstance> inslist = new HashSet<PriamInstance>(); String nextToken = null; do { SelectRequest request = new SelectRequest(String.format(ALL_QUERY, app)); request.setNextToken(nextToken); SelectResult result = simpleDBClient.select(request); nextToken = result.getNextToken(); Iterator<Item> itemiter = result.getItems().iterator(); while (itemiter.hasNext()) { inslist.add(transform(itemiter.next())); } } while (nextToken != null); return inslist; }
From source file:com.netflix.dynomitemanager.sidecore.SimpleDBConfigSource.java
License:Apache License
@Override public void initialize(final String asgName, final String region) { super.initialize(asgName, region); // End point is us-east-1 AmazonSimpleDBClient simpleDBClient = new AmazonSimpleDBClient(provider.getAwsCredentialProvider()); String nextToken = null;/*from w w w . j av a2 s . c o m*/ String appid = asgName.lastIndexOf('-') > 0 ? asgName.substring(0, asgName.indexOf('-')) : asgName; logger.info(String.format("appid used to fetch properties is: %s", appid)); do { SelectRequest request = new SelectRequest(String.format(ALL_QUERY, appid)); request.setNextToken(nextToken); SelectResult result = simpleDBClient.select(request); nextToken = result.getNextToken(); Iterator<Item> itemiter = result.getItems().iterator(); while (itemiter.hasNext()) addProperty(itemiter.next()); } while (nextToken != null); }