Deprecate JcloudsLocation#rebindMachine in favour of registerMachine

Return type now MachineLocation instead of JcloudsSshMachineLocation.


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/cb36537b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/cb36537b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/cb36537b

Branch: refs/heads/master
Commit: cb36537b393f70b81b8aed4e64bd0cb6cc403b9c
Parents: c3e027b
Author: Sam Corbett <[email protected]>
Authored: Tue Aug 18 18:27:51 2015 +0100
Committer: Sam Corbett <[email protected]>
Committed: Fri Aug 21 10:16:43 2015 +0100

----------------------------------------------------------------------
 .../location/jclouds/JcloudsLocation.java       | 45 +++++++++++++++++---
 1 file changed, 39 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/cb36537b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
----------------------------------------------------------------------
diff --git 
a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
 
b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
index 9167587..867d349 100644
--- 
a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
+++ 
b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
@@ -1861,16 +1861,41 @@ public class JcloudsLocation extends 
AbstractCloudMachineProvisioningLocation im
     }
 
 
-    // ----------------- rebinding to existing machine ------------------------
+    // ----------------- registering existing machines ------------------------
 
+    /**
+     * @deprecated since 0.8.0 use {@link #registerMachine(NodeMetadata)} 
instead.
+     */
+    @Deprecated
     public JcloudsSshMachineLocation rebindMachine(NodeMetadata metadata) 
throws NoMachinesAvailableException {
-        return rebindMachine(MutableMap.of(), metadata);
+        return (JcloudsSshMachineLocation) registerMachine(metadata);
     }
+
+    public MachineLocation registerMachine(NodeMetadata metadata) throws 
NoMachinesAvailableException {
+        return registerMachine(MutableMap.of(), metadata);
+    }
+
+    /**
+     * @deprecated since 0.8.0 use {@link #registerMachine(Map, NodeMetadata)} 
instead.
+     */
+    @Deprecated
     public JcloudsSshMachineLocation rebindMachine(Map<?,?> flags, 
NodeMetadata metadata) throws NoMachinesAvailableException {
+        return (JcloudsSshMachineLocation) registerMachine(flags, metadata);
+    }
+
+    public MachineLocation registerMachine(Map<?, ?> flags, NodeMetadata 
metadata) throws NoMachinesAvailableException {
         ConfigBag setup = ConfigBag.newInstanceExtending(config().getBag(), 
flags);
         if (!setup.containsKey("id")) setup.putStringKey("id", 
metadata.getId());
         setHostnameUpdatingCredentials(setup, metadata);
-        return rebindMachine(setup);
+        return registerMachine(setup);
+    }
+
+    /**
+     * @deprecated since 0.8.0 use {@link #registerMachine(ConfigBag)} instead.
+     */
+    @Deprecated
+    public JcloudsSshMachineLocation rebindMachine(ConfigBag setup) throws 
NoMachinesAvailableException {
+        return (JcloudsSshMachineLocation) registerMachine(setup);
     }
 
     /**
@@ -1883,7 +1908,7 @@ public class JcloudsLocation extends 
AbstractCloudMachineProvisioningLocation im
      *   <li>userName: the username for ssh'ing into the machine
      * <ul>
      */
-    public JcloudsSshMachineLocation rebindMachine(ConfigBag setup) throws 
NoMachinesAvailableException {
+    public MachineLocation registerMachine(ConfigBag setup) throws 
NoMachinesAvailableException {
         try {
             if (setup.getDescription() == null) setCreationString(setup);
             String user = checkNotNull(getUser(setup), "user");
@@ -1923,9 +1948,17 @@ public class JcloudsLocation extends 
AbstractCloudMachineProvisioningLocation im
         }
     }
 
-    public JcloudsSshMachineLocation rebindMachine(Map<?,?> flags) throws 
NoMachinesAvailableException {
+    /**
+     * @deprecated since 0.8.0 use {@link #registerMachine(Map)} instead.
+     */
+    @Deprecated
+    public JcloudsSshMachineLocation rebindMachine(Map<?, ?> flags) throws 
NoMachinesAvailableException {
+        return (JcloudsSshMachineLocation) registerMachine(flags);
+    }
+
+    public MachineLocation registerMachine(Map<?,?> flags) throws 
NoMachinesAvailableException {
         ConfigBag setup = ConfigBag.newInstanceExtending(config().getBag(), 
flags);
-        return rebindMachine(setup);
+        return registerMachine(setup);
     }
 
     /**

Reply via email to