camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1240737 [1/2] - in /camel/trunk: components/camel-aws/ components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/ components/camel-aws/src/main/resources/META-INF/services/org/apache/camel/component/ components/camel-aws/src/te...
Date Sun, 05 Feb 2012 14:04:12 GMT
Author: davsclaus
Date: Sun Feb  5 14:04:10 2012
New Revision: 1240737

URL: http://svn.apache.org/viewvc?rev=1240737&view=rev
Log:
CAMEL-4951: Upgrade aws to 1.3.0. CAMEL-4923: Added new aws-ddb component. Thanks to Bilgin for the patch.

Added:
    camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/
    camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/AbstractDdbCommand.java   (with props)
    camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/BatchGetItemsCommand.java   (with props)
    camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbComponent.java   (with props)
    camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbConfiguration.java   (with props)
    camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbConstants.java   (with props)
    camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbEndpoint.java   (with props)
    camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbOperations.java   (with props)
    camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbProducer.java   (with props)
    camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DeleteItemCommand.java   (with props)
    camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DeleteTableCommand.java   (with props)
    camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DescribeTableCommand.java   (with props)
    camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/GetItemCommand.java   (with props)
    camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/PutItemCommand.java   (with props)
    camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/QueryCommand.java   (with props)
    camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/ScanCommand.java   (with props)
    camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/UpdateItemCommand.java   (with props)
    camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/UpdateTableCommand.java   (with props)
    camel/trunk/components/camel-aws/src/main/resources/META-INF/services/org/apache/camel/component/aws-ddb
    camel/trunk/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/
    camel/trunk/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/AmazonDDBClientMock.java   (with props)
    camel/trunk/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/BatchGetItemsCommandTest.java   (with props)
    camel/trunk/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/DdbComponentTest.java   (with props)
    camel/trunk/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/DeleteItemCommandTest.java   (with props)
    camel/trunk/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/DeleteTableCommandTest.java   (with props)
    camel/trunk/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/DescribeTableCommandTest.java   (with props)
    camel/trunk/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/GetItemCommandTest.java   (with props)
    camel/trunk/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/PutItemCommandTest.java   (with props)
    camel/trunk/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/QueryCommandTest.java   (with props)
    camel/trunk/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/ScanCommandTest.java   (with props)
    camel/trunk/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/UpdateItemCommandTest.java   (with props)
    camel/trunk/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/UpdateTableCommandTest.java   (with props)
    camel/trunk/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/integration/
    camel/trunk/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/integration/DdbComponentIntegrationTest.java   (with props)
Modified:
    camel/trunk/components/camel-aws/   (props changed)
    camel/trunk/components/camel-aws/pom.xml
    camel/trunk/platforms/karaf/features/pom.xml

Propchange: camel/trunk/components/camel-aws/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Sun Feb  5 14:04:10 2012
@@ -14,3 +14,4 @@ eclipse-classes
 *.ipr
 *.iml
 *.iws
+*.idea

Modified: camel/trunk/components/camel-aws/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-aws/pom.xml?rev=1240737&r1=1240736&r2=1240737&view=diff
==============================================================================
--- camel/trunk/components/camel-aws/pom.xml (original)
+++ camel/trunk/components/camel-aws/pom.xml Sun Feb  5 14:04:10 2012
@@ -47,7 +47,7 @@
         <dependency>
             <groupId>com.amazonaws</groupId>
             <artifactId>aws-java-sdk</artifactId>
-            <version>1.2.12</version>
+            <version>1.3.0</version>
             <exclusions>
                 <exclusion>
                     <groupId>org.codehaus.jackson</groupId>

Added: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/AbstractDdbCommand.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/AbstractDdbCommand.java?rev=1240737&view=auto
==============================================================================
--- camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/AbstractDdbCommand.java (added)
+++ camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/AbstractDdbCommand.java Sun Feb  5 14:04:10 2012
@@ -0,0 +1,96 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.aws.ddb;
+
+import java.util.Collection;
+import java.util.Map;
+
+import com.amazonaws.services.dynamodb.AmazonDynamoDB;
+import com.amazonaws.services.dynamodb.model.AttributeValue;
+import com.amazonaws.services.dynamodb.model.ExpectedAttributeValue;
+import com.amazonaws.services.dynamodb.model.Key;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public abstract class AbstractDdbCommand {
+    protected DdbConfiguration configuration;
+    protected Exchange exchange;
+    protected AmazonDynamoDB ddbClient;
+
+    public AbstractDdbCommand(AmazonDynamoDB ddbClient,
+                              DdbConfiguration configuration, Exchange exchange) {
+
+        this.ddbClient = ddbClient;
+        this.configuration = configuration;
+        this.exchange = exchange;
+    }
+
+
+    public abstract void execute();
+
+    protected Message getMessageForResponse(Exchange exchange) {
+        if (exchange.getPattern().isOutCapable()) {
+            Message out = exchange.getOut();
+            out.copyFrom(exchange.getIn());
+            return out;
+        }
+        return exchange.getIn();
+    }
+
+    protected String determineTableName() {
+        String tableName = exchange.getIn().getHeader(DdbConstants.TABLE_NAME, String.class);
+        return tableName != null ? tableName : configuration.getTableName();
+    }
+
+    protected Map<String, ExpectedAttributeValue> determineUpdateCondition() {
+        return exchange.getIn().getHeader(DdbConstants.UPDATE_CONDITION, Map.class);
+    }
+
+    protected Map<String, AttributeValue> determineItem() {
+        return exchange.getIn().getHeader(DdbConstants.ITEM, Map.class);
+    }
+
+    protected String determineReturnValues() {
+        return exchange.getIn().getHeader(DdbConstants.RETURN_VALUES, String.class);
+    }
+
+    protected void addAttributesToResult(Map<String, AttributeValue> attributes) {
+        Message msg = getMessageForResponse(exchange);
+        msg.setHeader(DdbConstants.ATTRIBUTES, attributes);
+    }
+    
+    protected void addToResult(String headerKey, Object value) {
+        Message msg = getMessageForResponse(exchange);
+        msg.setHeader(headerKey, value);
+    }
+
+    protected Key determineKey() {
+        return exchange.getIn().getHeader(DdbConstants.KEY, Key.class);
+    }
+
+    protected Collection<String> determineAttributeNames() {
+        return exchange.getIn().getHeader(DdbConstants.ATTRIBUTE_NAMES, Collection.class);
+    }
+
+    protected Boolean determineConsistentRead() {
+        Boolean consistentRead = exchange.getIn().getHeader(DdbConstants.CONSISTENT_READ, Boolean.class);
+        return consistentRead != null ? consistentRead : configuration.getConsistentRead();
+    }
+}
\ No newline at end of file

Propchange: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/AbstractDdbCommand.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/AbstractDdbCommand.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/BatchGetItemsCommand.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/BatchGetItemsCommand.java?rev=1240737&view=auto
==============================================================================
--- camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/BatchGetItemsCommand.java (added)
+++ camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/BatchGetItemsCommand.java Sun Feb  5 14:04:10 2012
@@ -0,0 +1,46 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.aws.ddb;
+
+import java.util.Map;
+
+import com.amazonaws.services.dynamodb.AmazonDynamoDB;
+import com.amazonaws.services.dynamodb.model.BatchGetItemRequest;
+import com.amazonaws.services.dynamodb.model.BatchGetItemResult;
+import com.amazonaws.services.dynamodb.model.KeysAndAttributes;
+
+import org.apache.camel.Exchange;
+
+public class BatchGetItemsCommand extends AbstractDdbCommand {
+    public BatchGetItemsCommand(AmazonDynamoDB ddbClient, DdbConfiguration configuration, Exchange exchange) {
+        super(ddbClient, configuration, exchange);
+    }
+
+    @Override
+    public void execute() {
+        BatchGetItemResult result = ddbClient.batchGetItem(
+                new BatchGetItemRequest().withRequestItems(determineBatchItems()));
+
+        addToResult(DdbConstants.BATCH_RESPONSE, result.getResponses());
+        addToResult(DdbConstants.UNPROCESSED_KEYS, result.getUnprocessedKeys());
+    }
+
+    private Map<String, KeysAndAttributes> determineBatchItems() {
+        return exchange.getIn().getHeader(DdbConstants.BATCH_ITEMS, Map.class);
+    }
+}
+

Propchange: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/BatchGetItemsCommand.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/BatchGetItemsCommand.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbComponent.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbComponent.java?rev=1240737&view=auto
==============================================================================
--- camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbComponent.java (added)
+++ camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbComponent.java Sun Feb  5 14:04:10 2012
@@ -0,0 +1,53 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.aws.ddb;
+
+import java.util.Map;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Endpoint;
+import org.apache.camel.impl.DefaultComponent;
+
+/**
+ * Defines the <a href="http://aws.amazon.com/dynamodb/">AWS DynamoDB component</a>
+ */
+public class DdbComponent extends DefaultComponent {
+
+    public DdbComponent() {
+    }
+
+    public DdbComponent(CamelContext context) {
+        super(context);
+    }
+
+    protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
+        DdbConfiguration configuration = new DdbConfiguration();
+        setProperties(configuration, parameters);
+
+        if (remaining == null || remaining.trim().length() == 0) {
+            throw new IllegalArgumentException("Table name must be specified.");
+        }
+        configuration.setTableName(remaining);
+
+        if (configuration.getAmazonDDBClient() == null && (configuration.getAccessKey() == null || configuration.getSecretKey() == null)) {
+            throw new IllegalArgumentException("amazonDDBClient or accessKey and secretKey must be specified");
+        }
+
+        DdbEndpoint endpoint = new DdbEndpoint(uri, this, configuration);
+        return endpoint;
+    }
+}
\ No newline at end of file

Propchange: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbComponent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbComponent.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbConfiguration.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbConfiguration.java?rev=1240737&view=auto
==============================================================================
--- camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbConfiguration.java (added)
+++ camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbConfiguration.java Sun Feb  5 14:04:10 2012
@@ -0,0 +1,126 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.aws.ddb;
+
+import com.amazonaws.services.dynamodb.AmazonDynamoDB;
+
+/**
+ * The AWS SDB component configuration properties
+ * 
+ */
+public class DdbConfiguration {
+    
+    private String accessKey;
+    private String secretKey;
+    private AmazonDynamoDB amazonDDBClient;
+    private String amazonDdbEndpoint;
+    private String tableName;
+    private Boolean consistentRead;
+    private DdbOperations operation = DdbOperations.PutItem;
+    private Long readCapacity;
+    private Long writeCapacity;
+    private String keyAttributeName;
+    private String keyAttributeType;
+
+    public void setAmazonDdbEndpoint(String amazonDdbEndpoint) {
+        this.amazonDdbEndpoint = amazonDdbEndpoint;
+    }
+
+    public String getAmazonDdbEndpoint() {
+        return amazonDdbEndpoint;
+    }
+
+    public String getAccessKey() {
+        return accessKey;
+    }
+
+    public void setAccessKey(String accessKey) {
+        this.accessKey = accessKey;
+    }
+
+    public String getSecretKey() {
+        return secretKey;
+    }
+
+    public void setSecretKey(String secretKey) {
+        this.secretKey = secretKey;
+    }
+
+    public AmazonDynamoDB getAmazonDDBClient() {
+        return amazonDDBClient;
+    }
+
+    public void setAmazonDDBClient(AmazonDynamoDB amazonDDBClient) {
+        this.amazonDDBClient = amazonDDBClient;
+    }
+
+    public String getTableName() {
+        return tableName;
+    }
+
+    public void setTableName(String tableName) {
+        this.tableName = tableName;
+    }
+
+    public DdbOperations getOperation() {
+        return operation;
+    }
+
+    public void setOperation(DdbOperations operation) {
+        this.operation = operation;
+    }
+
+    public Boolean getConsistentRead() {
+        return consistentRead;
+    }
+
+    public void setConsistentRead(Boolean consistentRead) {
+        this.consistentRead = consistentRead;
+    }
+
+    public Long getReadCapacity() {
+        return readCapacity;
+    }
+
+    public void setReadCapacity(Long readCapacity) {
+        this.readCapacity = readCapacity;
+    }
+
+    public Long getWriteCapacity() {
+        return writeCapacity;
+    }
+
+    public void setWriteCapacity(Long writeCapacity) {
+        this.writeCapacity = writeCapacity;
+    }
+
+    public String getKeyAttributeName() {
+        return keyAttributeName;
+    }
+
+    public void setKeyAttributeName(String keyAttributeName) {
+        this.keyAttributeName = keyAttributeName;
+    }
+
+    public String getKeyAttributeType() {
+        return keyAttributeType;
+    }
+
+    public void setKeyAttributeType(String keyAttributeType) {
+        this.keyAttributeType = keyAttributeType;
+    }
+}

Propchange: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbConfiguration.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbConfiguration.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbConstants.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbConstants.java?rev=1240737&view=auto
==============================================================================
--- camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbConstants.java (added)
+++ camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbConstants.java Sun Feb  5 14:04:10 2012
@@ -0,0 +1,68 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.aws.ddb;
+
+/**
+ * Constants used in Camel AWS DynamoDB component
+ */
+public interface DdbConstants {
+
+    String ATTRIBUTES = "CamelAwsSdbAttributes";
+    String BATCH_ITEMS = "CamelAwsDdbBatchItems";
+    String BATCH_RESPONSE = "CamelAwsDdbBatchResponse";
+    String KEY = "CamelAwsDdbKey";
+    String RETURN_VALUES = "CamelAwsDdbReturnValues";
+    String TABLE_NAME = "CamelAwsDdbTableName";
+    String UPDATE_CONDITION = "CamelAwsDdbUpdateCondition";
+    String UNPROCESSED_KEYS = "CamelAwsDdbUnprocessedKeys";
+
+
+
+
+
+    String ATTRIBUTE_NAMES = "CamelAwsSdbAttributeNames";
+    String PROVISIONED_THROUGHPUT = "CamelAwsDdbProvisionedThroughput";
+    String CREATION_DATE = "CamelAwsDdbCreationDate";
+
+
+    String CONSISTENT_READ = "CamelAwsSdbConsistentRead";
+    String ITEMS = "CamelAwsSdbItems";
+    String ITEM_NAME = "CamelAwsSdbItemName";
+    String MESSAGE_ID = "CamelAwsSdbMessageId";
+    String NEXT_TOKEN = "CamelAwsSdbNextToken";
+    String OPERATION = "CamelAwsDdbOperation";
+    String READ_CAPACITY = "CamelAwsDdbReadCapacity";
+    String WRITE_CAPACITY = "CamelAwsDdbWriteCapacity";
+    String TABLE_STATUS = "CamelAwsDdbTableStatus";
+    String TABLE_CREATION_DATE = "CamelAwsDdbTableCreationDate";
+    String ITEM_COUNT = "CamelAwsDdbTableItemCount";
+    String KEY_SCHEMA = "CamelAwsDdbKeySchema";
+    String TABLE_SIZE = "CamelAwsDdbTableSize";
+    String ITEM = "CamelAwsDdbItem";
+    String UPDATE_VALUES = "CamelAwsDdbUpdateValues";
+    String SCAN_FILTER = "CamelAwsDdbScanFilter";
+    String LAST_EVALUATED_KEY = "CamelAwsDdbLastEvaluatedKey";
+    String CONSUMED_CAPACITY = "CamelAwsDdbConsumedCapacity";
+    String COUNT = "CamelAwsDdbCount";
+    String SCANNED_COUNT = "CamelAwsDdbScannedCount";
+    String SCAN_INDEX_FORWARD = "CamelAwsDdbScanIndexForward";
+    String SCAN_RANGE_KEY_CONDITION = "CamelAwsDdbScanRangeKeyCondition";
+    String LIMIT = "CamelAwsDdbLimit";
+    String HASH_KEY_VALUE = "CamelAwsDdbHashKeyValue";
+    String EXACT_COUNT = "CamelAwsDdbExactCount";
+    String START_KEY = "CamelAwsDdbStartKey";
+}

Propchange: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbConstants.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbConstants.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbEndpoint.java?rev=1240737&view=auto
==============================================================================
--- camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbEndpoint.java (added)
+++ camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbEndpoint.java Sun Feb  5 14:04:10 2012
@@ -0,0 +1,165 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.aws.ddb;
+
+import com.amazonaws.AmazonServiceException;
+import com.amazonaws.auth.AWSCredentials;
+import com.amazonaws.auth.BasicAWSCredentials;
+import com.amazonaws.services.dynamodb.AmazonDynamoDB;
+import com.amazonaws.services.dynamodb.AmazonDynamoDBClient;
+import com.amazonaws.services.dynamodb.model.CreateTableRequest;
+import com.amazonaws.services.dynamodb.model.DescribeTableRequest;
+import com.amazonaws.services.dynamodb.model.KeySchema;
+import com.amazonaws.services.dynamodb.model.KeySchemaElement;
+import com.amazonaws.services.dynamodb.model.ProvisionedThroughput;
+import com.amazonaws.services.dynamodb.model.ResourceNotFoundException;
+import com.amazonaws.services.dynamodb.model.TableDescription;
+import com.amazonaws.services.dynamodb.model.TableStatus;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Component;
+import org.apache.camel.Consumer;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.impl.ScheduledPollEndpoint;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Defines the <a href="http://aws.amazon.com/dynamodb/">AWS DynamoDB endpoint</a>
+ */
+public class DdbEndpoint extends ScheduledPollEndpoint {
+
+    private static final Logger LOG = LoggerFactory.getLogger(DdbEndpoint.class);
+    private DdbConfiguration configuration;
+
+    @Deprecated
+    public DdbEndpoint(String uri, CamelContext context, DdbConfiguration configuration) {
+        super(uri, context);
+        this.configuration = configuration;
+    }
+
+    public DdbEndpoint(String uri, Component component, DdbConfiguration configuration) {
+        super(uri, component);
+        this.configuration = configuration;
+    }
+
+    public Consumer createConsumer(Processor processor) throws Exception {
+        throw new UnsupportedOperationException("You cannot receive messages from this endpoint");
+    }
+
+    public Producer createProducer() throws Exception {
+        return new DdbProducer(this);
+    }
+
+    public boolean isSingleton() {
+        return true;
+    }
+
+    @Override
+    public void doStart() throws Exception {
+        super.doStart();
+
+        AmazonDynamoDB ddbClient = getDdbClient();
+        String tableName = getConfiguration().getTableName();
+        LOG.trace("Querying whether table [{}] already exists...", tableName);
+
+        try {
+            DescribeTableRequest request = new DescribeTableRequest().withTableName(tableName);
+            TableDescription tableDescription = ddbClient.describeTable(request).getTable();
+            if (!isTableActive(tableDescription)) {
+                waitForTableToBecomeAvailable(tableName);
+            }
+
+            LOG.trace("Table [{}] already exists", tableName);
+            return;
+        } catch (ResourceNotFoundException e) {
+            LOG.trace("Table [{}] doesn't exist yet", tableName);
+            LOG.trace("Creating table [{}]...", tableName);
+            TableDescription tableDescription = createTable(tableName);
+            if (!isTableActive(tableDescription)) {
+                waitForTableToBecomeAvailable(tableName);
+            }
+
+            LOG.trace("Table [{}] created", tableName);
+        }
+    }
+
+    private TableDescription createTable(String tableName) {
+        CreateTableRequest createTableRequest = new CreateTableRequest().withTableName(tableName)
+                .withKeySchema(new KeySchema(
+                        new KeySchemaElement().withAttributeName(
+                                configuration.getKeyAttributeName())
+                                .withAttributeType(configuration.getKeyAttributeType())))
+                .withProvisionedThroughput(
+                        new ProvisionedThroughput().withReadCapacityUnits(configuration.getReadCapacity())
+                                .withWriteCapacityUnits(configuration.getWriteCapacity()));
+        return getDdbClient().createTable(createTableRequest).getTableDescription();
+    }
+
+    public DdbConfiguration getConfiguration() {
+        return configuration;
+    }
+
+    public AmazonDynamoDB getDdbClient() {
+        return configuration.getAmazonDDBClient() != null ? configuration.getAmazonDDBClient()
+                : createDdbClient();
+    }
+
+    AmazonDynamoDB createDdbClient() {
+        AWSCredentials credentials = new BasicAWSCredentials(configuration.getAccessKey(),
+                configuration.getSecretKey());
+        AmazonDynamoDB client = new AmazonDynamoDBClient(credentials);
+        if (configuration.getAmazonDdbEndpoint() != null) {
+            client.setEndpoint(configuration.getAmazonDdbEndpoint());
+        }
+        configuration.setAmazonDDBClient(client);
+        return client;
+    }
+
+    private void waitForTableToBecomeAvailable(String tableName) {
+        LOG.trace("Waiting for [{}] to become ACTIVE...", tableName);
+
+        long waitTime = 5 * 60 * 1000;
+        while (waitTime > 0) {
+            try {
+                Thread.sleep(1000 * 5);
+                waitTime -= 5000;
+            } catch (Exception e) {
+            }
+            try {
+                DescribeTableRequest request = new DescribeTableRequest().withTableName(tableName);
+                TableDescription tableDescription = getDdbClient().describeTable(request).getTable();
+                if (isTableActive(tableDescription)) {
+                    LOG.trace("Table [{}] became active", tableName);
+                    return;
+                }
+                LOG.trace("Table [{}] not active yet", tableName);
+            } catch (AmazonServiceException ase) {
+                if (!ase.getErrorCode().equalsIgnoreCase("ResourceNotFoundException")) {
+                    throw ase;
+                }
+            }
+        }
+
+        throw new RuntimeException("Table " + tableName + " never went active");
+    }
+
+    private boolean isTableActive(TableDescription tableDescription) {
+        return tableDescription.getTableStatus().equals(TableStatus.ACTIVE.toString());
+    }
+}

Propchange: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbEndpoint.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbEndpoint.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbOperations.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbOperations.java?rev=1240737&view=auto
==============================================================================
--- camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbOperations.java (added)
+++ camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbOperations.java Sun Feb  5 14:04:10 2012
@@ -0,0 +1,30 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.aws.ddb;
+
+public enum DdbOperations {
+    BatchGetItems,
+    DeleteItem,
+    DeleteTable,
+    DescribeTable,
+    GetItem,
+    PutItem,
+    Query,
+    Scan,
+    UpdateItem,
+    UpdateTable
+}

Propchange: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbOperations.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbOperations.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbProducer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbProducer.java?rev=1240737&view=auto
==============================================================================
--- camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbProducer.java (added)
+++ camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbProducer.java Sun Feb  5 14:04:10 2012
@@ -0,0 +1,89 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.aws.ddb;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+import org.apache.camel.impl.DefaultProducer;
+import org.apache.camel.util.URISupport;
+
+/**
+ * A Producer which stores data into the Amazon DynamoDB Service
+ * <a href="http://aws.amazon.com/dynamodb/">AWS DynamoDB</a>
+ */
+public class DdbProducer extends DefaultProducer {
+
+    public DdbProducer(Endpoint endpoint) {
+        super(endpoint);
+    }
+
+    public void process(Exchange exchange) throws Exception {
+        switch (determineOperation(exchange)) {
+        case BatchGetItems:
+            new BatchGetItemsCommand(getEndpoint().getDdbClient(), getConfiguration(), exchange).execute();
+            break;
+        case DeleteItem:
+            new DeleteItemCommand(getEndpoint().getDdbClient(), getConfiguration(), exchange).execute();
+            break;
+        case DeleteTable:
+            new DeleteTableCommand(getEndpoint().getDdbClient(), getConfiguration(), exchange).execute();
+            break;
+        case DescribeTable:
+            new DescribeTableCommand(getEndpoint().getDdbClient(), getConfiguration(), exchange).execute();
+            break;
+        case GetItem:
+            new GetItemCommand(getEndpoint().getDdbClient(), getConfiguration(), exchange).execute();
+            break;
+        case PutItem:
+            new PutItemCommand(getEndpoint().getDdbClient(), getConfiguration(), exchange).execute();
+            break;
+        case Query:
+            new QueryCommand(getEndpoint().getDdbClient(), getConfiguration(), exchange).execute();
+            break;
+        case Scan:
+            new ScanCommand(getEndpoint().getDdbClient(), getConfiguration(), exchange).execute();
+            break;
+        case UpdateItem:
+            new UpdateItemCommand(getEndpoint().getDdbClient(), getConfiguration(), exchange).execute();
+            break;
+        case UpdateTable:
+            new UpdateTableCommand(getEndpoint().getDdbClient(), getConfiguration(), exchange).execute();
+            break;
+        default:
+            throw new IllegalArgumentException("Unsupported operation");
+        }
+    }
+
+    private DdbOperations determineOperation(Exchange exchange) {
+        DdbOperations operation = exchange.getIn().getHeader(DdbConstants.OPERATION, DdbOperations.class);
+        return operation != null ? operation : getConfiguration().getOperation();
+    }
+
+    protected DdbConfiguration getConfiguration() {
+        return getEndpoint().getConfiguration();
+    }
+
+    @Override
+    public String toString() {
+        return "DdbProducer[" + URISupport.sanitizeUri(getEndpoint().getEndpointUri()) + "]";
+    }
+
+    @Override
+    public DdbEndpoint getEndpoint() {
+        return (DdbEndpoint)super.getEndpoint();
+    }
+}
\ No newline at end of file

Propchange: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbProducer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbProducer.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DeleteItemCommand.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DeleteItemCommand.java?rev=1240737&view=auto
==============================================================================
--- camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DeleteItemCommand.java (added)
+++ camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DeleteItemCommand.java Sun Feb  5 14:04:10 2012
@@ -0,0 +1,40 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.aws.ddb;
+
+import com.amazonaws.services.dynamodb.AmazonDynamoDB;
+import com.amazonaws.services.dynamodb.model.DeleteItemRequest;
+import com.amazonaws.services.dynamodb.model.DeleteItemResult;
+
+import org.apache.camel.Exchange;
+
+public class DeleteItemCommand extends AbstractDdbCommand {
+    public DeleteItemCommand(AmazonDynamoDB ddbClient, DdbConfiguration configuration, Exchange exchange) {
+        super(ddbClient, configuration, exchange);
+    }
+
+    @Override
+    public void execute() {
+        DeleteItemResult result = ddbClient.deleteItem(new DeleteItemRequest()
+                .withTableName(determineTableName())
+                .withKey(determineKey())
+                .withReturnValues(determineReturnValues())
+                .withExpected(determineUpdateCondition()));
+
+        addAttributesToResult(result.getAttributes());
+    }
+}

Propchange: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DeleteItemCommand.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DeleteItemCommand.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DeleteTableCommand.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DeleteTableCommand.java?rev=1240737&view=auto
==============================================================================
--- camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DeleteTableCommand.java (added)
+++ camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DeleteTableCommand.java Sun Feb  5 14:04:10 2012
@@ -0,0 +1,46 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.aws.ddb;
+
+import com.amazonaws.services.dynamodb.AmazonDynamoDB;
+import com.amazonaws.services.dynamodb.AmazonDynamoDBClient;
+import com.amazonaws.services.dynamodb.model.DeleteTableRequest;
+import com.amazonaws.services.dynamodb.model.DeleteTableResult;
+import com.amazonaws.services.dynamodb.model.TableDescription;
+
+import org.apache.camel.Exchange;
+
+public class DeleteTableCommand extends AbstractDdbCommand {
+    public DeleteTableCommand(AmazonDynamoDB ddbClient, DdbConfiguration configuration,
+                              Exchange exchange) {
+        super(ddbClient, configuration, exchange);
+    }
+
+    @Override
+    public void execute() {
+        TableDescription tableDescription = ddbClient
+                .deleteTable(new DeleteTableRequest(determineTableName())).getTableDescription();
+
+        addToResult(DdbConstants.PROVISIONED_THROUGHPUT, tableDescription.getProvisionedThroughput());
+        addToResult(DdbConstants.CREATION_DATE, tableDescription.getCreationDateTime());
+        addToResult(DdbConstants.ITEM_COUNT, tableDescription.getItemCount());
+        addToResult(DdbConstants.KEY_SCHEMA, tableDescription.getKeySchema());
+        addToResult(DdbConstants.TABLE_NAME, tableDescription.getTableName());
+        addToResult(DdbConstants.TABLE_SIZE, tableDescription.getTableSizeBytes());
+        addToResult(DdbConstants.TABLE_STATUS, tableDescription.getTableStatus());
+    }
+}

Propchange: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DeleteTableCommand.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DeleteTableCommand.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DescribeTableCommand.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DescribeTableCommand.java?rev=1240737&view=auto
==============================================================================
--- camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DescribeTableCommand.java (added)
+++ camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DescribeTableCommand.java Sun Feb  5 14:04:10 2012
@@ -0,0 +1,49 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.aws.ddb;
+
+import com.amazonaws.services.dynamodb.AmazonDynamoDB;
+import com.amazonaws.services.dynamodb.model.DescribeTableRequest;
+import com.amazonaws.services.dynamodb.model.DescribeTableResult;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+
+public class DescribeTableCommand extends AbstractDdbCommand {
+    public DescribeTableCommand(AmazonDynamoDB ddbClient, DdbConfiguration configuration,
+                                Exchange exchange) {
+        super(ddbClient, configuration, exchange);
+    }
+
+    @Override
+    public void execute() {
+        DescribeTableResult result = ddbClient.describeTable(new DescribeTableRequest()
+                .withTableName(determineTableName()));
+
+        Message msg = getMessageForResponse(exchange);
+        msg.setHeader(DdbConstants.TABLE_NAME, result.getTable().getTableName());
+        msg.setHeader(DdbConstants.TABLE_STATUS, result.getTable().getTableStatus());
+        msg.setHeader(DdbConstants.TABLE_CREATION_DATE, result.getTable().getCreationDateTime());
+        msg.setHeader(DdbConstants.ITEM_COUNT, result.getTable().getItemCount());
+        msg.setHeader(DdbConstants.KEY_SCHEMA, result.getTable().getKeySchema());
+        msg.setHeader(DdbConstants.READ_CAPACITY,
+                result.getTable().getProvisionedThroughput().getReadCapacityUnits());
+        msg.setHeader(DdbConstants.WRITE_CAPACITY,
+                result.getTable().getProvisionedThroughput().getWriteCapacityUnits());
+        msg.setHeader(DdbConstants.TABLE_SIZE, result.getTable().getTableSizeBytes());
+    }
+}

Propchange: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DescribeTableCommand.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DescribeTableCommand.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/GetItemCommand.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/GetItemCommand.java?rev=1240737&view=auto
==============================================================================
--- camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/GetItemCommand.java (added)
+++ camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/GetItemCommand.java Sun Feb  5 14:04:10 2012
@@ -0,0 +1,39 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.aws.ddb;
+
+import com.amazonaws.services.dynamodb.AmazonDynamoDB;
+import com.amazonaws.services.dynamodb.model.GetItemRequest;
+import com.amazonaws.services.dynamodb.model.GetItemResult;
+
+import org.apache.camel.Exchange;
+
+public class GetItemCommand extends AbstractDdbCommand {
+    public GetItemCommand(AmazonDynamoDB ddbClient, DdbConfiguration configuration, Exchange exchange) {
+        super(ddbClient, configuration, exchange);
+    }
+
+    @Override
+    public void execute() {
+        GetItemResult result = ddbClient.getItem(new GetItemRequest()
+                .withKey(determineKey())
+                .withTableName(determineTableName())
+                .withAttributesToGet(determineAttributeNames())
+                .withConsistentRead(determineConsistentRead()));
+        addAttributesToResult(result.getItem());
+    }
+}

Propchange: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/GetItemCommand.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/GetItemCommand.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/PutItemCommand.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/PutItemCommand.java?rev=1240737&view=auto
==============================================================================
--- camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/PutItemCommand.java (added)
+++ camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/PutItemCommand.java Sun Feb  5 14:04:10 2012
@@ -0,0 +1,40 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.aws.ddb;
+
+import com.amazonaws.services.dynamodb.AmazonDynamoDB;
+import com.amazonaws.services.dynamodb.model.PutItemRequest;
+import com.amazonaws.services.dynamodb.model.PutItemResult;
+
+import org.apache.camel.Exchange;
+
+public class PutItemCommand extends AbstractDdbCommand {
+    public PutItemCommand(AmazonDynamoDB ddbClient, DdbConfiguration configuration, Exchange exchange) {
+        super(ddbClient, configuration, exchange);
+    }
+
+    @Override
+    public void execute() {
+        PutItemResult result = ddbClient.putItem(new PutItemRequest()
+                .withTableName(determineTableName())
+                .withItem(determineItem())
+                .withExpected(determineUpdateCondition())
+                .withReturnValues(determineReturnValues()));
+
+        addAttributesToResult(result.getAttributes());
+    }
+}

Propchange: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/PutItemCommand.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/PutItemCommand.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/QueryCommand.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/QueryCommand.java?rev=1240737&view=auto
==============================================================================
--- camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/QueryCommand.java (added)
+++ camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/QueryCommand.java Sun Feb  5 14:04:10 2012
@@ -0,0 +1,75 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.aws.ddb;
+
+import com.amazonaws.services.dynamodb.AmazonDynamoDB;
+import com.amazonaws.services.dynamodb.model.AttributeValue;
+import com.amazonaws.services.dynamodb.model.Condition;
+import com.amazonaws.services.dynamodb.model.Key;
+import com.amazonaws.services.dynamodb.model.QueryRequest;
+import com.amazonaws.services.dynamodb.model.QueryResult;
+
+import org.apache.camel.Exchange;
+
+public class QueryCommand extends AbstractDdbCommand {
+    public QueryCommand(AmazonDynamoDB ddbClient, DdbConfiguration configuration, Exchange exchange) {
+        super(ddbClient, configuration, exchange);
+    }
+
+    @Override
+    public void execute() {
+        QueryResult result = ddbClient.query(new QueryRequest()
+                .withTableName(determineTableName())
+                .withAttributesToGet(determineAttributeNames())
+                .withCount(determineExactCount())
+                .withConsistentRead(determineConsistentRead())
+                .withExclusiveStartKey(determineStartKey())
+                .withHashKeyValue(determineHashKeyValue())
+                .withLimit(determineLimit())
+                .withRangeKeyCondition(determineRangeKeyCondition())
+                .withScanIndexForward(determineScanIndexForward()));
+
+        addToResult(DdbConstants.ITEMS, result.getItems());
+        addToResult(DdbConstants.LAST_EVALUATED_KEY, result.getLastEvaluatedKey());
+        addToResult(DdbConstants.CONSUMED_CAPACITY, result.getConsumedCapacityUnits());
+        addToResult(DdbConstants.COUNT, result.getCount());
+    }
+
+    private Key determineStartKey() {
+        return exchange.getIn().getHeader(DdbConstants.START_KEY, Key.class);
+    }
+
+    private Boolean determineScanIndexForward() {
+        return exchange.getIn().getHeader(DdbConstants.SCAN_INDEX_FORWARD, Boolean.class);
+    }
+
+    private Condition determineRangeKeyCondition() {
+        return exchange.getIn().getHeader(DdbConstants.SCAN_RANGE_KEY_CONDITION, Condition.class);
+    }
+
+    private Integer determineLimit() {
+        return exchange.getIn().getHeader(DdbConstants.LIMIT, Integer.class);
+    }
+
+    private AttributeValue determineHashKeyValue() {
+        return exchange.getIn().getHeader(DdbConstants.HASH_KEY_VALUE, AttributeValue.class);
+    }
+
+    private Boolean determineExactCount() {
+        return exchange.getIn().getHeader(DdbConstants.EXACT_COUNT, Boolean.class);
+    }
+}

Propchange: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/QueryCommand.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/QueryCommand.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/ScanCommand.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/ScanCommand.java?rev=1240737&view=auto
==============================================================================
--- camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/ScanCommand.java (added)
+++ camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/ScanCommand.java Sun Feb  5 14:04:10 2012
@@ -0,0 +1,49 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.aws.ddb;
+
+import java.util.Map;
+
+import com.amazonaws.services.dynamodb.AmazonDynamoDB;
+import com.amazonaws.services.dynamodb.model.Condition;
+import com.amazonaws.services.dynamodb.model.ScanRequest;
+import com.amazonaws.services.dynamodb.model.ScanResult;
+
+import org.apache.camel.Exchange;
+
+public class ScanCommand extends AbstractDdbCommand {
+    public ScanCommand(AmazonDynamoDB ddbClient, DdbConfiguration configuration, Exchange exchange) {
+        super(ddbClient, configuration, exchange);
+    }
+
+    @Override
+    public void execute() {
+        ScanResult result = ddbClient.scan(new ScanRequest()
+                .withTableName(determineTableName())
+                .withScanFilter(determineScanFilter()));
+
+        addToResult(DdbConstants.ITEMS, result.getItems());
+        addToResult(DdbConstants.LAST_EVALUATED_KEY, result.getLastEvaluatedKey());
+        addToResult(DdbConstants.CONSUMED_CAPACITY, result.getConsumedCapacityUnits());
+        addToResult(DdbConstants.COUNT, result.getCount());
+        addToResult(DdbConstants.SCANNED_COUNT, result.getScannedCount());
+    }
+
+    private Map<String, Condition> determineScanFilter() {
+        return exchange.getIn().getHeader(DdbConstants.SCAN_FILTER, Map.class);
+    }
+}

Propchange: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/ScanCommand.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/ScanCommand.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/UpdateItemCommand.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/UpdateItemCommand.java?rev=1240737&view=auto
==============================================================================
--- camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/UpdateItemCommand.java (added)
+++ camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/UpdateItemCommand.java Sun Feb  5 14:04:10 2012
@@ -0,0 +1,49 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.aws.ddb;
+
+import java.util.Map;
+
+import com.amazonaws.services.dynamodb.AmazonDynamoDB;
+import com.amazonaws.services.dynamodb.model.AttributeValueUpdate;
+import com.amazonaws.services.dynamodb.model.UpdateItemRequest;
+import com.amazonaws.services.dynamodb.model.UpdateItemResult;
+
+import org.apache.camel.Exchange;
+
+public class UpdateItemCommand extends AbstractDdbCommand {
+    public UpdateItemCommand(AmazonDynamoDB ddbClient, DdbConfiguration configuration, Exchange exchange) {
+        super(ddbClient, configuration, exchange);
+    }
+
+    @Override
+    public void execute() {
+        UpdateItemResult result = ddbClient.updateItem(new UpdateItemRequest()
+                .withTableName(determineTableName())
+                .withKey(determineKey())
+                .withAttributeUpdates(determineUpdateValues())
+                .withExpected(determineUpdateCondition())
+                .withReturnValues(determineReturnValues()));
+
+        addAttributesToResult(result.getAttributes());
+    }
+
+    private Map<String, AttributeValueUpdate> determineUpdateValues() {
+        return exchange.getIn().getHeader(DdbConstants.UPDATE_VALUES, Map.class);
+    }
+
+}

Propchange: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/UpdateItemCommand.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/UpdateItemCommand.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/UpdateTableCommand.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/UpdateTableCommand.java?rev=1240737&view=auto
==============================================================================
--- camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/UpdateTableCommand.java (added)
+++ camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/UpdateTableCommand.java Sun Feb  5 14:04:10 2012
@@ -0,0 +1,49 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.aws.ddb;
+
+import com.amazonaws.services.dynamodb.AmazonDynamoDB;
+import com.amazonaws.services.dynamodb.model.ProvisionedThroughput;
+import com.amazonaws.services.dynamodb.model.UpdateTableRequest;
+
+import org.apache.camel.Exchange;
+
+public class UpdateTableCommand extends AbstractDdbCommand {
+    public UpdateTableCommand(AmazonDynamoDB ddbClient, DdbConfiguration configuration, Exchange exchange) {
+        super(ddbClient, configuration, exchange);
+    }
+
+    @Override
+    public void execute() {
+        ddbClient.updateTable(new UpdateTableRequest()
+                .withTableName(determineTableName())
+                .withProvisionedThroughput(new ProvisionedThroughput()
+                        .withReadCapacityUnits(determineReadCapacity())
+                        .withWriteCapacityUnits(determineWriteCapacity())));
+    }
+
+    private Long determineReadCapacity() {
+        Long readCapacity = exchange.getIn().getHeader(DdbConstants.READ_CAPACITY, Long.class);
+        return readCapacity != null ? readCapacity : configuration.getReadCapacity();
+    }
+
+
+    private Long determineWriteCapacity() {
+        Long writeCapacity = exchange.getIn().getHeader(DdbConstants.WRITE_CAPACITY, Long.class);
+        return writeCapacity != null ? writeCapacity : configuration.getWriteCapacity();
+    }
+}

Propchange: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/UpdateTableCommand.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/UpdateTableCommand.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-aws/src/main/resources/META-INF/services/org/apache/camel/component/aws-ddb
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-aws/src/main/resources/META-INF/services/org/apache/camel/component/aws-ddb?rev=1240737&view=auto
==============================================================================
--- camel/trunk/components/camel-aws/src/main/resources/META-INF/services/org/apache/camel/component/aws-ddb (added)
+++ camel/trunk/components/camel-aws/src/main/resources/META-INF/services/org/apache/camel/component/aws-ddb Sun Feb  5 14:04:10 2012
@@ -0,0 +1,18 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
+class=org.apache.camel.component.aws.ddb.DdbComponent

Added: camel/trunk/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/AmazonDDBClientMock.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/AmazonDDBClientMock.java?rev=1240737&view=auto
==============================================================================
--- camel/trunk/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/AmazonDDBClientMock.java (added)
+++ camel/trunk/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/AmazonDDBClientMock.java Sun Feb  5 14:04:10 2012
@@ -0,0 +1,194 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.aws.ddb;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+import com.amazonaws.auth.BasicAWSCredentials;
+import com.amazonaws.services.dynamodb.AmazonDynamoDBClient;
+import com.amazonaws.services.dynamodb.model.AttributeValue;
+import com.amazonaws.services.dynamodb.model.BatchGetItemRequest;
+import com.amazonaws.services.dynamodb.model.BatchGetItemResult;
+import com.amazonaws.services.dynamodb.model.BatchResponse;
+import com.amazonaws.services.dynamodb.model.CreateTableRequest;
+import com.amazonaws.services.dynamodb.model.CreateTableResult;
+import com.amazonaws.services.dynamodb.model.DeleteItemRequest;
+import com.amazonaws.services.dynamodb.model.DeleteItemResult;
+import com.amazonaws.services.dynamodb.model.DeleteTableRequest;
+import com.amazonaws.services.dynamodb.model.DeleteTableResult;
+import com.amazonaws.services.dynamodb.model.DescribeTableRequest;
+import com.amazonaws.services.dynamodb.model.DescribeTableResult;
+import com.amazonaws.services.dynamodb.model.GetItemRequest;
+import com.amazonaws.services.dynamodb.model.GetItemResult;
+import com.amazonaws.services.dynamodb.model.Key;
+import com.amazonaws.services.dynamodb.model.KeySchema;
+import com.amazonaws.services.dynamodb.model.KeySchemaElement;
+import com.amazonaws.services.dynamodb.model.KeysAndAttributes;
+import com.amazonaws.services.dynamodb.model.ProvisionedThroughputDescription;
+import com.amazonaws.services.dynamodb.model.PutItemRequest;
+import com.amazonaws.services.dynamodb.model.PutItemResult;
+import com.amazonaws.services.dynamodb.model.QueryRequest;
+import com.amazonaws.services.dynamodb.model.QueryResult;
+import com.amazonaws.services.dynamodb.model.ResourceNotFoundException;
+import com.amazonaws.services.dynamodb.model.ScanRequest;
+import com.amazonaws.services.dynamodb.model.ScanResult;
+import com.amazonaws.services.dynamodb.model.TableDescription;
+import com.amazonaws.services.dynamodb.model.TableStatus;
+import com.amazonaws.services.dynamodb.model.UpdateItemRequest;
+import com.amazonaws.services.dynamodb.model.UpdateItemResult;
+import com.amazonaws.services.dynamodb.model.UpdateTableRequest;
+import com.amazonaws.services.dynamodb.model.UpdateTableResult;
+
+public class AmazonDDBClientMock extends AmazonDynamoDBClient {
+    public static final long NOW = 1327709390233L;
+    DescribeTableRequest describeTableRequest;
+    CreateTableRequest createTableRequest;
+    UpdateTableRequest updateTableRequest;
+    DeleteTableRequest deleteTableRequest;
+    PutItemRequest putItemRequest;
+    UpdateItemRequest updateItemRequest;
+    DeleteItemRequest deleteItemRequest;
+    GetItemRequest getItemRequest;
+    BatchGetItemRequest batchGetItemRequest;
+    ScanRequest scanRequest;
+    QueryRequest queryRequest;
+
+    public AmazonDDBClientMock() {
+        super(new BasicAWSCredentials("user", "secret"));
+    }
+
+    @Override
+    public DescribeTableResult describeTable(DescribeTableRequest describeTableRequest) {
+        this.describeTableRequest = describeTableRequest;
+        String tableName = describeTableRequest.getTableName();
+        if ("activeTable".equals(tableName)) {
+            return tableWithStatus(TableStatus.ACTIVE);
+        } else if ("creatibleTable".equals(tableName) && createTableRequest != null) {
+            return tableWithStatus(TableStatus.ACTIVE);
+        } else if ("FULL_DESCRIBE_TABLE".equals(tableName)) {
+            return new DescribeTableResult().withTable(new TableDescription()
+                    .withTableName(tableName)
+                    .withTableStatus(TableStatus.ACTIVE)
+                    .withCreationDateTime(new Date(NOW))
+                    .withItemCount(100L)
+                    .withKeySchema(new KeySchema(new KeySchemaElement().withAttributeName("name")))
+                    .withProvisionedThroughput(new ProvisionedThroughputDescription()
+                            .withReadCapacityUnits(20L)
+                            .withWriteCapacityUnits(10L))
+                    .withTableSizeBytes(1000L));
+        }
+        throw new ResourceNotFoundException(tableName + " is missing");
+    }
+
+    private DescribeTableResult tableWithStatus(TableStatus active) {
+        return new DescribeTableResult().withTable(new TableDescription().withTableStatus(active));
+    }
+
+    @Override
+    public CreateTableResult createTable(CreateTableRequest createTableRequest) {
+        this.createTableRequest = createTableRequest;
+        return new CreateTableResult().withTableDescription(
+                new TableDescription().withTableStatus(TableStatus.CREATING));
+    }
+
+    @Override
+    public UpdateTableResult updateTable(UpdateTableRequest updateTableRequest) {
+        this.updateTableRequest = updateTableRequest;
+        return null;
+    }
+
+    @Override
+    public DeleteTableResult deleteTable(DeleteTableRequest deleteTableRequest) {
+        this.deleteTableRequest = deleteTableRequest;
+        return new DeleteTableResult().withTableDescription(new TableDescription()
+                .withProvisionedThroughput(new ProvisionedThroughputDescription())
+                .withTableName(deleteTableRequest.getTableName())
+                .withCreationDateTime(new Date(NOW))
+                .withItemCount(10L)
+                .withKeySchema(new KeySchema())
+                .withTableSizeBytes(20L)
+                .withTableStatus(TableStatus.ACTIVE));
+    }
+
+    @Override
+    public PutItemResult putItem(PutItemRequest putItemRequest) {
+        this.putItemRequest = putItemRequest;
+        return new PutItemResult().withAttributes(getAttributes());
+    }
+
+    private Map<String, AttributeValue> getAttributes() {
+        Map<String, AttributeValue> attributes = new HashMap<String, AttributeValue>();
+        attributes.put("attrName", new AttributeValue("attrValue"));
+        return attributes;
+    }
+
+    @Override
+    public UpdateItemResult updateItem(UpdateItemRequest updateItemRequest) {
+        this.updateItemRequest = updateItemRequest;
+        return new UpdateItemResult().withAttributes(getAttributes());
+    }
+
+    @Override
+    public DeleteItemResult deleteItem(DeleteItemRequest deleteItemRequest) {
+        this.deleteItemRequest = deleteItemRequest;
+        return new DeleteItemResult().withAttributes(getAttributes());
+    }
+
+    @Override
+    public GetItemResult getItem(GetItemRequest getItemRequest) {
+        this.getItemRequest = getItemRequest;
+        return new GetItemResult().withItem(getAttributes());
+    }
+
+    @Override
+    public BatchGetItemResult batchGetItem(BatchGetItemRequest batchGetItemRequest) {
+        this.batchGetItemRequest = batchGetItemRequest;
+        Map<String, BatchResponse> responseMap = new HashMap<String, BatchResponse>();
+        responseMap.put("DOMAIN1", new BatchResponse().withItems(getAttributes()));
+
+        Map<String, KeysAndAttributes> unprocessedKeys = new HashMap<String, KeysAndAttributes>();
+        unprocessedKeys.put("DOMAIN1", new KeysAndAttributes().withKeys(
+                new Key(new AttributeValue("UNPROCESSED_KEY"))));
+
+        return new BatchGetItemResult()
+                .withResponses(responseMap)
+                .withUnprocessedKeys(unprocessedKeys);
+    }
+
+    @Override
+    public ScanResult scan(ScanRequest scanRequest) {
+        this.scanRequest = scanRequest;
+        return new ScanResult()
+                .withConsumedCapacityUnits(1.0)
+                .withCount(1)
+                .withItems(getAttributes())
+                .withScannedCount(10)
+                .withLastEvaluatedKey(new Key(new AttributeValue("LAST_KEY")));
+    }
+
+    @Override
+    public QueryResult query(QueryRequest queryRequest) {
+        this.queryRequest = queryRequest;
+        return new QueryResult()
+                .withConsumedCapacityUnits(1.0)
+                .withCount(1)
+                .withItems(getAttributes())
+                .withLastEvaluatedKey(new Key(new AttributeValue("LAST_KEY")));
+    }
+}

Propchange: camel/trunk/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/AmazonDDBClientMock.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/AmazonDDBClientMock.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/BatchGetItemsCommandTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/BatchGetItemsCommandTest.java?rev=1240737&view=auto
==============================================================================
--- camel/trunk/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/BatchGetItemsCommandTest.java (added)
+++ camel/trunk/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/BatchGetItemsCommandTest.java Sun Feb  5 14:04:10 2012
@@ -0,0 +1,75 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.aws.ddb;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.amazonaws.services.dynamodb.model.AttributeValue;
+import com.amazonaws.services.dynamodb.model.BatchResponse;
+import com.amazonaws.services.dynamodb.model.Key;
+import com.amazonaws.services.dynamodb.model.KeysAndAttributes;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.impl.DefaultExchange;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class BatchGetItemsCommandTest {
+
+    private BatchGetItemsCommand command;
+    private AmazonDDBClientMock ddbClient;
+    private DdbConfiguration configuration;
+    private Exchange exchange;
+
+    @Before
+    public void setUp() {
+        ddbClient = new AmazonDDBClientMock();
+        configuration = new DdbConfiguration();
+        exchange = new DefaultExchange(new DefaultCamelContext());
+        command = new BatchGetItemsCommand(ddbClient, configuration, exchange);
+    }
+
+    @Test
+    public void execute() {
+        Key key = new Key(new AttributeValue("Key_1"));
+        Key unprocessedKey = new Key(new AttributeValue("UNPROCESSED_KEY"));
+        Map<String, KeysAndAttributes> keysAndAttributesMap = new HashMap<String, KeysAndAttributes>();
+        KeysAndAttributes keysAndAttributes = new KeysAndAttributes().withKeys(key);
+        keysAndAttributesMap.put("DOMAIN1", keysAndAttributes);
+        exchange.getIn().setHeader(DdbConstants.BATCH_ITEMS, keysAndAttributesMap);
+
+        command.execute();
+
+        assertEquals(keysAndAttributesMap, ddbClient.batchGetItemRequest.getRequestItems());
+
+
+        BatchResponse batchResponse = (BatchResponse)exchange.getIn()
+                .getHeader(DdbConstants.BATCH_RESPONSE, Map.class).get("DOMAIN1");
+        AttributeValue value = batchResponse.getItems().get(0).get("attrName");
+
+        KeysAndAttributes unProcessedAttributes = (KeysAndAttributes)exchange.getIn().getHeader(
+                DdbConstants.UNPROCESSED_KEYS, Map.class).get("DOMAIN1");
+        Key next = unProcessedAttributes.getKeys().iterator().next();
+
+        assertEquals(new AttributeValue("attrValue"), value);
+        assertEquals(unprocessedKey, next);
+    }
+}
\ No newline at end of file

Propchange: camel/trunk/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/BatchGetItemsCommandTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/BatchGetItemsCommandTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/DdbComponentTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/DdbComponentTest.java?rev=1240737&view=auto
==============================================================================
--- camel/trunk/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/DdbComponentTest.java (added)
+++ camel/trunk/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/DdbComponentTest.java Sun Feb  5 14:04:10 2012
@@ -0,0 +1,65 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.aws.ddb;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.impl.DefaultProducerTemplate;
+import org.apache.camel.impl.JndiRegistry;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+public class DdbComponentTest extends CamelTestSupport {
+
+    private AmazonDDBClientMock amazonDDBClient;
+
+    @Test
+    public void whenTableExistsThenDoesntCreateItOnStart() throws Exception {
+        assertNull(amazonDDBClient.createTableRequest);
+    }
+
+
+    @Test
+    public void whenTableIsMissingThenCreateItOnStart() throws Exception {
+        DefaultProducerTemplate.newInstance(context,
+                "aws-ddb://creatibleTable?amazonDDBClient=#amazonDDBClient");
+        assertEquals("creatibleTable", amazonDDBClient.createTableRequest.getTableName());
+    }
+
+
+
+
+    @Override
+    protected JndiRegistry createRegistry() throws Exception {
+        JndiRegistry registry = super.createRegistry();
+
+        amazonDDBClient = new AmazonDDBClientMock();
+        registry.bind("amazonDDBClient", amazonDDBClient);
+
+        return registry;
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("direct:start")
+                        .to("aws-ddb://activeTable?amazonDDBClient=#amazonDDBClient");
+            }
+        };
+    }
+}
\ No newline at end of file

Propchange: camel/trunk/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/DdbComponentTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/DdbComponentTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



Mime
View raw message