Example usage for com.amazonaws.services.simpledb.model DomainMetadataRequest DomainMetadataRequest

List of usage examples for com.amazonaws.services.simpledb.model DomainMetadataRequest DomainMetadataRequest

Introduction

In this page you can find the example usage for com.amazonaws.services.simpledb.model DomainMetadataRequest DomainMetadataRequest.

Prototype

public DomainMetadataRequest(String domainName) 

Source Link

Document

Constructs a new DomainMetadataRequest object.

Usage

From source file:com.dateofrock.simpledbmapper.SimpleDBMapper.java

License:Apache License

public boolean isDomainExists(Class<?> entityClass) {
    String domainName = getDomainName(entityClass);
    try {//w ww .j  a  v  a2s  . c  o  m
        this.sdb.domainMetadata(new DomainMetadataRequest(domainName));
    } catch (NoSuchDomainException e) {
        return false;
    }
    return true;
}

From source file:com.davidgildeh.hadoop.input.simpledb.SimpleDBDAO.java

License:Apache License

/**
 * Get total item count in domain/* w  w  w .  j  av a2s  . co m*/
 * 
 * @return  Total Item Count in domain
 */
public long getTotalItemCount() {
    return sdb.domainMetadata(new DomainMetadataRequest(sdb_domain)).getItemCount().longValue();
}

From source file:com.duboisproject.rushhour.database.SdbInterface.java

License:Open Source License

/**
 * Get the total number of levels: the number of records in the levels table.
 *///from w  w w .  jav a 2 s  . c  o m
public int fetchLevelCount() throws RequestException {
    // We don't expect this to change during app runs, so we'll cache it.
    if (cachedLevelCount == null) {
        DomainMetadataRequest request = new DomainMetadataRequest(LEVELS_DOMAIN);
        try {
            cachedLevelCount = client.domainMetadata(request).getItemCount();
        } catch (AmazonClientException e) {
            throw new RequestException(REQUEST_FAILED_MESSAGE);
        }
    }
    return cachedLevelCount;
}

From source file:org.apache.camel.component.aws.sdb.SdbEndpoint.java

License:Apache License

@Override
public void doStart() throws Exception {
    super.doStart();

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

    try {/* ww w .  j  av  a  2 s .  c  o m*/
        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);
    }
}

From source file:org.teiid.resource.adapter.simpledb.SimpleDBConnectionImpl.java

License:Open Source License

@Override
public Set<SimpleDBAttribute> getAttributeNames(String domainName) throws TranslatorException {
    DomainMetadataRequest domainMetadataRequest = new DomainMetadataRequest(domainName);
    DomainMetadataResult metadataResult = client.domainMetadata(domainMetadataRequest);
    int attributesCount = metadataResult.getAttributeNameCount();
    SelectResult selectResult = client.select(new SelectRequest("SELECT * FROM " + domainName)); //$NON-NLS-1$
    return getAttributeNamesFromSelectResult(selectResult, attributesCount);
}

From source file:org.teiid.resource.adpter.simpledb.SimpleDbAPIClass.java

License:Open Source License

/**
 * /*from w w  w.j av  a 2 s. c o m*/
 * @param domainName 
 * @return Set of attribute names for given domain
 */

public Set<String> getAttributeNames(String domainName) {
    DomainMetadataRequest domainMetadataRequest = new DomainMetadataRequest(domainName);
    DomainMetadataResult metadataResult = client.domainMetadata(domainMetadataRequest);
    int attributesCount = metadataResult.getAttributeNameCount();
    SelectResult selectResult = client.select(new SelectRequest("SELECT * FROM " + domainName)); //$NON-NLS-1$
    return getAttributeNamesFromSelectResult(selectResult, attributesCount);

}