Example usage for com.amazonaws.services.simpledb AmazonSimpleDBClient listDomains

List of usage examples for com.amazonaws.services.simpledb AmazonSimpleDBClient listDomains

Introduction

In this page you can find the example usage for com.amazonaws.services.simpledb AmazonSimpleDBClient listDomains.

Prototype

@Override
public ListDomainsResult listDomains(ListDomainsRequest request) 

Source Link

Document

The ListDomains operation lists all domains associated with the Access Key ID.

Usage

From source file:com.brighttag.agathon.dao.sdb.SdbDaoModule.java

License:Apache License

@Provides
@Named(RINGS_PROPERTY)// w ww .  jav  a 2s.  co m
Set<String> provideRings(AmazonSimpleDBClient client, CassandraDomainFactory domainFactory) {
    List<String> rings = Lists.newArrayList();
    String nextToken = null;

    do {
        ListDomainsRequest request = new ListDomainsRequest().withNextToken(nextToken);
        ListDomainsResult result = client.listDomains(request);
        for (String domain : result.getDomainNames()) {
            CassandraDomain cassandraDomain = domainFactory.createFromDomain(domain);
            if (cassandraDomain != null) {
                rings.add(cassandraDomain.getRing());
            }
        }
        nextToken = result.getNextToken();
    } while (nextToken != null);
    return ImmutableSet.copyOf(rings);
}