public static boolean createTable(String appid, long readCapacity, long writeCapacity) {
		if (StringUtils.isBlank(appid)) {
			return false;
		} else if (StringUtils.containsWhitespace(appid)) {
			logger.warn("DynamoDB table name contains whitespace. The name '{}' is invalid.", appid);
			return false;
		} else if (existsTable(appid)) {
			logger.warn("DynamoDB table '{}' already exists.", appid);
			return false;
		}
		try {
			String table = getTableNameForAppid(appid);
			getClient().createTable(new CreateTableRequest().withTableName(table).
					withKeySchema(new KeySchemaElement(Config._KEY, KeyType.HASH)).
					withSSESpecification(new SSESpecification().withEnabled(ENCRYPTION_AT_REST_ENABLED)).
					withAttributeDefinitions(new AttributeDefinition(Config._KEY, ScalarAttributeType.S)).
					withProvisionedThroughput(new ProvisionedThroughput(readCapacity, writeCapacity)));
			logger.info("Created DynamoDB table '{}'.", table);
		} catch (Exception e) {
			logger.error(null, e);
			return false;
		}
		return true;
	}
public static boolean createTable ( String appid , long readCapacity , long writeCapacity ) { if ( StringUtils . isBlank ( appid ) ) { return false ; } else if ( StringUtils . containsWhitespace ( appid ) ) { logger . warn ( "DynamoDB table name contains whitespace. The name '{}' is invalid." , appid ) ; return false ; } else if ( existsTable ( appid ) ) { logger . warn ( "DynamoDB table '{}' already exists." , appid ) ; return false ; } try { String table = getTableNameForAppid ( appid ) ; getClient ( ) . createTable ( new CreateTableRequest ( ) . withTableName ( table ) . withKeySchema ( new KeySchemaElement ( Config . _KEY , KeyType . HASH ) ) . withSSESpecification ( new SSESpecification ( ) . withEnabled ( ENCRYPTION_AT_REST_ENABLED ) ) . withAttributeDefinitions ( new AttributeDefinition ( Config . _KEY , ScalarAttributeType . S ) ) . withProvisionedThroughput ( new ProvisionedThroughput ( readCapacity , writeCapacity ) ) ) ; logger . info ( "Created DynamoDB table '{}'." , table ) ; } catch ( Exception e ) { logger . error ( null , e ) ; return false ; } return true ; }
Creates a table in AWS DynamoDB.
@param appid name of the {@link com.erudika.para.core.App}
@param readCapacity read capacity
@param writeCapacity write capacity
@return true if created