camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmuel...@apache.org
Subject svn commit: r1220761 [1/3] - in /camel/branches/camel-2.8.x: components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/ components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/ components/camel-aws/src/test/java/org/apache/cam...
Date Mon, 19 Dec 2011 14:20:08 GMT
Author: cmueller
Date: Mon Dec 19 14:20:07 2011
New Revision: 1220761

URL: http://svn.apache.org/viewvc?rev=1220761&view=rev
Log:
CAMEL-4793: Improve Camel aws-sdb component

Added:
    camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/AbstractSdbCommand.java
    camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/BatchDeleteAttributesCommand.java
    camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/BatchPutAttributesCommand.java
    camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/DeleteAttributesCommand.java
    camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/DeleteDomainCommand.java
      - copied, changed from r1220717, camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbConstants.java
    camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/DomainMetadataCommand.java
    camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/GetAttributesCommand.java
    camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/ListDomainsCommand.java
    camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/PutAttributesCommand.java
    camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbOperations.java
      - copied, changed from r1220717, camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbConstants.java
    camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SelectCommand.java
    camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/AbstractSdbCommandTest.java
    camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/BatchDeleteAttributesCommandTest.java
    camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/BatchPutAttributesCommandTest.java
    camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/DeleteAttributesCommandTest.java
    camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/DeleteDomainCommandTest.java
    camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/DomainMetadataCommandTest.java
    camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/GetAttributesCommandTest.java
    camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/ListDomainsCommandTest.java
    camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/PutAttributesCommandTest.java
    camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/SdbComponentConfigurationTest.java
    camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/SdbComponentSpringTest.java
    camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/SdbOperationsTest.java
    camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/SelectCommandTest.java
    camel/branches/camel-2.8.x/components/camel-aws/src/test/resources/org/apache/camel/component/aws/sdb/
    camel/branches/camel-2.8.x/components/camel-aws/src/test/resources/org/apache/camel/component/aws/sdb/SDBComponentSpringTest-context.xml
      - copied, changed from r1220717, camel/branches/camel-2.8.x/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/aws/CamelIntegrationContext.xml
    camel/branches/camel-2.8.x/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/aws/AmazonSDBClientMock.java
    camel/branches/camel-2.8.x/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/aws/AwsSdbIntegrationTest.java
    camel/branches/camel-2.8.x/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/aws/AwsSdbTest.java
Modified:
    camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbComponent.java
    camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbConfiguration.java
    camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbConstants.java
    camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbEndpoint.java
    camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbProducer.java
    camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/AmazonSDBClientMock.java
    camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/SdbComponentTest.java
    camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/integration/SdbComponentIntegrationTest.java
    camel/branches/camel-2.8.x/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/aws/CamelContext.xml
    camel/branches/camel-2.8.x/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/aws/CamelIntegrationContext.xml

Added: camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/AbstractSdbCommand.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/AbstractSdbCommand.java?rev=1220761&view=auto
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/AbstractSdbCommand.java (added)
+++ camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/AbstractSdbCommand.java Mon Dec 19 14:20:07 2011
@@ -0,0 +1,80 @@
+/**
+ * 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.sdb;
+
+import com.amazonaws.services.simpledb.AmazonSimpleDB;
+import com.amazonaws.services.simpledb.model.UpdateCondition;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public abstract class AbstractSdbCommand {
+    
+    protected final transient Logger log = LoggerFactory.getLogger(getClass());
+    
+    protected AmazonSimpleDB sdbClient;
+    protected SdbConfiguration configuration;
+    protected Exchange exchange;
+
+    public AbstractSdbCommand(AmazonSimpleDB sdbClient, SdbConfiguration configuration, Exchange exchange) {
+        this.sdbClient = sdbClient;
+        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 determineDomainName() {
+        String domainName = exchange.getIn().getHeader(SdbConstants.DOMAIN_NAME, String.class);
+        return domainName != null ? domainName : configuration.getDomainName();
+    }
+    
+    protected String determineItemName() {
+        String key = exchange.getIn().getHeader(SdbConstants.ITEM_NAME, String.class);
+        if (key == null) {
+            throw new IllegalArgumentException("AWS SDB Item Name header is missing.");
+        }
+        return key;
+    }
+    
+    protected Boolean determineConsistentRead() {
+        Boolean consistentRead = exchange.getIn().getHeader(SdbConstants.CONSISTENT_READ, Boolean.class);
+        if (consistentRead == null) {
+            consistentRead = this.configuration.getConsistentRead();
+        }
+        return consistentRead;
+    }
+    
+    protected UpdateCondition determineUpdateCondition() {
+        return exchange.getIn().getHeader(SdbConstants.UPDATE_CONDITION, UpdateCondition.class);
+    }
+    
+    protected String determineNextToken() {
+        return exchange.getIn().getHeader(SdbConstants.NEXT_TOKEN, String.class);
+    }
+}
\ No newline at end of file

Added: camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/BatchDeleteAttributesCommand.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/BatchDeleteAttributesCommand.java?rev=1220761&view=auto
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/BatchDeleteAttributesCommand.java (added)
+++ camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/BatchDeleteAttributesCommand.java Mon Dec 19 14:20:07 2011
@@ -0,0 +1,48 @@
+/**
+ * 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.sdb;
+
+import java.util.Collection;
+
+import com.amazonaws.services.simpledb.AmazonSimpleDB;
+import com.amazonaws.services.simpledb.model.BatchDeleteAttributesRequest;
+import com.amazonaws.services.simpledb.model.DeletableItem;
+
+import org.apache.camel.Exchange;
+
+public class BatchDeleteAttributesCommand extends AbstractSdbCommand {
+
+    public BatchDeleteAttributesCommand(AmazonSimpleDB sdbClient, SdbConfiguration configuration, Exchange exchange) {
+        super(sdbClient, configuration, exchange);
+    }
+
+    public void execute() {
+        BatchDeleteAttributesRequest request = new BatchDeleteAttributesRequest()
+            .withDomainName(determineDomainName())
+            .withItems(determineDeletableItems());
+        log.trace("Sending request [{}] for exchange [{}]...", request, exchange);
+        
+        this.sdbClient.batchDeleteAttributes(request);
+        
+        log.trace("Request sent");
+    }
+
+    @SuppressWarnings("unchecked")
+    protected Collection<DeletableItem> determineDeletableItems() {
+        return exchange.getIn().getHeader(SdbConstants.DELETABLE_ITEMS, Collection.class);
+    }
+}
\ No newline at end of file

Added: camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/BatchPutAttributesCommand.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/BatchPutAttributesCommand.java?rev=1220761&view=auto
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/BatchPutAttributesCommand.java (added)
+++ camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/BatchPutAttributesCommand.java Mon Dec 19 14:20:07 2011
@@ -0,0 +1,48 @@
+/**
+ * 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.sdb;
+
+import java.util.Collection;
+
+import com.amazonaws.services.simpledb.AmazonSimpleDB;
+import com.amazonaws.services.simpledb.model.BatchPutAttributesRequest;
+import com.amazonaws.services.simpledb.model.ReplaceableItem;
+
+import org.apache.camel.Exchange;
+
+public class BatchPutAttributesCommand extends AbstractSdbCommand {
+
+    public BatchPutAttributesCommand(AmazonSimpleDB sdbClient, SdbConfiguration configuration, Exchange exchange) {
+        super(sdbClient, configuration, exchange);
+    }
+
+    public void execute() {
+        BatchPutAttributesRequest request = new BatchPutAttributesRequest()
+            .withDomainName(determineDomainName())
+            .withItems(determineReplaceableItems());
+        log.trace("Sending request [{}] for exchange [{}]...", request, exchange);
+        
+        this.sdbClient.batchPutAttributes(request);
+        
+        log.trace("Request sent");
+    }
+
+    @SuppressWarnings("unchecked")
+    protected Collection<ReplaceableItem> determineReplaceableItems() {
+        return exchange.getIn().getHeader(SdbConstants.REPLACEABLE_ITEMS, Collection.class);
+    }
+}

Added: camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/DeleteAttributesCommand.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/DeleteAttributesCommand.java?rev=1220761&view=auto
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/DeleteAttributesCommand.java (added)
+++ camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/DeleteAttributesCommand.java Mon Dec 19 14:20:07 2011
@@ -0,0 +1,50 @@
+/**
+ * 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.sdb;
+
+import java.util.Collection;
+
+import com.amazonaws.services.simpledb.AmazonSimpleDB;
+import com.amazonaws.services.simpledb.model.Attribute;
+import com.amazonaws.services.simpledb.model.DeleteAttributesRequest;
+
+import org.apache.camel.Exchange;
+
+public class DeleteAttributesCommand extends AbstractSdbCommand {
+
+    public DeleteAttributesCommand(AmazonSimpleDB sdbClient, SdbConfiguration configuration, Exchange exchange) {
+        super(sdbClient, configuration, exchange);
+    }
+
+    public void execute() {
+        DeleteAttributesRequest request = new DeleteAttributesRequest()
+            .withDomainName(determineDomainName())
+            .withItemName(determineItemName())
+            .withExpected(determineUpdateCondition())
+            .withAttributes(determineAttributes());
+        log.trace("Sending request [{}] for exchange [{}]...", request, exchange);
+        
+        this.sdbClient.deleteAttributes(request);
+        
+        log.trace("Request sent");
+    }
+
+    @SuppressWarnings("unchecked")
+    protected Collection<Attribute> determineAttributes() {
+        return exchange.getIn().getHeader(SdbConstants.ATTRIBUTES, Collection.class);
+    }
+}
\ No newline at end of file

Copied: camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/DeleteDomainCommand.java (from r1220717, camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbConstants.java)
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/DeleteDomainCommand.java?p2=camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/DeleteDomainCommand.java&p1=camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbConstants.java&r1=1220717&r2=1220761&rev=1220761&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbConstants.java (original)
+++ camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/DeleteDomainCommand.java Mon Dec 19 14:20:07 2011
@@ -16,13 +16,24 @@
  */
 package org.apache.camel.component.aws.sdb;
 
-public interface SdbConstants {
-    String MESSAGE_ID = "CamelAwsSdbMessageId";
-    String DOMAIN_NAME = "CamelAwsSdbDomainName";
-    String ITEM_KEY = "CamelAwsSdbItemKey";
-    String ATTRIBUTE_PREFIX = "CamelAwsSdbAttributePrefix";
-    String OPERATION = "CamelAwsSdbOperation";
-    String OPERATION_PUT = "CamelAwsSdbPut";
-    String OPERATION_GET = "CamelAwsSdbGet";
-    String OPERATION_DELETE = "CamelAwsSdbDelete";
-}
+import com.amazonaws.services.simpledb.AmazonSimpleDB;
+import com.amazonaws.services.simpledb.model.DeleteDomainRequest;
+
+import org.apache.camel.Exchange;
+
+public class DeleteDomainCommand extends AbstractSdbCommand {
+
+    public DeleteDomainCommand(AmazonSimpleDB sdbClient, SdbConfiguration configuration, Exchange exchange) {
+        super(sdbClient, configuration, exchange);
+    }
+
+    public void execute() {
+        DeleteDomainRequest request = new DeleteDomainRequest()
+            .withDomainName(determineDomainName());
+        log.trace("Sending request [{}] for exchange [{}]...", request, exchange);
+        
+        this.sdbClient.deleteDomain(request);
+        
+        log.trace("Request sent");
+    }
+}
\ No newline at end of file

Added: camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/DomainMetadataCommand.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/DomainMetadataCommand.java?rev=1220761&view=auto
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/DomainMetadataCommand.java (added)
+++ camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/DomainMetadataCommand.java Mon Dec 19 14:20:07 2011
@@ -0,0 +1,50 @@
+/**
+ * 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.sdb;
+
+import com.amazonaws.services.simpledb.AmazonSimpleDB;
+import com.amazonaws.services.simpledb.model.DomainMetadataRequest;
+import com.amazonaws.services.simpledb.model.DomainMetadataResult;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+
+public class DomainMetadataCommand extends AbstractSdbCommand {
+
+    public DomainMetadataCommand(AmazonSimpleDB sdbClient, SdbConfiguration configuration, Exchange exchange) {
+        super(sdbClient, configuration, exchange);
+    }
+
+    public void execute() {
+        DomainMetadataRequest request = new DomainMetadataRequest()
+            .withDomainName(determineDomainName());
+        log.trace("Sending request [{}] for exchange [{}]...", request, exchange);
+        
+        DomainMetadataResult result = this.sdbClient.domainMetadata(request);
+        
+        log.trace("Received result [{}]", result);
+        
+        Message msg = getMessageForResponse(exchange);
+        msg.setHeader(SdbConstants.TIMESTAMP, result.getTimestamp());
+        msg.setHeader(SdbConstants.ITEM_COUNT, result.getItemCount());
+        msg.setHeader(SdbConstants.ATTRIBUTE_NAME_COUNT, result.getAttributeNameCount());
+        msg.setHeader(SdbConstants.ATTRIBUTE_VALUE_COUNT, result.getAttributeValueCount());
+        msg.setHeader(SdbConstants.ATTRIBUTE_NAME_SIZE, result.getAttributeNamesSizeBytes());
+        msg.setHeader(SdbConstants.ATTRIBUTE_VALUE_SIZE, result.getAttributeValuesSizeBytes());
+        msg.setHeader(SdbConstants.ITEM_NAME_SIZE, result.getItemNamesSizeBytes());
+    }
+}
\ No newline at end of file

Added: camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/GetAttributesCommand.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/GetAttributesCommand.java?rev=1220761&view=auto
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/GetAttributesCommand.java (added)
+++ camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/GetAttributesCommand.java Mon Dec 19 14:20:07 2011
@@ -0,0 +1,54 @@
+/**
+ * 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.sdb;
+
+import java.util.Collection;
+
+import com.amazonaws.services.simpledb.AmazonSimpleDB;
+import com.amazonaws.services.simpledb.model.GetAttributesRequest;
+import com.amazonaws.services.simpledb.model.GetAttributesResult;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+
+public class GetAttributesCommand extends AbstractSdbCommand {
+    
+    public GetAttributesCommand(AmazonSimpleDB sdbClient, SdbConfiguration configuration, Exchange exchange) {
+        super(sdbClient, configuration, exchange);
+    }
+
+    public void execute() {
+        GetAttributesRequest request = new GetAttributesRequest()
+            .withDomainName(determineDomainName())
+            .withItemName(determineItemName())
+            .withConsistentRead(determineConsistentRead())
+            .withAttributeNames(determineAttributeNames());
+        log.trace("Sending request [{}] for exchange [{}]...", request, exchange);
+        
+        GetAttributesResult result = this.sdbClient.getAttributes(request);
+        
+        log.trace("Received result [{}]", result);
+        
+        Message msg = getMessageForResponse(exchange);
+        msg.setHeader(SdbConstants.ATTRIBUTES, result.getAttributes());
+    }
+
+    @SuppressWarnings("unchecked")
+    protected Collection<String> determineAttributeNames() {
+        return exchange.getIn().getHeader(SdbConstants.ATTRIBUTE_NAMES, Collection.class);
+    }
+}
\ No newline at end of file

Added: camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/ListDomainsCommand.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/ListDomainsCommand.java?rev=1220761&view=auto
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/ListDomainsCommand.java (added)
+++ camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/ListDomainsCommand.java Mon Dec 19 14:20:07 2011
@@ -0,0 +1,54 @@
+/**
+ * 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.sdb;
+
+import com.amazonaws.services.simpledb.AmazonSimpleDB;
+import com.amazonaws.services.simpledb.model.ListDomainsRequest;
+import com.amazonaws.services.simpledb.model.ListDomainsResult;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+
+public class ListDomainsCommand extends AbstractSdbCommand {
+
+    public ListDomainsCommand(AmazonSimpleDB sdbClient, SdbConfiguration configuration, Exchange exchange) {
+        super(sdbClient, configuration, exchange);
+    }
+
+    public void execute() {
+        ListDomainsRequest request = new ListDomainsRequest()
+            .withMaxNumberOfDomains(determineMaxNumberOfDomains())
+            .withNextToken(determineNextToken());
+        log.trace("Sending request [{}] for exchange [{}]...", request, exchange);
+        
+        ListDomainsResult result = this.sdbClient.listDomains(request);
+        
+        log.trace("Received result [{}]", result);
+        
+        Message msg = getMessageForResponse(exchange);
+        msg.setHeader(SdbConstants.NEXT_TOKEN, result.getNextToken());
+        msg.setHeader(SdbConstants.DOMAIN_NAMES, result.getDomainNames());
+    }
+
+    protected Integer determineMaxNumberOfDomains() {
+        Integer maxNumberOfDomains = exchange.getIn().getHeader(SdbConstants.MAX_NUMBER_OF_DOMAINS, Integer.class);
+        if (maxNumberOfDomains == null) {
+            maxNumberOfDomains = this.configuration.getMaxNumberOfDomains();
+        }
+        return maxNumberOfDomains;
+    }
+}
\ No newline at end of file

Added: camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/PutAttributesCommand.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/PutAttributesCommand.java?rev=1220761&view=auto
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/PutAttributesCommand.java (added)
+++ camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/PutAttributesCommand.java Mon Dec 19 14:20:07 2011
@@ -0,0 +1,50 @@
+/**
+ * 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.sdb;
+
+import java.util.Collection;
+
+import com.amazonaws.services.simpledb.AmazonSimpleDB;
+import com.amazonaws.services.simpledb.model.PutAttributesRequest;
+import com.amazonaws.services.simpledb.model.ReplaceableAttribute;
+
+import org.apache.camel.Exchange;
+
+public class PutAttributesCommand extends AbstractSdbCommand {
+    
+    public PutAttributesCommand(AmazonSimpleDB sdbClient, SdbConfiguration configuration, Exchange exchange) {
+        super(sdbClient, configuration, exchange);
+    }
+
+    public void execute() {
+        PutAttributesRequest request = new PutAttributesRequest()
+            .withDomainName(determineDomainName())
+            .withItemName(determineItemName())
+            .withAttributes(determineReplaceableAttributes())
+            .withExpected(determineUpdateCondition());
+        log.trace("Sending request [{}] for exchange [{}]...", request, exchange);
+
+        this.sdbClient.putAttributes(request);
+        
+        log.trace("Request sent");
+    }
+    
+    @SuppressWarnings("unchecked")
+    protected Collection<ReplaceableAttribute> determineReplaceableAttributes() {
+        return exchange.getIn().getHeader(SdbConstants.REPLACEABLE_ATTRIBUTES, Collection.class);
+    }
+}
\ No newline at end of file

Modified: camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbComponent.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbComponent.java?rev=1220761&r1=1220760&r2=1220761&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbComponent.java (original)
+++ camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbComponent.java Mon Dec 19 14:20:07 2011
@@ -22,6 +22,9 @@ import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
 import org.apache.camel.impl.DefaultComponent;
 
+/**
+ * Defines the <a href="http://aws.amazon.com/simpledb/">AWS SDB component</a> 
+ */
 public class SdbComponent extends DefaultComponent {
 
     public SdbComponent() {
@@ -41,11 +44,11 @@ public class SdbComponent extends Defaul
         }
         configuration.setDomainName(remaining);
 
-        if (configuration.getAmazonSdbClient() == null && (configuration.getAccessKey() == null || configuration.getSecretKey() == null)) {
-            throw new IllegalArgumentException("amazonSdbClient or accessKey and secretKey must be specified");
+        if (configuration.getAmazonSDBClient() == null && (configuration.getAccessKey() == null || configuration.getSecretKey() == null)) {
+            throw new IllegalArgumentException("amazonSDBClient or accessKey and secretKey must be specified");
         }
 
         SdbEndpoint endpoint = new SdbEndpoint(uri, getCamelContext(), configuration);
         return endpoint;
     }
-}
+}
\ No newline at end of file

Modified: camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbConfiguration.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbConfiguration.java?rev=1220761&r1=1220760&r2=1220761&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbConfiguration.java (original)
+++ camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbConfiguration.java Mon Dec 19 14:20:07 2011
@@ -18,13 +18,20 @@ package org.apache.camel.component.aws.s
 
 import com.amazonaws.services.simpledb.AmazonSimpleDB;
 
+/**
+ * The AWS SDB component configuration properties
+ * 
+ */
 public class SdbConfiguration {
+    
     private String accessKey;
     private String secretKey;
-    private AmazonSimpleDB amazonSdbClient;
+    private AmazonSimpleDB amazonSDBClient;
     private String amazonSdbEndpoint;
     private String domainName;
-    private String operation;
+    private Integer maxNumberOfDomains;
+    private Boolean consistentRead;
+    private SdbOperations operation = SdbOperations.PutAttributes;
 
     public void setAmazonSdbEndpoint(String amazonSdbEndpoint) {
         this.amazonSdbEndpoint = amazonSdbEndpoint;
@@ -50,12 +57,12 @@ public class SdbConfiguration {
         this.secretKey = secretKey;
     }
 
-    public AmazonSimpleDB getAmazonSdbClient() {
-        return amazonSdbClient;
+    public AmazonSimpleDB getAmazonSDBClient() {
+        return amazonSDBClient;
     }
 
-    public void setAmazonSdbClient(AmazonSimpleDB amazonSdbClient) {
-        this.amazonSdbClient = amazonSdbClient;
+    public void setAmazonSDBClient(AmazonSimpleDB amazonSDBClient) {
+        this.amazonSDBClient = amazonSDBClient;
     }
 
     public String getDomainName() {
@@ -66,11 +73,27 @@ public class SdbConfiguration {
         this.domainName = domainName;
     }
 
-    public String getOperation() {
+    public SdbOperations getOperation() {
         return operation;
     }
 
-    public void setOperation(String operation) {
+    public void setOperation(SdbOperations operation) {
         this.operation = operation;
     }
+
+    public Integer getMaxNumberOfDomains() {
+        return maxNumberOfDomains;
+    }
+
+    public void setMaxNumberOfDomains(Integer maxNumberOfDomains) {
+        this.maxNumberOfDomains = maxNumberOfDomains;
+    }
+
+    public Boolean getConsistentRead() {
+        return consistentRead;
+    }
+
+    public void setConsistentRead(Boolean consistentRead) {
+        this.consistentRead = consistentRead;
+    }
 }

Modified: camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbConstants.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbConstants.java?rev=1220761&r1=1220760&r2=1220761&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbConstants.java (original)
+++ camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbConstants.java Mon Dec 19 14:20:07 2011
@@ -16,13 +16,32 @@
  */
 package org.apache.camel.component.aws.sdb;
 
+/**
+ * Constants used in Camel AWS SDB component
+ */
 public interface SdbConstants {
-    String MESSAGE_ID = "CamelAwsSdbMessageId";
+    
+    String ATTRIBUTES = "CamelAwsSdbAttributes";
+    String ATTRIBUTE_NAMES = "CamelAwsSdbAttributeNames";
+    String ATTRIBUTE_NAME_COUNT = "CamelAwsSdbAttributeNameCount";
+    String ATTRIBUTE_NAME_SIZE = "CamelAwsSdbAttributeNameSize";
+    String ATTRIBUTE_VALUE_COUNT = "CamelAwsSdbAttributeValueCount";
+    String ATTRIBUTE_VALUE_SIZE = "CamelAwsSdbAttributeValueSize";
+    String CONSISTENT_READ = "CamelAwsSdbConsistentRead";
+    String DELETABLE_ITEMS = "CamelAwsSdbDeletableItems";
     String DOMAIN_NAME = "CamelAwsSdbDomainName";
-    String ITEM_KEY = "CamelAwsSdbItemKey";
-    String ATTRIBUTE_PREFIX = "CamelAwsSdbAttributePrefix";
+    String DOMAIN_NAMES = "CamelAwsSdbDomainNames";
+    String ITEMS = "CamelAwsSdbItems";
+    String ITEM_COUNT = "CamelAwsSdbItemCount";
+    String ITEM_NAME_SIZE = "CamelAwsSdbItemNameSize";
+    String ITEM_NAME = "CamelAwsSdbItemName";
+    String MAX_NUMBER_OF_DOMAINS = "CamelAwsSdbMaxNumberOfDomains";
+    String MESSAGE_ID = "CamelAwsSdbMessageId";
+    String NEXT_TOKEN = "CamelAwsSdbNextToken";
     String OPERATION = "CamelAwsSdbOperation";
-    String OPERATION_PUT = "CamelAwsSdbPut";
-    String OPERATION_GET = "CamelAwsSdbGet";
-    String OPERATION_DELETE = "CamelAwsSdbDelete";
+    String REPLACEABLE_ATTRIBUTES = "CamelAwsSdbReplaceableAttributes";
+    String REPLACEABLE_ITEMS = "CamelAwsSdbReplaceableItems";
+    String SELECT_EXPRESSION = "CamelAwsSdbSelectExpression";
+    String TIMESTAMP = "CamelAwsSdbTimestamp";
+    String UPDATE_CONDITION = "CamelAwsSdbUpdateCondition";
 }

Modified: camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbEndpoint.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbEndpoint.java?rev=1220761&r1=1220760&r2=1220761&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbEndpoint.java (original)
+++ camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbEndpoint.java Mon Dec 19 14:20:07 2011
@@ -32,7 +32,12 @@ import org.apache.camel.impl.ScheduledPo
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+/**
+ * Defines the <a href="http://camel.apache.org/aws.html">AWS SDB Endpoint</a>.  
+ *
+ */
 public class SdbEndpoint extends ScheduledPollEndpoint {
+    
     private static final Logger LOG = LoggerFactory.getLogger(S3Endpoint.class);
     private SdbConfiguration configuration;
 
@@ -56,6 +61,7 @@ public class SdbEndpoint extends Schedul
     @Override
     public void doStart() throws Exception {
         super.doStart();
+        
         AmazonSimpleDB sdbClient = getSdbClient();
         String domainName = getConfiguration().getDomainName();
         LOG.trace("Querying whether domain [{}] already exists...", domainName);
@@ -66,8 +72,9 @@ public class SdbEndpoint extends Schedul
             return;
         } catch (NoSuchDomainException ase) {
             LOG.trace("Domain [{}] doesn't exist yet", domainName);
+            LOG.trace("Creating domain [{}]...", domainName);
             sdbClient.createDomain(new CreateDomainRequest(domainName));
-            LOG.trace("Domain created:" + domainName);
+            LOG.trace("Domain [{}] created", domainName);
         }
     }
 
@@ -76,7 +83,7 @@ public class SdbEndpoint extends Schedul
     }
 
     public AmazonSimpleDB getSdbClient() {
-        return configuration.getAmazonSdbClient() != null ? configuration.getAmazonSdbClient() : createSdbClient();
+        return configuration.getAmazonSDBClient() != null ? configuration.getAmazonSDBClient() : createSdbClient();
     }
 
     AmazonSimpleDBClient createSdbClient() {
@@ -85,7 +92,7 @@ public class SdbEndpoint extends Schedul
         if (configuration.getAmazonSdbEndpoint() != null) {
             client.setEndpoint(configuration.getAmazonSdbEndpoint());
         }
-        configuration.setAmazonSdbClient(client);
+        configuration.setAmazonSDBClient(client);
         return client;
     }
 }

Copied: camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbOperations.java (from r1220717, camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbConstants.java)
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbOperations.java?p2=camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbOperations.java&p1=camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbConstants.java&r1=1220717&r2=1220761&rev=1220761&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbConstants.java (original)
+++ camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbOperations.java Mon Dec 19 14:20:07 2011
@@ -16,13 +16,15 @@
  */
 package org.apache.camel.component.aws.sdb;
 
-public interface SdbConstants {
-    String MESSAGE_ID = "CamelAwsSdbMessageId";
-    String DOMAIN_NAME = "CamelAwsSdbDomainName";
-    String ITEM_KEY = "CamelAwsSdbItemKey";
-    String ATTRIBUTE_PREFIX = "CamelAwsSdbAttributePrefix";
-    String OPERATION = "CamelAwsSdbOperation";
-    String OPERATION_PUT = "CamelAwsSdbPut";
-    String OPERATION_GET = "CamelAwsSdbGet";
-    String OPERATION_DELETE = "CamelAwsSdbDelete";
+public enum SdbOperations {
+
+    BatchDeleteAttributes,
+    BatchPutAttributes,
+    DeleteAttributes,
+    DeleteDomain,
+    DomainMetadata,
+    GetAttributes,
+    ListDomains,
+    PutAttributes,
+    Select;
 }

Modified: camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbProducer.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbProducer.java?rev=1220761&r1=1220760&r2=1220761&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbProducer.java (original)
+++ camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SdbProducer.java Mon Dec 19 14:20:07 2011
@@ -16,102 +16,61 @@
  */
 package org.apache.camel.component.aws.sdb;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import com.amazonaws.services.simpledb.model.Attribute;
-import com.amazonaws.services.simpledb.model.DeleteAttributesRequest;
-import com.amazonaws.services.simpledb.model.GetAttributesRequest;
-import com.amazonaws.services.simpledb.model.GetAttributesResult;
-import com.amazonaws.services.simpledb.model.PutAttributesRequest;
-import com.amazonaws.services.simpledb.model.ReplaceableAttribute;
 import org.apache.camel.Endpoint;
 import org.apache.camel.Exchange;
 import org.apache.camel.impl.DefaultProducer;
 import org.apache.camel.util.URISupport;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
+/**
+ * A Producer which sends messages to the Amazon SimpleDB Service
+ * <a href="http://aws.amazon.com/simpledb/">AWS SDB</a>
+ */
 public class SdbProducer extends DefaultProducer {
-    private static final Logger LOG = LoggerFactory.getLogger(SdbProducer.class);
-
+    
     public SdbProducer(Endpoint endpoint) {
         super(endpoint);
     }
 
     public void process(Exchange exchange) throws Exception {
-        String domainName = determineDomainName(exchange);
-        String itemName = determineItemName(exchange);
-        String operation = determineOperation(exchange);
-
-        if (SdbConstants.OPERATION_PUT.equals(operation)) {
-            executePut(exchange, domainName, itemName);
-        } else if (SdbConstants.OPERATION_GET.equals(operation)) {
-            executeGet(exchange, domainName, itemName);
-        } else if (SdbConstants.OPERATION_DELETE.equals(operation)) {
-            executeDelete(domainName, itemName);
-        } else {
-            throw new UnsupportedOperationException("Not supported operation: " + operation);
-        }
-    }
-
-    private void executeDelete(String domainName, String itemName) {
-        LOG.trace("Deleting item [{}] from domain [{}]...", itemName, domainName);
-        getEndpoint().getSdbClient().deleteAttributes(new DeleteAttributesRequest(domainName, itemName));
-    }
-
-    private void executeGet(Exchange exchange, String domainName, String itemName) {
-        LOG.trace("Getting item [{}] from domain [{}]...", itemName, domainName);
-        GetAttributesRequest getAttributesRequest = new GetAttributesRequest(domainName, itemName);
-        GetAttributesResult result = getEndpoint().getSdbClient().getAttributes(getAttributesRequest);
-        populateExchangeWithResult(exchange, result);
-    }
-
-    private void populateExchangeWithResult(Exchange exchange, GetAttributesResult attributesResult) {
-        for (Attribute attribute : attributesResult.getAttributes()) {
-            exchange.getIn().setHeader(attribute.getName(), attribute.getValue());
+        switch (determineOperation(exchange)) {
+        case BatchDeleteAttributes:
+            new BatchDeleteAttributesCommand(getEndpoint().getSdbClient(), getConfiguration(), exchange).execute();
+            break;
+        case BatchPutAttributes:
+            new BatchPutAttributesCommand(getEndpoint().getSdbClient(), getConfiguration(), exchange).execute();
+            break;
+        case DeleteAttributes:
+            new DeleteAttributesCommand(getEndpoint().getSdbClient(), getConfiguration(), exchange).execute();
+            break;
+        case DeleteDomain:
+            new DeleteDomainCommand(getEndpoint().getSdbClient(), getConfiguration(), exchange).execute();
+            break;
+        case DomainMetadata:
+            new DomainMetadataCommand(getEndpoint().getSdbClient(), getConfiguration(), exchange).execute();
+            break;
+        case GetAttributes:
+            new GetAttributesCommand(getEndpoint().getSdbClient(), getConfiguration(), exchange).execute();
+            break;
+        case ListDomains:
+            new ListDomainsCommand(getEndpoint().getSdbClient(), getConfiguration(), exchange).execute();
+            break;
+        case PutAttributes:
+            new PutAttributesCommand(getEndpoint().getSdbClient(), getConfiguration(), exchange).execute();
+            break;
+        case Select:
+            new SelectCommand(getEndpoint().getSdbClient(), getConfiguration(), exchange).execute();
+            break;
+        default:
+            throw new IllegalArgumentException("Unsupported operation");
         }
     }
 
-    private void executePut(Exchange exchange, String domainName, String itemName) {
-        List<ReplaceableAttribute> attributes = extractAttributesFrom(exchange);
-        PutAttributesRequest request = new PutAttributesRequest(domainName, itemName, attributes);
-
-        LOG.trace("Put object [{}] from exchange [{}]...", request, exchange);
-        getEndpoint().getSdbClient().putAttributes(request);
-    }
-
-    private List<ReplaceableAttribute> extractAttributesFrom(Exchange exchange) {
-        List<ReplaceableAttribute> attributes = new ArrayList<ReplaceableAttribute>();
-        for (Map.Entry<String, Object> entry : exchange.getIn().getHeaders().entrySet()) {
-            if (entry.getKey().startsWith(SdbConstants.ATTRIBUTE_PREFIX)) {
-                String fieldName = entry.getKey().substring(SdbConstants.ATTRIBUTE_PREFIX.length());
-                attributes.add(new ReplaceableAttribute(fieldName, (String) entry.getValue(), true));
-            }
-        }
-        return attributes;
-    }
-
-    private String determineDomainName(Exchange exchange) {
-        String domainName = exchange.getIn().getHeader(SdbConstants.DOMAIN_NAME, String.class);
-        return domainName != null ? domainName : getConfiguration().getDomainName();
-    }
-
-    private String determineOperation(Exchange exchange) {
-        String operation = exchange.getIn().getHeader(SdbConstants.OPERATION, String.class);
+    private SdbOperations determineOperation(Exchange exchange) {
+        SdbOperations operation = exchange.getIn().getHeader(SdbConstants.OPERATION, SdbOperations.class);
         if (operation == null) {
             operation = getConfiguration().getOperation();
         }
-        return operation != null ? operation : SdbConstants.OPERATION_PUT;
-    }
-
-    private String determineItemName(Exchange exchange) {
-        String key = exchange.getIn().getHeader(SdbConstants.ITEM_KEY, String.class);
-        if (key == null) {
-            throw new IllegalArgumentException("AWS SDB Item Key header is missing.");
-        }
-        return key;
+        return operation;
     }
 
     protected SdbConfiguration getConfiguration() {
@@ -127,4 +86,4 @@ public class SdbProducer extends Default
     public SdbEndpoint getEndpoint() {
         return (SdbEndpoint) super.getEndpoint();
     }
-}
+}
\ No newline at end of file

Added: camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SelectCommand.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SelectCommand.java?rev=1220761&view=auto
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SelectCommand.java (added)
+++ camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sdb/SelectCommand.java Mon Dec 19 14:20:07 2011
@@ -0,0 +1,51 @@
+/**
+ * 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.sdb;
+
+import com.amazonaws.services.simpledb.AmazonSimpleDB;
+import com.amazonaws.services.simpledb.model.SelectRequest;
+import com.amazonaws.services.simpledb.model.SelectResult;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+
+public class SelectCommand extends AbstractSdbCommand {
+
+    public SelectCommand(AmazonSimpleDB sdbClient, SdbConfiguration configuration, Exchange exchange) {
+        super(sdbClient, configuration, exchange);
+    }
+
+    public void execute() {
+        SelectRequest request = new SelectRequest()
+            .withSelectExpression(determineSelectExpression())
+            .withConsistentRead(determineConsistentRead())
+            .withNextToken(determineNextToken());
+        log.trace("Sending request [{}] for exchange [{}]...", request, exchange);
+        
+        SelectResult result = this.sdbClient.select(request);
+        
+        log.trace("Received result [{}]", result);
+        
+        Message msg = getMessageForResponse(exchange);
+        msg.setHeader(SdbConstants.ITEMS, result.getItems());
+        msg.setHeader(SdbConstants.NEXT_TOKEN, result.getNextToken());
+    }
+
+    protected String determineSelectExpression() {
+        return exchange.getIn().getHeader(SdbConstants.SELECT_EXPRESSION, String.class);
+    }
+}
\ No newline at end of file

Added: camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/AbstractSdbCommandTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/AbstractSdbCommandTest.java?rev=1220761&view=auto
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/AbstractSdbCommandTest.java (added)
+++ camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/AbstractSdbCommandTest.java Mon Dec 19 14:20:07 2011
@@ -0,0 +1,116 @@
+/**
+ * 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.sdb;
+
+import com.amazonaws.services.simpledb.AmazonSimpleDB;
+import com.amazonaws.services.simpledb.model.UpdateCondition;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePattern;
+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;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.fail;
+
+public class AbstractSdbCommandTest {
+
+    private AbstractSdbCommand command;
+    private AmazonSimpleDB sdbClient;
+    private SdbConfiguration configuration;
+    private Exchange exchange;
+    
+    @Before
+    public void setUp() {
+        sdbClient = new AmazonSDBClientMock();
+        configuration = new SdbConfiguration();
+        configuration.setDomainName("DOMAIN1");
+        configuration.setConsistentRead(Boolean.TRUE);
+        exchange = new DefaultExchange(new DefaultCamelContext());
+        
+        this.command = new AbstractSdbCommand(sdbClient, configuration, exchange) {
+            @Override
+            public void execute() {
+                // noop
+            }
+        };
+    }
+    
+    @Test
+    public void getMessageForResponse() {
+        assertSame(exchange.getIn(), this.command.getMessageForResponse(exchange));
+        
+        exchange.setPattern(ExchangePattern.InOut);
+        
+        assertSame(exchange.getOut(), this.command.getMessageForResponse(exchange));
+    }
+    
+    @Test
+    public void determineDomainName() {
+        assertEquals("DOMAIN1", this.command.determineDomainName());
+        
+        exchange.getIn().setHeader(SdbConstants.DOMAIN_NAME, "DOMAIN2");
+        
+        assertEquals("DOMAIN2", this.command.determineDomainName());
+    }
+    
+    @Test
+    public void determineItemName() {
+        try {
+            this.command.determineItemName();
+            fail("IllegalArgumentException expected");
+        } catch (IllegalArgumentException e) {
+            assertEquals("AWS SDB Item Name header is missing.", e.getMessage());
+        }
+        
+        exchange.getIn().setHeader(SdbConstants.ITEM_NAME, "ITEM1");
+        
+        assertEquals("ITEM1", this.command.determineItemName());
+    }
+    
+    @Test
+    public void determineConsistentRead() {
+        assertEquals(Boolean.TRUE, this.command.determineConsistentRead());
+        
+        exchange.getIn().setHeader(SdbConstants.CONSISTENT_READ, Boolean.FALSE);
+        
+        assertEquals(Boolean.FALSE, this.command.determineConsistentRead());
+    }
+    
+    @Test
+    public void determineUpdateCondition() {
+        assertNull(this.command.determineUpdateCondition());
+        
+        UpdateCondition condition = new UpdateCondition("Key1", "Value1", true);
+        exchange.getIn().setHeader(SdbConstants.UPDATE_CONDITION, condition);
+        
+        assertSame(condition, this.command.determineUpdateCondition());
+    }
+    
+    @Test
+    public void determineNextToken() {
+        assertNull(this.command.determineNextToken());
+        
+        exchange.getIn().setHeader(SdbConstants.NEXT_TOKEN, "Token1");
+        
+        assertEquals("Token1", this.command.determineNextToken());
+    }
+}
\ No newline at end of file

Modified: camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/AmazonSDBClientMock.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/AmazonSDBClientMock.java?rev=1220761&r1=1220760&r2=1220761&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/AmazonSDBClientMock.java (original)
+++ camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/AmazonSDBClientMock.java Mon Dec 19 14:20:07 2011
@@ -21,64 +21,122 @@ import com.amazonaws.AmazonServiceExcept
 import com.amazonaws.auth.BasicAWSCredentials;
 import com.amazonaws.services.simpledb.AmazonSimpleDBClient;
 import com.amazonaws.services.simpledb.model.Attribute;
+import com.amazonaws.services.simpledb.model.BatchDeleteAttributesRequest;
+import com.amazonaws.services.simpledb.model.BatchPutAttributesRequest;
 import com.amazonaws.services.simpledb.model.CreateDomainRequest;
 import com.amazonaws.services.simpledb.model.DeleteAttributesRequest;
+import com.amazonaws.services.simpledb.model.DeleteDomainRequest;
 import com.amazonaws.services.simpledb.model.DomainMetadataRequest;
 import com.amazonaws.services.simpledb.model.DomainMetadataResult;
 import com.amazonaws.services.simpledb.model.GetAttributesRequest;
 import com.amazonaws.services.simpledb.model.GetAttributesResult;
+import com.amazonaws.services.simpledb.model.Item;
+import com.amazonaws.services.simpledb.model.ListDomainsRequest;
+import com.amazonaws.services.simpledb.model.ListDomainsResult;
 import com.amazonaws.services.simpledb.model.NoSuchDomainException;
 import com.amazonaws.services.simpledb.model.PutAttributesRequest;
+import com.amazonaws.services.simpledb.model.SelectRequest;
+import com.amazonaws.services.simpledb.model.SelectResult;
 
 public class AmazonSDBClientMock extends AmazonSimpleDBClient {
-    private String domainNameToCreate;
-    private String itemNameToDelete;
-    private PutAttributesRequest putAttributesRequest;
+    
+    protected BatchDeleteAttributesRequest batchDeleteAttributesRequest;
+    protected BatchPutAttributesRequest batchPutAttributesRequest;
+    protected CreateDomainRequest createDomainRequest;
+    protected DeleteAttributesRequest deleteAttributesRequest;
+    protected DeleteDomainRequest deleteDomainRequest;
+    protected DomainMetadataRequest domainMetadataRequest;
+    protected GetAttributesRequest getAttributesRequest;
+    protected ListDomainsRequest listDomainsRequest;
+    protected PutAttributesRequest putAttributesRequest;
+    protected SelectRequest selectRequest;
 
     public AmazonSDBClientMock() {
         super(new BasicAWSCredentials("user", "secret"));
     }
-
+    
     @Override
-    public DomainMetadataResult domainMetadata(DomainMetadataRequest domainMetadataRequest) throws AmazonServiceException, AmazonClientException {
-        throw new NoSuchDomainException(domainNameToCreate + " doesn't exist");
+    public void batchDeleteAttributes(BatchDeleteAttributesRequest batchDeleteAttributesRequest) throws AmazonServiceException, AmazonClientException {
+        this.batchDeleteAttributesRequest = batchDeleteAttributesRequest;
     }
-
+    
     @Override
-    public void createDomain(CreateDomainRequest createDomainRequest) throws AmazonServiceException, AmazonClientException {
-        this.domainNameToCreate = createDomainRequest.getDomainName();
+    public void batchPutAttributes(BatchPutAttributesRequest batchPutAttributesRequest) throws AmazonServiceException, AmazonClientException {
+        this.batchPutAttributesRequest = batchPutAttributesRequest;
     }
-
+    
     @Override
-    public void putAttributes(PutAttributesRequest putAttributesRequest) throws AmazonServiceException, AmazonClientException {
-        this.putAttributesRequest = putAttributesRequest;
+    public void createDomain(CreateDomainRequest createDomainRequest) throws AmazonServiceException, AmazonClientException {
+        this.createDomainRequest = createDomainRequest;
     }
-
+    
     @Override
     public void deleteAttributes(DeleteAttributesRequest deleteAttributesRequest) throws AmazonServiceException, AmazonClientException {
+        this.deleteAttributesRequest = deleteAttributesRequest;
+        
         String domainName = deleteAttributesRequest.getDomainName();
         if ("MissingDomain".equals(domainName)) {
             throw new NoSuchDomainException(domainName);
         }
-        this.itemNameToDelete = deleteAttributesRequest.getItemName();
+    }
+    
+    @Override
+    public void deleteDomain(DeleteDomainRequest deleteDomainRequest) throws AmazonServiceException, AmazonClientException {
+        this.deleteDomainRequest = deleteDomainRequest;
     }
 
     @Override
+    public DomainMetadataResult domainMetadata(DomainMetadataRequest domainMetadataRequest) throws AmazonServiceException, AmazonClientException {
+        this.domainMetadataRequest = domainMetadataRequest;
+        
+        if ("NonExistingDomain".equals(domainMetadataRequest.getDomainName())) {
+            throw new NoSuchDomainException("Domain 'NonExistingDomain' doesn't exist.");
+        }
+        
+        DomainMetadataResult result = new DomainMetadataResult();
+        result.setTimestamp(new Integer(10));
+        result.setItemCount(new Integer(11));
+        result.setAttributeNameCount(new Integer(12));
+        result.setAttributeValueCount(new Integer(13));
+        result.setAttributeNamesSizeBytes(new Long(1000000));
+        result.setAttributeValuesSizeBytes(new Long(2000000));
+        result.setItemNamesSizeBytes(new Long(3000000));
+        return result;
+    }
+    
+    @Override
     public GetAttributesResult getAttributes(GetAttributesRequest getAttributesRequest) throws AmazonServiceException, AmazonClientException {
+        this.getAttributesRequest = getAttributesRequest;
+        
         return new GetAttributesResult()
                 .withAttributes(new Attribute("AttributeOne", "Value One"))
                 .withAttributes(new Attribute("AttributeTwo", "Value Two"));
     }
-
-    public PutAttributesRequest getPutAttributesRequest() {
-        return putAttributesRequest;
+    
+    @Override
+    public ListDomainsResult listDomains(ListDomainsRequest listDomainsRequest) throws AmazonServiceException, AmazonClientException {
+        this.listDomainsRequest = listDomainsRequest;
+        
+        ListDomainsResult result = new ListDomainsResult();
+        result.getDomainNames().add("DOMAIN1");
+        result.getDomainNames().add("DOMAIN2");
+        result.setNextToken("TOKEN2");
+        return result;
     }
 
-    public String getDomainNameToCreate() {
-        return domainNameToCreate;
+    @Override
+    public void putAttributes(PutAttributesRequest putAttributesRequest) throws AmazonServiceException, AmazonClientException {
+        this.putAttributesRequest = putAttributesRequest;
     }
-
-    public String getItemNameToDelete() {
-        return itemNameToDelete;
+    
+    @Override
+    public SelectResult select(SelectRequest selectRequest) throws AmazonServiceException, AmazonClientException {
+        this.selectRequest = selectRequest;
+        
+        SelectResult result = new SelectResult();
+        result.setNextToken("TOKEN2");
+        result.getItems().add(new Item("ITEM1", null));
+        result.getItems().add(new Item("ITEM2", null));
+        return result;
     }
-}
+}
\ No newline at end of file

Added: camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/BatchDeleteAttributesCommandTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/BatchDeleteAttributesCommandTest.java?rev=1220761&view=auto
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/BatchDeleteAttributesCommandTest.java (added)
+++ camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/BatchDeleteAttributesCommandTest.java Mon Dec 19 14:20:07 2011
@@ -0,0 +1,72 @@
+/**
+ * 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.sdb;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.amazonaws.services.simpledb.model.Item;
+
+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;
+import static org.junit.Assert.assertNull;
+
+public class BatchDeleteAttributesCommandTest {
+    
+    private BatchDeleteAttributesCommand command;
+    private AmazonSDBClientMock sdbClient;
+    private SdbConfiguration configuration;
+    private Exchange exchange;
+
+    @Before
+    public void setUp() {
+        sdbClient = new AmazonSDBClientMock();
+        configuration = new SdbConfiguration();
+        configuration.setDomainName("DOMAIN1");
+        exchange = new DefaultExchange(new DefaultCamelContext());
+        
+        command = new BatchDeleteAttributesCommand(sdbClient, configuration, exchange);
+    }
+
+    @Test
+    public void execute() {
+        List<Item> deletableItems = new ArrayList<Item>();
+        deletableItems.add(new Item());
+        exchange.getIn().setHeader(SdbConstants.DELETABLE_ITEMS, deletableItems);
+        
+        command.execute();
+        
+        assertEquals("DOMAIN1", sdbClient.batchDeleteAttributesRequest.getDomainName());
+        assertEquals(deletableItems, sdbClient.batchDeleteAttributesRequest.getItems());
+    }
+
+    @Test
+    public void determineDeletableItems() {
+        assertNull(this.command.determineDeletableItems());
+        
+        List<Item> deletableItems = new ArrayList<Item>();
+        deletableItems.add(new Item());
+        exchange.getIn().setHeader(SdbConstants.DELETABLE_ITEMS, deletableItems);
+        
+        assertEquals(deletableItems, this.command.determineDeletableItems());
+    }
+}

Added: camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/BatchPutAttributesCommandTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/BatchPutAttributesCommandTest.java?rev=1220761&view=auto
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/BatchPutAttributesCommandTest.java (added)
+++ camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/BatchPutAttributesCommandTest.java Mon Dec 19 14:20:07 2011
@@ -0,0 +1,72 @@
+/**
+ * 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.sdb;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.amazonaws.services.simpledb.model.ReplaceableItem;
+
+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;
+import static org.junit.Assert.assertNull;
+
+public class BatchPutAttributesCommandTest {
+
+    private BatchPutAttributesCommand command;
+    private AmazonSDBClientMock sdbClient;
+    private SdbConfiguration configuration;
+    private Exchange exchange;
+    
+    @Before
+    public void setUp() {
+        sdbClient = new AmazonSDBClientMock();
+        configuration = new SdbConfiguration();
+        configuration.setDomainName("DOMAIN1");
+        exchange = new DefaultExchange(new DefaultCamelContext());
+        
+        command = new BatchPutAttributesCommand(sdbClient, configuration, exchange);
+    }
+
+    @Test
+    public void execute() {
+        List<ReplaceableItem> replaceableItems = new ArrayList<ReplaceableItem>();
+        replaceableItems.add(new ReplaceableItem("ITEM1"));
+        exchange.getIn().setHeader(SdbConstants.REPLACEABLE_ITEMS, replaceableItems);
+        
+        command.execute();
+        
+        assertEquals("DOMAIN1", sdbClient.batchPutAttributesRequest.getDomainName());
+        assertEquals(replaceableItems, sdbClient.batchPutAttributesRequest.getItems());
+    }
+
+    @Test
+    public void determineReplaceableItems() {
+        assertNull(this.command.determineReplaceableItems());
+        
+        List<ReplaceableItem> replaceableItems = new ArrayList<ReplaceableItem>();
+        replaceableItems.add(new ReplaceableItem("ITEM1"));
+        exchange.getIn().setHeader(SdbConstants.REPLACEABLE_ITEMS, replaceableItems);
+        
+        assertEquals(replaceableItems, this.command.determineReplaceableItems());
+    }
+}
\ No newline at end of file

Added: camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/DeleteAttributesCommandTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/DeleteAttributesCommandTest.java?rev=1220761&view=auto
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/DeleteAttributesCommandTest.java (added)
+++ camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/DeleteAttributesCommandTest.java Mon Dec 19 14:20:07 2011
@@ -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.sdb;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.amazonaws.services.simpledb.model.Attribute;
+import com.amazonaws.services.simpledb.model.UpdateCondition;
+
+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;
+import static org.junit.Assert.assertNull;
+
+public class DeleteAttributesCommandTest {
+
+    private DeleteAttributesCommand command;
+    private AmazonSDBClientMock sdbClient;
+    private SdbConfiguration configuration;
+    private Exchange exchange;
+    
+    @Before
+    public void setUp() {
+        sdbClient = new AmazonSDBClientMock();
+        configuration = new SdbConfiguration();
+        configuration.setDomainName("DOMAIN1");
+        exchange = new DefaultExchange(new DefaultCamelContext());
+        
+        command = new DeleteAttributesCommand(sdbClient, configuration, exchange);
+    }
+
+    @Test
+    public void execute() {
+        List<Attribute> attributes = new ArrayList<Attribute>();
+        attributes.add(new Attribute("NAME1", "VALUE1"));
+        exchange.getIn().setHeader(SdbConstants.ATTRIBUTES, attributes);
+        exchange.getIn().setHeader(SdbConstants.ITEM_NAME, "ITEM1");
+        UpdateCondition condition = new UpdateCondition("Key1", "Value1", true);
+        exchange.getIn().setHeader(SdbConstants.UPDATE_CONDITION, condition);
+        
+        command.execute();
+        
+        assertEquals("DOMAIN1", sdbClient.deleteAttributesRequest.getDomainName());
+        assertEquals("ITEM1", sdbClient.deleteAttributesRequest.getItemName());
+        assertEquals(condition, sdbClient.deleteAttributesRequest.getExpected());
+        assertEquals(attributes, sdbClient.deleteAttributesRequest.getAttributes());
+    }
+    
+    @Test(expected = IllegalArgumentException.class)
+    public void executeWithoutItemName() {
+        List<Attribute> attributes = new ArrayList<Attribute>();
+        attributes.add(new Attribute("NAME1", "VALUE1"));
+        exchange.getIn().setHeader(SdbConstants.ATTRIBUTES, attributes);
+        UpdateCondition condition = new UpdateCondition("Key1", "Value1", true);
+        exchange.getIn().setHeader(SdbConstants.UPDATE_CONDITION, condition);
+        
+        command.execute();
+    }
+
+    @Test
+    public void determineAttributes() {
+        assertNull(this.command.determineAttributes());
+        
+        List<Attribute> attributes = new ArrayList<Attribute>();
+        attributes.add(new Attribute("NAME1", "VALUE1"));
+        exchange.getIn().setHeader(SdbConstants.ATTRIBUTES, attributes);
+        
+        assertEquals(attributes, this.command.determineAttributes());
+    }
+}
\ No newline at end of file

Added: camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/DeleteDomainCommandTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/DeleteDomainCommandTest.java?rev=1220761&view=auto
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/DeleteDomainCommandTest.java (added)
+++ camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/DeleteDomainCommandTest.java Mon Dec 19 14:20:07 2011
@@ -0,0 +1,50 @@
+/**
+ * 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.sdb;
+
+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 DeleteDomainCommandTest {
+
+    private DeleteDomainCommand command;
+    private AmazonSDBClientMock sdbClient;
+    private SdbConfiguration configuration;
+    private Exchange exchange;
+    
+    @Before
+    public void setUp() {
+        sdbClient = new AmazonSDBClientMock();
+        configuration = new SdbConfiguration();
+        configuration.setDomainName("DOMAIN1");
+        exchange = new DefaultExchange(new DefaultCamelContext());
+        
+        command = new DeleteDomainCommand(sdbClient, configuration, exchange);
+    }
+
+    @Test
+    public void testExecute() {
+        command.execute();
+        
+        assertEquals("DOMAIN1", sdbClient.deleteDomainRequest.getDomainName());
+    }
+}
\ No newline at end of file

Added: camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/DomainMetadataCommandTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/DomainMetadataCommandTest.java?rev=1220761&view=auto
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/DomainMetadataCommandTest.java (added)
+++ camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/DomainMetadataCommandTest.java Mon Dec 19 14:20:07 2011
@@ -0,0 +1,58 @@
+/**
+ * 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.sdb;
+
+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 DomainMetadataCommandTest {
+
+    private DomainMetadataCommand command;
+    private AmazonSDBClientMock sdbClient;
+    private SdbConfiguration configuration;
+    private Exchange exchange;
+    
+    @Before
+    public void setUp() {
+        sdbClient = new AmazonSDBClientMock();
+        configuration = new SdbConfiguration();
+        configuration.setDomainName("DOMAIN1");
+        exchange = new DefaultExchange(new DefaultCamelContext());
+        
+        command = new DomainMetadataCommand(sdbClient, configuration, exchange);
+    }
+
+    @Test
+    public void execute() {
+        command.execute();
+        
+        assertEquals("DOMAIN1", sdbClient.domainMetadataRequest.getDomainName());
+        
+        assertEquals(new Integer(10), exchange.getIn().getHeader(SdbConstants.TIMESTAMP));
+        assertEquals(new Integer(11), exchange.getIn().getHeader(SdbConstants.ITEM_COUNT));
+        assertEquals(new Integer(12), exchange.getIn().getHeader(SdbConstants.ATTRIBUTE_NAME_COUNT));
+        assertEquals(new Integer(13), exchange.getIn().getHeader(SdbConstants.ATTRIBUTE_VALUE_COUNT));
+        assertEquals(new Long(1000000), exchange.getIn().getHeader(SdbConstants.ATTRIBUTE_NAME_SIZE));
+        assertEquals(new Long(2000000), exchange.getIn().getHeader(SdbConstants.ATTRIBUTE_VALUE_SIZE));
+        assertEquals(new Long(3000000), exchange.getIn().getHeader(SdbConstants.ITEM_NAME_SIZE));
+    }
+}
\ No newline at end of file

Added: camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/GetAttributesCommandTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/GetAttributesCommandTest.java?rev=1220761&view=auto
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/GetAttributesCommandTest.java (added)
+++ camel/branches/camel-2.8.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sdb/GetAttributesCommandTest.java Mon Dec 19 14:20:07 2011
@@ -0,0 +1,93 @@
+/**
+ * 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.sdb;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.amazonaws.services.simpledb.model.Attribute;
+
+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;
+import static org.junit.Assert.assertNull;
+
+public class GetAttributesCommandTest {
+
+    private GetAttributesCommand command;
+    private AmazonSDBClientMock sdbClient;
+    private SdbConfiguration configuration;
+    private Exchange exchange;
+    
+    @Before
+    public void setUp() {
+        sdbClient = new AmazonSDBClientMock();
+        configuration = new SdbConfiguration();
+        configuration.setDomainName("DOMAIN1");
+        configuration.setConsistentRead(Boolean.TRUE);
+        exchange = new DefaultExchange(new DefaultCamelContext());
+        
+        command = new GetAttributesCommand(sdbClient, configuration, exchange);
+    }
+
+    @SuppressWarnings("unchecked")
+    @Test
+    public void execute() {
+        List<String> attributeNames = new ArrayList<String>();
+        attributeNames.add("ATTRIBUTE1");
+        exchange.getIn().setHeader(SdbConstants.ATTRIBUTE_NAMES, attributeNames);
+        exchange.getIn().setHeader(SdbConstants.ITEM_NAME, "ITEM1");
+        
+        command.execute();
+        
+        assertEquals("DOMAIN1", sdbClient.getAttributesRequest.getDomainName());
+        assertEquals("ITEM1", sdbClient.getAttributesRequest.getItemName());
+        assertEquals(Boolean.TRUE, sdbClient.getAttributesRequest.getConsistentRead());
+        assertEquals(attributeNames, sdbClient.getAttributesRequest.getAttributeNames());
+        
+        List<Attribute> attributes = exchange.getIn().getHeader(SdbConstants.ATTRIBUTES, List.class);
+        assertEquals(2, attributes.size());
+        assertEquals("AttributeOne", attributes.get(0).getName());
+        assertEquals("Value One", attributes.get(0).getValue());
+        assertEquals("AttributeTwo", attributes.get(1).getName());
+        assertEquals("Value Two", attributes.get(1).getValue());
+    }
+    
+    @Test(expected = IllegalArgumentException.class)
+    public void executeWithoutItemName() {
+        List<String> attributeNames = new ArrayList<String>();
+        attributeNames.add("ATTRIBUTE1");
+        exchange.getIn().setHeader(SdbConstants.ATTRIBUTE_NAMES, attributeNames);
+        
+        command.execute();
+    }
+    
+    @Test
+    public void determineAttributeNames() {
+        assertNull(this.command.determineAttributeNames());
+        
+        List<String> attributeNames = new ArrayList<String>();
+        attributeNames.add("ATTRIBUTE1");
+        exchange.getIn().setHeader(SdbConstants.ATTRIBUTE_NAMES, attributeNames);
+        
+        assertEquals(attributeNames, this.command.determineAttributeNames());
+    }
+}
\ No newline at end of file



Mime
View raw message