Package com.amazonaws.services.simpledb.model

Examples of com.amazonaws.services.simpledb.model.ListDomainsResult


   
    @Override
    public ListDomainsResult listDomains(ListDomainsRequest listDomainsRequest) throws AmazonServiceException, AmazonClientException {
        this.listDomainsRequest = listDomainsRequest;
       
        ListDomainsResult result = new ListDomainsResult();
        result.getDomainNames().add("DOMAIN1");
        result.getDomainNames().add("DOMAIN2");
        result.setNextToken("TOKEN2");
        return result;
    }
View Full Code Here


   
    @Override
    public ListDomainsResult listDomains(ListDomainsRequest listDomainsRequest) throws AmazonServiceException, AmazonClientException {
        this.listDomainsRequest = listDomainsRequest;
       
        ListDomainsResult result = new ListDomainsResult();
        result.getDomainNames().add("DOMAIN1");
        result.getDomainNames().add("DOMAIN2");
        result.setNextToken("TOKEN2");
        return result;
    }
View Full Code Here

        ListDomainsRequest request = new ListDomainsRequest()
            .withMaxNumberOfDomains(determineMaxNumberOfDomains())
            .withNextToken(determineNextToken());
        log.trace("Sending request [{}] for exchange [{}]...", request, exchange);
       
        ListDomainsResult result = this.sdbClient.listDomains(request);
       
        log.trace("Received result [{}]", result);
       
        Message msg = getMessageForResponse(exchange);
        msg.setHeader(SdbConstants.NEXT_TOKEN, result.getNextToken());
        msg.setHeader(SdbConstants.DOMAIN_NAMES, result.getDomainNames());
    }
View Full Code Here

        try {
            domainSet = new HashSet<String>();
            logger.info("getting all domains");
            AmazonSimpleDB db = getSimpleDb();
            ListDomainsResult listDomainsResult = db.listDomains();
            domainSet.addAll(listDomainsResult.getDomainNames());
            while (listDomainsResult.getNextToken() != null) {
                ListDomainsRequest request = new ListDomainsRequest().withNextToken(listDomainsResult.getNextToken());
                listDomainsResult = db.listDomains(request);
                domainSet.addAll(listDomainsResult.getDomainNames());
            }
        } catch (AmazonClientException e) {
            throw new PersistenceException(e);
        }
    }
View Full Code Here

         * domains owned by the current user, and add up the number of items
         * (similar to rows of data in a relational DB) in each domain.
         */
        try {
            ListDomainsRequest sdbRequest = new ListDomainsRequest().withMaxNumberOfDomains(100);
            ListDomainsResult sdbResult = sdb.listDomains(sdbRequest);

            int totalItems = 0;
            for (String domainName : sdbResult.getDomainNames()) {
                DomainMetadataRequest metadataRequest = new DomainMetadataRequest().withDomainName(domainName);
                DomainMetadataResult domainMetadata = sdb.domainMetadata(metadataRequest);
                totalItems += domainMetadata.getItemCount();
            }

            System.out.println("You have " + sdbResult.getDomainNames().size() + " Amazon SimpleDB domain(s)" +
                    "containing a total of " + totalItems + " items.");
        } catch (AmazonServiceException ase) {
                System.out.println("Caught Exception: " + ase.getMessage());
                System.out.println("Reponse Status Code: " + ase.getStatusCode());
                System.out.println("Error Code: " + ase.getErrorCode());
View Full Code Here

    }
  }

  protected boolean exists(final String domainName, final AmazonSimpleDB sdb) {
    try {
      ListDomainsResult listDomainsResult = sdb.listDomains(new ListDomainsRequest());
      List<String> domainNames = listDomainsResult.getDomainNames();
      String nextToken = listDomainsResult.getNextToken();
      while (nextToken != null && !nextToken.isEmpty()) {
        listDomainsResult = sdb.listDomains(new ListDomainsRequest().withNextToken(nextToken));
        domainNames.addAll(listDomainsResult.getDomainNames());
        nextToken = listDomainsResult.getNextToken();
      }
      return domainNames.contains(domainName);
    } catch(AmazonClientException amazonException) {
      throw SimpleDbExceptionTranslator.getTranslatorInstance().translateAmazonClientException(amazonException);
    }
View Full Code Here

        try {
            domainSet = new HashSet<String>();
            logger.info("getting all domains");
            AmazonSimpleDB db = getSimpleDb();
            ListDomainsResult listDomainsResult = db.listDomains();
            domainSet.addAll(listDomainsResult.getDomainNames());
            while (listDomainsResult.getNextToken() != null) {
                ListDomainsRequest request = new ListDomainsRequest().withNextToken(listDomainsResult.getNextToken());
                listDomainsResult = db.listDomains(request);
                domainSet.addAll(listDomainsResult.getDomainNames());
            }
        } catch (AmazonClientException e) {
            throw new PersistenceException(e);
        }
    }
View Full Code Here

    public void deleteTable(String tableName) {
        sdbClient.deleteDomain(new DeleteDomainRequest(tableName));
    }

    public List<String> listTables() {
        ListDomainsResult   list = sdbClient.listDomains();
        return list.getDomainNames();
    }
View Full Code Here

            if (this.region == null || this.region.equals("region-null")) {
                // This is a mock with an invalid region; avoid a slow timeout
                LOGGER.debug("Region=null; skipping SimpleDB domain creation");
                return;
            }
            ListDomainsResult listDomains = sdbClient().listDomains();
            for (String d : listDomains.getDomainNames()) {
                if (d.equals(domain)) {
                    LOGGER.debug("SimpleDB domain found: {}", domain);
                    return;
                }
            }
View Full Code Here

    log.info("SimpleDbJobStore initialized.");
  }

  private List<String> getSimpleDbDomainNames() {

    ListDomainsResult result = amazonSimpleDb.listDomains();
    List<String> names = result.getDomainNames();
    String nextToken = result.getNextToken();
    while (nextToken != null && !nextToken.isEmpty()) {
      result = amazonSimpleDb.listDomains(new ListDomainsRequest()
          .withNextToken(nextToken));
      names.addAll(result.getDomainNames());
      nextToken = result.getNextToken();
    }
    return names;
  }
View Full Code Here

TOP

Related Classes of com.amazonaws.services.simpledb.model.ListDomainsResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.