CAMEL-8910 Camel-JClouds: Add new operations to JClouds Compute Service Producer, add resumeNode operation
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/8c640f57 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/8c640f57 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/8c640f57 Branch: refs/heads/master Commit: 8c640f575f884ffb7b7facf3372eb955c7a6d60d Parents: 85798aa Author: Andrea Cosentino <anco...@gmail.com> Authored: Sun Jun 28 15:29:02 2015 +0200 Committer: Andrea Cosentino <anco...@gmail.com> Committed: Sun Jun 28 15:29:02 2015 +0200 ---------------------------------------------------------------------- .../camel/component/jclouds/JcloudsComputeProducer.java | 12 +++++++++++- .../camel/component/jclouds/JcloudsConstants.java | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/8c640f57/components/camel-jclouds/src/main/java/org/apache/camel/component/jclouds/JcloudsComputeProducer.java ---------------------------------------------------------------------- diff --git a/components/camel-jclouds/src/main/java/org/apache/camel/component/jclouds/JcloudsComputeProducer.java b/components/camel-jclouds/src/main/java/org/apache/camel/component/jclouds/JcloudsComputeProducer.java index 0e4b4c3..3714ce2 100644 --- a/components/camel-jclouds/src/main/java/org/apache/camel/component/jclouds/JcloudsComputeProducer.java +++ b/components/camel-jclouds/src/main/java/org/apache/camel/component/jclouds/JcloudsComputeProducer.java @@ -71,6 +71,8 @@ public class JcloudsComputeProducer extends JcloudsProducer { rebootNode(exchange); } else if (JcloudsConstants.SUSPEND_NODE.equals(operation)) { suspendNode(exchange); + } else if (JcloudsConstants.RESUME_NODE.equals(operation)) { + resumeNode(exchange); } } @@ -180,12 +182,20 @@ public class JcloudsComputeProducer extends JcloudsProducer { } /** - * Reboot the node with the specified nodeId. + * Suspend the node with the specified nodeId. */ protected void suspendNode(Exchange exchange) { Predicate<NodeMetadata> predicate = getNodePredicate(exchange); computeService.suspendNodesMatching(predicate); } + + /** + * Suspend the node with the specified nodeId. + */ + protected void resumeNode(Exchange exchange) { + Predicate<NodeMetadata> predicate = getNodePredicate(exchange); + computeService.resumeNodesMatching(predicate); + } /** * Returns the required {@ComputeMetadata} {@link Predicate} for the Exhcnage. http://git-wip-us.apache.org/repos/asf/camel/blob/8c640f57/components/camel-jclouds/src/main/java/org/apache/camel/component/jclouds/JcloudsConstants.java ---------------------------------------------------------------------- diff --git a/components/camel-jclouds/src/main/java/org/apache/camel/component/jclouds/JcloudsConstants.java b/components/camel-jclouds/src/main/java/org/apache/camel/component/jclouds/JcloudsConstants.java index 49c9f29..662317e 100644 --- a/components/camel-jclouds/src/main/java/org/apache/camel/component/jclouds/JcloudsConstants.java +++ b/components/camel-jclouds/src/main/java/org/apache/camel/component/jclouds/JcloudsConstants.java @@ -35,6 +35,7 @@ public final class JcloudsConstants { public static final String DESTROY_NODE = "CamelJcloudsDestroyNode"; public static final String REBOOT_NODE = "CamelJcloudsRebootNode"; public static final String SUSPEND_NODE = "CamelJcloudsSuspendNode"; + public static final String RESUME_NODE = "CamelJcloudsResumeNode"; public static final String RUN_SCRIPT = "CamelJcloudsRunScript"; public static final String CONTENT_LANGUAGE = "CamelJcloudsContentLanguage";