Fix memento/rebind of AbstractController

- serverPoolTargets has entities as keys, so needed to fix
  MementoTransformer.transformIdsToEntities so it converted
  keys and values correctly.
- Can revisit this in the future for instead using serialised
  form of an entity-ref, rather than just String perhaps.


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

Branch: refs/heads/0.5.0
Commit: 4181d279daa424b5fb873518aa8717f2274c78b7
Parents: 32a6eba
Author: Aled Sage <[email protected]>
Authored: Wed Apr 10 13:01:17 2013 +0100
Committer: Aled Sage <[email protected]>
Committed: Wed Apr 10 14:34:36 2013 +0100

----------------------------------------------------------------------
 .../main/java/brooklyn/entity/proxy/AbstractControllerImpl.java   | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/4181d279/software/webapp/src/main/java/brooklyn/entity/proxy/AbstractControllerImpl.java
----------------------------------------------------------------------
diff --git 
a/software/webapp/src/main/java/brooklyn/entity/proxy/AbstractControllerImpl.java
 
b/software/webapp/src/main/java/brooklyn/entity/proxy/AbstractControllerImpl.java
index 86f80ab..4585013 100644
--- 
a/software/webapp/src/main/java/brooklyn/entity/proxy/AbstractControllerImpl.java
+++ 
b/software/webapp/src/main/java/brooklyn/entity/proxy/AbstractControllerImpl.java
@@ -33,6 +33,7 @@ import com.google.common.base.Function;
 import com.google.common.collect.Maps;
 import com.google.common.collect.Sets;
 import com.google.common.net.HostAndPort;
+import com.google.common.reflect.TypeToken;
 
 /**
  * Represents a controller mechanism for a {@link Cluster}.
@@ -359,7 +360,7 @@ public abstract class AbstractControllerImpl extends 
SoftwareProcessImpl impleme
                // TODO If pool-target entity couldn't be resolved, then  
serverPoolAddresses and serverPoolTargets
                // will be out-of-sync (for ever more?)
                serverPoolAddresses.addAll((Collection<String>) 
memento.getCustomField("serverPoolAddresses"));
-                               
serverPoolTargets.putAll(MementoTransformer.transformIdsToEntities(rebindContext,
 memento.getCustomField("serverPoolTargets"), Map.class, true));
+                               
serverPoolTargets.putAll(MementoTransformer.transformIdsToEntities(rebindContext,
 memento.getCustomField("serverPoolTargets"), new 
TypeToken<Map<Entity,String>>() {}, true));
             }
         };
     }

Reply via email to