Java 类com.amazonaws.services.simpledb.model.CreateDomainRequest 实例源码

项目:Camel    文件:SdbEndpoint.java   
@Override
public void doStart() throws Exception {
    super.doStart();

    sdbClient = configuration.getAmazonSDBClient() != null ? configuration.getAmazonSDBClient() : createSdbClient();
    if (ObjectHelper.isNotEmpty(configuration.getAmazonSdbEndpoint())) {
        sdbClient.setEndpoint(configuration.getAmazonSdbEndpoint());
    }

    String domainName = getConfiguration().getDomainName();
    LOG.trace("Querying whether domain [{}] already exists...", domainName);

    try {
        sdbClient.domainMetadata(new DomainMetadataRequest(domainName));
        LOG.trace("Domain [{}] already exists", domainName);
        return;
    } catch (NoSuchDomainException ase) {
        LOG.trace("Domain [{}] doesn't exist yet", domainName);
        LOG.trace("Creating domain [{}]...", domainName);
        sdbClient.createDomain(new CreateDomainRequest(domainName));
        LOG.trace("Domain [{}] created", domainName);
    }
}
项目:dwtc-extractor    文件:StatHandler.java   
public AmazonStatHandler(AmazonSimpleDBClient client, String domain) {
    this.client = client;
    this.domain = domain;

    int tries = 0;
    do {
        tries++;
        try {
            ListDomainsResult domainsL = client.listDomains();
            if (!domainsL.getDomainNames().contains(domain)) {
                client.createDomain(new CreateDomainRequest(domain));
            }
            return;
        } catch (Exception ase) {
            log.warn(ase);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
            }               log.warn(ase);

        }
    } while (tries < MAX_TRIES);
    throw new RuntimeException("Unable to connect to SDB " + domain);

}
项目:spring-data-simpledb    文件:DomainManager.java   
protected void createDomain(final String domainName, final AmazonSimpleDB sdb) {
    try {
        LOGGER.debug("Creating domain: {}", domainName);
        CreateDomainRequest request = new CreateDomainRequest(domainName);
        sdb.createDomain(request);
        LOGGER.debug("Created domain: {}", domainName);
    } catch(AmazonClientException amazonException) {
        throw SimpleDbExceptionTranslator.getTranslatorInstance().translateAmazonClientException(amazonException);
    }
}
项目:Tank    文件:AmazonSimpleDatabase.java   
/**
 * 
 * @{inheritDoc
 */
public void createTable(String tableName) {
    try {
        if (!hasTable(tableName)) {
            logger.info("Creating table: " + tableName);
            db.createDomain(new CreateDomainRequest(tableName));
        }
    } catch (Exception t) {
        logger.error(t, t);
    }
}
项目:aws-cms-plugins    文件:WPBAwsSdbAdminDataStorage.java   
public void initialize(Map<String, String> params) throws WPBIOException {

        String accessKey = params.get(CONFIG_ACCESS_KEY);
        String secretkey = params.get(CONFIG_SECRET_KEY);
        BasicAWSCredentials awsCredentials = new BasicAWSCredentials(accessKey, secretkey);

        ClientConfiguration clientConfig = new ClientConfiguration();

        String protocolStr = params.get(CONFIG_PROTOCOL);
        if (protocolStr != null && protocolStr.length()>0)
        {
            Protocol protocol = Protocol.valueOf(params.get(CONFIG_PROTOCOL));
            if (protocol != null)
            {
                clientConfig.setProtocol(protocol);
            }
        }
        sdbClient = new AmazonSimpleDBClient(awsCredentials, clientConfig);     
        String endpoint = params.get(CONFIG_ENDPOINT);
        if (endpoint != null)
        {
            sdbClient.setEndpoint(endpoint);
        }

        domainName = params.get(CONFIG_DOMAIN);
        // create the domain if not exists
        CreateDomainRequest createDomainRequest = new CreateDomainRequest();
        createDomainRequest.setDomainName(domainName);
        sdbClient.createDomain(createDomainRequest);    
    }
项目:agathon    文件:SdbCassandraRingDao.java   
@Override
public void save(CassandraRing ring) {
  String domain = domain(ring);
  if (!ringsProvider.get().contains(domain)) {
    client.createDomain(new CreateDomainRequest().withDomainName(domain));
  }
  for (CassandraInstance instance : ring.getInstances()) {
    instanceDao.save(ring.getName(), instance);
  }
}
项目:jcabi-simpledb    文件:AwsDomain.java   
/**
 * {@inheritDoc}
 */
@Override
public void create() {
    this.credentials.aws().createDomain(
        new CreateDomainRequest().withDomainName(this.table)
    );
}
项目:wildfly-camel    文件:SDBUtils.java   
public static void createDomain(AmazonSimpleDBClient client, String domainName) throws InterruptedException {
    client.createDomain(new CreateDomainRequest(domainName));

    // Unfortunatly, there is no waiters for domain create

    int retries = 10;
    List<String> domainNames = client.listDomains().getDomainNames();
    while (!domainNames.contains(domainName) && 0 < retries--) {
        Thread.sleep(500);
        domainNames = client.listDomains().getDomainNames();
    }
    Assert.assertTrue(domainNames.contains(domainName));
}
项目:Camel    文件:AmazonSDBClientMock.java   
@Override
public CreateDomainResult createDomain(CreateDomainRequest createDomainRequest) throws AmazonServiceException, AmazonClientException {
    this.createDomainRequest = createDomainRequest;
    return new CreateDomainResult();
}
项目:QuotesSocial    文件:SimpleDB.java   
public static void createDomain(String domainName) {
    getInstance().createDomain(new CreateDomainRequest(domainName));
}