brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aleds...@apache.org
Subject [08/10] incubator-brooklyn git commit: Simplify PolicySupport etc method names
Date Wed, 23 Sep 2015 10:52:00 GMT
Simplify PolicySupport etc method names

e.g. policies().addPolicy(...) becomes policies().add(...)

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

Branch: refs/heads/master
Commit: ebe942be06a417cc00d442472ca7219ec8125c21
Parents: ee52d48
Author: Aled Sage <aled.sage@gmail.com>
Authored: Wed Sep 23 10:51:07 2015 +0100
Committer: Aled Sage <aled.sage@gmail.com>
Committed: Wed Sep 23 10:51:07 2015 +0100

----------------------------------------------------------------------
 .../org/apache/brooklyn/api/entity/Entity.java  | 32 ++++++-------
 .../brooklyn/core/entity/AbstractEntity.java    | 48 ++++++++++----------
 .../brooklyn/core/entity/EntityInternal.java    |  2 +-
 3 files changed, 41 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ebe942be/api/src/main/java/org/apache/brooklyn/api/entity/Entity.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/entity/Entity.java b/api/src/main/java/org/apache/brooklyn/api/entity/Entity.java
index d302cff..32f9c00 100644
--- a/api/src/main/java/org/apache/brooklyn/api/entity/Entity.java
+++ b/api/src/main/java/org/apache/brooklyn/api/entity/Entity.java
@@ -191,7 +191,7 @@ public interface Entity extends BrooklynObject {
      * automatically be called. However, the reverse is not true (calling this method will

      * not tell the group; this behaviour may change in a future release!)
      * 
-     * @deprecated since 0.9.0; see {@link GroupSupport#getGroups()} and {@link #groups()}
+     * @deprecated since 0.9.0; see {@link GroupSupport#add()} and {@link #groups()}
      */
     @Deprecated
     void addGroup(Group group);
@@ -203,7 +203,7 @@ public interface Entity extends BrooklynObject {
      * automatically be called. However, the reverse is not true (calling this method will

      * not tell the group; this behaviour may change in a future release!)
      * 
-     * @deprecated since 0.9.0; see {@link GroupSupport#getGroups()} and {@link #groups()}
+     * @deprecated since 0.9.0; see {@link GroupSupport#remove()} and {@link #groups()}
      */
     @Deprecated
     void removeGroup(Group group);
@@ -256,7 +256,7 @@ public interface Entity extends BrooklynObject {
     /**
      * Adds the given policy to this entity. Also calls policy.setEntity if available.
      * 
-     * @deprecated since 0.9.0; see {@link PolicySupport#addPolicy(Policy)}
+     * @deprecated since 0.9.0; see {@link PolicySupport#add(Policy)}
      */
     @Deprecated
     void addPolicy(Policy policy);
@@ -264,7 +264,7 @@ public interface Entity extends BrooklynObject {
     /**
      * Adds the given policy to this entity. Also calls policy.setEntity if available.
      * 
-     * @deprecated since 0.9.0; see {@link PolicySupport#addPolicy(PolicySpec)}
+     * @deprecated since 0.9.0; see {@link PolicySupport#add(PolicySpec)}
      */
     @Deprecated
     <T extends Policy> T addPolicy(PolicySpec<T> enricher);
@@ -273,7 +273,7 @@ public interface Entity extends BrooklynObject {
      * Removes the given policy from this entity. 
      * @return True if the policy existed at this entity; false otherwise
      * 
-     * @deprecated since 0.9.0; see {@link PolicySupport#removePolicy(Policy)}
+     * @deprecated since 0.9.0; see {@link PolicySupport#remove(Policy)}
      */
     @Deprecated
     boolean removePolicy(Policy policy);
@@ -281,7 +281,7 @@ public interface Entity extends BrooklynObject {
     /**
      * Adds the given enricher to this entity. Also calls enricher.setEntity if available.
      * 
-     * @deprecated since 0.9.0; see {@link EnricherSupport#addEnricher(Enricher)}
+     * @deprecated since 0.9.0; see {@link EnricherSupport#add(Enricher)}
      */
     @Deprecated
     void addEnricher(Enricher enricher);
@@ -289,7 +289,7 @@ public interface Entity extends BrooklynObject {
     /**
      * Adds the given enricher to this entity. Also calls enricher.setEntity if available.
      * 
-     * @deprecated since 0.9.0; see {@link EnricherSupport#addEnricher(EnricherSpec)}
+     * @deprecated since 0.9.0; see {@link EnricherSupport#add(EnricherSpec)}
      */
     @Deprecated
     <T extends Enricher> T addEnricher(EnricherSpec<T> enricher);
@@ -298,7 +298,7 @@ public interface Entity extends BrooklynObject {
      * Removes the given enricher from this entity. 
      * @return True if the policy enricher at this entity; false otherwise
      * 
-     * @deprecated since 0.9.0; see {@link EnricherSupport#removeEnricher(Enricher)}
+     * @deprecated since 0.9.0; see {@link EnricherSupport#remove(Enricher)}
      */
     @Deprecated
     boolean removeEnricher(Enricher enricher);
@@ -372,18 +372,18 @@ public interface Entity extends BrooklynObject {
         /**
          * Adds the given policy to this entity. Also calls policy.setEntity if available.
          */
-        void addPolicy(Policy policy);
+        void add(Policy policy);
         
         /**
          * Adds the given policy to this entity. Also calls policy.setEntity if available.
          */
-        <T extends Policy> T addPolicy(PolicySpec<T> enricher);
+        <T extends Policy> T add(PolicySpec<T> enricher);
         
         /**
          * Removes the given policy from this entity. 
          * @return True if the policy existed at this entity; false otherwise
          */
-        boolean removePolicy(Policy policy);
+        boolean remove(Policy policy);
     }
     
     @Beta
@@ -396,18 +396,18 @@ public interface Entity extends BrooklynObject {
         /**
          * Adds the given enricher to this entity. Also calls enricher.setEntity if available.
          */
-        void addEnricher(Enricher enricher);
+        void add(Enricher enricher);
         
         /**
          * Adds the given enricher to this entity. Also calls enricher.setEntity if available.
          */
-        <T extends Enricher> T addEnricher(EnricherSpec<T> enricher);
+        <T extends Enricher> T add(EnricherSpec<T> enricher);
         
         /**
          * Removes the given enricher from this entity. 
          * @return True if the policy enricher at this entity; false otherwise
          */
-        boolean removeEnricher(Enricher enricher);
+        boolean remove(Enricher enricher);
     }
     
     @Beta
@@ -426,7 +426,7 @@ public interface Entity extends BrooklynObject {
          * automatically be called. However, the reverse is not true (calling this method
will 
          * not tell the group; this behaviour may change in a future release!)
          */
-        void addGroup(Group group);
+        void add(Group group);
 
         /**
          * Removes this entity as a member of the given {@link Group}. Called by framework.
@@ -435,6 +435,6 @@ public interface Entity extends BrooklynObject {
          * automatically be called. However, the reverse is not true (calling this method
will 
          * not tell the group; this behaviour may change in a future release!)
          */
-        void removeGroup(Group group);
+        void remove(Group group);
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ebe942be/core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java b/core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java
index 291389f..08b25f2 100644
--- a/core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java
+++ b/core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java
@@ -707,7 +707,7 @@ public abstract class AbstractEntity extends AbstractBrooklynObject implements
E
     // TODO revert to private when groups() is reverted to return GroupSupport
     public class BasicGroupSupport implements GroupSupport {
         @Override
-        public void addGroup(Group group) {
+        public void add(Group group) {
             boolean changed = groupsInternal.add(group);
             getApplication();
             
@@ -717,7 +717,7 @@ public abstract class AbstractEntity extends AbstractBrooklynObject implements
E
         }
 
         @Override
-        public void removeGroup(Group group) {
+        public void remove(Group group) {
             boolean changed = groupsInternal.remove(group);
             getApplication();
             
@@ -738,7 +738,7 @@ public abstract class AbstractEntity extends AbstractBrooklynObject implements
E
     @Override
     @Deprecated
     public void addGroup(Group group) {
-        groups().addGroup(group);
+        groups().add(group);
     }
 
     /**
@@ -747,7 +747,7 @@ public abstract class AbstractEntity extends AbstractBrooklynObject implements
E
     @Override
     @Deprecated
     public void removeGroup(Group group) {
-        groups().removeGroup(group);
+        groups().remove(group);
     }
 
     /**
@@ -1612,11 +1612,11 @@ public abstract class AbstractEntity extends AbstractBrooklynObject
implements E
         }
 
         @Override
-        public void addPolicy(Policy policy) {
+        public void add(Policy policy) {
             Policy old = findApparentlyEqualAndWarnIfNotSameUniqueTag(policiesInternal, policy);
             if (old!=null) {
                 LOG.debug("Removing "+old+" when adding "+policy+" to "+AbstractEntity.this);
-                removePolicy(old);
+                remove(old);
             }
             
             CatalogUtils.setCatalogItemIdOnAddition(AbstractEntity.this, policy);
@@ -1628,14 +1628,14 @@ public abstract class AbstractEntity extends AbstractBrooklynObject
implements E
         }
 
         @Override
-        public <T extends Policy> T addPolicy(PolicySpec<T> spec) {
+        public <T extends Policy> T add(PolicySpec<T> spec) {
             T policy = getManagementContext().getEntityManager().createPolicy(spec);
-            addPolicy(policy);
+            add(policy);
             return policy;
         }
         
         @Override
-        public boolean removePolicy(Policy policy) {
+        public boolean remove(Policy policy) {
             ((AbstractPolicy)policy).destroy();
             boolean changed = policiesInternal.remove(policy);
             
@@ -1650,7 +1650,7 @@ public abstract class AbstractEntity extends AbstractBrooklynObject
implements E
         public boolean removeAllPolicies() {
             boolean changed = false;
             for (Policy policy : policiesInternal) {
-                removePolicy(policy);
+                remove(policy);
                 changed = true;
             }
             return changed;
@@ -1671,18 +1671,18 @@ public abstract class AbstractEntity extends AbstractBrooklynObject
implements E
         }
 
         @Override
-        public <T extends Enricher> T addEnricher(EnricherSpec<T> spec) {
+        public <T extends Enricher> T add(EnricherSpec<T> spec) {
             T enricher = getManagementContext().getEntityManager().createEnricher(spec);
-            addEnricher(enricher);
+            add(enricher);
             return enricher;
         }
 
         @Override
-        public void addEnricher(Enricher enricher) {
+        public void add(Enricher enricher) {
             Enricher old = findApparentlyEqualAndWarnIfNotSameUniqueTag(enrichersInternal,
enricher);
             if (old!=null) {
                 LOG.debug("Removing "+old+" when adding "+enricher+" to "+AbstractEntity.this);
-                removeEnricher(old);
+                remove(old);
             }
             
             CatalogUtils.setCatalogItemIdOnAddition(AbstractEntity.this, enricher);
@@ -1694,7 +1694,7 @@ public abstract class AbstractEntity extends AbstractBrooklynObject
implements E
         }
         
         @Override
-        public boolean removeEnricher(Enricher enricher) {
+        public boolean remove(Enricher enricher) {
             ((AbstractEnricher)enricher).destroy();
             boolean changed = enrichersInternal.remove(enricher);
             
@@ -1706,10 +1706,10 @@ public abstract class AbstractEntity extends AbstractBrooklynObject
implements E
         }
 
         @Override
-        public boolean removeAllEnrichers() {
+        public boolean removeAll() {
             boolean changed = false;
             for (AbstractEnricher enricher : enrichersInternal) {
-                changed = removeEnricher(enricher) || changed;
+                changed = remove(enricher) || changed;
             }
             return changed;
         }
@@ -1730,7 +1730,7 @@ public abstract class AbstractEntity extends AbstractBrooklynObject
implements E
     @Override
     @Deprecated
     public void addPolicy(Policy policy) {
-        policies().addPolicy(policy);
+        policies().add(policy);
     }
 
     /**
@@ -1739,7 +1739,7 @@ public abstract class AbstractEntity extends AbstractBrooklynObject
implements E
     @Override
     @Deprecated
     public <T extends Policy> T addPolicy(PolicySpec<T> spec) {
-        return policies().addPolicy(spec);
+        return policies().add(spec);
     }
 
     /**
@@ -1748,7 +1748,7 @@ public abstract class AbstractEntity extends AbstractBrooklynObject
implements E
     @Override
     @Deprecated
     public <T extends Enricher> T addEnricher(EnricherSpec<T> spec) {
-        return enrichers().addEnricher(spec);
+        return enrichers().add(spec);
     }
 
     /**
@@ -1757,7 +1757,7 @@ public abstract class AbstractEntity extends AbstractBrooklynObject
implements E
     @Override
     @Deprecated
     public boolean removePolicy(Policy policy) {
-        return policies().removePolicy(policy);
+        return policies().remove(policy);
     }
     
     /**
@@ -1784,7 +1784,7 @@ public abstract class AbstractEntity extends AbstractBrooklynObject
implements E
     @Override
     @Deprecated
     public void addEnricher(Enricher enricher) {
-        enrichers().addEnricher(enricher);
+        enrichers().add(enricher);
     }
     
     private <T extends EntityAdjunct> T findApparentlyEqualAndWarnIfNotSameUniqueTag(Collection<?
extends T> items, T newItem) {
@@ -1870,7 +1870,7 @@ public abstract class AbstractEntity extends AbstractBrooklynObject
implements E
     @Override
     @Deprecated
     public boolean removeEnricher(Enricher enricher) {
-        return enrichers().removeEnricher(enricher);
+        return enrichers().remove(enricher);
     }
 
     /**
@@ -1879,7 +1879,7 @@ public abstract class AbstractEntity extends AbstractBrooklynObject
implements E
     @Override
     @Deprecated
     public boolean removeAllEnrichers() {
-        return enrichers().removeAllEnrichers();
+        return enrichers().removeAll();
     }
     
     // -------- FEEDS --------------------

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ebe942be/core/src/main/java/org/apache/brooklyn/core/entity/EntityInternal.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/entity/EntityInternal.java b/core/src/main/java/org/apache/brooklyn/core/entity/EntityInternal.java
index 49dfa00..c0eca7e 100644
--- a/core/src/main/java/org/apache/brooklyn/core/entity/EntityInternal.java
+++ b/core/src/main/java/org/apache/brooklyn/core/entity/EntityInternal.java
@@ -242,6 +242,6 @@ public interface EntityInternal extends BrooklynObjectInternal, EntityLocal,
Reb
          * Use with caution as some entities automatically register enrichers; this will
remove those enrichers as well.
          * @return True if any enrichers existed at this entity; false otherwise
          */
-        boolean removeAllEnrichers();
+        boolean removeAll();
     }
 }


Mime
View raw message