brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rich...@apache.org
Subject [07/25] git commit: Deprecate memento.customFields
Date Sun, 01 Jun 2014 20:15:22 GMT
Deprecate memento.customFields

- and remove from policy/enricher rebind support


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

Branch: refs/heads/master
Commit: 94456fc2fea38bc1584fe9ade0080cfcfb9888ff
Parents: 1c92b2b
Author: Aled Sage <aled.sage@gmail.com>
Authored: Mon May 26 23:54:45 2014 +0100
Committer: Aled Sage <aled.sage@gmail.com>
Committed: Fri May 30 10:24:37 2014 +0100

----------------------------------------------------------------------
 api/src/main/java/brooklyn/mementos/Memento.java            | 7 +++++++
 .../brooklyn/entity/rebind/BasicEnricherRebindSupport.java  | 6 +-----
 .../brooklyn/entity/rebind/BasicEntityRebindSupport.java    | 4 ++++
 .../brooklyn/entity/rebind/BasicLocationRebindSupport.java  | 4 ++++
 .../brooklyn/entity/rebind/BasicPolicyRebindSupport.java    | 9 +--------
 .../java/brooklyn/entity/rebind/dto/AbstractMemento.java    | 8 +++++++-
 .../brooklyn/entity/rebind/dto/AbstractTreeNodeMemento.java | 4 ++++
 .../brooklyn/entity/rebind/dto/BasicEnricherMemento.java    | 2 ++
 .../java/brooklyn/entity/rebind/dto/BasicPolicyMemento.java | 2 ++
 9 files changed, 32 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/94456fc2/api/src/main/java/brooklyn/mementos/Memento.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/brooklyn/mementos/Memento.java b/api/src/main/java/brooklyn/mementos/Memento.java
index af9b661..6e08654 100644
--- a/api/src/main/java/brooklyn/mementos/Memento.java
+++ b/api/src/main/java/brooklyn/mementos/Memento.java
@@ -28,9 +28,16 @@ public interface Memento extends Serializable {
     /**
      * A (weakly-typed) property set for this memento.
      * These can be used to avoid sub-classing the entity memento, but developers can sub-class
to get strong typing if desired.
+     * 
+     * @deprecated since 0.7.0; use config/attributes so generic persistence will work, rather
than requiring "custom fields"
      */
+    @Deprecated
     public Object getCustomField(String name);
 
+    /**
+     * @deprecated since 0.7.0; use config/attributes so generic persistence will work, rather
than requiring "custom fields"
+     */
+    @Deprecated
     public Map<String, ? extends Object> getCustomFields();
     
     public String toVerboseString();

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/94456fc2/core/src/main/java/brooklyn/entity/rebind/BasicEnricherRebindSupport.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/entity/rebind/BasicEnricherRebindSupport.java b/core/src/main/java/brooklyn/entity/rebind/BasicEnricherRebindSupport.java
index 3fca1b8..a8364bc 100644
--- a/core/src/main/java/brooklyn/entity/rebind/BasicEnricherRebindSupport.java
+++ b/core/src/main/java/brooklyn/entity/rebind/BasicEnricherRebindSupport.java
@@ -22,11 +22,7 @@ public class BasicEnricherRebindSupport implements RebindSupport<EnricherMemento
     
     @Override
     public EnricherMemento getMemento() {
-        return getMementoWithProperties(Collections.<String,Object>emptyMap());
-    }
-
-    protected EnricherMemento getMementoWithProperties(Map<String,?> props) {
-        EnricherMemento memento = MementosGenerators.newEnricherMementoBuilder(enricher).customFields(props).build();
+        EnricherMemento memento = MementosGenerators.newEnricherMementoBuilder(enricher).build();
         if (LOG.isTraceEnabled()) LOG.trace("Creating memento for enricher: {}", memento.toVerboseString());
         return memento;
     }

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/94456fc2/core/src/main/java/brooklyn/entity/rebind/BasicEntityRebindSupport.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/entity/rebind/BasicEntityRebindSupport.java b/core/src/main/java/brooklyn/entity/rebind/BasicEntityRebindSupport.java
index e19c2fa..de172a6 100644
--- a/core/src/main/java/brooklyn/entity/rebind/BasicEntityRebindSupport.java
+++ b/core/src/main/java/brooklyn/entity/rebind/BasicEntityRebindSupport.java
@@ -39,6 +39,10 @@ public class BasicEntityRebindSupport implements RebindSupport<EntityMemento>
{
         return getMementoWithProperties(Collections.<String,Object>emptyMap());
     }
 
+    /**
+     * @deprecated since 0.7.0; use generic config/attributes rather than "custom fields",
so use {@link #getMemento()}
+     */
+    @Deprecated
     protected EntityMemento getMementoWithProperties(Map<String,?> props) {
         EntityMemento memento = MementosGenerators.newEntityMementoBuilder(entity).customFields(props).build();
         if (LOG.isTraceEnabled()) LOG.trace("Creating memento for entity: {}", memento.toVerboseString());

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/94456fc2/core/src/main/java/brooklyn/entity/rebind/BasicLocationRebindSupport.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/entity/rebind/BasicLocationRebindSupport.java b/core/src/main/java/brooklyn/entity/rebind/BasicLocationRebindSupport.java
index a45f137..5e5c6e6 100644
--- a/core/src/main/java/brooklyn/entity/rebind/BasicLocationRebindSupport.java
+++ b/core/src/main/java/brooklyn/entity/rebind/BasicLocationRebindSupport.java
@@ -33,6 +33,10 @@ public class BasicLocationRebindSupport implements RebindSupport<LocationMemento
         return getMementoWithProperties(Collections.<String,Object>emptyMap());
     }
 
+    /**
+     * @deprecated since 0.7.0; use generic config/attributes rather than "custom fields",
so use {@link #getMemento()}
+     */
+    @Deprecated
     protected LocationMemento getMementoWithProperties(Map<String,?> props) {
         LocationMemento memento = MementosGenerators.newLocationMementoBuilder(location).customFields(props).build();
     	if (LOG.isTraceEnabled()) LOG.trace("Creating memento for location: {}", memento.toVerboseString());

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/94456fc2/core/src/main/java/brooklyn/entity/rebind/BasicPolicyRebindSupport.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/entity/rebind/BasicPolicyRebindSupport.java b/core/src/main/java/brooklyn/entity/rebind/BasicPolicyRebindSupport.java
index 2c33702..3f21d64 100644
--- a/core/src/main/java/brooklyn/entity/rebind/BasicPolicyRebindSupport.java
+++ b/core/src/main/java/brooklyn/entity/rebind/BasicPolicyRebindSupport.java
@@ -1,8 +1,5 @@
 package brooklyn.entity.rebind;
 
-import java.util.Collections;
-import java.util.Map;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -22,11 +19,7 @@ public class BasicPolicyRebindSupport implements RebindSupport<PolicyMemento>
{
     
     @Override
     public PolicyMemento getMemento() {
-        return getMementoWithProperties(Collections.<String,Object>emptyMap());
-    }
-
-    protected PolicyMemento getMementoWithProperties(Map<String,?> props) {
-        PolicyMemento memento = MementosGenerators.newPolicyMementoBuilder(policy).customFields(props).build();
+        PolicyMemento memento = MementosGenerators.newPolicyMementoBuilder(policy).build();
         if (LOG.isTraceEnabled()) LOG.trace("Creating memento for policy: {}", memento.toVerboseString());
         return memento;
     }

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/94456fc2/core/src/main/java/brooklyn/entity/rebind/dto/AbstractMemento.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/entity/rebind/dto/AbstractMemento.java b/core/src/main/java/brooklyn/entity/rebind/dto/AbstractMemento.java
index 15d6072..cf7f98f 100644
--- a/core/src/main/java/brooklyn/entity/rebind/dto/AbstractMemento.java
+++ b/core/src/main/java/brooklyn/entity/rebind/dto/AbstractMemento.java
@@ -54,6 +54,10 @@ public abstract class AbstractMemento implements Memento, Serializable
{
         public B displayName(String val) {
             displayName = val; return self();
         }
+        /**
+         * @deprecated since 0.7.0; use config/attributes so generic persistence will work,
rather than requiring "custom fields"
+         */
+        @Deprecated
         public B customFields(Map<String,?> vals) {
             fields.putAll(vals); return self();
         }
@@ -113,13 +117,15 @@ public abstract class AbstractMemento implements Memento, Serializable
{
     public String getDisplayName() {
         return displayName;
     }
-    
+
+    @Deprecated
     @Override
     public Object getCustomField(String name) {
         if (getCustomFields()==null) return null;
         return getCustomFields().get(name);
     }
     
+    @Deprecated
     @Override
     public abstract Map<String, ? extends Object> getCustomFields();
     

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/94456fc2/core/src/main/java/brooklyn/entity/rebind/dto/AbstractTreeNodeMemento.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/entity/rebind/dto/AbstractTreeNodeMemento.java b/core/src/main/java/brooklyn/entity/rebind/dto/AbstractTreeNodeMemento.java
index fd234a5..07f39b0 100644
--- a/core/src/main/java/brooklyn/entity/rebind/dto/AbstractTreeNodeMemento.java
+++ b/core/src/main/java/brooklyn/entity/rebind/dto/AbstractTreeNodeMemento.java
@@ -66,10 +66,14 @@ public class AbstractTreeNodeMemento extends AbstractMemento implements
Memento,
         children = toPersistedList(builder.children);
     }
 
+    @Deprecated
+    @Override
     protected void setCustomFields(Map<String, Object> fields) {
         this.fields = toPersistedMap(fields);
     }
     
+    @Deprecated
+    @Override
     public Map<String, Object> getCustomFields() {
         return fromPersistedMap(fields);
     }

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/94456fc2/core/src/main/java/brooklyn/entity/rebind/dto/BasicEnricherMemento.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/entity/rebind/dto/BasicEnricherMemento.java b/core/src/main/java/brooklyn/entity/rebind/dto/BasicEnricherMemento.java
index b1d7052..9433798 100644
--- a/core/src/main/java/brooklyn/entity/rebind/dto/BasicEnricherMemento.java
+++ b/core/src/main/java/brooklyn/entity/rebind/dto/BasicEnricherMemento.java
@@ -46,11 +46,13 @@ public class BasicEnricherMemento extends AbstractMemento implements EnricherMem
         flags = toPersistedMap(builder.flags);
     }
 
+    @Deprecated
     @Override
     protected void setCustomFields(Map<String, Object> fields) {
         this.fields = toPersistedMap(fields);
     }
 
+    @Deprecated
     @Override
     public Map<String, Object> getCustomFields() {
         return fromPersistedMap(fields);

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/94456fc2/core/src/main/java/brooklyn/entity/rebind/dto/BasicPolicyMemento.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/entity/rebind/dto/BasicPolicyMemento.java b/core/src/main/java/brooklyn/entity/rebind/dto/BasicPolicyMemento.java
index b5ccc3b..e8b3190 100644
--- a/core/src/main/java/brooklyn/entity/rebind/dto/BasicPolicyMemento.java
+++ b/core/src/main/java/brooklyn/entity/rebind/dto/BasicPolicyMemento.java
@@ -46,11 +46,13 @@ public class BasicPolicyMemento extends AbstractMemento implements PolicyMemento
 	    flags = toPersistedMap(builder.flags);
 	}
 	
+    @Deprecated
     @Override
     protected void setCustomFields(Map<String, Object> fields) {
         this.fields = toPersistedMap(fields);
     }
     
+    @Deprecated
     @Override
     public Map<String, Object> getCustomFields() {
         return fromPersistedMap(fields);


Mime
View raw message