Github user robertgmoss commented on a diff in the pull request:
https://github.com/apache/incubator-brooklyn/pull/911#discussion_r39991054
--- Diff: api/src/main/java/org/apache/brooklyn/api/entity/Entity.java ---
@@ -314,4 +361,80 @@
*/
<T> void emit(Sensor<T> sensor, T value);
}
+
+ @Beta
+ public interface PolicySupport {
+ /**
+ * @return an immutable thread-safe view of the policies.
+ */
+ Collection<Policy> getPolicies();
+
+ /**
+ * Adds the given policy to this entity. Also calls
policy.setEntity if available.
+ */
+ void addPolicy(Policy policy);
+
+ /**
+ * Adds the given policy to this entity. Also calls
policy.setEntity if available.
+ */
+ <T extends Policy> T addPolicy(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);
+ }
+
+ @Beta
+ public interface EnricherSupport {
+ /**
+ * @return an immutable thread-safe view of the enrichers.
+ */
+ Collection<Enricher> getEnrichers();
+
+ /**
+ * Adds the given enricher to this entity. Also calls
enricher.setEntity if available.
+ */
+ void addEnricher(Enricher enricher);
+
+ /**
+ * Adds the given enricher to this entity. Also calls
enricher.setEntity if available.
+ */
+ <T extends Enricher> T addEnricher(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);
+ }
+
+ @Beta
+ public interface GroupSupport {
--- End diff --
Something like `public interface AdjunctSupport<T extends EntityAdjunct>
extends Iterable<T> ` with
`iterator()`, `add()`, and `remove()` with `public interface
EnricherSupport extends AdjunctSupport<Enricher>` perhaps?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---