You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2020/03/17 15:05:52 UTC

[camel] 01/03: Camel-AWS2-EC2: Cleanup

This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 1e9475d0a4b5eaa088ca182537ee6dea326536ee
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Tue Mar 17 16:00:36 2020 +0100

    Camel-AWS2-EC2: Cleanup
---
 .../camel/component/aws2/ec2/AWS2EC2Producer.java  | 58 +++++++++++++---------
 1 file changed, 35 insertions(+), 23 deletions(-)

diff --git a/components/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2Producer.java b/components/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2Producer.java
index 000c4f3..18fa9a4 100644
--- a/components/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2Producer.java
+++ b/components/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2Producer.java
@@ -49,6 +49,7 @@ import software.amazon.awssdk.services.ec2.model.StartInstancesRequest;
 import software.amazon.awssdk.services.ec2.model.StartInstancesResponse;
 import software.amazon.awssdk.services.ec2.model.StopInstancesRequest;
 import software.amazon.awssdk.services.ec2.model.StopInstancesResponse;
+import software.amazon.awssdk.services.ec2.model.Tag;
 import software.amazon.awssdk.services.ec2.model.TerminateInstancesRequest;
 import software.amazon.awssdk.services.ec2.model.TerminateInstancesResponse;
 import software.amazon.awssdk.services.ec2.model.UnmonitorInstancesRequest;
@@ -134,7 +135,8 @@ public class AWS2EC2Producer extends DefaultProducer {
         return (AWS2EC2Endpoint)super.getEndpoint();
     }
 
-    private void createAndRunInstance(Ec2Client ec2Client, Exchange exchange) {
+    @SuppressWarnings({ "rawtypes", "unchecked" })
+	private void createAndRunInstance(Ec2Client ec2Client, Exchange exchange) {
         String ami;
         InstanceType instanceType;
         RunInstancesRequest.Builder builder = RunInstancesRequest.builder();
@@ -208,8 +210,9 @@ public class AWS2EC2Producer extends DefaultProducer {
         message.setBody(result);
     }
 
-    private void startInstances(Ec2Client ec2Client, Exchange exchange) {
-        Collection instanceIds;
+    @SuppressWarnings("unchecked")
+	private void startInstances(Ec2Client ec2Client, Exchange exchange) {
+        Collection<String> instanceIds;
         StartInstancesRequest.Builder builder = StartInstancesRequest.builder();
         if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(AWS2EC2Constants.INSTANCES_IDS))) {
             instanceIds = exchange.getIn().getHeader(AWS2EC2Constants.INSTANCES_IDS, Collection.class);
@@ -229,8 +232,9 @@ public class AWS2EC2Producer extends DefaultProducer {
         message.setBody(result);
     }
 
-    private void stopInstances(Ec2Client ec2Client, Exchange exchange) {
-        Collection instanceIds;
+    @SuppressWarnings("unchecked")
+	private void stopInstances(Ec2Client ec2Client, Exchange exchange) {
+        Collection<String> instanceIds;
         StopInstancesRequest.Builder builder = StopInstancesRequest.builder();
         if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(AWS2EC2Constants.INSTANCES_IDS))) {
             instanceIds = exchange.getIn().getHeader(AWS2EC2Constants.INSTANCES_IDS, Collection.class);
@@ -250,8 +254,9 @@ public class AWS2EC2Producer extends DefaultProducer {
         message.setBody(result);
     }
 
-    private void terminateInstances(Ec2Client ec2Client, Exchange exchange) {
-        Collection instanceIds;
+    @SuppressWarnings("unchecked")
+	private void terminateInstances(Ec2Client ec2Client, Exchange exchange) {
+        Collection<String> instanceIds;
         TerminateInstancesRequest.Builder builder = TerminateInstancesRequest.builder();
         if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(AWS2EC2Constants.INSTANCES_IDS))) {
             instanceIds = exchange.getIn().getHeader(AWS2EC2Constants.INSTANCES_IDS, Collection.class);
@@ -271,8 +276,9 @@ public class AWS2EC2Producer extends DefaultProducer {
         message.setBody(result);
     }
 
-    private void describeInstances(Ec2Client ec2Client, Exchange exchange) {
-        Collection instanceIds;
+    @SuppressWarnings("unchecked")
+	private void describeInstances(Ec2Client ec2Client, Exchange exchange) {
+        Collection<String> instanceIds;
         DescribeInstancesRequest.Builder builder = DescribeInstancesRequest.builder();
         if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(AWS2EC2Constants.INSTANCES_IDS))) {
             instanceIds = exchange.getIn().getHeader(AWS2EC2Constants.INSTANCES_IDS, Collection.class);
@@ -289,8 +295,9 @@ public class AWS2EC2Producer extends DefaultProducer {
         message.setBody(result);
     }
 
-    private void describeInstancesStatus(Ec2Client ec2Client, Exchange exchange) {
-        Collection instanceIds;
+    @SuppressWarnings("unchecked")
+	private void describeInstancesStatus(Ec2Client ec2Client, Exchange exchange) {
+        Collection<String> instanceIds;
         DescribeInstanceStatusRequest.Builder builder = DescribeInstanceStatusRequest.builder();
         if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(AWS2EC2Constants.INSTANCES_IDS))) {
             instanceIds = exchange.getIn().getHeader(AWS2EC2Constants.INSTANCES_IDS, Collection.class);
@@ -307,8 +314,9 @@ public class AWS2EC2Producer extends DefaultProducer {
         message.setBody(result);
     }
 
-    private void rebootInstances(Ec2Client ec2Client, Exchange exchange) {
-        Collection instanceIds;
+    @SuppressWarnings("unchecked")
+	private void rebootInstances(Ec2Client ec2Client, Exchange exchange) {
+        Collection<String> instanceIds;
         RebootInstancesRequest.Builder builder = RebootInstancesRequest.builder();
         if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(AWS2EC2Constants.INSTANCES_IDS))) {
             instanceIds = exchange.getIn().getHeader(AWS2EC2Constants.INSTANCES_IDS, Collection.class);
@@ -325,8 +333,9 @@ public class AWS2EC2Producer extends DefaultProducer {
         }
     }
 
-    private void monitorInstances(Ec2Client ec2Client, Exchange exchange) {
-        Collection instanceIds;
+    @SuppressWarnings("unchecked")
+	private void monitorInstances(Ec2Client ec2Client, Exchange exchange) {
+        Collection<String> instanceIds;
         MonitorInstancesRequest.Builder builder = MonitorInstancesRequest.builder();
         if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(AWS2EC2Constants.INSTANCES_IDS))) {
             instanceIds = exchange.getIn().getHeader(AWS2EC2Constants.INSTANCES_IDS, Collection.class);
@@ -346,8 +355,9 @@ public class AWS2EC2Producer extends DefaultProducer {
         message.setBody(result);
     }
 
-    private void unmonitorInstances(Ec2Client ec2Client, Exchange exchange) {
-        Collection instanceIds;
+    @SuppressWarnings("unchecked")
+	private void unmonitorInstances(Ec2Client ec2Client, Exchange exchange) {
+        Collection<String> instanceIds;
         UnmonitorInstancesRequest.Builder builder = UnmonitorInstancesRequest.builder();
         if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(AWS2EC2Constants.INSTANCES_IDS))) {
             instanceIds = exchange.getIn().getHeader(AWS2EC2Constants.INSTANCES_IDS, Collection.class);
@@ -367,9 +377,10 @@ public class AWS2EC2Producer extends DefaultProducer {
         message.setBody(result);
     }
 
-    private void createTags(Ec2Client ec2Client, Exchange exchange) {
-        Collection instanceIds;
-        Collection tags;
+    @SuppressWarnings("unchecked")
+	private void createTags(Ec2Client ec2Client, Exchange exchange) {
+        Collection<String> instanceIds;
+        Collection<Tag> tags;
         CreateTagsRequest.Builder builder = CreateTagsRequest.builder();
         if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(AWS2EC2Constants.INSTANCES_IDS))) {
             instanceIds = exchange.getIn().getHeader(AWS2EC2Constants.INSTANCES_IDS, Collection.class);
@@ -395,9 +406,10 @@ public class AWS2EC2Producer extends DefaultProducer {
         message.setBody(result);
     }
 
-    private void deleteTags(Ec2Client ec2Client, Exchange exchange) {
-        Collection instanceIds;
-        Collection tags;
+    @SuppressWarnings("unchecked")
+	private void deleteTags(Ec2Client ec2Client, Exchange exchange) {
+        Collection<String> instanceIds;
+        Collection<Tag> tags;
         DeleteTagsRequest.Builder builder = DeleteTagsRequest.builder();
         if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(AWS2EC2Constants.INSTANCES_IDS))) {
             instanceIds = exchange.getIn().getHeader(AWS2EC2Constants.INSTANCES_IDS, Collection.class);