public class AffinityRules extends Object implements com.google.common.base.Predicate<brooklyn.entity.Entity>
Rules are specified as strings, formatted as follows:
NOT) TYPE entityType?
NOT) NAME entityName
NOT) ID entityId?
NOT) APPLICATION applicationId?
NOT) PREDICATE entityPredicateClass
NOT) EMPTY
SAME token is the default behaviour, and means the entities must have the property defined in the rule, NOT
means they mustn't have the property. The parameter given specifies the type or id, and if it's missing thee rule will apply to the
properties of the entity being placed. Rules that take a class name will instantiate an instance of that class from the current
classpath, so ensure the appropriate Jar files are available. The EMPTY rule will treaty empty locations as allowable,
otherwise a new DockerHostLocation will be created for the container.
To specify a rule that there must be no entities of the same type, an entity of type SolrServer, all in the same application, use these rules:
NOT TYPE TYPE brooklyn.entity.nosql.solr.SolrServer SAME APPLICATION
Specify the rules during configuration using the AFFINITY_RULES key:
- serviceType: brooklyn.entity.webapp.tomcat.TomcatServer
brooklyn.config:
affinity.rules:
- "NOT TYPE"
- "TYPE brooklyn.entity.nosql.solr.SolrServer"
- "APPLICATION"
- $brooklyn:formatString("NOT ID %s", $brooklyn:entity("name"))
| Modifier and Type | Field and Description |
|---|---|
static brooklyn.config.ConfigKey<List<String>> |
AFFINITY_RULES |
static String |
APPLICATION |
static String |
EMPTY |
static String |
ID |
static String |
NAME |
static String |
NOT |
static String |
PREDICATE |
static String |
TYPE |
static Iterable<String> |
VERBS |
| Modifier and Type | Method and Description |
|---|---|
boolean |
allowEmptyLocations() |
boolean |
apply(brooklyn.entity.Entity input) |
AffinityRules |
parse(Iterable<String> rules) |
AffinityRules |
parse(String... rules) |
AffinityRules |
parse(String rules) |
static AffinityRules |
rulesFor(brooklyn.entity.Entity entity) |
public static final String NOT
public static final String TYPE
public static final String NAME
public static final String ID
public static final String APPLICATION
public static final String PREDICATE
public static final String EMPTY
public static AffinityRules rulesFor(brooklyn.entity.Entity entity)
public AffinityRules parse(String... rules)
public AffinityRules parse(String rules)
public AffinityRules parse(Iterable<String> rules)
public boolean apply(@Nullable brooklyn.entity.Entity input)
apply in interface com.google.common.base.Predicate<brooklyn.entity.Entity>public boolean allowEmptyLocations()
Copyright © 2015. All rights reserved.