You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gora.apache.org by rm...@apache.org on 2012/12/27 23:54:54 UTC
svn commit: r1426357 - in /gora/trunk/gora-dynamodb/src:
examples/java/org/apache/gora/examples/generated/
main/java/org/apache/gora/dynamodb/compiler/
main/java/org/apache/gora/dynamodb/query/
main/java/org/apache/gora/dynamodb/store/ test/java/org/ap...
Author: rmarroquin
Date: Thu Dec 27 22:54:54 2012
New Revision: 1426357
URL: http://svn.apache.org/viewvc?rev=1426357&view=rev
Log:
Fixing tabs used.
Modified:
gora/trunk/gora-dynamodb/src/examples/java/org/apache/gora/examples/generated/person.java
gora/trunk/gora-dynamodb/src/main/java/org/apache/gora/dynamodb/compiler/GoraDynamoDBCompiler.java
gora/trunk/gora-dynamodb/src/main/java/org/apache/gora/dynamodb/query/DynamoDBQuery.java
gora/trunk/gora-dynamodb/src/main/java/org/apache/gora/dynamodb/store/DynamoDBMapping.java
gora/trunk/gora-dynamodb/src/main/java/org/apache/gora/dynamodb/store/DynamoDBStore.java
gora/trunk/gora-dynamodb/src/test/java/org/apache/gora/dynamodb/GoraDynamoDBTestDriver.java
Modified: gora/trunk/gora-dynamodb/src/examples/java/org/apache/gora/examples/generated/person.java
URL: http://svn.apache.org/viewvc/gora/trunk/gora-dynamodb/src/examples/java/org/apache/gora/examples/generated/person.java?rev=1426357&r1=1426356&r2=1426357&view=diff
==============================================================================
--- gora/trunk/gora-dynamodb/src/examples/java/org/apache/gora/examples/generated/person.java (original)
+++ gora/trunk/gora-dynamodb/src/examples/java/org/apache/gora/examples/generated/person.java Thu Dec 27 22:54:54 2012
@@ -49,19 +49,19 @@ public class person implements Persisten
@Override
public String[] getFields() { return null; }
@Override
- public String getField(int index) { return null; }
+ public String getField(int index) { return null; }
@Override
public int getFieldIndex(String field) { return 0; }
@Override
public void clear() { }
@Override
- public person clone() { return null; }
+ public person clone() { return null; }
@Override
public boolean isNew() { return false; }
@Override
public void setNew() { }
@Override
- public void clearNew() { }
+ public void clearNew() { }
@Override
public boolean isDirty() { return false; }
@Override
@@ -81,7 +81,7 @@ public class person implements Persisten
@Override
public void clearDirty() { }
@Override
- public boolean isReadable(int fieldIndex) { return false; }
+ public boolean isReadable(int fieldIndex) { return false; }
@Override
public boolean isReadable(String field) { return false; }
@Override
Modified: gora/trunk/gora-dynamodb/src/main/java/org/apache/gora/dynamodb/compiler/GoraDynamoDBCompiler.java
URL: http://svn.apache.org/viewvc/gora/trunk/gora-dynamodb/src/main/java/org/apache/gora/dynamodb/compiler/GoraDynamoDBCompiler.java?rev=1426357&r1=1426356&r2=1426357&view=diff
==============================================================================
--- gora/trunk/gora-dynamodb/src/main/java/org/apache/gora/dynamodb/compiler/GoraDynamoDBCompiler.java (original)
+++ gora/trunk/gora-dynamodb/src/main/java/org/apache/gora/dynamodb/compiler/GoraDynamoDBCompiler.java Thu Dec 27 22:54:54 2012
@@ -53,7 +53,7 @@ public class GoraDynamoDBCompiler {
GoraDynamoDBCompiler compiler = new GoraDynamoDBCompiler(dest);
DynamoDBMapping dynamoDBMap = compiler.readMapping(src);
if (dynamoDBMap.getTables().isEmpty()) throw new IllegalStateException("There are not tables defined.");
-
+
for(String tableName : dynamoDBMap.getTables().keySet()){
compiler.compile(tableName, dynamoDBMap.getKeySchema(tableName), dynamoDBMap.getItems(tableName));
}
@@ -61,9 +61,9 @@ public class GoraDynamoDBCompiler {
/**
* Method in charge of compiling a specific table using a key schema and a set of attributes
- * @param pTableName Table name
- * @param pKeySchema Key schema used
- * @param pItems List of items belonging to a specific table
+ * @param pTableNameTable name
+ * @param pKeySchemaKey schema used
+ * @param pItemsList of items belonging to a specific table
*/
private void compile(String pTableName, KeySchema pKeySchema, List<Map<String, String>> pItems){
// TODO define where the generated will go
@@ -88,8 +88,8 @@ public class GoraDynamoDBCompiler {
/**
* Receives a list of all items and creates getters and setters for them
- * @param pItems The items belonging to the table
- * @param pIden The number of spaces used for identation
+ * @param pItemsThe items belonging to the table
+ * @param pIdenThe number of spaces used for identation
* @throws IOException
*/
private void setItems(List<Map<String, String>> pItems, int pIden) throws IOException{
@@ -111,9 +111,9 @@ public class GoraDynamoDBCompiler {
/**
* Creates item getters and setters
- * @param pItemName Item's name
- * @param pItemType Item's type
- * @param pIden Number of spaces used for indentation
+ * @param pItemNameItem's name
+ * @param pItemTypeItem's type
+ * @param pIdenNumber of spaces used for indentation
* @throws IOException
*/
private void setItemMethods(String pItemName, String pItemType, int pIden) throws IOException{
@@ -125,8 +125,8 @@ public class GoraDynamoDBCompiler {
/**
* Creates key getters and setters
- * @param pKeySchema The key schema for a specific table
- * @param pIden Number of spaces used for indentation
+ * @param pKeySchemaThe key schema for a specific table
+ * @param pIdenNumber of spaces used for indentation
* @throws IOException
*/
private void setKeyMethods(KeySchema pKeySchema, int pIden) throws IOException{
@@ -157,8 +157,8 @@ public class GoraDynamoDBCompiler {
/**
* Creates the key attributes within the generated class
- * @param pKeySchema Key schema
- * @param pIden Number of spaces used for indentation
+ * @param pKeySchemaKey schema
+ * @param pIdenNumber of spaces used for indentation
* @throws IOException
*/
private void setKeyAttributes(KeySchema pKeySchema, int pIden) throws IOException{
@@ -183,7 +183,7 @@ public class GoraDynamoDBCompiler {
/**
* Returns camel case version of a string
- * @param s String to be camelcasified
+ * @param sString to be camelcasified
* @return
*/
private static String camelCasify(String s) {
@@ -208,7 +208,7 @@ public class GoraDynamoDBCompiler {
/**
* Starts the java generated class file
- * @param name Class name
+ * @param nameClass name
* @param space
* @throws IOException
*/
@@ -242,7 +242,7 @@ public class GoraDynamoDBCompiler {
/**
* Creates default methods inherited from upper classes
- * @param pIden Number of spaces used for indentation
+ * @param pIdenNumber of spaces used for indentation
* @throws IOException
*/
private void setDefaultMethods(int pIden) throws IOException {
@@ -255,19 +255,19 @@ public class GoraDynamoDBCompiler {
line(pIden, "@Override");
line(pIden, "public String[] getFields() { return null; }");
line(pIden, "@Override");
- line(pIden, "public String getField(int index) { return null; }");
+ line(pIden, "public String getField(int index) {return null; }");
line(pIden, "@Override");
line(pIden, "public int getFieldIndex(String field) { return 0; }");
line(pIden, "@Override");
line(pIden, "public void clear() { }");
line(pIden, "@Override");
- line(pIden, "public person clone() { return null; }");
+ line(pIden, "public person clone() {return null; }");
line(pIden, "@Override");
line(pIden, "public boolean isNew() { return false; }");
line(pIden, "@Override");
line(pIden, "public void setNew() { }");
line(pIden, "@Override");
- line(pIden, "public void clearNew() { }");
+ line(pIden, "public void clearNew() {}");
line(pIden, "@Override");
line(pIden, "public boolean isDirty() { return false; }");
line(pIden, "@Override");
@@ -287,7 +287,7 @@ public class GoraDynamoDBCompiler {
line(pIden, "@Override");
line(pIden, "public void clearDirty() { }");
line(pIden, "@Override");
- line(pIden, "public boolean isReadable(int fieldIndex) { return false; }");
+ line(pIden, "public boolean isReadable(int fieldIndex) {return false; }");
line(pIden, "@Override");
line(pIden, "public boolean isReadable(String field) { return false; }");
line(pIden, "@Override");
@@ -304,8 +304,8 @@ public class GoraDynamoDBCompiler {
/**
* Writes a line within the output stream
- * @param indent Number of spaces used for indentation
- * @param text Text to be written
+ * @param indentNumber of spaces used for indentation
+ * @param textText to be written
* @throws IOException
*/
private void line(int indent, String text) throws IOException {
@@ -318,7 +318,7 @@ public class GoraDynamoDBCompiler {
/**
* Returns the string received with the first letter in uppercase
- * @param name String to be converted
+ * @param nameString to be converted
* @return
*/
static String cap(String name) {
@@ -327,7 +327,7 @@ public class GoraDynamoDBCompiler {
/**
* Start point of the compiler program
- * @param args Receives the schema file to be compiled and where this should be written
+ * @param argsReceives the schema file to be compiled and where this should be written
* @throws Exception
*/
public static void main(String[] args) throws Exception {
@@ -340,7 +340,7 @@ public class GoraDynamoDBCompiler {
/**
* Reads the schema file and converts it into a data structure to be used
- * @param pMapFile The schema file to be mapped into a table
+ * @param pMapFileThe schema file to be mapped into a table
* @return
* @throws IOException
*/
@@ -357,15 +357,15 @@ public class GoraDynamoDBCompiler {
List<Element> tableElements = root.getChildren("table");
for(Element tableElement : tableElements) {
-
+
String tableName = tableElement.getAttributeValue("name");
long readCapacUnits = Long.parseLong(tableElement.getAttributeValue("readcunit"));
long writeCapacUnits = Long.parseLong(tableElement.getAttributeValue("readcunit"));
-
+
mappingBuilder.setTableName(tableName);
mappingBuilder.setProvisionedThroughput(tableName, readCapacUnits, writeCapacUnits);
log.debug("Basic table properties have been set: Name, and Provisioned throughput.");
-
+
// Retrieving key's features
List<Element> fieldElements = tableElement.getChildren("key");
for(Element fieldElement : fieldElements) {
@@ -378,7 +378,7 @@ public class GoraDynamoDBCompiler {
mappingBuilder.setHashRangeKeySchema(tableName, keyName, keyAttrType);
}
log.debug("Table key schemas have been set.");
-
+
// Retrieving attributes
fieldElements = tableElement.getChildren("attribute");
for(Element fieldElement : fieldElements) {
Modified: gora/trunk/gora-dynamodb/src/main/java/org/apache/gora/dynamodb/query/DynamoDBQuery.java
URL: http://svn.apache.org/viewvc/gora/trunk/gora-dynamodb/src/main/java/org/apache/gora/dynamodb/query/DynamoDBQuery.java?rev=1426357&r1=1426356&r2=1426357&view=diff
==============================================================================
--- gora/trunk/gora-dynamodb/src/main/java/org/apache/gora/dynamodb/query/DynamoDBQuery.java (original)
+++ gora/trunk/gora-dynamodb/src/main/java/org/apache/gora/dynamodb/query/DynamoDBQuery.java Thu Dec 27 22:54:54 2012
@@ -37,68 +37,68 @@ import com.amazonaws.services.dynamodb.m
import com.amazonaws.services.dynamodb.model.KeySchemaElement;
public class DynamoDBQuery<K, T extends Persistent> extends QueryWSBase<K, T> {
-
+
/**
* Helper to write useful information into the logs
*/
public static final Logger LOG = LoggerFactory.getLogger(DynamoDBQuery.class);
-
+
/**
* Reads consistency level
*/
private boolean consistencyReadLevel;
-
+
/**
* Range comparator operator
*/
private static ComparisonOperator rangeCompOp;
-
+
/**
* Scan comparator operator
*/
private static ComparisonOperator scanCompOp;
-
+
/**
* Range query type property
*/
public static final String RANGE_QUERY = "range";
-
+
/**
* Scan query type property
*/
public static final String SCAN_QUERY = "scan";
-
+
/**
* Query type property
*/
private static String type;
-
+
/**
* Generic query
*/
private Query<K, T> query;
-
+
/**
* DynamoDB Expression to be used.
* This could be a range or a scan DynamoDB Expression
*/
private Object dynamoDBExpression;
-
+
/**
* Key schema used for the query
*/
private KeySchema keySchema;
-
+
/**
* Hash key used for the query
*/
private K hashKey;
-
+
/**
* Default Constructor
*/
public DynamoDBQuery(){
- super(null);
+ super(null);
}
/**
@@ -106,9 +106,9 @@ public class DynamoDBQuery<K, T extends
* @param dataStore
*/
public DynamoDBQuery(DataStore<K, T> dataStore) {
- super(dataStore);
+ super(dataStore);
}
-
+
/**
* Sets hash key
*/
@@ -116,7 +116,7 @@ public class DynamoDBQuery<K, T extends
public void setKey(K key) {
this.hashKey = key;
}
-
+
/**
* Gets hash key
*/
@@ -124,7 +124,7 @@ public class DynamoDBQuery<K, T extends
public K getKey() {
return this.hashKey;
}
-
+
/**
* Builds query expression depending on query type (range or scan)
*/
@@ -139,10 +139,10 @@ public class DynamoDBQuery<K, T extends
if (DynamoDBQuery.getType().equals(SCAN_QUERY))
buildScanExpression(hashAttrValue);
}
-
+
/**
* Builds scan query expression using a hash attribute value where to start
- * @param pHashAttrValue Hash attribute value where to start scanning
+ * @param pHashAttrValueHash attribute value where to start scanning
*/
public void buildScanExpression(AttributeValue pHashAttrValue){
DynamoDBScanExpression newScanExpression = new DynamoDBScanExpression();
@@ -150,11 +150,11 @@ public class DynamoDBQuery<K, T extends
newScanExpression.addFilterCondition(getKeySchema().getHashKeyElement().getAttributeName(), buildKeyScanCondition());
dynamoDBExpression = newScanExpression;
}
-
+
/**
* Builds range query expression
- * @param pNewCondition Condition for querying
- * @param pHashAttrValue Hash attribute value where to start
+ * @param pNewConditionCondition for querying
+ * @param pHashAttrValueHash attribute value where to start
*/
public void buildQueryExpression(Condition pNewCondition, AttributeValue pHashAttrValue) {
DynamoDBQueryExpression newQueryExpression = new DynamoDBQueryExpression(pHashAttrValue);
@@ -162,10 +162,10 @@ public class DynamoDBQuery<K, T extends
newQueryExpression.setRangeKeyCondition(pNewCondition);
dynamoDBExpression = newQueryExpression;
}
-
+
/**
* Builds hash key attribute from generic query received
- * @return AttributeValue build from query
+ * @returnAttributeValue build from query
*/
private AttributeValue buildKeyHashAttribute(){
String pAttrType = getKeySchema().getHashKeyElement().getAttributeType();
@@ -175,7 +175,7 @@ public class DynamoDBQuery<K, T extends
return new AttributeValue().withN(getHashKey(query.getKey()).toString());
return null;
}
-
+
/**
* Gets hash key for querying
* @param key
@@ -277,7 +277,7 @@ public class DynamoDBQuery<K, T extends
public boolean getConsistencyReadLevel(){
return consistencyReadLevel;
}
-
+
/**
* Sets read consistency level
* @param pConsistencyReadLevel
@@ -285,7 +285,7 @@ public class DynamoDBQuery<K, T extends
public void setConsistencyReadLevel(boolean pConsistencyReadLevel){
this.consistencyReadLevel = pConsistencyReadLevel;
}
-
+
/**
* Gets key schema
* @return
@@ -317,7 +317,7 @@ public class DynamoDBQuery<K, T extends
public void setQuery(Query<K, T> pQuery){
this.query = pQuery;
}
-
+
/**
* Gets query performed
* @return
@@ -359,7 +359,7 @@ public class DynamoDBQuery<K, T extends
public static void setScanCompOp(ComparisonOperator scanCompOp) {
DynamoDBQuery.scanCompOp = scanCompOp;
}
-
+
/**
* Gets range query comparator operator
* @return
@@ -369,7 +369,7 @@ public class DynamoDBQuery<K, T extends
rangeCompOp = ComparisonOperator.BETWEEN;
return rangeCompOp;
}
-
+
/**
* Sets range query comparator operator
* @param pRangeCompOp
Modified: gora/trunk/gora-dynamodb/src/main/java/org/apache/gora/dynamodb/store/DynamoDBMapping.java
URL: http://svn.apache.org/viewvc/gora/trunk/gora-dynamodb/src/main/java/org/apache/gora/dynamodb/store/DynamoDBMapping.java?rev=1426357&r1=1426356&r2=1426357&view=diff
==============================================================================
--- gora/trunk/gora-dynamodb/src/main/java/org/apache/gora/dynamodb/store/DynamoDBMapping.java (original)
+++ gora/trunk/gora-dynamodb/src/main/java/org/apache/gora/dynamodb/store/DynamoDBMapping.java Thu Dec 27 22:54:54 2012
@@ -113,24 +113,24 @@ public class DynamoDBMapping {
* Table name to be used to build the DynamoDBMapping object
*/
private String tableName;
-
+
/**
* This data structure can hold several tables, with their own items.
* Map<TableName, List<Map<AttributeName,AttributeType>>
*/
private Map<String, List<Map<String, String>>> tablesToItems =
new HashMap<String, List<Map<String, String>>>();
-
+
/**
* Maps tables to key schemas
*/
private Map<String, KeySchema> tablesToKeySchemas = new HashMap<String, KeySchema>();
-
+
/**
* Maps tables to provisioned throughput
*/
private Map<String, ProvisionedThroughput> tablesToPrTh = new HashMap<String, ProvisionedThroughput>();
-
+
/**
* Sets table name
* @param tabName
@@ -138,7 +138,7 @@ public class DynamoDBMapping {
public void setTableName(String tabName){
tableName = tabName;
}
-
+
/**
* Gets the table name for which the table is being mapped
* @param tableName
@@ -147,7 +147,7 @@ public class DynamoDBMapping {
public String getTableName(String tableName){
return tableName;
}
-
+
/**
* Sets the provisioned throughput for the specified table
* @param tableName
@@ -159,7 +159,7 @@ public class DynamoDBMapping {
new ProvisionedThroughput().withReadCapacityUnits(readCapUnits).withWriteCapacityUnits(writeCapUnits);
tablesToPrTh.put(tableName, ptDesc);
}
-
+
/**
* Sets the hash range key schema for the specified table
* @param tableName
@@ -171,12 +171,11 @@ public class DynamoDBMapping {
if ( kSchema == null)
kSchema = new KeySchema();
- KeySchemaElement rangeKeyElement =
- new KeySchemaElement().withAttributeName(rangeKeyName).withAttributeType(rangeKeyType);
- kSchema.setRangeKeyElement(rangeKeyElement);
- tablesToKeySchemas.put(tableName, kSchema);
+ KeySchemaElement rangeKeyElement = new KeySchemaElement().withAttributeName(rangeKeyName).withAttributeType(rangeKeyType);
+ kSchema.setRangeKeyElement(rangeKeyElement);
+ tablesToKeySchemas.put(tableName, kSchema);
}
-
+
/**
* Sets the hash key schema for the specified table
* @param tableName
@@ -186,13 +185,12 @@ public class DynamoDBMapping {
public void setHashKeySchema(String tableName, String keyName, String keyType){
KeySchema kSchema = tablesToKeySchemas.get(tableName);
if ( kSchema == null)
- kSchema = new KeySchema();
- KeySchemaElement hashKey =
- new KeySchemaElement().withAttributeName(keyName).withAttributeType(keyType);
- kSchema.setHashKeyElement(hashKey);
- tablesToKeySchemas.put(tableName, kSchema);
+ kSchema = new KeySchema();
+ KeySchemaElement hashKey = new KeySchemaElement().withAttributeName(keyName).withAttributeType(keyType);
+ kSchema.setHashKeyElement(hashKey);
+ tablesToKeySchemas.put(tableName, kSchema);
}
-
+
/**
* Checks if a table exists, and if doesn't exist it creates the new table.
* @param tableName
@@ -207,7 +205,7 @@ public class DynamoDBMapping {
}
return items;
}
-
+
/**
* Gets the attribute for a specific item. The idea is to be able to get different items with different attributes.
* TODO This method is incomplete because the itemNumber might not be present and this would be a problem
@@ -217,14 +215,14 @@ public class DynamoDBMapping {
*/
private HashMap<String, String> getOrCreateItemAttribs(List<Map<String, String>> items, int itemNumber){
HashMap<String, String> itemAttribs;
-
+
if (items.isEmpty())
items.add(new HashMap<String, String>());
-
- itemAttribs = (HashMap<String, String>) items.get(itemNumber);
- if (itemAttribs == null)
- items.add(new HashMap<String, String>());
- return (HashMap<String, String>) items.get(itemNumber);
+
+ itemAttribs = (HashMap<String, String>) items.get(itemNumber);
+ if (itemAttribs == null)
+ items.add(new HashMap<String, String>());
+ return (HashMap<String, String>) items.get(itemNumber);
}
/**
@@ -244,24 +242,24 @@ public class DynamoDBMapping {
// add item to table
//tablesToItems.put(tableName, items);
}
-
+
/**
* Method to verify whether or not the schemas have been initialized
* @return
*/
private String verifyAllKeySchemas(){
-
+
String wrongTable = "";
// if there are not tables defined
if (tablesToItems.isEmpty()) return "";
for(String tableName : tablesToItems.keySet()){
- // if there are not schemas defined
- if (tablesToKeySchemas.isEmpty()) return "";
- if (!verifyKeySchema(tableName)) return "";
+ // if there are not schemas defined
+ if (tablesToKeySchemas.isEmpty()) return "";
+ if (!verifyKeySchema(tableName)) return "";
}
return wrongTable;
}
-
+
/**
* Verifies is a table has a key schema defined
* @param tableName Table name to determine which key schema to obtain
@@ -269,41 +267,41 @@ public class DynamoDBMapping {
*/
private boolean verifyKeySchema(String tableName){
KeySchema kSchema = tablesToKeySchemas.get(tableName);
-
+
if (kSchema == null)
return false;
-
- KeySchemaElement rangeKey = kSchema.getRangeKeyElement();
- KeySchemaElement hashKey = kSchema.getHashKeyElement();
- // A range key must have a hash key as well
- if (rangeKey != null){
- if (hashKey != null)
- return true;
- else
- return false;
- }
- // A hash key may exist by itself
- if (hashKey != null)
- return true;
- return false;
+
+ KeySchemaElement rangeKey = kSchema.getRangeKeyElement();
+ KeySchemaElement hashKey = kSchema.getHashKeyElement();
+ // A range key must have a hash key as well
+
+ if (rangeKey != null){
+ if (hashKey != null)
+ return true;
+ else
+ return false;
+ }
+ // A hash key may exist by itself
+ if (hashKey != null)
+ return true;
+ return false;
}
-
+
/**
* Constructs the DynamoDBMapping object
* @return A newly constructed mapping.
*/
public DynamoDBMapping build() {
-
+
if (tableName == null) throw new IllegalStateException("tableName is not specified");
-
// verifying items for at least a table
if (tablesToItems.isEmpty()) throw new IllegalStateException("No tables");
- // verifying if key schemas have been properly defined
- String wrongTableName = verifyAllKeySchemas();
- if (!wrongTableName.equals("")) throw new IllegalStateException("no key schemas defined for table " + wrongTableName);
+ // verifying if key schemas have been properly defined
+ String wrongTableName = verifyAllKeySchemas();
+ if (!wrongTableName.equals("")) throw new IllegalStateException("no key schemas defined for table " + wrongTableName);
- // Return the tableDescription and all the attributes needed
+ // Return the tableDescription and all the attributes needed
return new DynamoDBMapping(tablesToItems,tablesToKeySchemas, tablesToPrTh);
}
}
Modified: gora/trunk/gora-dynamodb/src/main/java/org/apache/gora/dynamodb/store/DynamoDBStore.java
URL: http://svn.apache.org/viewvc/gora/trunk/gora-dynamodb/src/main/java/org/apache/gora/dynamodb/store/DynamoDBStore.java?rev=1426357&r1=1426356&r2=1426357&view=diff
==============================================================================
--- gora/trunk/gora-dynamodb/src/main/java/org/apache/gora/dynamodb/store/DynamoDBStore.java (original)
+++ gora/trunk/gora-dynamodb/src/main/java/org/apache/gora/dynamodb/store/DynamoDBStore.java Thu Dec 27 22:54:54 2012
@@ -212,11 +212,11 @@ public class DynamoDBStore<K, T extends
String tableName = tableElement.getAttributeValue("name");
long readCapacUnits = Long.parseLong(tableElement.getAttributeValue("readcunit"));
long writeCapacUnits = Long.parseLong(tableElement.getAttributeValue("readcunit"));
-
+
mappingBuilder.setTableName(tableName);
mappingBuilder.setProvisionedThroughput(tableName, readCapacUnits, writeCapacUnits);
LOG.debug("Basic table properties have been set: Name, and Provisioned throughput.");
-
+
// Retrieving key's features
List<Element> fieldElements = tableElement.getChildren("key");
for(Element fieldElement : fieldElements) {
@@ -229,7 +229,7 @@ public class DynamoDBStore<K, T extends
mappingBuilder.setHashRangeKeySchema(tableName, keyName, keyAttrType);
}
LOG.debug("Table key schemas have been set.");
-
+
// Retrieving attributes
fieldElements = tableElement.getChildren("attribute");
for(Element fieldElement : fieldElements) {
@@ -397,7 +397,7 @@ public class DynamoDBStore<K, T extends
@Override
public void createSchema() {
LOG.info("Creating schema");
- if (mapping.getTables().isEmpty()) throw new IllegalStateException("There are not tables defined.");
+ if (mapping.getTables().isEmpty()) throw new IllegalStateException("There are not tables defined.");
if (preferredSchema == null){
LOG.debug("create schemas");
// read the mapping object
@@ -447,10 +447,10 @@ public class DynamoDBStore<K, T extends
*/
@Override
public void deleteSchema() {
- if (mapping.getTables().isEmpty()) throw new IllegalStateException("There are not tables defined.");
+ if (mapping.getTables().isEmpty()) throw new IllegalStateException("There are not tables defined.");
if (preferredSchema == null){
LOG.debug("Delete schemas");
- if (mapping.getTables().isEmpty()) throw new IllegalStateException("There are not tables defined.");
+ if (mapping.getTables().isEmpty()) throw new IllegalStateException("There are not tables defined.");
// read the mapping object
for(String tableName : mapping.getTables().keySet())
executeDeleteTableRequest(tableName);
@@ -534,10 +534,10 @@ public class DynamoDBStore<K, T extends
public boolean schemaExists() {
LOG.info("Verifying schemas.");
TableDescription success = null;
- if (mapping.getTables().isEmpty()) throw new IllegalStateException("There are not tables defined.");
+ if (mapping.getTables().isEmpty()) throw new IllegalStateException("There are not tables defined.");
if (preferredSchema == null){
LOG.debug("Verifying schemas");
- if (mapping.getTables().isEmpty()) throw new IllegalStateException("There are not tables defined.");
+ if (mapping.getTables().isEmpty()) throw new IllegalStateException("There are not tables defined.");
// read the mapping object
for(String tableName : mapping.getTables().keySet()){
success = getTableSchema(tableName);
@@ -559,7 +559,7 @@ public class DynamoDBStore<K, T extends
*/
private TableDescription getTableSchema(String tableName){
TableDescription tableDescription = null;
- try{
+ try{
DescribeTableRequest describeTableRequest = new DescribeTableRequest().withTableName(tableName);
tableDescription = dynamoDBClient.describeTable(describeTableRequest).getTable();
}
@@ -661,9 +661,9 @@ public class DynamoDBStore<K, T extends
object = (T) mapper.load(persistentClass, hashKey);
else
object = (T) mapper.load(persistentClass, hashKey, rangeKey);
-
+
if (object == null) return false;
-
+
// setting key for dynamodbMapper
mapper.delete(object);
return true;
Modified: gora/trunk/gora-dynamodb/src/test/java/org/apache/gora/dynamodb/GoraDynamoDBTestDriver.java
URL: http://svn.apache.org/viewvc/gora/trunk/gora-dynamodb/src/test/java/org/apache/gora/dynamodb/GoraDynamoDBTestDriver.java?rev=1426357&r1=1426356&r2=1426357&view=diff
==============================================================================
--- gora/trunk/gora-dynamodb/src/test/java/org/apache/gora/dynamodb/GoraDynamoDBTestDriver.java (original)
+++ gora/trunk/gora-dynamodb/src/test/java/org/apache/gora/dynamodb/GoraDynamoDBTestDriver.java Thu Dec 27 22:54:54 2012
@@ -103,7 +103,7 @@ public class GoraDynamoDBTestDriver exte
*/
@Override
public void setUp() throws Exception {
- personStore.createSchema();
+ personStore.createSchema();
}
/**
@@ -186,7 +186,7 @@ public class GoraDynamoDBTestDriver exte
*/
public TableDescription checkResource(String tableName){
TableDescription tableDescription = null;
-
+
try{
DescribeTableRequest describeTableRequest = new DescribeTableRequest().withTableName(tableName);
tableDescription = dynamoDBClient.describeTable(describeTableRequest).getTable();